You are here

public function QuizQuestion::delete in OG Quiz 7

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.

1 call to QuizQuestion::delete()
LongAnswerQuestion::delete in includes/og_long_answer.php
Implementation of delete
1 method overrides QuizQuestion::delete()
LongAnswerQuestion::delete in includes/og_long_answer.php
Implementation of delete

File

includes/og_quiz_question.php, line 473
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();
}