function quiz_add_question_to_quiz in Quiz 7.6
Same name and namespace in other branches
- 7.5 quiz.module \quiz_add_question_to_quiz()
Action to add questions to the current quiz.
File
- ./
quiz.module, line 3814 - quiz.module Main file for the Quiz module.
Code
function quiz_add_question_to_quiz($question) {
$quiz = node_load(arg(1));
$quiz_questions = quiz_get_questions($quiz->nid, $quiz->vid);
// Do not add a question if it's already been added (selected in an earlier checkbox)
foreach ($quiz_questions as $q) {
if ($question->vid == $q->vid) {
return FALSE;
}
}
_quiz_question_get_instance($question)
->saveRelationships($quiz->nid, $quiz->vid);
quiz_update_max_score_properties(array(
$quiz->vid,
));
}