Changeset 91 for Dev/trunk/classes/SurveyCreationDatabaseInterface.php
- Timestamp:
- 08/30/11 17:49:19 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 ?>
Note: See TracChangeset
for help on using the changeset viewer.