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");
27 $crumbs[] = array('name' => $strwikis, 'link' => "index.php?id=$course->id", 'type' => 'activity');
28 $navigation = build_navigation($crumbs);
30 print_header_simple("$strwikis", "", $navigation, "", "", true, "", navmenu($course));
32 /// Get all the appropriate data
34 if (! $wikis = get_all_instances_in_course("wiki", $course)) {
35 notice("There are no wikis", "../../course/view.php?id=$course->id");
39 /// Print the list of instances (your module will probably extend this)
42 $strname = get_string('wikiname', 'wiki');
43 $strsummary = get_string('summary');
44 $strtype = get_string('wikitype', 'wiki');
45 $strlastmodified = get_string('lastmodified');
46 $strweek = get_string('week');
47 $strtopic = get_string('topic');
49 if ($course->format
== "weeks") {
50 $table->head
= array ($strweek, $strname, $strsummary, $strtype, $strlastmodified);
51 $table->align
= array ('CENTER', 'LEFT', 'LEFT', 'LEFT', 'LEFT');
52 } else if ($course->format
== "topics") {
53 $table->head
= array ($strtopic, $strname, $strsummary, $strtype, $strlastmodified);
54 $table->align
= array ('CENTER', 'LEFT', 'LEFT', 'LEFT', 'LEFT');
56 $table->head
= array ($strname, $strsummary, $strtype, $strlastmodified);
57 $table->align
= array ('LEFT', 'LEFT', 'LEFT', 'LEFT');
60 foreach ($wikis as $wiki) {
61 if (!$wiki->visible
) {
62 //Show dimmed if the mod is hidden
63 $link = '<a class="dimmed" href="view.php?id='.$wiki->coursemodule
.'">'.format_string($wiki->name
,true).'</a>';
65 //Show normal if the mod is visible
66 $link = '<a href="view.php?id='.$wiki->coursemodule
.'">'.format_string($wiki->name
,true).'</a>';
69 $timmod = '<span class="smallinfo">'.userdate($wiki->timemodified
).'</span>';
70 $summary = '<span class="smallinfo">'.format_text($wiki->summary
).'</span>';
73 switch ($wiki->wtype
) {
76 $wtype = $site->teacher
;
80 $wtype = $site->student
;
85 $wtype = get_string('group');
89 $wtype = '<span class="smallinfo">'.$wtype.'</span>';
91 if ($course->format
== "weeks" or $course->format
== "topics") {
92 $table->data
[] = array ($wiki->section
, $link, $summary, $wtype, $timmod);
94 $table->data
[] = array ($link, $summary, $wtype, $timmod);
104 print_footer($course);