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");
25 $crumbs[] = array('name' => $strassignments, 'link' => '', 'type' => 'activity');
26 $navigation = build_navigation($crumbs);
28 print_header_simple($strassignments, "", $navigation, "", "", true, "", navmenu($course));
30 if (! $assignments = get_all_instances_in_course("assignment", $course)) {
31 notice(get_string('noassignments', 'assignment'), "../../course/view.php?id=$course->id");
37 if ($course->format
== "weeks") {
38 $table->head
= array ($strweek, $strname, $strassignmenttype, $strduedate, $strsubmitted, $strgrade);
39 $table->align
= array ("center", "left", "left", "left", "right");
40 } else if ($course->format
== "topics") {
41 $table->head
= array ($strtopic, $strname, $strassignmenttype, $strduedate, $strsubmitted, $strgrade);
42 $table->align
= array ("center", "left", "left", "left", "right");
44 $table->head
= array ($strname, $strassignmenttype, $strduedate, $strsubmitted, $strgrade);
45 $table->align
= array ("left", "left", "left", "right");
48 $currentgroup = get_current_group($course->id
);
49 if ($currentgroup and has_capability('moodle/site:accessallgroups', get_context_instance(CONTEXT_COURSE
, $id))) {
50 $group = groups_get_group($currentgroup, false);
51 $groupname = " ($group->name)";
58 $types = assignment_types();
60 foreach ($assignments as $assignment) {
62 if (!file_exists($CFG->dirroot
.'/mod/assignment/type/'.$assignment->assignmenttype
.'/assignment.class.php')) {
66 require_once ($CFG->dirroot
.'/mod/assignment/type/'.$assignment->assignmenttype
.'/assignment.class.php');
67 $assignmentclass = 'assignment_'.$assignment->assignmenttype
;
68 $assignmentinstance = new $assignmentclass($assignment->coursemodule
);
70 $submitted = $assignmentinstance->submittedlink();
73 if ($submission = $assignmentinstance->get_submission($USER->id
)) {
74 if ($submission->timemarked
) {
75 $grade = $assignmentinstance->display_grade($submission->grade
);
79 $type = $types[$assignment->assignmenttype
];
81 $due = $assignment->timedue ?
userdate($assignment->timedue
) : '-';
82 if (!$assignment->visible
) {
83 //Show dimmed if the mod is hidden
84 $link = "<a class=\"dimmed\" href=\"view.php?id=$assignment->coursemodule\">".format_string($assignment->name
,true)."</a>";
86 //Show normal if the mod is visible
87 $link = "<a href=\"view.php?id=$assignment->coursemodule\">".format_string($assignment->name
,true)."</a>";
91 if ($assignment->section
!== $currentsection) {
92 if ($assignment->section
) {
93 $printsection = $assignment->section
;
95 if ($currentsection !== "") {
96 $table->data
[] = 'hr';
98 $currentsection = $assignment->section
;
101 if ($course->format
== "weeks" or $course->format
== "topics") {
102 $table->data
[] = array ($printsection, $link, $type, $due, $submitted, $grade);
104 $table->data
[] = array ($link, $type, $due, $submitted, $grade);
112 print_footer($course);