3 /// This page lists all the instances of wiki in a particular course
4 /// Replace wiki with the name of your module
6 require_once("../../config.php");
7 require_once("lib.php");
9 $id = required_param('id', PARAM_INT
); // course
11 if (! $course = get_record("course", "id", $id)) {
12 error("Course ID is incorrect");
15 require_course_login($course);
17 add_to_log($course->id
, "wiki", "view all", "index.php?id=$course->id", "");
20 /// Get all required strings
22 $strwikis = get_string("modulenameplural", "wiki");
23 $strwiki = get_string("modulename", "wiki");
28 $navlinks[] = array('name' => $strwikis, 'link' => "index.php?id=$course->id", 'type' => 'activity');
29 $navigation = build_navigation($navlinks);
31 print_header_simple("$strwikis", "", $navigation, "", "", true, "", navmenu($course));
33 /// Get all the appropriate data
35 if (! $wikis = get_all_instances_in_course("wiki", $course)) {
36 notice("There are no wikis", "../../course/view.php?id=$course->id");
40 /// Print the list of instances (your module will probably extend this)
43 $strname = get_string('wikiname', 'wiki');
44 $strsummary = get_string('summary');
45 $strtype = get_string('wikitype', 'wiki');
46 $strlastmodified = get_string('lastmodified');
47 $strweek = get_string('week');
48 $strtopic = get_string('topic');
50 if ($course->format
== "weeks") {
51 $table->head
= array ($strweek, $strname, $strsummary, $strtype, $strlastmodified);
52 $table->align
= array ('CENTER', 'LEFT', 'LEFT', 'LEFT', 'LEFT');
53 } else if ($course->format
== "topics") {
54 $table->head
= array ($strtopic, $strname, $strsummary, $strtype, $strlastmodified);
55 $table->align
= array ('CENTER', 'LEFT', 'LEFT', 'LEFT', 'LEFT');
57 $table->head
= array ($strname, $strsummary, $strtype, $strlastmodified);
58 $table->align
= array ('LEFT', 'LEFT', 'LEFT', 'LEFT');
61 foreach ($wikis as $wiki) {
62 if (!$wiki->visible
) {
63 //Show dimmed if the mod is hidden
64 $link = '<a class="dimmed" href="view.php?id='.$wiki->coursemodule
.'">'.format_string($wiki->name
,true).'</a>';
66 //Show normal if the mod is visible
67 $link = '<a href="view.php?id='.$wiki->coursemodule
.'">'.format_string($wiki->name
,true).'</a>';
70 $timmod = '<span class="smallinfo">'.userdate($wiki->timemodified
).'</span>';
71 $summary = '<span class="smallinfo">'.format_text($wiki->summary
).'</span>';
74 switch ($wiki->wtype
) {
77 $wtype = $site->teacher
;
81 $wtype = $site->student
;
86 $wtype = get_string('group');
90 $wtype = '<span class="smallinfo">'.$wtype.'</span>';
92 if ($course->format
== "weeks" or $course->format
== "topics") {
93 $table->data
[] = array ($wiki->section
, $link, $summary, $wtype, $timmod);
95 $table->data
[] = array ($link, $summary, $wtype, $timmod);
105 print_footer($course);