- Timestamp:
- 02/24/12 16:17:56 (13 years ago)
- Location:
- Dev/branches/rest-dojo-ui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui
- Property svn:mergeinfo changed
/Dev/branches/jos-branch merged: 285-287
- Property svn:mergeinfo changed
-
Dev/branches/rest-dojo-ui/server/classes/models/ApplicationInstance.php
r274 r289 32 32 * @param type $periodicresults: Periodical results from playing. 33 33 */ 34 public function __construct($uid = null, $application = null, $starttime = null, $endtime = null, $open = false, $playerresults = null, $groupresults = null, $periodicresults = null)34 public function __construct($uid = null, $application = null, $starttime = null, $endtime = null, $open = 0, $playerresults = null, $groupresults = null, $periodicresults = null) 35 35 { 36 36 if(!isset($uid)) … … 56 56 if(is_string($this->application)) 57 57 { 58 $result = Application::get(array("uid" => $this->application)); 58 $app = ResearchToolObject::stripUri($this->application); 59 $result = Application::get(array("uid" => $app["uid"])); 59 60 if(!isset($result[0])) 60 61 return false; … … 96 97 $model->add(new Statement($resourceAI, $predicateUid, $AIUid)); 97 98 98 $AIApplication = new Literal($this->application->uid);99 $AIApplication = new Resource(APPLICATION . '/' . $this->application->uid); 99 100 $predicateApplication = new Resource(OF_APPLICATION); 100 101 $model->add(new Statement($resourceAI, $predicateApplication, $AIApplication)); … … 108 109 $model->add(new Statement($resourceAI, $predicateEndTime, $AIEndTime)); 109 110 110 $AIOpen = new Literal( $this->open);111 $AIOpen = new Literal((bool)$this->open); 111 112 $predicateOpen = new Resource(OPEN); 112 113 $model->add(new Statement($resourceAI, $predicateOpen, $AIOpen)); … … 127 128 { 128 129 $model = ResearchToolObject::load(ApplicationInstance::$filename); 130 $model->writeAsHTMLTable(); 129 131 130 132 //Build the query string … … 135 137 WHERE 136 138 { 137 _applicationinstance predicates:resource_type resources:applicationinstance ;139 ?applicationinstance predicates:resource_type resources:applicationinstance ; 138 140 predicates:uid ?uid ; 139 141 predicates:of_application ?of_application ; … … 141 143 predicates:endtime ?endtime ; 142 144 predicates:open ?open ; 143 144 145 ' . ResearchToolObject::createArguments($arguments) . ' 146 }'; 145 147 //Query the model 146 148 $results = $model->sparqlQuery($querystring); 147 148 149 //Create the corresponding ApplicationInstance objects 149 150 $aInstances = array(); … … 156 157 $endTime = new DateTime(); 157 158 $endTime->setTimestamp(intval($result['?endtime']->label)); 158 $open = false; 159 if ($result['?open'] == 'true') 160 $open = true; 161 162 $aInstances[] = new ApplicationInstance($result['?uid']->label, $result['?of_application']->label, $startTime, $endTime, $open, null, null, null); 159 $open = (bool) $result['?open']; 160 $aInstances[] = new ApplicationInstance($result['?uid']->label, $result['?of_application']->uri, $startTime, $endTime, $open, null, null, null); 163 161 } 164 162 }
Note: See TracChangeset
for help on using the changeset viewer.