Ignore:
Timestamp:
11/07/11 16:55:36 (13 years ago)
Author:
jkraaijeveld
Message:

Added missing classes for the database connection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/classes/SurveyConnector.php

    r139 r149  
    5555        $keys = array_keys($arguments);
    5656        //Set default values for arguments
    57         $uid = "?uid"; $title = "?title"; $description = "?description"; $questions = "";
     57        $uid = "?uid"; $title = "?title"; $description = "?description"; $creator = "?creator"; $questions = "";
    5858        if(in_array("uid", $keys))
    5959            $uid = '\''.$arguments["uid"].'\'';
     
    6161            $title = '\''.$arguments["title"].'\'';
    6262        if(in_array("description", $keys))
    63             $description = "\"".$arguments["description"]."\"";
     63                        $description = "\"".$arguments["description"]."\"";
     64                if(in_array("creator", $keys))
     65                        $creator = "\"".$arguments["creator"]."\"";
    6466        if(in_array("questions", $keys))
    6567        {
     
    7577            PREFIX  predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
    7678            PREFIX  resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
    77             SELECT DISTINCT ?uid, ?title, ?description
     79            SELECT DISTINCT ?uid, ?title, ?description, ?creator
    7880            WHERE
    7981            {
     
    8486                predicates:uid ' . $uid . '
    8587                predicates:title ' . $title . '
    86                 predicates:description ' . $description . '
     88                                predicates:description ' . $description . '
     89                                predicates:creator ' . $creator . '
    8790                ' . $questions . '
    8891            }';
     
    98101            foreach($results as $result)
    99102            {
    100                 $questions = $this->getQuestions($result['?uid']->label);
    101                 $surveys[] = new Survey($result['?uid']->label, $result['?title']->label, $result['?description']->label, $questions);
     103                                $questions = $this->getQuestions($result['?uid']->label);
     104                                $creator = $this->db->get("user", array("uid" => $result['?creator']->label));
     105                $surveys[] = new Survey($result['?uid']->label, $result['?title']->label, $result['?description']->label, $creator[0], $questions);
    102106            }
    103107        }
     
    165169        $this->model->add(new Statement($resourceSurvey,$predicateDescription,$surveyDescription));
    166170       
     171                $predicateCreator = new Resource(CREATOR);
     172                $surveyCreator = new Literal($rToolObject->creator->uid);
     173                $this->model->add(new Statement($resourceSurvey, $predicateCreator, $surveyCreator));
     174
    167175        if(isset($rToolObject->questions))
    168176        {
Note: See TracChangeset for help on using the changeset viewer.