]> git.mjollnir.org Git - moodle.git/commitdiff
Added grade.php so that MDL-10674 works
authormoodler <moodler>
Mon, 6 Aug 2007 05:31:17 +0000 (05:31 +0000)
committermoodler <moodler>
Mon, 6 Aug 2007 05:31:17 +0000 (05:31 +0000)
mod/assignment/grade.php [new file with mode: 0644]

diff --git a/mod/assignment/grade.php b/mod/assignment/grade.php
new file mode 100644 (file)
index 0000000..a4bd1b8
--- /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('assignment', $id)) {
+        error("Course Module ID was incorrect");
+    }
+
+    if (! $assignment = get_record("assignment", "id", $cm->instance)) {
+        error("assignment ID was incorrect");
+    }
+
+    if (! $course = get_record("course", "id", $assignment->course)) {
+        error("Course is misconfigured");
+    }
+
+    require_login($course->id, false, $cm);
+
+    if (has_capability('mod/assignment:grade', get_context_instance(CONTEXT_MODULE, $cm->id))) {
+        redirect('submissions.php?id='.$cm->id);
+    } else {
+        redirect('view.php?id='.$cm->id);
+    }
+
+?>