function multichoice_delete in Quiz 6.3
Same name and namespace in other branches
- 5.2 multichoice.module \multichoice_delete()
- 5 multichoice.module \multichoice_delete()
- 6.6 question_types/multichoice/multichoice.module \multichoice_delete()
- 6.2 multichoice.module \multichoice_delete()
- 6.5 question_types/multichoice/multichoice.module \multichoice_delete()
Implementation of hook_delete().
File
- question_types/
multichoice/ multichoice.module, line 640 - Multiple choice question type for the Quiz module.
Code
function multichoice_delete(&$node) {
//drupal_set_message('CALLED', 'status');
// Delete all answers for this question.
db_query("DELETE FROM {quiz_multichoice_answers} WHERE nid = %d", $node->nid);
// For all quizzes that have this quiz with status ALWAYS, reduce number of questions by 1.
// TODO: This should also create a new revision of every quiz that used to contain this question.
//db_query("UPDATE {quiz_node_properties} SET number_of_questions = number_of_questions-1 WHERE nid IN " .
// "(SELECT parent_vid FROM {quiz_node_relationship} WHERE question_status = %d AND child_nid = %d)", QUESTION_ALWAYS, $node->nid);
// Delete this question from all quizzes.
db_query("DELETE FROM {quiz_node_question_properties} WHERE nid = %d", $node->nid);
db_query("DELETE FROM {quiz_node_relationship} WHERE child_nid = %d", $node->nid);
}