]> git.mjollnir.org Git - moodle.git/commitdiff
No reports or grading when there are no questions
authormoodler <moodler>
Tue, 21 Mar 2006 09:28:08 +0000 (09:28 +0000)
committermoodler <moodler>
Tue, 21 Mar 2006 09:28:08 +0000 (09:28 +0000)
mod/quiz/attempt.php
mod/quiz/grading.php

index b5659d96ecc22d5896cb35d6e581a7835fc44cd9..ef0e547b5e89b262f4fb5150457c11adf056aeec 100644 (file)
     require_login($course->id, false, $cm);
     $isteacher = isteacher($course->id);
 
+    // if no questions have been set up yet redirect to edit.php
+    if (!$quiz->questions and isteacheredit($course->id)) {
+        redirect('edit.php?quizid='.$quiz->id);
+    }
+
 // Get number for the next or unfinished attempt
     if(!$attemptnumber = (int)get_field_sql('SELECT MAX(attempt)+1 FROM ' .
      "{$CFG->prefix}quiz_attempts WHERE quiz = '{$quiz->id}' AND " .
index 50a220286910c2da54bd7e0c6a5f63546c109025..d709b881ad49178d28aa6d0f68fe98c3ae8c3d18 100644 (file)
         error("Only teachers authorized to edit the course '{$course->fullname}' can use this page!");
     }
 
+    // if no questions have been set up yet redirect to edit.php
+    if (!$quiz->questions) {
+        redirect('edit.php?quizid='.$quiz->id);
+    }
+
     add_to_log($course->id, "quiz", "manualgrading", "grading.php?quizid=$quiz->id", "$quiz->id", "$cm->id");
 
 /// GROUP CODE FROM ATTEMPTS.PHP no sure how to use just yet... need to update later perhaps