Ignore:
Timestamp:
02/24/12 16:17:56 (13 years ago)
Author:
hendrikvanantwerpen
Message:

[merge] svn merge ../jos-branch -r 284:287 .

Location:
Dev/branches/rest-dojo-ui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Dev/branches/rest-dojo-ui

  • Dev/branches/rest-dojo-ui/server/classes/models/ApplicationInstance.php

    r274 r289  
    3232         * @param type $periodicresults: Periodical results from playing.
    3333         */
    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)
    3535        {
    3636                if(!isset($uid))
     
    5656                if(is_string($this->application))
    5757                {
    58                         $result = Application::get(array("uid" => $this->application));
     58                        $app = ResearchToolObject::stripUri($this->application);
     59                        $result = Application::get(array("uid" => $app["uid"]));
    5960                        if(!isset($result[0]))
    6061                                return false;
     
    9697                $model->add(new Statement($resourceAI, $predicateUid, $AIUid));
    9798
    98                 $AIApplication = new Literal($this->application->uid);
     99                $AIApplication = new Resource(APPLICATION . '/' . $this->application->uid);
    99100                $predicateApplication = new Resource(OF_APPLICATION);
    100101                $model->add(new Statement($resourceAI, $predicateApplication, $AIApplication));
     
    108109                $model->add(new Statement($resourceAI, $predicateEndTime, $AIEndTime));
    109110
    110                 $AIOpen = new Literal($this->open);
     111                $AIOpen = new Literal((bool)$this->open);
    111112                $predicateOpen = new Resource(OPEN);
    112113                $model->add(new Statement($resourceAI, $predicateOpen, $AIOpen));
     
    127128        {
    128129                $model = ResearchToolObject::load(ApplicationInstance::$filename);
     130                $model->writeAsHTMLTable();
    129131
    130132                //Build the query string
     
    135137                        WHERE
    136138                        {
    137                                 _applicationinstance    predicates:resource_type        resources:applicationinstance ;
     139                                ?applicationinstance    predicates:resource_type        resources:applicationinstance ;
    138140                                predicates:uid ?uid ;
    139141                                predicates:of_application ?of_application ;
     
    141143                                predicates:endtime ?endtime ;
    142144                                predicates:open ?open ;
    143                                 ' . ResearchToolObject::createArguments($arguments) . '
    144                         }';
     145                        ' . ResearchToolObject::createArguments($arguments) . '
     146        }';
    145147                //Query the model
    146148                $results = $model->sparqlQuery($querystring);
    147 
    148149                //Create the corresponding ApplicationInstance objects
    149150                $aInstances = array();
     
    156157                                $endTime = new DateTime();
    157158                                $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);
    163161                        }
    164162                }
Note: See TracChangeset for help on using the changeset viewer.