public function MatchingQuestion::delete in Quiz 7
Same name and namespace in other branches
- 6.6 question_types/matching/matching.classes.inc \MatchingQuestion::delete()
- 6.3 question_types/matching/matching.classes.inc \MatchingQuestion::delete()
- 6.4 question_types/matching/matching.classes.inc \MatchingQuestion::delete()
- 6.5 question_types/matching/matching.classes.inc \MatchingQuestion::delete()
- 7.6 question_types/matching/matching.classes.inc \MatchingQuestion::delete()
- 7.4 question_types/matching/matching.classes.inc \MatchingQuestion::delete()
- 7.5 question_types/matching/matching.classes.inc \MatchingQuestion::delete()
Implementation of delete
Overrides QuizQuestion::delete
See also
QuizQuestion#delete($only_this_version)
File
- question_types/
matching/ matching.classes.inc, line 100 - matching.classes
Class
- MatchingQuestion
- Extension of QuizQuestion.
Code
public function delete($only_this_version = FALSE) {
parent::delete($only_this_version);
if ($only_this_version) {
$match_id = db_query('SELECT match_id FROM {quiz_matching_node} WHERE nid = :nid AND vid = :vid', array(
':nid' => $this->node->nid,
':vid' => $this->node->vid,
))
->fetchCol();
db_delete('quiz_matching_user_answers')
->condition('match_id', is_array($match_id) ? $match_id : array(
0,
), 'IN')
->execute();
db_delete('quiz_matching_node')
->condition('nid', $this->node->nid)
->condition('vid', $this->node->vid)
->execute();
}
else {
$match_id = db_query('SELECT match_id FROM {quiz_matching_node} WHERE nid = :nid', array(
':nid' => $this->node->nid,
))
->fetchCol();
db_delete('quiz_matching_user_answers')
->condition('match_id', is_array($match_id) ? $match_id : array(
0,
), 'IN')
->execute();
db_delete('quiz_matching_node')
->condition('nid', $this->node->nid)
->execute();
}
}