You are here

public function ChoiceQuestion::delete in Quiz 6.6

Implementation of delete

(non-PHPdoc)

Overrides QuizQuestion::delete

See also

sites/all/modules/quiz-HEAD/question_types/quiz_question/QuizQuestion#delete()

File

question_types/choice/choice.classes.inc, line 199
The main classes for the choice question type.

Class

ChoiceQuestion
Implementation of QuizQuestion.

Code

public function delete($only_this_version = FALSE) {
  if ($only_this_version) {
    db_query('DELETE FROM {quiz_choice_properties} WHERE nid = %d AND vid = %d', $this->node->nid, $this->node->vid);
    $sql = 'DELETE FROM {quiz_choice_user_answers}
      		  WHERE result_id IN(
      		  	SELECT result_id
      		  	FROM {quiz_node_results}
      		  	WHERE nid = %d AND vid = %d
      		  )';
    db_query($sql, $this->node->nid, $this->node->vid);
  }
  else {
    db_query('DELETE FROM {quiz_choice_properties} WHERE nid = %d', $this->node->nid);
    $sql = 'DELETE FROM {quiz_choice_user_answers}
      		  WHERE result_id IN(
      		  	SELECT result_id
      		  	FROM {quiz_node_results}
      		  	WHERE nid = %d
      		  )';
    db_query($sql, $this->node->nid);
  }
}