From: moodler Date: Sun, 10 Nov 2002 08:43:44 +0000 (+0000) Subject: Added navmenu in more places X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=dfc9ba9bbe307bc0ea30dcdb17e8715df2f2b2fa;p=moodle.git Added navmenu in more places --- diff --git a/lib/moodlelib.php b/lib/moodlelib.php index bfac149260..b51b12d3f5 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -387,7 +387,7 @@ function update_module_button($moduleid, $courseid, $string) { } -function navmenu($course, $cm) { +function navmenu($course, $cm=NULL) { // Given a course and a (current) coursemodule // This function returns a small popup menu with all the // course activity modules in it, as a navigation menu @@ -396,6 +396,10 @@ function navmenu($course, $cm) { global $CFG; + if ($cm) { + $cm = $cm->id; + } + if ($course->format == 'weeks') { $strsection = get_string("week"); } else { @@ -413,7 +417,7 @@ function navmenu($course, $cm) { } $section = $mod->section; $url = "$mod->mod/view.php?id=$mod->cm"; - if ($cm->id == $mod->cm) { + if ($cm == $mod->cm) { $selected = $url; } $mod->name = urldecode($mod->name); diff --git a/mod/assignment/index.php b/mod/assignment/index.php index 3d74c6aafd..f26140b94c 100644 --- a/mod/assignment/index.php +++ b/mod/assignment/index.php @@ -25,7 +25,7 @@ $strsubmitted = get_string("submitted", "assignment"); - print_header("$course->shortname: $strassignments", "$course->fullname", "$navigation $strassignments", ""); + print_header("$course->shortname: $strassignments", "$course->fullname", "$navigation $strassignments", "", "", true, "", navmenu($course)); if (! $assignments = get_all_instances_in_course("assignment", $course->id, "cw.section ASC")) { notice("There are no assignments", "../../course/view.php?id=$course->id"); diff --git a/mod/choice/index.php b/mod/choice/index.php index d7c8038fec..20cc0aa3a1 100644 --- a/mod/choice/index.php +++ b/mod/choice/index.php @@ -21,7 +21,7 @@ $strchoices = get_string("modulenameplural", "choice"); print_header("$course->shortname: $strchoices", "$course->fullname", - "$navigation $strchoices", ""); + "$navigation $strchoices", "", "", true, "", navmenu($course)); if (! $choices = get_all_instances_in_course("choice", $course->id, "cw.section ASC")) { diff --git a/mod/forum/discuss.php b/mod/forum/discuss.php index 109000a7da..ed619bcd11 100644 --- a/mod/forum/discuss.php +++ b/mod/forum/discuss.php @@ -22,6 +22,10 @@ notify("Bad forum ID stored in this discussion"); } + if (!$cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) { + notify("Bad coursemodule for this discussion"); + } + if ($course->category) { require_login($course->id); } @@ -57,7 +61,7 @@ if ($course->category) { print_header("$course->shortname: $discussion->name", "$course->fullname", "id>$course->shortname -> - $navmiddle -> $navtail", "", "", true); + $navmiddle -> $navtail", "", "", true, "", navmenu($course, $cm)); } else { print_header("$course->shortname: $discussion->name", "$course->fullname", "$navmiddle -> $navtail", "", "", true); diff --git a/mod/forum/index.php b/mod/forum/index.php index b1ed1889be..cdff4345f8 100644 --- a/mod/forum/index.php +++ b/mod/forum/index.php @@ -28,7 +28,8 @@ if ($course->category) { print_header("$course->shortname: $strforums", "$course->fullname", - "id>$course->shortname -> $strforums"); + "id>$course->shortname -> $strforums", + "", "", true, "", navmenu($course)); } else { print_header("$course->shortname: $strforums", "$course->fullname", "$strforums"); } diff --git a/mod/forum/post.php b/mod/forum/post.php index b8b584f8c2..225c46cbf6 100644 --- a/mod/forum/post.php +++ b/mod/forum/post.php @@ -250,6 +250,7 @@ require_login($course->id); + if ($post->discussion) { if (! $toppost = get_record_sql("SELECT * FROM forum_posts WHERE discussion='$post->discussion' @@ -277,10 +278,12 @@ $navmiddle = "id\">$strforums -> id\">$forum->name"; + $cm = get_coursemodule_from_instance("forum", $forum->id, $course->id); + if ($course->category) { print_header("$course->shortname: $discussion->name: $toppost->subject", "$course->fullname", "id>$course->shortname -> - $navmiddle -> $navtail", "$forumstart"); + $navmiddle -> $navtail", "$forumstart", "", true, "", navmenu($course, $cm)); } else { print_header("$course->shortname: $discussion->name: $toppost->subject", "$course->fullname", "$navmiddle -> $navtail", ""); diff --git a/mod/journal/index.php b/mod/journal/index.php index 25aec9c313..1cad28876d 100644 --- a/mod/journal/index.php +++ b/mod/journal/index.php @@ -25,7 +25,8 @@ $strquestion = get_string("question"); $stranswer = get_string("answer"); - print_header("$course->shortname: $strjournals", "$course->fullname", "$navigation $strjournals", ""); + print_header("$course->shortname: $strjournals", "$course->fullname", "$navigation $strjournals", + "", "", true, "", navmenu($course)); if (! $journals = get_all_instances_in_course("journal", $course->id, "cw.section ASC")) { diff --git a/mod/quiz/index.php b/mod/quiz/index.php index 1c9dc705f1..ca538b8465 100644 --- a/mod/quiz/index.php +++ b/mod/quiz/index.php @@ -25,7 +25,8 @@ $navigation = "id\">$course->shortname ->"; } - print_header("$course->shortname: $strquizzes", "$course->fullname", "$navigation $strquizzes"); + print_header("$course->shortname: $strquizzes", "$course->fullname", "$navigation $strquizzes", + "", "", true, "", navmenu($course)); // Get all the appropriate data diff --git a/mod/resource/index.php b/mod/resource/index.php index dd7476bf6b..0002f398e2 100644 --- a/mod/resource/index.php +++ b/mod/resource/index.php @@ -23,7 +23,8 @@ $strsummary = get_string("summary"); $strlastmodified = get_string("lastmodified"); - print_header("$course->shortname: $strresources", "$course->fullname", "$navigation $strresources"); + print_header("$course->shortname: $strresources", "$course->fullname", "$navigation $strresources", + "", "", true, "", navmenu($course)); if ($course->format == "weeks" or $course->format == "topics") { $sortorder = "cw.section ASC"; diff --git a/mod/survey/index.php b/mod/survey/index.php index 9aca87a110..a9f6d783f2 100644 --- a/mod/survey/index.php +++ b/mod/survey/index.php @@ -25,7 +25,8 @@ $strdone = get_string("done", "survey"); $strnotdone = get_string("notdone", "survey"); - print_header("$course->shortname: $strsurveys", "$course->fullname", "$navigation $strsurveys", ""); + print_header("$course->shortname: $strsurveys", "$course->fullname", "$navigation $strsurveys", + "", "", true, "", navmenu($course)); if (! $surveys = get_all_instances_in_course("survey", $course->id, "cw.section ASC")) { notice("There are no surveys.", "../../course/view.php?id=$course->id");