From: moodler Date: Tue, 21 Mar 2006 09:28:08 +0000 (+0000) Subject: No reports or grading when there are no questions X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=92b6d775b27f821bf0f11d732a300ff26bfd9f0b;p=moodle.git No reports or grading when there are no questions --- diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php index b5659d96ec..ef0e547b5e 100644 --- a/mod/quiz/attempt.php +++ b/mod/quiz/attempt.php @@ -59,6 +59,11 @@ 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 " . diff --git a/mod/quiz/grading.php b/mod/quiz/grading.php index 50a2202869..d709b881ad 100644 --- a/mod/quiz/grading.php +++ b/mod/quiz/grading.php @@ -48,6 +48,11 @@ 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