You are here

public function MultichoiceResponse::delete in Quiz 6.4

Same name and namespace in other branches
  1. 7.6 question_types/multichoice/multichoice.classes.inc \MultichoiceResponse::delete()
  2. 7 question_types/multichoice/multichoice.classes.inc \MultichoiceResponse::delete()
  3. 7.4 question_types/multichoice/multichoice.classes.inc \MultichoiceResponse::delete()
  4. 7.5 question_types/multichoice/multichoice.classes.inc \MultichoiceResponse::delete()

Implementation of delete

Overrides QuizQuestionResponse::delete

See also

QuizQuestionResponse#delete()

File

question_types/multichoice/multichoice.classes.inc, line 772
The main classes for the multichoice question type.

Class

MultichoiceResponse
Extension of QuizQuestionResponse

Code

public function delete() {
  $sql = 'DELETE FROM {quiz_multichoice_user_answer_multi}
            USING {quiz_multichoice_user_answer_multi}
            INNER JOIN {quiz_multichoice_user_answers}
            ON {quiz_multichoice_user_answer_multi}.user_answer_id = {quiz_multichoice_user_answers}.id
            WHERE {quiz_multichoice_user_answers}.question_nid = %d
            AND {quiz_multichoice_user_answers}.question_vid = %d
            AND {quiz_multichoice_user_answers}.result_id = %d';
  db_query($sql, $this->question->nid, $this->question->vid, $this->rid);
  $sql = 'DELETE FROM {quiz_multichoice_user_answers}
            WHERE result_id = %d AND question_nid = %d AND question_vid = %d';
  db_query($sql, $this->rid, $this->question->nid, $this->question->vid);
}