3 require_once("../../config.php");
5 require_variable($id); // course
7 if (! $course = get_record("course", "id", $id)) {
8 error("Course ID is incorrect");
11 if ($course->category
) {
12 require_login($course->id
);
13 $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
16 add_to_log($course->id
, "resource", "view all", "index.php?id=$course->id", "");
18 $strresource = get_string("modulename", "resource");
19 $strresources = get_string("modulenameplural", "resource");
20 $strweek = get_string("week");
21 $strtopic = get_string("topic");
22 $strname = get_string("name");
23 $strsummary = get_string("summary");
24 $strlastmodified = get_string("lastmodified");
26 print_header("$course->shortname: $strresources", "$course->fullname", "$navigation $strresources",
27 "", "", true, "", navmenu($course));
29 if (! $resources = get_all_instances_in_course("resource", $course)) {
30 notice("There are no resources", "../../course/view.php?id=$course->id");
34 if ($course->format
== "weeks") {
35 $table->head
= array ($strweek, $strname, $strsummary);
36 $table->align
= array ("CENTER", "LEFT", "LEFT");
37 } else if ($course->format
== "topics") {
38 $table->head
= array ($strtopic, $strname, $strsummary);
39 $table->align
= array ("CENTER", "LEFT", "LEFT");
41 $table->head
= array ($strlastmodified, $strname, $strsummary);
42 $table->align
= array ("LEFT", "LEFT", "LEFT");
46 foreach ($resources as $resource) {
47 if ($course->format
== "weeks" or $course->format
== "topics") {
49 if ($resource->section
!== $currentsection) {
50 if ($resource->section
) {
51 $printsection = $resource->section
;
53 if ($currentsection !== "") {
54 $table->data
[] = 'hr';
56 $currentsection = $resource->section
;
59 $printsection = '<span class="smallinfo">'.userdate($resource->timemodified
)."</span>";
61 if (!empty($resource->extra
)) {
62 $extra = urldecode($resource->extra
);
66 if (!$resource->visible
) { // Show dimmed if the mod is hidden
67 $table->data
[] = array ($printsection,
68 "<a class=\"dimmed\" $extra href=\"view.php?id=$resource->coursemodule\">$resource->name</a>",
69 text_to_html($resource->summary
) );
71 } else { //Show normal if the mod is visible
72 $table->data
[] = array ($printsection,
73 "<a $extra href=\"view.php?id=$resource->coursemodule\">$resource->name</a>",
74 text_to_html($resource->summary
) );
82 print_footer($course);