Added navmenu in more places
authormoodler <moodler>
Sun, 10 Nov 2002 08:43:44 +0000 (08:43 +0000)
committermoodler <moodler>
Sun, 10 Nov 2002 08:43:44 +0000 (08:43 +0000)
lib/moodlelib.php
mod/assignment/index.php
mod/choice/index.php
mod/forum/discuss.php
mod/forum/index.php
mod/forum/post.php
mod/journal/index.php
mod/quiz/index.php
mod/resource/index.php
mod/survey/index.php

index bfac149..b51b12d 100644 (file)
@@ -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
 // 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;
 
 
     global $CFG;
 
+    if ($cm) {
+       $cm = $cm->id;
+    }
+
     if ($course->format == 'weeks') {
         $strsection = get_string("week");
     } else {
     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";
         }
         $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);
             $selected = $url;
         }
         $mod->name = urldecode($mod->name);
index 3d74c6a..f26140b 100644 (file)
@@ -25,7 +25,7 @@
     $strsubmitted = get_string("submitted", "assignment");
 
 
     $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");
 
     if (! $assignments = get_all_instances_in_course("assignment", $course->id, "cw.section ASC")) {
         notice("There are no assignments", "../../course/view.php?id=$course->id");
index d7c8038..20cc0aa 100644 (file)
@@ -21,7 +21,7 @@
     $strchoices = get_string("modulenameplural", "choice");
 
     print_header("$course->shortname: $strchoices", "$course->fullname",
     $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")) {
 
 
     if (! $choices = get_all_instances_in_course("choice", $course->id, "cw.section ASC")) {
index 109000a..ed619bc 100644 (file)
         notify("Bad forum ID stored in this discussion");
     }
 
         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) {
         require_login($course->id);
     }
@@ -57,7 +61,7 @@
     if ($course->category) {
         print_header("$course->shortname: $discussion->name", "$course->fullname",
                  "<A HREF=../../course/view.php?id=$course->id>$course->shortname</A> ->
     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);
     } else {
         print_header("$course->shortname: $discussion->name", "$course->fullname",
                  "$navmiddle -> $navtail", "", "", true);
index b1ed188..cdff434 100644 (file)
@@ -28,7 +28,8 @@
 
     if ($course->category) {
         print_header("$course->shortname: $strforums", "$course->fullname",
 
     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");
     }
     } else {
         print_header("$course->shortname: $strforums", "$course->fullname", "$strforums");
     }
index b8b584f..225c46c 100644 (file)
 
     require_login($course->id);
 
 
     require_login($course->id);
 
+
     if ($post->discussion) {
         if (! $toppost = get_record_sql("SELECT * FROM forum_posts 
                                          WHERE discussion='$post->discussion' 
     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>";
 
 
     $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> ->
     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", "");
     } else {
         print_header("$course->shortname: $discussion->name: $toppost->subject", "$course->fullname",
                  "$navmiddle -> $navtail", "");
index 25aec9c..1cad288 100644 (file)
@@ -25,7 +25,8 @@
     $strquestion = get_string("question");
     $stranswer = get_string("answer");
 
     $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")) {
 
 
     if (! $journals = get_all_instances_in_course("journal", $course->id, "cw.section ASC")) {
index 1c9dc70..ca538b8 100644 (file)
@@ -25,7 +25,8 @@
         $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
     }
 
         $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
 
 
 // Get all the appropriate data
 
index dd7476b..0002f39 100644 (file)
@@ -23,7 +23,8 @@
     $strsummary = get_string("summary");
     $strlastmodified = get_string("lastmodified");
 
     $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";
 
     if ($course->format == "weeks" or $course->format == "topics") {
         $sortorder = "cw.section ASC";
index 9aca87a..a9f6d78 100644 (file)
@@ -25,7 +25,8 @@
     $strdone  = get_string("done", "survey");
     $strnotdone  = get_string("notdone", "survey");
 
     $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");
 
     if (! $surveys = get_all_instances_in_course("survey", $course->id, "cw.section ASC")) {
         notice("There are no surveys.", "../../course/view.php?id=$course->id");