public function MatchingQuestion::delete in Quiz 6.4
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.5 question_types/matching/matching.classes.inc \MatchingQuestion::delete()
- 7.6 question_types/matching/matching.classes.inc \MatchingQuestion::delete()
- 7 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 75 - matching.classes
Class
- MatchingQuestion
- Extension of QuizQuestion.
Code
public function delete($only_this_version = FALSE) {
parent::delete($only_this_version);
if ($only_this_version) {
$sql = 'DELETE FROM {quiz_matching_user_answers}
WHERE match_id IN(
SELECT match_id
FROM {quiz_matching_node}
WHERE nid = %d AND vid = %d
)';
db_query($sql, $this->node->nid, $this->node->vid);
$sql = 'DELETE FROM {quiz_matching_node} WHERE nid = %d AND vid = %d';
db_query($sql, $this->node->nid, $this->node->vid);
}
else {
$sql = 'DELETE FROM {quiz_matching_user_answers}
WHERE match_id IN(
SELECT match_id
FROM {quiz_matching_node}
WHERE nid = %d
)';
db_query($sql, $this->node->nid);
$sql = 'DELETE FROM {quiz_matching_node} WHERE nid = %d';
db_query($sql, $this->node->nid, $this->node->vid);
}
}