3 /// This page lists all the instances of lams in a particular course
5 require_once("../../config.php");
6 require_once("lib.php");
8 $id = required_param('id', PARAM_INT
); // course
10 if (! $course = get_record("course", "id", $id)) {
11 error("Course ID is incorrect");
14 require_login($course->id
);
16 add_to_log($course->id
, "lams", "view all", "index.php?id=$course->id", "");
19 /// Get all required strings
21 $strlamss = get_string("modulenameplural", "lams");
22 $strlams = get_string("modulename", "lams");
28 $navlinks[] = array('name' => $strlamss, 'link' => '', 'type' => 'activity');
29 $navigation = build_navigation($navlinks);
31 print_header("$course->shortname: $strlamss", $course->fullname
, "$navigation $strlamss", "", "", true, "", navmenu($course));
33 /// Get all the appropriate data
35 if (! $lamss = get_all_instances_in_course("lams", $course)) {
36 notice(get_string('thereareno', 'moodle', $strlamss) , "../../course/view.php?id=$course->id");
40 /// Print the list of instances (your module will probably extend this)
43 $strname = get_string("name");
44 $strweek = get_string("week");
45 $strtopic = get_string("topic");
47 if ($course->format
== "weeks") {
48 $table->head
= array ($strweek, $strname);
49 $table->align
= array ('center', 'left');
50 } else if ($course->format
== "topics") {
51 $table->head
= array ($strtopic, $strname);
52 $table->align
= array ('center', 'left', 'left', 'left');
54 $table->head
= array ($strname);
55 $table->align
= array ('left', 'left', 'left');
58 foreach ($lamss as $lams) {
59 if (!$lams->visible
) {
60 //Show dimmed if the mod is hidden
61 $link = "<a class=\"dimmed\" href=\"view.php?id=$lams->coursemodule\">$lams->name</a>";
63 //Show normal if the mod is visible
64 $link = "<a href=\"view.php?id=$lams->coursemodule\">$lams->name</a>";
67 if ($course->format
== 'weeks' or $course->format
== 'topics') {
68 $table->data
[] = array ($lams->section
, $link);
70 $table->data
[] = array ($link);
80 print_footer($course);