Changeset 171 for Dev/trunk/classes/RespondentConnector.php
- Timestamp:
- 12/02/11 15:26:01 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/classes/RespondentConnector.php
r158 r171 10 10 * @author jkraaijeveld 11 11 */ 12 class RespondentConnector implements IConnector{ 13 14 protected $fileName = 'data/users/respondents.rdf'; 12 class RespondentConnector extends Connector{ 15 13 16 14 /** … … 19 17 public function __construct() 20 18 { 19 $this->fileName = 'data/users/respondents.rdf'; 21 20 if (!is_dir('data/users/')) 22 21 mkdir('data/users/'); 23 }24 25 /**26 * function load()27 * Loads the file into the standard MemModel.28 */29 public function load() {30 //Get the Memory Model from the ModelFactory31 $this->model = ModelFactory::getDefaultModel();32 //Ensure the required file exists before loading33 if(file_exists($this->fileName))34 $this->model->load($this->fileName);35 }36 37 /**38 * function save()39 * Saves the MemModel into the given file.40 */41 public function save() {42 $this->model->saveAs($this->fileName,'rdf');43 22 } 44 23 … … 51 30 public function get($arguments) { 52 31 $this->load(); 53 //Determine which arguments are supplied54 $keys = array_keys($arguments);55 //Set default values for arguments56 $uid = ""; $name = ""; $password = "";57 //Set the arguments if they are supplied58 if(in_array("uid", $keys))59 $uid = "predicates:uid \"".$arguments["uid"]."\"";60 if(in_array("name", $keys))61 $name = 'predicates:name \''.$arguments["name"].'\'';62 if(in_array("password", $keys))63 $password = "predicates:password \"".$arguments["password"]."\"";64 32 65 33 //Create the querystring … … 74 42 predicates:name ?name ; 75 43 predicates:password ?password ; 76 ' . $ uid . $name . $password .'44 ' . $this->createArguments($arguments) . ' 77 45 }'; 78 46 //Query the model
Note: See TracChangeset
for help on using the changeset viewer.