Changeset 91 for Dev/trunk/classes
- Timestamp:
- 08/30/11 17:49:19 (14 years ago)
- Location:
- Dev/trunk/classes
- Files:
-
- 3 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/classes/ApplicationDatabaseInterface.php
r88 r91 63 63 64 64 $resultApplication = $this->applicationRDFReader->readAllApplications(); 65 66 for($aNumber = 0;$aNumber<sizeof($resultApplication[0]);$aNumber++) 65 if($resultApplication[0] != false) 67 66 { 68 $aID = $resultApplication[0][$aNumber]['?uid']->label; 69 $aTitle = $resultApplication[1][$aNumber]['?title']->label; 70 $applicationInfo[$aID] = $aTitle; 71 } 67 for($aNumber = 0;$aNumber<sizeof($resultApplication[0]);$aNumber++) 68 { 69 $aID = $resultApplication[0][$aNumber]['?uid']->label; 70 $aTitle = $resultApplication[1][$aNumber]['?title']->label; 71 $applicationInfo[$aID] = $aTitle; 72 } 73 } 72 74 73 75 return $applicationInfo; -
Dev/trunk/classes/QuestionRDFReader.php
r85 r91 69 69 return $result; 70 70 } 71 72 public function readQuestionCodes() 73 { 74 $result = null; 75 76 if(file_exists($this->filePath.'questions.rdf')) 77 { 78 // Create empty MemModel 79 $factory = new ModelFactory(); 80 $tempmodel= $factory->getDefaultModel(); 81 $tempmodel->load($this->filePath.'questions.rdf'); 82 83 $querystring = ' 84 PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '> 85 PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '> 86 SELECT ?questionCode 87 WHERE 88 { 89 _question predicates:resource_type resources:question ; 90 predicates:question_code ?questionCode 91 }'; 92 93 $result = $tempmodel->sparqlQuery($querystring); 94 } 95 return $result; 96 } 71 97 72 98 public function readQuestionTitle($questionID) -
Dev/trunk/classes/SurveyAnswerDatabaseInterface.php
r85 r91 5 5 // Include RAP Library to write RDF files 6 6 include(RDFAPI_INCLUDE_DIR . "RDFAPI.php"); 7 8 9 7 10 8 class SurveyAnswerDatabaseInterface extends SurveyCreationDatabaseInterface -
Dev/trunk/classes/SurveyCreationDatabaseInterface.php
r85 r91 94 94 } 95 95 96 if(!$this->checkQuestionIDExists($qID)) 97 { 96 if($this->checkQuestionCodeExists($qCode)) 97 { 98 return 'Question code (' . $qCode . ') already in use. Please try a new code.'; 99 } 100 else if($this->checkQuestionIDExists($qID)) 101 { 102 return 'Question already exists'; 103 } 104 else { 98 105 $this->questionRDFWriter->createQuestion($qTitle,$qDescription,$qType,$qID,"null","null",$qAnswers); 106 return 'Question saved'; 99 107 } 100 108 } … … 201 209 return $result; 202 210 } 211 212 public function checkQuestionCodeExists($qCode) 213 { 214 $result = false; 215 216 $questionCodes = $this->questionRDFReader->readQuestionCodes(); 217 218 if ($questionCodes != null) 219 { 220 foreach($questionCodes as $questionCode) 221 { 222 $code = $questionCode['?questionCode']->label; 223 if(!strcmp($code ,$qCode)) 224 { 225 $result = true; 226 break; 227 } 228 } 229 } 230 231 return $result; 232 } 203 233 } 204 234 ?> -
Dev/trunk/classes/SurveyCreationTool.php
r73 r91 15 15 $this->survey = $survey; 16 16 $this->timeStamp = $timeStamp; 17 var_dump($_POST);18 var_dump($survey);19 17 if (isset($this->survey->id)) 20 18 SurveyCreationTool::javascript($this->survey->id); -
Dev/trunk/classes/SurveyRDFReader.php
r82 r91 20 20 public function loadSurvey() 21 21 { 22 $this->model->load($this->filePath); 22 if(file_exists($this->filePath)) 23 { 24 $this->model->load($this->filePath); 25 return true; 26 } 27 else 28 { 29 return false; 30 } 23 31 } 24 32
Note: See TracChangeset
for help on using the changeset viewer.