- Timestamp:
- 08/30/11 17:49:19 (14 years ago)
- Location:
- Dev/trunk
- Files:
-
- 3 added
- 9 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 -
Dev/trunk/doc/TODO
r90 r91 11 11 Load existing question 12 12 Question code 13 Question category 13 14 14 15 Application Load / Edit -
Dev/trunk/rdfConstants.php
r82 r91 10 10 11 11 // Resource used for RDF triples 12 define('USER',SURVEYTOOL_RESOURCES_NAMESPACE . 'user'); 12 13 define('SURVEY',SURVEYTOOL_RESOURCES_NAMESPACE . 'survey'); 14 define('QUESTION',SURVEYTOOL_RESOURCES_NAMESPACE . 'question'); 13 15 define('APPLICATION',SURVEYTOOL_RESOURCES_NAMESPACE . 'application'); 14 16 define('SESSION',SURVEYTOOL_RESOURCES_NAMESPACE . 'session'); 15 17 define('DASHBOARD',SURVEYTOOL_RESOURCES_NAMESPACE . 'dashboard'); 16 define('USER',SURVEYTOOL_RESOURCES_NAMESPACE . 'user'); 17 define('QUESTION',SURVEYTOOL_RESOURCES_NAMESPACE . 'question'); 18 define('ANSWER',SURVEYTOOL_RESOURCES_NAMESPACE . 'answer'); 18 define('GRAPH',SURVEYTOOL_RESOURCES_NAMESPACE . 'graph'); 19 19 20 20 // Predicates used for RDF triples 21 21 define('UID',SURVEYTOOL_PREDICATES_NAMESPACE . 'uid'); 22 define('CREATOR',SURVEYTOOL_PREDICATES_NAMESPACE . 'creator');23 22 define('NAME',SURVEYTOOL_PREDICATES_NAMESPACE . 'name'); 24 23 define('PASSWORD',SURVEYTOOL_PREDICATES_NAMESPACE . 'password'); 24 define('CREATOR',SURVEYTOOL_PREDICATES_NAMESPACE . 'creator'); 25 25 define('TITLE',SURVEYTOOL_PREDICATES_NAMESPACE . 'title'); 26 26 define('DESCRIPTION',SURVEYTOOL_PREDICATES_NAMESPACE . 'description'); … … 30 30 define('QTYPE',SURVEYTOOL_PREDICATES_NAMESPACE . 'question_type'); 31 31 define('QCODE',SURVEYTOOL_PREDICATES_NAMESPACE . 'question_code'); 32 define('ANSWERED',SURVEYTOOL_PREDICATES_NAMESPACE . 'answered'); 33 define('RESPONDENT',SURVEYTOOL_PREDICATES_NAMESPACE . 'respondent'); 32 34 define('QCATEGORY',SURVEYTOOL_PREDICATES_NAMESPACE . 'question_category'); 33 35 define('HAS_QUESTION',SURVEYTOOL_PREDICATES_NAMESPACE . 'has_question'); 34 36 define('HAS_ANSWER',SURVEYTOOL_PREDICATES_NAMESPACE . 'has_answer'); 35 define('ANSWERED',SURVEYTOOL_PREDICATES_NAMESPACE . 'answered'); 36 define('RESPONDENT',SURVEYTOOL_PREDICATES_NAMESPACE . 'respondent'); 37 define('HAS_GRAPH',SURVEYTOOL_PREDICATES_NAMESPACE . 'has_graph'); 37 38 define('HAS_PROCESS',SURVEYTOOL_PREDICATES_NAMESPACE . 'has_process'); 38 39 define('INDEX',SURVEYTOOL_PREDICATES_NAMESPACE . 'index'); 40 define('GRAPH_TYPE',SURVEYTOOL_PREDICATES_NAMESPACE . 'graph_type'); 41 define('DATA',SURVEYTOOL_PREDICATES_NAMESPACE . 'data'); 39 42 40 43 ?> -
Dev/trunk/sessioncreation.php
r85 r91 4 4 if (is_null($_SESSION['username'])) 5 5 redirect('index.php'); 6 7 var_dump($_POST);8 6 9 7 /* LOAD SURVEY */
Note: See TracChangeset
for help on using the changeset viewer.