Ignore:
Timestamp:
09/19/11 18:04:48 (14 years ago)
Author:
fpvanagthoven
Message:

questions get loaded in fully

File:
1 edited

Legend:

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

    r112 r114  
    1919    public $category;
    2020   
    21     public function __construct($code, $title, $type = null, $description = null)
     21    public function __construct($code, $title = null, $type = null, $description = null)
    2222    {
    2323        $this->code = $code;
     
    3434    }
    3535   
    36     public static function getQuestion($questionInfo)
     36    public static function getQuestion($code, $info)
    3737    {
     38        $question = new Question($code);
     39        $question->title = $info['questionTitle'];
     40        $question->type = $info['questionType'];
     41        if(isset($info['questionDescription']))
     42            $question->description = $info['questionDescription'];
     43        $question->category = $info['questionCategory'];
    3844       
     45        $i = 1;
     46        while (isset($info['ans' . $i]))
     47        {
     48            array_push($question->answers, $info['ans' . $i]);
     49            $i++;
     50        }
     51       
     52        return $question;
    3953    }
    4054
Note: See TracChangeset for help on using the changeset viewer.