3 require_once("../../config.php");
4 require_once("lib.php");
6 require_variable($id); // course
8 if (! $course = get_record("course", "id", $id)) {
9 error("Course ID is incorrect");
12 require_login($course->id
);
13 add_to_log($course->id
, "assignment", "view all", "index.php?id=$course->id", "");
15 if ($course->category
) {
16 $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
19 $strassignments = get_string("modulenameplural", "assignment");
20 $strassignment = get_string("modulename", "assignment");
21 $strweek = get_string("week");
22 $strtopic = get_string("topic");
23 $strname = get_string("name");
24 $strduedate = get_string("duedate", "assignment");
25 $strsubmitted = get_string("submitted", "assignment");
28 print_header("$course->shortname: $strassignments", "$course->fullname", "$navigation $strassignments", "", "", true, "", navmenu($course));
30 if (! $assignments = get_all_instances_in_course("assignment", $course)) {
31 notice("There are no assignments", "../../course/view.php?id=$course->id");
37 if ($course->format
== "weeks") {
38 $table->head
= array ($strweek, $strname, $strduedate, $strsubmitted);
39 $table->align
= array ("center", "left", "left", "left");
40 } else if ($course->format
== "topics") {
41 $table->head
= array ($strtopic, $strname, $strduedate, $strsubmitted);
42 $table->align
= array ("center", "left", "left", "left");
44 $table->head
= array ($strname, $strduedate, $strsubmitted);
45 $table->align
= array ("left", "left", "left");
48 $currentgroup = get_current_group($course->id
);
49 if ($currentgroup and isteacheredit($course->id
)) {
50 $group = get_record("groups", "id", $currentgroup);
51 $groupname = " ($group->name)";
58 foreach ($assignments as $assignment) {
59 if (isteacher($course->id
)) {
60 if ($assignment->type
== OFFLINE
) {
61 $submitted = "<a href=\"submissions.php?id=$assignment->id\">" .
62 get_string("viewfeedback", "assignment") . "</a>";
64 $count = assignment_count_real_submissions($assignment, $currentgroup);
65 $submitted = "<a href=\"submissions.php?id=$assignment->id\">" .
66 get_string("viewsubmissions", "assignment", $count) . "</a>$groupname";
69 if ($submission = assignment_get_submission($assignment, $USER)) {
70 if ($submission->timemodified
<= $assignment->timedue
) {
71 $submitted = userdate($submission->timemodified
);
73 $submitted = "<font color=red>".userdate($submission->timemodified
)."</font>";
76 $submitted = get_string("no");
80 $due = userdate($assignment->timedue
);
81 if (!$assignment->visible
) {
82 //Show dimmed if the mod is hidden
83 $link = "<a class=\"dimmed\" href=\"view.php?id=$assignment->coursemodule\">$assignment->name</a>";
85 //Show normal if the mod is visible
86 $link = "<a href=\"view.php?id=$assignment->coursemodule\">$assignment->name</a>";
90 if ($assignment->section
!== $currentsection) {
91 if ($assignment->section
) {
92 $printsection = $assignment->section
;
94 if ($currentsection !== "") {
95 $table->data
[] = 'hr';
97 $currentsection = $assignment->section
;
100 if ($course->format
== "weeks" or $course->format
== "topics") {
101 $table->data
[] = array ($printsection, $link, $due, $submitted);
103 $table->data
[] = array ($link, $due, $submitted);
111 print_footer($course);