Ignore:
Timestamp:
11/18/11 11:07:07 (13 years ago)
Author:
jkraaijeveld
Message:

Refactored queries / cleaned up some code.

File:
1 edited

Legend:

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

    r149 r158  
    5050    /**
    5151     * Get the questions corresponding to the arguments.
    52      * @param type $arguments
    53      * @return type Array
     52         * @param type $arguments : An array having one ore more of the following elements:
     53         * 'uid', 'title', 'type', 'description', 'category', 'has_answer'.
    5454     */
    5555    public function get($arguments)
     
    5959        $keys = array_keys($arguments);
    6060        //Set default values for arguments
    61         $uid = "?uid"; $title = "?title"; $type = "?type"; $description = "?description"; $category = "?category"; $has_answer = "";
     61        $uid = ""; $title = ""; $type = ""; $description = ""; $category = ""; $has_answer = "";
    6262        //Set the arguments if they are supplied
    6363        if(in_array("uid", $keys))
    64             $uid = '\''.$arguments["uid"].'\'';
     64            $uid = 'predicates:question_code \''.$arguments["uid"].'\'';
    6565        if(in_array("title", $keys))
    66             $title = '\''.$arguments["title"].'\'';
     66            $title = 'predicates:title \''.$arguments["title"].'\'';
    6767        if(in_array("type", $keys))
    68             $type = '\''.$arguments["type"].'\'';
     68            $type = 'predicates:type \''.$arguments["type"].'\'';
    6969        if(in_array("description", $keys))
    70             $description = "\"".$arguments["description"]."\"";
     70            $description = "predicates:description \"".$arguments["description"]."\"";
    7171        if(in_array("category", $keys))
    72                         $style = "\"".$arguments["category"]."\"";
     72                        $style = "predicates:category \"".$arguments["category"]."\"";
    7373                if(in_array("answers", $keys))
    7474                {
     
    9191                predicates:description ?description ;
    9292                predicates:question_category ?category ;
    93 
    94                 predicates:question_code ' . $uid . '
    95                 predicates:title ' . $title . '
    96                 predicates:question_type ' . $type . '
    97                 predicates:description ' . $description . '
    98                                 predicates:question_category ' . $category . '
    99                                 ' . $has_answer . '
     93                                '. $uid . $title . $type . $description . $category . $has_answer . '
    10094            }';
    10195        //Create the querystring
     
    117111    /**
    118112     * Gets the answers belonging to the given uid.
    119      * @param type $uid
    120      * @return type Array
     113     * @param type $uid : The uid of the Question in question (haha, pun).
    121114     */
    122115    private function getAnswers($uid)
     
    148141    /**
    149142     * Save the given ResearchTool object
    150      * @param type $rToolObject
     143     * @param type $rToolObject : The ResearchToolObject to be saved.
    151144     */
    152145    public function set($rToolObject)
Note: See TracChangeset for help on using the changeset viewer.