You are here

public function ScaleQuestion::delete in Quiz 7.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. 6.4 question_types/scale/scale.classes.inc \ScaleQuestion::delete()
  5. 7.6 question_types/scale/scale.classes.inc \ScaleQuestion::delete()
  6. 7 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 277
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_delete('quiz_scale_user_answers')
      ->condition('question_nid', $this->node->nid)
      ->condition('question_vid', $this->node->vid)
      ->execute();
    db_delete('quiz_scale_node_properties')
      ->condition('nid', $this->node->nid)
      ->condition('vid', $this->node->vid)
      ->execute();
  }
  else {
    db_delete('quiz_scale_user_answers')
      ->condition('question_nid', $this->node->nid)
      ->execute();
    db_delete('quiz_scale_node_properties')
      ->condition('nid', $this->node->nid)
      ->execute();
  }
  $this
    ->deleteCollectionIfNotUsed($this->node->{0}->answer_collection_id, 0);
}