]> git.mjollnir.org Git - moodle.git/commitdiff
Added grade.php file to make MDL-10674 work
authormoodler <moodler>
Mon, 6 Aug 2007 05:38:58 +0000 (05:38 +0000)
committermoodler <moodler>
Mon, 6 Aug 2007 05:38:58 +0000 (05:38 +0000)
mod/quiz/grade.php [new file with mode: 0644]

diff --git a/mod/quiz/grade.php b/mod/quiz/grade.php
new file mode 100644 (file)
index 0000000..04e8023
--- /dev/null
@@ -0,0 +1,27 @@
+<?php  // $Id$
+
+    require_once("../../config.php");
+
+    $id   = required_param('id', PARAM_INT);          // Course module ID
+
+    if (! $cm = get_coursemodule_from_id('quiz', $id)) {
+        error('Course Module ID was incorrect');
+    }
+
+    if (! $quiz = get_record('quiz', 'id', $cm->instance)) {
+        error('quiz ID was incorrect');
+    }
+
+    if (! $course = get_record('course', 'id', $quiz->course)) {
+        error('Course is misconfigured');
+    }
+
+    require_login($course->id, false, $cm);
+
+    if (has_capability('mod/quiz:viewreports', get_context_instance(CONTEXT_MODULE, $cm->id))) {
+        redirect('report.php?id='.$cm->id);
+    } else {
+        redirect('view.php?id='.$cm->id);
+    }
+
+?>