3 require_once("../../config.php");
4 require_once("lib.php");
6 $id = required_param('id', PARAM_INT
); // course
8 if (! $course = get_record("course", "id", $id)) {
9 error("Course ID is incorrect");
12 require_course_login($course);
13 add_to_log($course->id
, "assignment", "view all", "index.php?id=$course->id", "");
15 $strassignments = get_string("modulenameplural", "assignment");
16 $strassignment = get_string("modulename", "assignment");
17 $strassignmenttype = get_string("assignmenttype", "assignment");
18 $strweek = get_string("week");
19 $strtopic = get_string("topic");
20 $strname = get_string("name");
21 $strduedate = get_string("duedate", "assignment");
22 $strsubmitted = get_string("submitted", "assignment");
23 $strgrade = get_string("grade");
26 $navlinks[] = array('name' => $strassignments, 'link' => '', 'type' => 'activity');
27 $navigation = build_navigation($navlinks);
29 print_header_simple($strassignments, "", $navigation, "", "", true, "", navmenu($course));
31 if (! $assignments = get_all_instances_in_course("assignment", $course)) {
32 notice(get_string('noassignments', 'assignment'), "../../course/view.php?id=$course->id");
38 if ($course->format
== "weeks") {
39 $table->head
= array ($strweek, $strname, $strassignmenttype, $strduedate, $strsubmitted, $strgrade);
40 $table->align
= array ("center", "left", "left", "left", "right");
41 } else if ($course->format
== "topics") {
42 $table->head
= array ($strtopic, $strname, $strassignmenttype, $strduedate, $strsubmitted, $strgrade);
43 $table->align
= array ("center", "left", "left", "left", "right");
45 $table->head
= array ($strname, $strassignmenttype, $strduedate, $strsubmitted, $strgrade);
46 $table->align
= array ("left", "left", "left", "right");
51 $types = assignment_types();
53 foreach ($assignments as $assignment) {
55 if (!file_exists($CFG->dirroot
.'/mod/assignment/type/'.$assignment->assignmenttype
.'/assignment.class.php')) {
59 require_once ($CFG->dirroot
.'/mod/assignment/type/'.$assignment->assignmenttype
.'/assignment.class.php');
60 $assignmentclass = 'assignment_'.$assignment->assignmenttype
;
61 $assignmentinstance = new $assignmentclass($assignment->coursemodule
);
63 $submitted = $assignmentinstance->submittedlink();
66 if ($submission = $assignmentinstance->get_submission($USER->id
)) {
67 if ($submission->timemarked
) {
68 $grade = $assignmentinstance->display_grade($submission->grade
);
72 $type = $types[$assignment->assignmenttype
];
74 $due = $assignment->timedue ?
userdate($assignment->timedue
) : '-';
75 if (!$assignment->visible
) {
76 //Show dimmed if the mod is hidden
77 $link = "<a class=\"dimmed\" href=\"view.php?id=$assignment->coursemodule\">".format_string($assignment->name
,true)."</a>";
79 //Show normal if the mod is visible
80 $link = "<a href=\"view.php?id=$assignment->coursemodule\">".format_string($assignment->name
,true)."</a>";
84 if ($assignment->section
!== $currentsection) {
85 if ($assignment->section
) {
86 $printsection = $assignment->section
;
88 if ($currentsection !== "") {
89 $table->data
[] = 'hr';
91 $currentsection = $assignment->section
;
94 if ($course->format
== "weeks" or $course->format
== "topics") {
95 $table->data
[] = array ($printsection, $link, $type, $due, $submitted, $grade);
97 $table->data
[] = array ($link, $type, $due, $submitted, $grade);
105 print_footer($course);