3 require_once("../../config.php");
4 require_once("lib.php");
6 $id = optional_param('id', 0, PARAM_INT
); // Course module ID
7 $a = optional_param('a', 0, PARAM_INT
); // Assignment ID
8 $mode = optional_param('mode', 'all', PARAM_ALPHA
); // What mode are we in?
11 if (! $cm = get_coursemodule_from_id('assignment', $id)) {
12 error("Course Module ID was incorrect");
15 if (! $assignment = get_record("assignment", "id", $cm->instance
)) {
16 error("assignment ID was incorrect");
19 if (! $course = get_record("course", "id", $assignment->course
)) {
20 error("Course is misconfigured");
23 if (!$assignment = get_record("assignment", "id", $a)) {
24 error("Course module is incorrect");
26 if (! $course = get_record("course", "id", $assignment->course
)) {
27 error("Course is misconfigured");
29 if (! $cm = get_coursemodule_from_instance("assignment", $assignment->id
, $course->id
)) {
30 error("Course Module ID was incorrect");
34 require_login($course->id
, false, $cm);
36 require_capability('mod/assignment:grade', get_context_instance(CONTEXT_MODULE
, $cm->id
));
38 /// Load up the required assignment code
39 require($CFG->dirroot
.'/mod/assignment/type/'.$assignment->assignmenttype
.'/assignment.class.php');
40 $assignmentclass = 'assignment_'.$assignment->assignmenttype
;
41 $assignmentinstance = new $assignmentclass($cm->id
, $assignment, $cm, $course);
43 $assignmentinstance->submissions($mode); // Display or process the submissions