You are here

function multichoice_load in Quiz 5

Same name and namespace in other branches
  1. 5.2 multichoice.module \multichoice_load()
  2. 6.6 question_types/multichoice/multichoice.module \multichoice_load()
  3. 6.2 multichoice.module \multichoice_load()
  4. 6.3 question_types/multichoice/multichoice.module \multichoice_load()
  5. 6.5 question_types/multichoice/multichoice.module \multichoice_load()

Implementation of hook_load().

File

./multichoice.module, line 277
Multiple choice question type for quiz module

Code

function multichoice_load($node) {
  $additions = db_fetch_object(db_query("SELECT * FROM {quiz_question} WHERE nid = %d", $node->nid));
  $answers = array();
  $result = db_query("SELECT * FROM {quiz_question_answer} WHERE question_nid = %d", $node->nid);
  while ($line = db_fetch_array($result)) {
    $answers[] = $line;
  }
  $additions->answers = $answers;
  $additions->properties = unserialize($additions->properties);
  $additions->multiple_answers = $additions->properties['multiple_answers'];
  return $additions;
}