3 require_once("../../config.php");
5 $id = required_param('id', PARAM_INT
); // Course module ID
7 if (! $cm = get_coursemodule_from_id('assignment', $id)) {
8 error("Course Module ID was incorrect");
11 if (! $assignment = get_record("assignment", "id", $cm->instance
)) {
12 error("assignment ID was incorrect");
15 if (! $course = get_record("course", "id", $assignment->course
)) {
16 error("Course is misconfigured");
19 require_login($course->id
, false, $cm);
21 if (has_capability('mod/assignment:grade', get_context_instance(CONTEXT_MODULE
, $cm->id
))) {
22 redirect('submissions.php?id='.$cm->id
);
24 redirect('view.php?id='.$cm->id
);