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 require_variable($id); // 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 print_header_simple("$strwikis", "", "$strwikis", "", "", true, "", navmenu($course));
30 /// Get all the appropriate data
32 if (! $wikis = get_all_instances_in_course("wiki", $course)) {
33 notice("There are no wikis", "../../course/view.php?id=$course->id");
37 /// Print the list of instances (your module will probably extend this)
40 $strname = get_string('wikiname', 'wiki');
41 $strsummary = get_string('summary');
42 $strtype = get_string('wikitype', 'wiki');
43 $strlastmodified = get_string('lastmodified');
44 $strweek = get_string('week');
45 $strtopic = get_string('topic');
47 if ($course->format
== "weeks") {
48 $table->head
= array ($strweek, $strname, $strsummary, $strtype, $strlastmodified);
49 $table->align
= array ('CENTER', 'LEFT', 'LEFT', 'LEFT', 'LEFT');
50 } else if ($course->format
== "topics") {
51 $table->head
= array ($strtopic, $strname, $strsummary, $strtype, $strlastmodified);
52 $table->align
= array ('CENTER', 'LEFT', 'LEFT', 'LEFT', 'LEFT');
54 $table->head
= array ($strname, $strsummary, $strtype, $strlastmodified);
55 $table->align
= array ('LEFT', 'LEFT', 'LEFT', 'LEFT');
58 foreach ($wikis as $wiki) {
59 if (!$wiki->visible
) {
60 //Show dimmed if the mod is hidden
61 $link = '<A class="dimmed" HREF="view.php?id='.$wiki->coursemodule
.'">'.format_string($wiki->name
,true).'</A>';
63 //Show normal if the mod is visible
64 $link = '<A HREF="view.php?id='.$wiki->coursemodule
.'">'.format_string($wiki->name
,true).'</A>';
67 $timmod = '<span class="smallinfo">'.userdate($wiki->timemodified
).'</span>';
68 $summary = '<span class="smallinfo">'.format_text($wiki->summary
).'</span>';
71 switch ($wiki->wtype
) {
74 $wtype = $site->teacher
;
78 $wtype = $site->student
;
83 $wtype = get_string('group');
87 $wtype = '<span class="smallinfo">'.$wtype.'</span>';
89 if ($course->format
== "weeks" or $course->format
== "topics") {
90 $table->data
[] = array ($wiki->section
, $link, $summary, $wtype, $timmod);
92 $table->data
[] = array ($link, $summary, $wtype, $timmod);
102 print_footer($course);