You are here

public function QuizQuestion::delete in Quiz 7.6

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

Delete question data from the database.

Called by quiz_question_delete (hook_delete). Child classes must call super

Parameters

$only_this_version: If the $only_this_version flag is TRUE, then only the particular nid/vid combo should be deleted. Otherwise, all questions with the current nid can be deleted.

6 calls to QuizQuestion::delete()
LongAnswerQuestion::delete in question_types/long_answer/long_answer.classes.inc
Implementation of delete
MatchingQuestion::delete in question_types/matching/matching.classes.inc
Implementation of delete
MultichoiceQuestion::delete in question_types/multichoice/multichoice.classes.inc
Implementation of delete
ScaleQuestion::delete in question_types/scale/scale.classes.inc
Implementation of delete
ShortAnswerQuestion::delete in question_types/short_answer/short_answer.classes.inc
Implementation of delete

... See full list

6 methods override QuizQuestion::delete()
LongAnswerQuestion::delete in question_types/long_answer/long_answer.classes.inc
Implementation of delete
MatchingQuestion::delete in question_types/matching/matching.classes.inc
Implementation of delete
MultichoiceQuestion::delete in question_types/multichoice/multichoice.classes.inc
Implementation of delete
ScaleQuestion::delete in question_types/scale/scale.classes.inc
Implementation of delete
ShortAnswerQuestion::delete in question_types/short_answer/short_answer.classes.inc
Implementation of delete

... See full list

File

question_types/quiz_question/quiz_question.core.inc, line 261
Classes used in the Quiz Question module.

Class

QuizQuestion
A base implementation of a quiz_question, adding a layer of abstraction between the node API, quiz API and the question types.

Code

public function delete($only_this_version = FALSE) {

  // Delete answeres
  $delete = db_delete('quiz_node_results_answers')
    ->condition('question_nid', $this->node->nid);
  if ($only_this_version) {
    $delete
      ->condition('question_vid', $this->node->vid);
  }
  $delete
    ->execute();

  // Delete properties
  $delete = db_delete('quiz_question_properties')
    ->condition('nid', $this->node->nid);
  if ($only_this_version) {
    $delete
      ->condition('vid', $this->node->vid);
  }
  $delete
    ->execute();
}