Ignore:
Timestamp:
11/18/11 11:07:07 (13 years ago)
Author:
jkraaijeveld
Message:

Refactored queries / cleaned up some code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/classes/RespondentConnector.php

    r149 r158  
    1212class RespondentConnector implements IConnector{
    1313   
    14     protected $model;
    1514    protected $fileName = 'data/users/respondents.rdf';
    1615   
     
    2019    public function __construct()
    2120    {
    22         //Ensure the required folder for this connector exists
    2321        if (!is_dir('data/users/'))
    2422            mkdir('data/users/');       
     
    3230        //Get the Memory Model from the ModelFactory
    3331        $this->model = ModelFactory::getDefaultModel();
    34        
    3532        //Ensure the required file exists before loading
    3633        if(file_exists($this->fileName))
     
    4744   
    4845    /**
    49      * function get($arguments)
     46     * function get()
    5047     * Gets the array of Respondent objects belonging to arguments supplied.
    5148     * @param type $arguments : An array containing zero or more of the following keys:
     
    5754        $keys = array_keys($arguments);
    5855        //Set default values for arguments
    59         $uid = "?uid"; $name = "?name"; $password = "?password";
     56        $uid = ""; $name = ""; $password = "";
    6057        //Set the arguments if they are supplied
    6158        if(in_array("uid", $keys))
    62             $uid = "\"".$arguments["uid"]."\"";
     59            $uid = "predicates:uid \"".$arguments["uid"]."\"";
    6360        if(in_array("name", $keys))
    64             $name = '\''.$arguments["name"].'\'';
     61            $name = 'predicates:name \''.$arguments["name"].'\'';
    6562        if(in_array("password", $keys))
    66             $password = "\"".$arguments["password"]."\"";
     63            $password = "predicates:password \"".$arguments["password"]."\"";
    6764       
    6865        //Create the querystring
     
    7774                                        predicates:name ?name ;
    7875                                        predicates:password ?password ;
    79                                 predicates:uid ' . $uid . '
    80                                         predicates:name ' . $name . '
    81                                         predicates:password ' . $password . '
     76                                        ' . $uid . $name . $password . '
    8277            }';
    8378        //Query the model
     
    9691   
    9792    /**
    98      * Save the given User object in the file.
    99      * @param type $rToolObject
     93         * function set()
     94     * @param type $rToolObject : The ResearchToolObject to be saved.
    10095     */
    10196    public function set($rToolObject)
Note: See TracChangeset for help on using the changeset viewer.