Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

factored out functionality to check if question is in use on delete

will be using this to delete whole categories of questions (or not)
  • Loading branch information...
commit b90d6ed1e26378ef3ecb72aa11358e9c15698441 1 parent bb5e13d
thepurpleblob authored
Showing with 1 addition and 16 deletions.
  1. +1 −16 mod/quiz/question.php
View
17 mod/quiz/question.php
@@ -83,22 +83,7 @@
} else {
// determine if the question is being used in any quiz
- if ($category->publish) {
- $quizzes = get_records("quiz");
- } else {
- $quizzes = get_records("quiz", "course", $course->id);
- }
- $beingused = array();
- if ($quizzes) {
- foreach ($quizzes as $quiz) {
- $qqq = explode(",", $quiz->questions);
- foreach ($qqq as $key => $value) {
- if ($value == $delete) {
- $beingused[] = $quiz->name;
- }
- }
- }
- }
+ $beingused = quizzes_question_used( $delete, $category->publish, $course->id );
if ($beingused) {
$beingused = implode(", ", $beingused);
$beingused = get_string("questioninuse", "quiz", "<i>$question->name</i>")."<p>".$beingused;
Please sign in to comment.
Something went wrong with that request. Please try again.