- Timestamp:
- 11/18/11 11:07:07 (13 years ago)
- Location:
- Dev/trunk/classes
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/classes/AnswerConnector.php
r157 r158 46 46 47 47 /** 48 * Function get() 49 * Get the answers corresponding to the arguments 50 * 'Question' argument is supposed to be the question ID 51 * 'Values' has to be an array to make sure multiple answers can be selected. 48 * function get() 49 * @param type $arguments: An array having one or more of the following elements: 50 * 'uid', 'question', 'values'. 52 51 */ 53 52 public function get($arguments) … … 99 98 } 100 99 /** 101 * Gets the values that belong to the answer102 * specified by the UID100 * function getValues() 101 * @param type $uid : The uid of the Answer for which the values should be gotten. 103 102 */ 104 103 private function getValues($uid) … … 127 126 128 127 /** 129 * Saves the answer Object to the RDF file. 130 * @param type $rToolObject 128 * function set() 129 * @param type $rToolObject : The ResearchToolObject to be saved. 131 130 */ 132 131 public function set($rToolObject) -
Dev/trunk/classes/AnswerSetConnector.php
r149 r158 44 44 45 45 /** 46 * Get the AnswerSets corresponding to the arguments 47 * Arguments can be one or more of the following: 48 * uid, survey, respondent, answers 49 * Where answers is an array of answer ids 46 * function get() 47 * @param type $arguments : An array having one ore more of the following elements: 48 * 'uid', 'survey', 'respondent', 'answers'. 50 49 */ 51 50 public function get($arguments) … … 102 101 /** 103 102 * function getAnswers() 104 * Gets the answers corresponding to the given answerset uid103 * @param type $uid : the uid for which the answers should be retrieved. 105 104 */ 106 105 private function getAnswers($uid) … … 130 129 131 130 /** 132 * Save the given AnswerSet in the file.133 * @param type $rToolObject 131 * function set() 132 * @param type $rToolObject : The ResearchToolObject to be saved. 134 133 */ 135 134 public function set($rToolObject) -
Dev/trunk/classes/Application.php
r131 r158 4 4 * Description of Application 5 5 * 6 * @author fpvanagthoven6 * @author jkraaijeveld 7 7 */ 8 8 class Application extends ResearchToolObject{ … … 12 12 public $style; 13 13 14 /** 15 * Constructor for an Application object 16 * @param type $uid : The uid of the Application object. 17 * @param type $title: The title of the Application. 18 * @param type $description: The description of the Application. 19 * @param type $style: The style of the Application. 20 */ 14 21 public function __construct($uid = null, $title = null, $description = null, $style = null) 15 22 { -
Dev/trunk/classes/ApplicationConnector.php
r149 r158 49 49 /** 50 50 * function get($arguments) 51 * Gets the array of Application objects belonging to arguments supplied.52 51 * @param type $arguments : An array containing zero or more of the following keys: 53 * 52 * 'uid', 'title', 'description', 'style' 54 53 */ 55 54 public function get($arguments) { … … 58 57 $keys = array_keys($arguments); 59 58 //Set default values for arguments 60 $uid = " ?uid"; $title = "?title"; $description = "?description"; $style = "?style";59 $uid = ""; $title = ""; $description = ""; $style = ""; 61 60 //Set the arguments if they are supplied 62 61 if(in_array("uid", $keys)) 63 $uid = " \"".$arguments["uid"]."\"";62 $uid = "predicates:uid \"".$arguments["uid"]."\""; 64 63 if(in_array("title", $keys)) 65 $title = ' \''.$arguments["title"].'\'';64 $title = 'predicates:title \''.$arguments["title"].'\''; 66 65 if(in_array("description", $keys)) 67 $description = " \"".$arguments["description"]."\"";66 $description = "predicates:description \"".$arguments["description"]."\""; 68 67 if(in_array("style", $keys)) 69 $style = " \"".$arguments["style"]."\"";68 $style = "predicates:style \"".$arguments["style"]."\""; 70 69 71 70 //Create the querystring … … 80 79 predicates:title ?title ; 81 80 predicates:description ?description ; 82 predicates:style ?style ; 83 predicates:uid ' . $uid . ' 84 predicates:title ' . $title . ' 85 predicates:description ' . $description . ' 86 predicates:style ' . $style . ' 81 predicates:style ?style ; ' 82 . $uid . $title . $description . $style . ' 87 83 }'; 88 84 … … 135 131 $this->model->add(new Statement($resourceApplication,$predicateStyle,$applicationStyle)); 136 132 137 $this->save();133 $this->save(); 138 134 } 139 135 } -
Dev/trunk/classes/QuestionConnector.php
r149 r158 50 50 /** 51 51 * Get the questions corresponding to the arguments. 52 * @param type $arguments 53 * @return type Array 52 * @param type $arguments : An array having one ore more of the following elements: 53 * 'uid', 'title', 'type', 'description', 'category', 'has_answer'. 54 54 */ 55 55 public function get($arguments) … … 59 59 $keys = array_keys($arguments); 60 60 //Set default values for arguments 61 $uid = " ?uid"; $title = "?title"; $type = "?type"; $description = "?description"; $category = "?category"; $has_answer = "";61 $uid = ""; $title = ""; $type = ""; $description = ""; $category = ""; $has_answer = ""; 62 62 //Set the arguments if they are supplied 63 63 if(in_array("uid", $keys)) 64 $uid = ' \''.$arguments["uid"].'\'';64 $uid = 'predicates:question_code \''.$arguments["uid"].'\''; 65 65 if(in_array("title", $keys)) 66 $title = ' \''.$arguments["title"].'\'';66 $title = 'predicates:title \''.$arguments["title"].'\''; 67 67 if(in_array("type", $keys)) 68 $type = ' \''.$arguments["type"].'\'';68 $type = 'predicates:type \''.$arguments["type"].'\''; 69 69 if(in_array("description", $keys)) 70 $description = " \"".$arguments["description"]."\"";70 $description = "predicates:description \"".$arguments["description"]."\""; 71 71 if(in_array("category", $keys)) 72 $style = " \"".$arguments["category"]."\"";72 $style = "predicates:category \"".$arguments["category"]."\""; 73 73 if(in_array("answers", $keys)) 74 74 { … … 91 91 predicates:description ?description ; 92 92 predicates:question_category ?category ; 93 94 predicates:question_code ' . $uid . ' 95 predicates:title ' . $title . ' 96 predicates:question_type ' . $type . ' 97 predicates:description ' . $description . ' 98 predicates:question_category ' . $category . ' 99 ' . $has_answer . ' 93 '. $uid . $title . $type . $description . $category . $has_answer . ' 100 94 }'; 101 95 //Create the querystring … … 117 111 /** 118 112 * Gets the answers belonging to the given uid. 119 * @param type $uid 120 * @return type Array 113 * @param type $uid : The uid of the Question in question (haha, pun). 121 114 */ 122 115 private function getAnswers($uid) … … 148 141 /** 149 142 * Save the given ResearchTool object 150 * @param type $rToolObject 143 * @param type $rToolObject : The ResearchToolObject to be saved. 151 144 */ 152 145 public function set($rToolObject) -
Dev/trunk/classes/ResearchToolObject.php
r131 r158 5 5 * @author jkraaijeveld 6 6 */ 7 class ResearchToolObject {7 abstract class ResearchToolObject { 8 8 public $uid; 9 9 } -
Dev/trunk/classes/Respondent.php
r149 r158 6 6 * @author jkraaijeveld 7 7 */ 8 class Respondent extends ResearchToolObject{8 class Respondent extends User { 9 9 public $name; 10 10 public $password; … … 12 12 /** 13 13 * Constructor for a Respondent object 14 * @param type $uid 14 * @param type $uid 15 15 * @param type $name 16 16 * @param type $password -
Dev/trunk/classes/RespondentConnector.php
r149 r158 12 12 class RespondentConnector implements IConnector{ 13 13 14 protected $model;15 14 protected $fileName = 'data/users/respondents.rdf'; 16 15 … … 20 19 public function __construct() 21 20 { 22 //Ensure the required folder for this connector exists23 21 if (!is_dir('data/users/')) 24 22 mkdir('data/users/'); … … 32 30 //Get the Memory Model from the ModelFactory 33 31 $this->model = ModelFactory::getDefaultModel(); 34 35 32 //Ensure the required file exists before loading 36 33 if(file_exists($this->fileName)) … … 47 44 48 45 /** 49 * function get( $arguments)46 * function get() 50 47 * Gets the array of Respondent objects belonging to arguments supplied. 51 48 * @param type $arguments : An array containing zero or more of the following keys: … … 57 54 $keys = array_keys($arguments); 58 55 //Set default values for arguments 59 $uid = " ?uid"; $name = "?name"; $password = "?password";56 $uid = ""; $name = ""; $password = ""; 60 57 //Set the arguments if they are supplied 61 58 if(in_array("uid", $keys)) 62 $uid = " \"".$arguments["uid"]."\"";59 $uid = "predicates:uid \"".$arguments["uid"]."\""; 63 60 if(in_array("name", $keys)) 64 $name = ' \''.$arguments["name"].'\'';61 $name = 'predicates:name \''.$arguments["name"].'\''; 65 62 if(in_array("password", $keys)) 66 $password = " \"".$arguments["password"]."\"";63 $password = "predicates:password \"".$arguments["password"]."\""; 67 64 68 65 //Create the querystring … … 77 74 predicates:name ?name ; 78 75 predicates:password ?password ; 79 predicates:uid ' . $uid . ' 80 predicates:name ' . $name . ' 81 predicates:password ' . $password . ' 76 ' . $uid . $name . $password . ' 82 77 }'; 83 78 //Query the model … … 96 91 97 92 /** 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. 100 95 */ 101 96 public function set($rToolObject) -
Dev/trunk/classes/SessionConnector.php
r157 r158 47 47 48 48 /** 49 * Get the Sessions corresponding to the arguments 50 * @ param type $arguments 51 * Arguments can be one or more of the following: 52 * uid, title, datetime, applications, surveys, answersets 53 * Where applications, surveys and answersets are arrays containing ids 49 * function get() 50 * @param type $arguments : An array containing one or more of the following elements: 51 * 'uid', 'title', 'datetime', 'applications', 'surveys', 'answersets' 54 52 */ 55 53 public function get($arguments) … … 119 117 } 120 118 /** 121 * function getPipeline 122 * Get the application and survey objects of the Session in order119 * function getPipeline() 120 * param type $uid : The Session uid for which the pipeline should be retrieved. 123 121 */ 124 122 private function getPipeline($uid) … … 145 143 146 144 /** 147 * function getAnswerSets 148 * Get the answersets belonging to the given session145 * function getAnswerSets() 146 * @param type $uid : The Session uid for which the answerSets should be retrieved. 149 147 */ 150 148 private function getAnswerSets($uid) … … 163 161 164 162 /** 165 * Save the given Session object in the file.166 * @param type $rToolObjects 163 * function set() 164 * @param type $rToolObjects : The ResearchToolObject to be saved. 167 165 */ 168 166 public function set($rToolObject) … … 188 186 $sessionTimestamp = new Literal($rToolObject->datetime->getTimestamp()); 189 187 // $sessionTimestamp = new Literal($rToolObject->datetime); // Edit of above function, allows for creation of session, but still results in errors... 190 188 $predicateTimestamp = new Resource(DATETIME); 191 189 $this->model->add(new Statement($resourceSession, $predicateTimestamp, $sessionTimestamp)); 192 190 -
Dev/trunk/classes/SurveyConnector.php
r149 r158 55 55 $keys = array_keys($arguments); 56 56 //Set default values for arguments 57 $uid = " ?uid"; $title = "?title"; $description = "?description"; $creator = "?creator"; $questions = "";57 $uid = ""; $title = ""; $description = ""; $creator = ""; $questions = ""; 58 58 if(in_array("uid", $keys)) 59 $uid = ' \''.$arguments["uid"].'\'';59 $uid = 'predicates:uid \''.$arguments["uid"].'\''; 60 60 if(in_array("title", $keys)) 61 $title = ' \''.$arguments["title"].'\'';61 $title = 'predicates:title \''.$arguments["title"].'\''; 62 62 if(in_array("description", $keys)) 63 $description = " \"".$arguments["description"]."\"";63 $description = "predicates:description \"".$arguments["description"]."\""; 64 64 if(in_array("creator", $keys)) 65 $creator = " \"".$arguments["creator"]."\"";65 $creator = "predicates:creator \"".$arguments["creator"]."\""; 66 66 if(in_array("questions", $keys)) 67 67 { … … 83 83 predicates:uid ?uid ; 84 84 predicates:title ?title ; 85 predicates:description ?description ; 86 predicates:uid ' . $uid . ' 87 predicates:title ' . $title . ' 88 predicates:description ' . $description . ' 89 predicates:creator ' . $creator . ' 90 ' . $questions . ' 85 predicates:description ?description ; 86 predicates:creator ?creator ; 87 ' . $uid . $title . $description . $creator . $questions . ' 91 88 }'; 92 89 … … 111 108 /** 112 109 * Gets the questions corresponding to the survey 113 * @param type $uid 110 * @param type $uid : The uid for which the questions should be gotten. 114 111 */ 115 112 private function getQuestions($uid) … … 143 140 /** 144 141 * Saves the given Survey object. 145 * @param type $rToolObject 142 * @param type $rToolObject : The ResearchToolObject to be saved. 146 143 */ 147 144 public function set($rToolObject) -
Dev/trunk/classes/UserConnector.php
r149 r158 32 32 //Get the Memory Model from the ModelFactory 33 33 $this->model = ModelFactory::getDefaultModel(); 34 35 34 //Ensure the required file exists before loading 36 35 if(file_exists($this->fileName)) … … 57 56 $keys = array_keys($arguments); 58 57 //Set default values for arguments 59 $uid = " ?uid"; $name = "?name"; $password = "?password";58 $uid = ""; $name = ""; $password = ""; 60 59 //Set the arguments if they are supplied 61 60 if(in_array("uid", $keys)) 62 $uid = " \"".$arguments["uid"]."\"";61 $uid = "predicates:uid \"".$arguments["uid"]."\""; 63 62 if(in_array("name", $keys)) 64 $name = ' \''.$arguments["name"].'\'';63 $name = 'predicates:name \''.$arguments["name"].'\''; 65 64 if(in_array("password", $keys)) 66 $password = " \"".$arguments["password"]."\"";65 $password = "predicates:password \"".$arguments["password"]."\""; 67 66 68 67 //Create the querystring … … 77 76 predicates:name ?name ; 78 77 predicates:password ?password ; 79 predicates:uid ' . $uid . ' 80 predicates:name ' . $name . ' 81 predicates:password ' . $password . ' 78 ' . $uid . $name . $password . ' 82 79 }'; 83 80 //Query the model
Note: See TracChangeset
for help on using the changeset viewer.