Changeset 148 for Dev/branches/jos-branch/classes/SurveyConnector.php
- Timestamp:
- 11/07/11 16:54:41 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/jos-branch/classes/SurveyConnector.php
r143 r148 55 55 $keys = array_keys($arguments); 56 56 //Set default values for arguments 57 $uid = "?uid"; $title = "?title"; $description = "?description"; $ questions = "";57 $uid = "?uid"; $title = "?title"; $description = "?description"; $creator = "?creator"; $questions = ""; 58 58 if(in_array("uid", $keys)) 59 59 $uid = '\''.$arguments["uid"].'\''; … … 61 61 $title = '\''.$arguments["title"].'\''; 62 62 if(in_array("description", $keys)) 63 $description = "\"".$arguments["description"]."\""; 63 $description = "\"".$arguments["description"]."\""; 64 if(in_array("creator", $keys)) 65 $creator = "\"".$arguments["creator"]."\""; 64 66 if(in_array("questions", $keys)) 65 67 { … … 75 77 PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '> 76 78 PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '> 77 SELECT DISTINCT ?uid, ?title, ?description 79 SELECT DISTINCT ?uid, ?title, ?description, ?creator 78 80 WHERE 79 81 { … … 84 86 predicates:uid ' . $uid . ' 85 87 predicates:title ' . $title . ' 86 predicates:description ' . $description . ' 88 predicates:description ' . $description . ' 89 predicates:creator ' . $creator . ' 87 90 ' . $questions . ' 88 91 }'; … … 95 98 if(!empty($results)) 96 99 { 100 $this->db = new DatabaseInterface(); 97 101 foreach($results as $result) 98 102 { 99 $questions = $this->getQuestions($result['?uid']->label); 100 $surveys[] = new Survey($result['?uid']->label, $result['?title']->label, $result['?description']->label, $questions); 103 $questions = $this->getQuestions($result['?uid']->label); 104 $creator = $this->db->get("user", array("uid" => $result['?creator']->label)); 105 $surveys[] = new Survey($result['?uid']->label, $result['?title']->label, $result['?description']->label, $creator[0], $questions); 101 106 } 102 107 } … … 127 132 if(!empty($results)) 128 133 { 129 $this->db = new DatabaseInterface();130 134 foreach($results as $questionId) 131 135 { … … 165 169 $this->model->add(new Statement($resourceSurvey,$predicateDescription,$surveyDescription)); 166 170 171 $predicateCreator = new Resource(CREATOR); 172 $surveyCreator = new Literal($rToolObject->creator->uid); 173 $this->model->add(new Statement($resourceSurvey, $predicateCreator, $surveyCreator)); 174 167 175 if(isset($rToolObject->questions)) 168 176 {
Note: See TracChangeset
for help on using the changeset viewer.