]> git.mjollnir.org Git - moodle.git/commitdiff
If a question is removed from a quiz then also all existing responses (e.g. from...
authorgustav_delius <gustav_delius>
Sun, 6 Feb 2005 07:45:40 +0000 (07:45 +0000)
committergustav_delius <gustav_delius>
Sun, 6 Feb 2005 07:45:40 +0000 (07:45 +0000)
mod/quiz/edit.php

index bea4c56626e8889e150a0a47778f3d2b46d3db87..33c2d9c28dfa7e78c8493f4d3df18d706d1b6f1e 100644 (file)
             if ($question == $delete) {
                 unset($questions[$key]);
                 unset($modform->grades[$question]);
-                if (!delete_records('quiz_question_grades', 'quiz', $modform->instance, 'question', $question)) {
-                    error("Could not delete question grade");
+                if (!(delete_records('quiz_question_grades', 'quiz', $modform->instance, 'question', $question)
+                      and delete_records('quiz_responses', 'question', $question))) {
+                    error("Could not delete question responses");
                 }
             }
         }
     $strediting = get_string('editquestions', "quiz");
 
     // Print basic page layout.
-    
-    if (isset($modform->instance) and record_exists_sql("SELECT * FROM {$CFG->prefix}quiz_attempts WHERE quiz = '$modform->instance' AND NOT (userid = '$USER->id') LIMIT 1")){    
+
+    if (isset($modform->instance) and record_exists_sql("SELECT * FROM {$CFG->prefix}quiz_attempts WHERE quiz = '$modform->instance' AND NOT (userid = '$USER->id') LIMIT 1")){
     // one column layout with table of questions used in this quiz
         print_header_simple($strediting, '',
                  "<a href=\"index.php?id=$course->id\">$strquizzes</a>".