You are here

public function ShortAnswerQuestion::delete in Quiz 7.6

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

Implementation of delete

Overrides QuizQuestion::delete

See also

QuizQuestion#delete($only_this_version)

File

question_types/short_answer/short_answer.classes.inc, line 75
The main classes for the short answer question type.

Class

ShortAnswerQuestion
Extension of QuizQuestion.

Code

public function delete($only_this_version = FALSE) {
  parent::delete($only_this_version);
  $delete_ans = db_delete('quiz_short_answer_user_answers');
  $delete_ans
    ->condition('question_nid', $this->node->nid);
  $delete_node = db_delete('quiz_short_answer_node_properties');
  $delete_node
    ->condition('nid', $this->node->nid);
  if ($only_this_version) {
    $delete_ans
      ->condition('question_vid', $this->node->vid);
    $delete_node
      ->condition('vid', $this->node->vid);
  }
  $delete_ans
    ->execute();
  $delete_node
    ->execute();
}