function multichoice_load in Quiz 6.5
Same name and namespace in other branches
- 5.2 multichoice.module \multichoice_load()
- 5 multichoice.module \multichoice_load()
- 6.6 question_types/multichoice/multichoice.module \multichoice_load()
- 6.2 multichoice.module \multichoice_load()
- 6.3 question_types/multichoice/multichoice.module \multichoice_load()
Implementation of hook_load().
File
- question_types/
multichoice/ multichoice.module, line 658 - Multiple choice question type for the Quiz module.
Code
function multichoice_load($node) {
$additions = new stdClass();
$question_vid = $node->vid;
$additions->properties = db_fetch_array(db_query("SELECT * FROM {quiz_node_question_properties} WHERE nid = %d AND vid = %d", $node->nid, $question_vid));
$answers = array();
$result = db_query("SELECT * FROM {quiz_multichoice_answers} WHERE nid = %d AND vid = %d", $node->nid, $question_vid);
while ($line = db_fetch_array($result)) {
$answers[] = $line;
}
$additions->answers = $answers;
// Just check for multiple answers for now.
$additions->multiple_answers = $additions->properties['number_of_answers'] > 1 ? 1 : 0;
return $additions;
}