}
-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
global $CFG;
+ if ($cm) {
+ $cm = $cm->id;
+ }
+
if ($course->format == 'weeks') {
$strsection = get_string("week");
} else {
}
$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);
$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");
$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")) {
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);
}
if ($course->category) {
print_header("$course->shortname: $discussion->name", "$course->fullname",
"<A HREF=../../course/view.php?id=$course->id>$course->shortname</A> ->
- $navmiddle -> $navtail", "", "", true);
+ $navmiddle -> $navtail", "", "", true, "", navmenu($course, $cm));
} else {
print_header("$course->shortname: $discussion->name", "$course->fullname",
"$navmiddle -> $navtail", "", "", true);
if ($course->category) {
print_header("$course->shortname: $strforums", "$course->fullname",
- "<A HREF=../../course/view.php?id=$course->id>$course->shortname</A> -> $strforums");
+ "<A HREF=../../course/view.php?id=$course->id>$course->shortname</A> -> $strforums",
+ "", "", true, "", navmenu($course));
} else {
print_header("$course->shortname: $strforums", "$course->fullname", "$strforums");
}
require_login($course->id);
+
if ($post->discussion) {
if (! $toppost = get_record_sql("SELECT * FROM forum_posts
WHERE discussion='$post->discussion'
$navmiddle = "<A HREF=\"../forum/index.php?id=$course->id\">$strforums</A> -> <A HREF=\"view.php?f=$forum->id\">$forum->name</A>";
+ $cm = get_coursemodule_from_instance("forum", $forum->id, $course->id);
+
if ($course->category) {
print_header("$course->shortname: $discussion->name: $toppost->subject", "$course->fullname",
"<A HREF=../../course/view.php?id=$course->id>$course->shortname</A> ->
- $navmiddle -> $navtail", "$forumstart");
+ $navmiddle -> $navtail", "$forumstart", "", true, "", navmenu($course, $cm));
} else {
print_header("$course->shortname: $discussion->name: $toppost->subject", "$course->fullname",
"$navmiddle -> $navtail", "");
$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")) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
- 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
$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";
$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");