Ignore:
Timestamp:
02/10/12 15:25:42 (13 years ago)
Author:
jkraaijeveld
Message:

Ticket #5: Added emails to users and respondents. This replaces the original 'name' field.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/branches/jQueryUI/server/classes/models/User.php

    r249 r252  
    1616        private static $filename = 'data/users/users.rdf';
    1717   
    18     public $name;
     18    public $email;
    1919    public $password;
    2020   
     
    2323     * If the user does not yet exist in the database, call with null as first parameter
    2424     */
    25     public function __construct($uid = null, $name = null, $password = null) {
     25    public function __construct($uid = null, $email = null, $password = null) {
    2626        if(!isset($uid))
    2727        {
     
    2929        }
    3030        $this->uid = $uid;
    31         $this->name = $name;
     31                $this->email = $email;
    3232        $this->password = $password;
    3333        }
     
    5656        $model->add(new Statement($resourceUser,$predicateUniqueID,$literalUserID));
    5757       
    58         $literalUserName = new Literal($this->name);
    59         $predicateName = new Resource(NAME);
     58        $literalUserName = new Literal($this->email);
     59        $predicateName = new Resource(EMAIL);
    6060        $model->add(new Statement($resourceUser,$predicateName,$literalUserName));                     
    6161
     
    7373         * Gets the array of User objects belonging to arguments supplied.
    7474         * @param type $arguments : An array containing zero or more of the following keys:
    75          *                                                      'uid', 'name', 'password'
     75         *                                                      'uid', 'email', 'password'
    7676         */
    7777        public static function get($arguments)
     
    8282            PREFIX  predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
    8383            PREFIX  resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
    84             SELECT ?uid, ?name, ?password
     84            SELECT ?uid, ?email, ?password
    8585            WHERE       
    8686            {
    8787                    _user       predicates:resource_type        resources:user ;
    8888                                        predicates:uid ?uid ;
    89                                         predicates:name ?name ;
     89                                        predicates:email ?email ;
    9090                                        predicates:password ?password ;
    9191                                        ' . ResearchToolObject::createArguments($arguments) . '
     
    9999            foreach($results as $result)
    100100            {
    101                     $users[] = new User($result['?uid']->label, $result['?name']->label, $result['?password']->label);
     101                                $users[] = new User($result['?uid']->label, $result['?email']->label, $result['?password']->label);
    102102            }
    103103        }
    104104        return $users;
    105105        }
    106        
    107        
    108106}
    109107
Note: See TracChangeset for help on using the changeset viewer.