You are here

public function ChoiceQuestion::load in Quiz 6.6

Implementation of load

(non-PHPdoc)

Overrides QuizQuestion::load

See also

sites/all/modules/quiz-HEAD/question_types/quiz_question/QuizQuestion#load()

File

question_types/choice/choice.classes.inc, line 228
The main classes for the choice question type.

Class

ChoiceQuestion
Implementation of QuizQuestion.

Code

public function load() {
  $sql = 'SELECT choice_multi, choice_random, choice_boolean
            FROM {quiz_choice_properties}
            WHERE nid = %d AND vid = %d';
  $res = db_query($sql, $this->node->nid, $this->node->vid);
  $to_return = db_fetch_array($res);
  $sql = 'SELECT id, answer, answer_format, feedback_if_chosen, feedback_if_chosen_format,
            feedback_if_not_chosen, feedback_if_not_chosen_format, score_if_chosen, score_if_not_chosen
            FROM {quiz_choice_answer}
            WHERE question_nid = %d AND question_vid = %d';
  $res = db_query($sql, $this->node->nid, $this->node->vid);
  $counter = 0;
  while ($res_arr = db_fetch_array($res)) {
    $to_return['alternatives'][$counter] = $res_arr;
    $counter++;
  }
  return $to_return;
}