Incorrect variable name used for parameter.
[moodle-linuxchix.git] / mod / assignment / submissions.php
blob5e3c40abd4da625b5c4c885b79b1836ccd4e71d8
1 <?php // $Id$
3 require_once("../../config.php");
4 require_once("lib.php");
6 $id = optional_param('id'); // Course module ID
7 $a = optional_param('a'); // Assignment ID
8 $mode = optional_param('mode', 'all'); // What mode are we in?
10 if ($id) {
11 if (! $cm = get_record("course_modules", "id", $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");
22 } else {
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 if (!isteacher($course->id)) {
37 error("Only teachers can look at this page");
40 /// Load up the required assignment code
41 require($CFG->dirroot.'/mod/assignment/type/'.$assignment->assignmenttype.'/assignment.class.php');
42 $assignmentclass = 'assignment_'.$assignment->assignmenttype;
43 $assignmentinstance = new $assignmentclass($cm->id, $assignment, $cm, $course);
45 $assignmentinstance->submissions($mode); // Display or process the submissions