Changeset 207 for Dev/branches/Cartis/classes
- Timestamp:
- 01/06/12 10:24:45 (13 years ago)
- Location:
- Dev/branches/Cartis/classes
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/Cartis/classes/Connector.php
r171 r207 66 66 case "password" : $addition = "predicates:password '" . $arguments[$key] . "'\n"; break; 67 67 case "creator" : $addition = "predicates:creator '" . $arguments[$key] . "'\n"; break; 68 case " datetime" : $addition = "predicates:datetime '" . $arguments[$key] . "'\n"; break;68 case "creationdate" : $addition = "predicates:creationdate '" . $arguments[$key] . "'\n"; break; 69 69 case "applications" : foreach($arguments[$key] as $application) { $addition = $addition . "predicates:has_application '" . $application . "'\n"; } break; 70 71 70 case "surveys" : foreach($arguments[$key] as $survey) { $addition = $addition . "predicates:has_survey '" . $survey . "'\n"; } break; 72 71 case "answersets" : foreach($arguments[$key] as $answerset) { $addition = $addition . "predicates:has_answerset '" . $answerset . "'\n"; } break; 73 72 case "questions" : foreach($arguments[$key] as $question) { $addition = $addition . "predicates:has_question '" . $question . "'\n"; } break; 74 73 case "location" : $addition = "predicates:location '" . $arguments[$key] . "\n"; break; 74 case "facilitator" : $addition = "predicates:facilitator '" . $arguments[$key] . "\n"; break; 75 case "starttime" : $addition = "predicates:starttime '" . $arguments[$key] . "\n"; break; 76 case "endtime" : $addition = "predicates:endtime '" . $arguments[$key] . "\n"; break; 77 case "session" : $addition = "predicates:of_session '" . $arguments[$key] . "\n"; break; 78 case "resultset" : $addition = "predciates:has_resultset '" . $arguments[$key] . "\n"; break; 75 79 } 76 80 $argumentString = $argumentString . $addition; -
Dev/branches/Cartis/classes/DatabaseInterface.php
r149 r207 25 25 private $answerSetConnector; 26 26 private $sessionConnector; 27 private $sessionInstanceConnector; 27 28 28 29 /** … … 39 40 $this->answerSetConnector = new AnswerSetConnector(); 40 41 $this->sessionConnector = new SessionConnector(); 42 $this->sessionInstanceConnector = new SessionInstanceConnector(); 41 43 } 42 44 … … 75 77 return $this->sessionConnector->get($arguments); 76 78 break; 79 case "sessioninstance": 80 return $this->sessionInstanceConnector->get($arguments); 81 break; 77 82 } 78 83 } … … 87 92 { 88 93 case "Application": 89 $this->applicationConnector->set($rToolObject);94 return $this->applicationConnector->set($rToolObject); 90 95 break; 91 96 case "Question": 92 $this->questionConnector->set($rToolObject);97 return $this->questionConnector->set($rToolObject); 93 98 break; 94 99 case "User": 95 $this->userConnector->set($rToolObject);100 return $this->userConnector->set($rToolObject); 96 101 break; 97 102 case "Survey": 98 $this->surveyConnector->set($rToolObject);103 return $this->surveyConnector->set($rToolObject); 99 104 break; 100 105 case "Respondent": 101 $this->respondentConnector->set($rToolObject);106 return $this->respondentConnector->set($rToolObject); 102 107 break; 103 108 case "Answer": 104 $this->answerConnector->set($rToolObject);109 return $this->answerConnector->set($rToolObject); 105 110 break; 106 111 case "AnswerSet": 107 $this->answerSetConnector->set($rToolObject);112 return $this->answerSetConnector->set($rToolObject); 108 113 break; 109 114 case "Session": 110 $this->sessionConnector->set($rToolObject); 115 return $this->sessionConnector->set($rToolObject); 116 break; 117 case "SessionInstance": 118 return $this->sessionInstanceConnector->set($rToolObject); 111 119 break; 112 120 } … … 122 130 foreach ($rToolObjects as $rToolObject) 123 131 { 124 $this->set($rToolObject); 125 } 132 if(!$this->set($rToolObject)) 133 return false; 134 } 135 return true; 126 136 } 127 137 -
Dev/branches/Cartis/classes/Session.php
r186 r207 10 10 public $title; 11 11 public $creator; 12 public $ datetime;12 public $creationdate; 13 13 public $pipeline; 14 public $answersets;15 14 16 15 … … 23 22 * @param type $pipeline 24 23 */ 25 public function __construct($uid = null, $title = null, $creator = null, $datetime = null, $pipeline = null , $answersets = null)24 public function __construct($uid = null, $title = null, $creator = null, $datetime = null, $pipeline = null) 26 25 { 27 26 if(!isset($uid)) … … 32 31 $this->title = $title; 33 32 $this->creator = $creator; 34 $this-> datetime = $datetime;33 $this->creationdate = $datetime; 35 34 $this->pipeline = $pipeline; 36 $this->answersets = $answersets;37 35 } 38 36 … … 67 65 $this->pipeline = $newPipeline; 68 66 } 69 if(!empty($this->answersets) && is_string($this->answersets[0]))70 {71 $newAnswerSets = array();72 foreach($this->answersets as $element)73 {74 $result = $dbi->get("answerset", array("uid" => $element));75 if(!isset($result[0]))76 return false;77 $newAnswerSets[] = $result[0];78 }79 $this->answersets = $newAnswerSets;80 }81 67 return true; 82 68 } … … 90 76 * are written to the file whilst the others get lost. 91 77 */ 78 //DO NOT USE - BROKEN AS OF 23/12/2011 92 79 public function toSPSS($location) 93 80 { -
Dev/branches/Cartis/classes/SessionConnector.php
r186 r207 28 28 * function get() 29 29 * @param type $arguments : An array containing one or more of the following elements: 30 * 'uid', 'title', ' datetime', 'applications', 'surveys', 'answersets'30 * 'uid', 'title', 'creationdate', 'applications', 'surveys' 31 31 */ 32 32 public function get($arguments) … … 38 38 PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '> 39 39 PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '> 40 SELECT DISTINCT ?uid, ?title, ?creator, ? datetime40 SELECT DISTINCT ?uid, ?title, ?creator, ?creationdate 41 41 WHERE 42 42 { … … 45 45 predicates:title ?title ; 46 46 predicates:creator ?creator ; 47 predicates: datetime ?datetime ;47 predicates:creationdate ?creationdate ; 48 48 ' . $this->createArguments($arguments) . ' 49 49 }'; … … 58 58 //Create a session object out of every result, get all required fields as well. 59 59 $pipeline = $this->getPipeline($result['?uid']->label); 60 $answersets = $this->getAnswerSets($result['?uid']->label);61 60 $creator = $result['?creator']->label; 62 $ datetime = new DateTime();63 $ datetime->setTimestamp(intval($result['?datetime']->label));64 $sessions[] = new Session($result['?uid']->label, $result['?title']->label, $creator, $ datetime, $pipeline, $answersets);61 $creationdate = new DateTime(); 62 $creationdate->setTimestamp(intval($result['?creationdate']->label)); 63 $sessions[] = new Session($result['?uid']->label, $result['?title']->label, $creator, $creationdate, $pipeline); 65 64 } 66 65 } … … 135 134 $this->model->add(new Statement($resourceSession, $predicateCreator, $sessionCreator)); 136 135 137 $sessionTimestamp = new Literal($rToolObject-> datetime->getTimestamp());136 $sessionTimestamp = new Literal($rToolObject->creationdate->getTimestamp()); 138 137 // $sessionTimestamp = new Literal($rToolObject->datetime); // Edit of above function, allows for creation of session, but still results in errors... 139 $predicateTimestamp = new Resource( DATETIME);138 $predicateTimestamp = new Resource(CREATIONDATE); 140 139 $this->model->add(new Statement($resourceSession, $predicateTimestamp, $sessionTimestamp)); 141 140 -
Dev/branches/Cartis/classes/sessionEditorWidget.php
r191 r207 88 88 89 89 public function LoadSession() { // Initialize variables on page load. 90 90 // Redirect if no session is set 91 91 if (!isset($_SESSION['currentSession'])) { 92 92 redirect("selectSession.php"); … … 94 94 // Store the current session in internal variable 95 95 $results = $this->dbi->get("Session", array("uid"=> $_SESSION['currentSession'])); 96 print_r($results); 96 97 if (!empty($results)) { 97 98 if ($results[0]->evaluate()) { -
Dev/branches/Cartis/classes/surveyEditorWidget.php
r191 r207 10 10 * @author Thijs Schipper 11 11 */ 12 class surveyEditorWidget {12 class SurveyEditorWidget { 13 13 14 14 private $loadedSurvey;
Note: See TracChangeset
for help on using the changeset viewer.