From 92b6d775b27f821bf0f11d732a300ff26bfd9f0b Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 21 Mar 2006 09:28:08 +0000 Subject: [PATCH] No reports or grading when there are no questions --- mod/quiz/attempt.php | 5 +++++ mod/quiz/grading.php | 5 +++++ 2 files changed, 10 insertions(+) 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 -- 2.39.5