You are here

public function ScaleQuestion::delete in Quiz 6.4

Same name and namespace in other branches
  1. 8.6 question_types/quiz_scale/src/Plugin/quiz/QuizQuestion/ScaleQuestion.php \ScaleQuestion::delete()
  2. 8.5 question_types/quiz_scale/src/Plugin/quiz/QuizQuestion/ScaleQuestion.php \ScaleQuestion::delete()
  3. 6.6 question_types/scale/scale.classes.inc \ScaleQuestion::delete()
  4. 7.6 question_types/scale/scale.classes.inc \ScaleQuestion::delete()
  5. 7 question_types/scale/scale.classes.inc \ScaleQuestion::delete()
  6. 7.4 question_types/scale/scale.classes.inc \ScaleQuestion::delete()
  7. 7.5 question_types/scale/scale.classes.inc \ScaleQuestion::delete()

Implementation of delete

Overrides QuizQuestion::delete

See also

QuizQuestion#delete()

File

question_types/scale/scale.classes.inc, line 254
The main classes for the scale question type.

Class

ScaleQuestion
Extension of QuizQuestion.

Code

public function delete($only_this_version = FALSE) {
  parent::delete($only_this_version);
  if ($only_this_version) {
    db_query('DELETE FROM {quiz_scale_user_answers} WHERE question_nid = %d AND question_vid = %d', $this->node->nid, $this->node->vid);
    db_query('DELETE FROM {quiz_scale_node_properties} WHERE nid = %d AND vid = %d', $this->node->nid, $this->node->vid);
  }
  else {
    db_query('DELETE FROM {quiz_scale_user_answers} WHERE question_nid = %d', $this->node->nid);
    db_query('DELETE FROM {quiz_scale_node_properties} WHERE nid = %d', $this->node->nid);
  }
  $this
    ->deleteCollectionIfNotUsed($this->node->{0}->answer_collection_id, 0);
}