You are here

public function ScaleQuestion::delete in Quiz 6.6

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.4 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

(non-PHPdoc)

Overrides QuizQuestion::delete

See also

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

File

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

Class

ScaleQuestion
Implementation of QuizQuestion.

Code

public function delete($only_this_version = FALSE) {
  if ($only_this_version) {
    db_query('DELETE FROM {quiz_scale_node_properties} WHERE nid = %d AND vid = %d', $this->node->nid, $this->node->vid);
    $sql = 'DELETE FROM {quiz_scale_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_scale_node_properties} WHERE nid = %d', $this->node->nid);
    $sql = 'DELETE FROM {quiz_scale_user_answers}
      		  WHERE result_id IN(
      		  	SELECT result_id
      		  	FROM {quiz_node_results}
      		  	WHERE nid = %d
      		  )';
    db_query($sql, $this->node->nid);
  }
  $this
    ->deleteCollectionIfNotUsed($this->node->{0}->answer_collection_id, 0);
}