You are here

public function TrueFalseQuestion::delete in Quiz 6.4

Same name and namespace in other branches
  1. 6.6 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::delete()
  2. 6.3 question_types/quiz_question/quiz_question.truefalse.inc \TrueFalseQuestion::delete()
  3. 6.5 question_types/quiz_question/quiz_question.truefalse.inc \TrueFalseQuestion::delete()
  4. 7.6 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::delete()
  5. 7 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::delete()
  6. 7.4 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::delete()
  7. 7.5 question_types/truefalse/truefalse.classes.inc \TrueFalseQuestion::delete()

Implementation of delete

Overrides QuizQuestion::delete

See also

QuizQuestion#delete($only_this_version)

File

question_types/truefalse/truefalse.classes.inc, line 49
Defines the classes necessary for a True/False quiz.

Class

TrueFalseQuestion
Extension of QuizQuestion.

Code

public function delete($only_this_version = FALSE) {
  parent::delete($only_this_version);

  // Only delete a nid/vid.
  if ($only_this_version) {
    $sql = 'DELETE FROM {quiz_truefalse_user_answers} WHERE question_nid = %d AND question_vid = %d';
    db_query($sql, $this->node->nid, $this->node->vid);
    $sql = 'DELETE FROM {quiz_truefalse_node} WHERE nid = %d AND vid = %d';
    db_query($sql, $this->node->nid, $this->node->vid);
  }
  else {
    $sql = 'DELETE FROM {quiz_truefalse_user_answers} WHERE question_nid = %d';
    db_query($sql, $this->node->nid);
    $sql = 'DELETE FROM {quiz_truefalse_node} WHERE nid = %d';
    db_query($sql, $this->node->nid, $this->node->vid);
  }
}