From: tjhunt Date: Fri, 12 Oct 2007 15:55:49 +0000 (+0000) Subject: MDL-11741 - Convert core modules to take advantage of recent improvements to build_na... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=38e179a4edaae58506404bd310dee151fd0424e7;p=moodle.git MDL-11741 - Convert core modules to take advantage of recent improvements to build_navigation. This check-in removes about 400 lines of code. I hope I have not screwed anything up. I would be grateful if people could review this change, and keep an eye on the navigation bar in modules. Any navigation bar bugs you find in the near future, feel free to file them in the tracker and assign them to me. Thanks. If not to many problems are found, I think I would like to backport this to 1.9 stable, but I am not sure that is a good idea. Opinions to the General Developer Forum please. I am about to start a thread there. --- diff --git a/lang/en_utf8/quiz.php b/lang/en_utf8/quiz.php index 85a7159226..690ad9aaa5 100644 --- a/lang/en_utf8/quiz.php +++ b/lang/en_utf8/quiz.php @@ -486,7 +486,8 @@ $string['reviewbefore'] = 'Allow review while quiz is open'; $string['reviewclosed'] = 'After the quiz is closed'; $string['reviewimmediately'] = 'Immediately after the attempt'; $string['reviewnever'] = 'Never allow review'; -$string['reviewofattempt'] = 'Review of Attempt $a'; +$string['reviewofattempt'] = 'Review of attempt $a'; +$string['reviewofpreview'] = 'Review of preview'; $string['reviewopen'] = 'Later, while the quiz is still open'; $string['reviewoptions'] = 'Students may review'; $string['reviewoptionsheading'] = 'Review options'; diff --git a/lib/pagelib.php b/lib/pagelib.php index 5dc5a4d544..c1c5d43230 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -648,14 +648,6 @@ class page_generic_activity extends page_base { $title = str_replace($search, $replace, $title); } - $navlinks = array(); - $navlinks[] = array('name' => get_string('modulenameplural', $this->activityname), 'link' => $CFG->wwwroot."/mod/{$this->activityname}/index.php?id={$this->courserecord->id}", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($this->activityrecord->name), 'link' => $CFG->wwwroot."/mod/{$this->activityname}/view.php?id={$this->modulerecord->id}", 'type' => 'activityinstance'); - - if (!empty($morenavlinks)) { - $navlinks = array_merge($navlinks, $morenavlinks); - } - if (empty($morenavlinks) && $this->user_allowed_editing()) { $buttons = ''; if (!empty($CFG->showblocksonmodpages)) { @@ -669,8 +661,10 @@ class page_generic_activity extends page_base { $buttons = ' '; } - $navigation = build_navigation($navlinks); - + if (empty($morenavlinks)) { + $morenavlinks = array(); + } + $navigation = build_navigation($morenavlinks, $this->modulerecord); print_header($title, $this->courserecord->fullname, $navigation, '', $meta, true, $buttons, navmenu($this->courserecord, $this->modulerecord), false, $bodytags); } diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index 99298c0478..3daa3b325c 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -27,7 +27,6 @@ class assignment_base { var $strassignments; var $strsubmissions; var $strlastmodified; - var $navigation; var $pagetitle; var $currentgroup; var $usehtmleditor; @@ -82,19 +81,15 @@ class assignment_base { $this->strassignments = get_string('modulenameplural', 'assignment'); $this->strsubmissions = get_string('submissions', 'assignment'); $this->strlastmodified = get_string('lastmodified'); - - $this->navigation[] = array('name' => $this->strassignments, 'link' => "index.php?id={$this->course->id}", 'type' => 'activity'); - $this->pagetitle = strip_tags($this->course->shortname.': '.$this->strassignment.': '.format_string($this->assignment->name,true)); // visibility $context = get_context_instance(CONTEXT_MODULE, $cmid); if (!$this->cm->visible and !has_capability('moodle/course:viewhiddenactivities', $context)) { $pagetitle = strip_tags($this->course->shortname.': '.$this->strassignment); - $this->navigation[] = array('name' => $this->strassignment, 'link' => '', 'type' => 'activityinstance'); - $navigation = build_navigation($this->navigation); + $navigation = build_navigation('', $this->cm); - print_header($pagetitle, $this->course->fullname, $this->navigation, + print_header($pagetitle, $this->course->fullname, $navigation, "", "", true, '', navmenu($this->course, $this->cm)); notice(get_string("activityiscurrentlyhidden"), "$CFG->wwwroot/course/view.php?id={$this->course->id}"); } @@ -148,14 +143,11 @@ class assignment_base { if ($subpage) { - $this->navigation[] = array('name' => format_string($this->assignment->name,true), 'link' => "view.php?id={$this->cm->id}", 'type' => 'activityinstance'); - $this->navigation[] = array('name' => $subpage, 'link' => '', 'type' => 'title'); + $navigation = build_navigation($subpage, $this->cm); } else { - $this->navigation[] = array('name' => format_string($this->assignment->name,true), 'link' => '', 'type' => 'activityinstance'); + $navigation = build_navigation('', $this->cm); } - $navigation = build_navigation($this->navigation); - print_header($this->pagetitle, $this->course->fullname, $navigation, '', '', true, update_module_button($this->cm->id, $this->course->id, $this->strassignment), navmenu($this->course, $this->cm)); @@ -1039,14 +1031,7 @@ class assignment_base { add_to_log($course->id, 'assignment', 'view submission', 'submissions.php?id='.$this->assignment->id, $this->assignment->id, $this->cm->id); - $navlinks = array(); - $navlinks[] = array('name' => $this->strassignments, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($this->assignment->name,true), - 'link' => "view.php?a={$this->assignment->id}", - 'type' => 'activityinstance'); - $navlinks[] = array('name' => $this->strsubmissions, 'link' => '', 'type' => 'title'); - $navigation = build_navigation($navlinks); - + $navigation = build_navigation($this->strsubmissions, $this->cm); print_header_simple(format_string($this->assignment->name,true), "", $navigation, '', '', true, update_module_button($cm->id, $course->id, $this->strassignment), navmenu($course, $cm)); diff --git a/mod/chat/report.php b/mod/chat/report.php index 17ca573b63..9aaef0ab81 100644 --- a/mod/chat/report.php +++ b/mod/chat/report.php @@ -39,13 +39,7 @@ /// Print a session if one has been specified if ($start and $end and !$confirmdelete) { // Show a full transcript - - $navlinks[] = array('name' => $strchats, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($chat->name,true), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance'); - $navlinks[] = array('name' => $strchatreport, 'link' => "report.php?id=$cm->id", 'type' => 'title'); - - $navigation = build_navigation($navlinks); - + $navigation = build_navigation($strchatreport, $cm); print_header_simple(format_string($chat->name).": $strchatreport", '', $navigation, '', '', true, '', navmenu($course, $cm)); @@ -95,12 +89,7 @@ /// Print the Sessions display - $navlinks[] = array('name' => $strchats, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($chat->name,true), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance'); - $navlinks[] = array('name' => $strchatreport, 'link' => '', 'type' => 'title'); - - $navigation = build_navigation($navlinks); - + $navigation = build_navigation($strchatreport, $cm); print_header_simple(format_string($chat->name).": $strchatreport", '', $navigation, '', '', true, '', navmenu($course, $cm)); diff --git a/mod/choice/report.php b/mod/choice/report.php index d782383219..842ff43fd0 100644 --- a/mod/choice/report.php +++ b/mod/choice/report.php @@ -40,13 +40,7 @@ if (!$download) { - $navlinks = array(); - $navlinks[] = array('name' => $strchoices, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($choice->name), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance'); - $navlinks[] = array('name' => $strresponses, 'link' => '', 'type' => 'title'); - - $navigation = build_navigation($navlinks); - + $navigation = build_navigation($strresponses, $cm); print_header_simple(format_string($choice->name).": $strresponses", "", $navigation, "", '', true, update_module_button($cm->id, $course->id, $strchoice), navmenu($course, $cm)); /// Check to see if groups are being used in this choice diff --git a/mod/choice/view.php b/mod/choice/view.php index e36863470b..7c544b6d8d 100644 --- a/mod/choice/view.php +++ b/mod/choice/view.php @@ -58,12 +58,7 @@ if ($action == 'delchoice') { /// Display the choice and possibly results - $navlinks = array(); - $navlinks[] = array('name' => $strchoices, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($choice->name), 'link' => '', 'type' => 'activityinstance'); - - $navigation = build_navigation($navlinks); - + $navigation = build_navigation('', $cm); print_header_simple(format_string($choice->name), "", $navigation, "", "", true, update_module_button($cm->id, $course->id, $strchoice), navmenu($course, $cm)); diff --git a/mod/data/edit.php b/mod/data/edit.php index eb1e791876..58f7cc8c49 100755 --- a/mod/data/edit.php +++ b/mod/data/edit.php @@ -68,11 +68,7 @@ if (empty($cm->visible) and !has_capability('moodle/course:viewhiddenactivities', $context)) { $strdatabases = get_string("modulenameplural", "data"); - $navlinks = array(); - $navlinks[] = array('name' => $strdatabases, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($data->name), 'link' => '', 'type' => 'activityinstance'); - $navigation = build_navigation($navlinks); - + $navigation = build_navigation('', $cm); print_header_simple(format_string($data->name), "", $navigation, "", "", true, '', navmenu($course, $cm)); notice(get_string("activityiscurrentlyhidden")); } @@ -113,11 +109,7 @@ /// Print the page header $strdata = get_string('modulenameplural','data'); - $navlinks = array(); - $navlinks[] = array('name' => $strdata, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($data->name), 'link' => '', 'type' => 'activityinstance'); - $navigation = build_navigation($navlinks); - + $navigation = build_navigation('', $cm); print_header_simple($data->name, '', $navigation, '', $meta, true, update_module_button($cm->id, $course->id, get_string('modulename', 'data')), navmenu($course, $cm), '', ''); diff --git a/mod/data/field/latlong/kml.php b/mod/data/field/latlong/kml.php index e701f97b96..7af26312b5 100644 --- a/mod/data/field/latlong/kml.php +++ b/mod/data/field/latlong/kml.php @@ -57,11 +57,7 @@ require_course_login($course, true, $cm); /// If it's hidden then it's don't show anything. :) if (empty($cm->visible) and !has_capability('moodle/course:viewhiddenactivities',get_context_instance(CONTEXT_MODULE, $cm->id))) { - $navlinks = array(); - $navlinks[] = array('name' => $strdatabases, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($data->name), 'link' => '', 'type' => 'activityinstance'); - $navigation = build_navigation($navlinks); - + $navigation = build_navigation('', $cm); print_header_simple(format_string($data->name), "", $navigation, "", "", true, '', navmenu($course, $cm)); notice(get_string("activityiscurrentlyhidden")); diff --git a/mod/data/import.php b/mod/data/import.php index f0c78790ff..c3ac8c73e0 100755 --- a/mod/data/import.php +++ b/mod/data/import.php @@ -78,11 +78,7 @@ /// Print the page header $strdata = get_string('modulenameplural','data'); - $navlinks = array(); - $navlinks[] = array('name' => $strdata, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($data->name), 'link' => '', 'type' => 'activityinstance'); - $navigation = build_navigation($navlinks); - + $navigation = build_navigation('', $cm); print_header_simple($data->name, "", $navigation, "", "", true, "", navmenu($course)); print_heading(format_string($data->name)); diff --git a/mod/data/lib.php b/mod/data/lib.php index cc7543d4c4..854956047c 100755 --- a/mod/data/lib.php +++ b/mod/data/lib.php @@ -1680,14 +1680,7 @@ function data_print_header($course, $cm, $data, $currenttab='') { global $CFG, $displaynoticegood, $displaynoticebad; - $strdata = get_string('modulenameplural','data'); - - $navlinks = array(); - $navlinks[] = array('name' => $strdata, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => $data->name, 'link' => '', 'type' => 'activityinstance'); - - $navigation = build_navigation($navlinks); - + $navigation = build_navigation('', $cm); print_header_simple($data->name, '', $navigation, '', '', true, update_module_button($cm->id, $course->id, get_string('modulename', 'data')), navmenu($course, $cm)); diff --git a/mod/data/templates.php b/mod/data/templates.php index 2bd4ac48c6..4d40585412 100755 --- a/mod/data/templates.php +++ b/mod/data/templates.php @@ -94,11 +94,7 @@ $meta .= '//]]>'."\n"; $meta .= ''."\n"; - $navlinks = array(); - $navlinks[] = array('name' => $strdata, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($data->name), 'link' => '', 'type' => 'activityinstance'); - $navigation = build_navigation($navlinks); - + $navigation = build_navigation('', $cm); print_header_simple($data->name, '', $navigation, '', $meta, true, update_module_button($cm->id, $course->id, get_string('modulename', 'data')), navmenu($course, $cm), '', $bodytag); diff --git a/mod/data/view.php b/mod/data/view.php index e17e53b9ce..9e11581832 100755 --- a/mod/data/view.php +++ b/mod/data/view.php @@ -92,13 +92,7 @@ /// If it's hidden then it's don't show anything. :) if (empty($cm->visible) and !has_capability('mod/data:managetemplates', $context)) { - $strdatabases = get_string("modulenameplural", "data"); - - $navlinks = array(); - $navlinks[] = array('name' => $strdatabases, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($data->name), 'link' => '', 'type' => 'activityinstance'); - $navigation = build_navigation($navlinks); - + $navigation = build_navigation('', $cm); print_header_simple(format_string($data->name), "", $navigation, "", "", true, '', navmenu($course, $cm)); notice(get_string("activityiscurrentlyhidden")); diff --git a/mod/exercise/assessments.php b/mod/exercise/assessments.php index 20eea1c1ff..0e5d2f9b68 100644 --- a/mod/exercise/assessments.php +++ b/mod/exercise/assessments.php @@ -62,13 +62,7 @@ $strassessments = get_string("assessments", "exercise"); // ... print the header and... - $navlinks = array(); - $navlinks[] = array('name' => $strexercises, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($exercise->name), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance'); - $navlinks[] = array('name' => $strassessments, 'link' => '', 'type' => 'title'); - - $navigation = build_navigation($navlinks); - + $navigation = build_navigation($strassessments, $cm); print_header_simple(format_string($exercise->name), "", $navigation, "", "", true); diff --git a/mod/exercise/submissions.php b/mod/exercise/submissions.php index eb9430965d..68d5bb4d9b 100644 --- a/mod/exercise/submissions.php +++ b/mod/exercise/submissions.php @@ -50,12 +50,7 @@ $strsubmissions = get_string("submissions", "exercise"); // ... print the header and... - $navlinks = array(); - $navlinks[] = array('name' => $strexercises, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($exercise->name), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance'); - $navlinks[] = array('name' => $strsubmissions, 'link' => '', 'type' => 'title'); - - $navigation = build_navigation($navlinks); + $navigation = build_navigation($strsubmissions, $cm); print_header_simple(format_string($exercise->name), "", $navigation, "", "", true); diff --git a/mod/exercise/upload.php b/mod/exercise/upload.php index 375f125be8..8a6796c073 100644 --- a/mod/exercise/upload.php +++ b/mod/exercise/upload.php @@ -28,12 +28,7 @@ $strexercise = get_string("modulename", "exercise"); $strupload = get_string("upload"); - $navlinks = array(); - $navlinks[] = array('name' => $strexercises, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($exercise->name), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance'); - $navlinks[] = array('name' => $strupload, 'link' => '', 'type' => 'title'); - $navigation = build_navigation($navlinks); - + $navigation = build_navigation($strupload, $cm); print_header_simple(format_string($exercise->name)." : $strupload", "", $navigation, "", "", true); diff --git a/mod/exercise/view.php b/mod/exercise/view.php index 3cf1b12375..5ee7fc7add 100644 --- a/mod/exercise/view.php +++ b/mod/exercise/view.php @@ -47,10 +47,7 @@ $strexercise = get_string("modulename", "exercise"); // ...display header... - $navlinks = array(); - $navlinks[] = array('name' => $strexercises, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($exercise->name), 'link' => '', 'type' => 'activityinstance'); - $navigation = build_navigation($navlinks); + $navigation = build_navigation('', $cm); print_header_simple(format_string($exercise->name), "", $navigation, "", "", true, update_module_button($cm->id, $course->id, $strexercise), navmenu($course, $cm)); diff --git a/mod/forum/discuss.php b/mod/forum/discuss.php index abdbd9ae33..05a14d78c5 100644 --- a/mod/forum/discuss.php +++ b/mod/forum/discuss.php @@ -134,14 +134,12 @@ $searchform = forum_search_form($course); $navlinks = array(); - $navlinks[] = array('name' => get_string('forums', 'forum'), 'link' => "../forum/index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($forum->name,true), 'link' => "../forum/view.php?f=$forum->id", 'type' => 'activityinstance'); $navlinks[] = array('name' => format_string($discussion->name,true), 'link' => "discuss.php?d=$discussion->id", 'type' => 'title'); if ($parent != $discussion->firstpost) { $navlinks[] = array('name' => format_string($post->subject,true), 'type' => 'title'); } - $navigation = build_navigation($navlinks); + $navigation = build_navigation($navlinks, $cm); print_header("$course->shortname: ".format_string($discussion->name), $course->fullname, $navigation, "", "", true, $searchform, navmenu($course, $cm)); diff --git a/mod/forum/markposts.php b/mod/forum/markposts.php index 5b859fd9a9..aca13d4355 100644 --- a/mod/forum/markposts.php +++ b/mod/forum/markposts.php @@ -32,13 +32,7 @@ $wwwroot = str_replace('http:','https:', $wwwroot); } - $strforums = get_string('modulenameplural', 'forum'); - $navlinks = array(); - $navlinks[] = array('name' => $strforums, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($forum->name), 'link' => "view.php?f=$forum->id", 'type' => 'activityinstance'); - - $navigation = build_navigation($navlinks); - + $navigation = build_navigation('', $cm); print_header($course->shortname, $course->fullname, $navigation, '', '', true, "", navmenu($course, $cm)); notice_yesno(get_string('noguesttracking', 'forum').'

'.get_string('liketologin'), $wwwroot, $_SERVER['HTTP_REFERER']); diff --git a/mod/forum/post.php b/mod/forum/post.php index 4206de261a..70f3abc962 100644 --- a/mod/forum/post.php +++ b/mod/forum/post.php @@ -52,19 +52,11 @@ $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id); } - $strforums = get_string('modulenameplural', 'forum'); - if (!get_referer()) { // No referer - probably coming in via email See MDL-9052 require_login(); } - $navlinks = array(); - $navlinks[] = array('name' => get_string("forums", "forum"), 'link' => "../forum/view.php?f=$forum->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($forum->name,true), 'link' => '../forum/index.php?id=$course->id', 'type' => 'activityinstance'); - - $navigation = build_navigation($navlinks); - - + $navigation = build_navigation('', $cm); print_header($course->shortname, $course->fullname, $navigation, '' , '', true, "", navmenu($course, $cm)); notice_yesno(get_string('noguestpost', 'forum').'

'.get_string('liketologin'), @@ -410,16 +402,11 @@ } else { // User just asked to prune something $course = get_record('course', 'id', $forum->course); - $strforums = get_string("modulenameplural", "forum"); $navlinks = array(); - $navlinks[] = array('name' => $strforums, 'link' => "../forum/index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => $forum->name, 'link' => "view.php?f=$forum->id", 'type' => 'activityinstance'); $navlinks[] = array('name' => format_string($post->subject, true), 'link' => "discuss.php?d=$discussion->id", 'type' => 'title'); $navlinks[] = array('name' => get_string("prune", "forum"), 'link' => '', 'type' => 'title'); - - $navigation = build_navigation($navlinks); - + $navigation = build_navigation($navlinks, $cm); print_header_simple(format_string($discussion->name).": ".format_string($post->subject), "", $navigation, '', "", true, "", navmenu($course, $cm)); print_heading(get_string('pruneheading', 'forum')); @@ -635,24 +622,9 @@ get_string("addanewdiscussion", "forum"); } - $strforums = get_string("modulenameplural", "forum"); - - $navlinks = array(); - $navlinks[] = array('name' => $strforums, 'link' => "../forum/index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => $forum->name, 'link' => "view.php?f=$forum->id", 'type' => 'activityinstance'); - - - if ($post->parent) { - $navlinks[] = array('name' => format_string($toppost->subject, true), 'link' => "discuss.php?d=$discussion->id", 'type' => 'activityinstance'); - $navlinks[] = array('name' => get_string('editing', 'forum'), 'link' => '', 'type' => 'action'); - } else { - $navlinks[] = array('name' => format_string($toppost->subject), 'link' => '', 'type' => 'action'); - } - if (empty($post->edit)) { $post->edit = ''; } - if (empty($discussion->name)) { if (empty($discussion)) { @@ -665,7 +637,6 @@ // not show the discussion name (same as forum name in this case) in // the breadcrumbs. $strdiscussionname = ''; - $navtail = ''; } else { // Show the discussion name in the breadcrumbs. $strdiscussionname = format_string($discussion->name).':'; @@ -673,13 +644,18 @@ $forcefocus = empty($reply) ? NULL : 'message'; - - $navigation = build_navigation($navlinks); + $navlinks = array(); + if ($post->parent) { + $navlinks[] = array('name' => format_string($toppost->subject, true), 'link' => "discuss.php?d=$discussion->id", 'type' => 'title'); + $navlinks[] = array('name' => get_string('editing', 'forum'), 'link' => '', 'type' => 'title'); + } else { + $navlinks[] = array('name' => format_string($toppost->subject), 'link' => '', 'type' => 'title'); + } + $navigation = build_navigation($navlinks, $cm); print_header("$course->shortname: $strdiscussionname ". format_string($toppost->subject), $course->fullname, $navigation, $mform_post->focus($forcefocus), "", true, "", navmenu($course, $cm)); - // checkup if (!empty($parent) && !forum_user_can_see_post($forum, $discussion, $post)) { diff --git a/mod/forum/search.php b/mod/forum/search.php index 4c52187369..75e311a260 100644 --- a/mod/forum/search.php +++ b/mod/forum/search.php @@ -97,12 +97,11 @@ $strsearchresults = get_string("searchresults", "forum"); $strpage = get_string("page"); - $navlinks = array(); - $navlinks[] = array('name' => $strforums, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - if (!$search || $showform) { - $crumns[] = array('name' => $strsearch, 'link' => '', 'type' => 'title'); + $navlinks = array(); + $navlinks[] = array('name' => $strforums, 'link' => "index.php?id=$course->id", 'type' => 'activity'); + $navlinks[] = array('name' => $strsearch, 'link' => '', 'type' => 'title'); $navigation = build_navigation($navlinks); print_header_simple("$strsearch", "", $navigation, 'search.words', diff --git a/mod/forum/settracking.php b/mod/forum/settracking.php index 766ad927bf..92238d7301 100644 --- a/mod/forum/settracking.php +++ b/mod/forum/settracking.php @@ -30,13 +30,7 @@ $wwwroot = str_replace('http:','https:', $wwwroot); } - $strforums = get_string('modulenameplural', 'forum'); - $navlinks = array(); - $navlinks[] = array('name' => $strforums, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($forum->name), 'link' => "view.php?f=$forum->id", 'type' => 'activityinstance'); - - $navigation = build_navigation($navlinks); - + $navigation = build_navigation('', $cm); print_header($course->shortname, $course->fullname, $navigation, '', '', true, "", navmenu($course, $cm)); notice_yesno(get_string('noguesttracking', 'forum').'

'.get_string('liketologin'), $wwwroot, $_SERVER['HTTP_REFERER']); diff --git a/mod/forum/subscribe.php b/mod/forum/subscribe.php index 6baad93c68..5aad133e05 100644 --- a/mod/forum/subscribe.php +++ b/mod/forum/subscribe.php @@ -51,13 +51,7 @@ $wwwroot = str_replace('http:','https:', $wwwroot); } - $strforums = get_string('modulenameplural', 'forum'); - $navlinks = array(); - $navlinks[] = array('name' => $strforums, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($forum->name), 'link' => "view.php?f=$forum->id", 'type' => 'activityinstance'); - - $navigation = build_navigation($navlinks); - + $navigation = build_navigation('', $cm); print_header($course->shortname, $course->fullname, $navigation, '', '', true, "", navmenu($course, $cm)); notice_yesno(get_string('noguestsubscribe', 'forum').'

'.get_string('liketologin'), diff --git a/mod/forum/subscribers.php b/mod/forum/subscribers.php index 853d6a738c..3fa4f0a2ee 100644 --- a/mod/forum/subscribers.php +++ b/mod/forum/subscribers.php @@ -36,12 +36,7 @@ $strsubscribers = get_string("subscribers", "forum"); $strforums = get_string("forums", "forum"); - $navlinks = array(); - $navlinks[] = array('name' => $strforums, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($forum->name), 'link' => "view.php?f=$forum->id", 'type' => 'activityinstance'); - $navlinks[] = array('name' => $strsubscribers, 'link' => '', 'type' => 'title'); - - $navigation = build_navigation($navlinks); + $navigation = build_navigation($strsubscribers, $cm); if (has_capability('mod/forum:managesubscriptions', $context)) { print_header_simple("$strsubscribers", "", $navigation, diff --git a/mod/forum/view.php b/mod/forum/view.php index 6a6e624ec9..f9da7604ad 100644 --- a/mod/forum/view.php +++ b/mod/forum/view.php @@ -64,12 +64,7 @@ /// Print header. - $navlinks = array(); - $navlinks[] = array('name' => $strforums, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($forum->name), 'link' => "view.php?f=$forum->id", 'type' => 'activityinstance'); - - $navigation = build_navigation($navlinks); - + $navigation = build_navigation('', $cm); print_header_simple(format_string($forum->name), "", $navigation, "", "", true, $buttontext, navmenu($course, $cm)); diff --git a/mod/glossary/comment.php b/mod/glossary/comment.php index 3a0f76249c..c9c7e0592e 100644 --- a/mod/glossary/comment.php +++ b/mod/glossary/comment.php @@ -220,17 +220,13 @@ function glossary_comment_print_header($course, $cm, $glossary, $entry, $action) break; } - $strglossaries = get_string('modulenameplural', 'glossary'); $strglossary = get_string('modulename', 'glossary'); $strcomments = get_string('comments', 'glossary'); $navlinks = array(); - $navlinks[] = array('name' => $strglossaries, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($glossary->name,true), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance'); $navlinks[] = array('name' => $strcomments, 'link' => "comments.php?id=$cm->id&eid=$entry->id", 'type' => 'title'); $navlinks[] = array('name' => $straction, 'link' => '', 'type' => 'action'); - - $navigation = build_navigation($navlinks); + $navigation = build_navigation($navlinks, $cm); print_header_simple(format_string($glossary->name), '', $navigation, '', '', true, update_module_button($cm->id, $course->id, $strglossary), diff --git a/mod/glossary/comments.php b/mod/glossary/comments.php index 271d13eee4..cf13f26c1d 100644 --- a/mod/glossary/comments.php +++ b/mod/glossary/comments.php @@ -42,12 +42,7 @@ $strcomments = get_string("comments", "glossary"); $straddcomment = get_string("addcomment", "glossary"); - $navlinks = array(); - $navlinks[] = array('name' => $strglossaries, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($glossary->name,true), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance'); - $navlinks[] = array('name' => $strcomments, 'link' => '', 'type' => 'title'); - $navigation = build_navigation($navlinks); - + $navigation = build_navigation($strcomments, $cm); print_header_simple(strip_tags("$strcomments: $entry->concept"), "", $navigation, "", "", true, update_module_button($cm->id, $course->id, $strglossary), navmenu($course, $cm)); diff --git a/mod/glossary/deleteentry.php b/mod/glossary/deleteentry.php index 4f9db3b5e4..e3a8ab0113 100644 --- a/mod/glossary/deleteentry.php +++ b/mod/glossary/deleteentry.php @@ -39,17 +39,11 @@ $strareyousuredelete = get_string("areyousuredelete","glossary"); - $navlinks = array(); - $navlinks[] = array('name' => $strglossaries, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($glossary->name), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance'); - -$navigation = build_navigation($navlinks); - + $navigation = build_navigation('', $cm); print_header_simple(format_string($glossary->name), "", $navigation, "", "", true, update_module_button($cm->id, $course->id, $strglossary), navmenu($course, $cm)); - if (($entry->userid != $USER->id) and !$manageentries) { // guest id is never matched, no need for special check here error("You can't delete other people's entries!"); } diff --git a/mod/glossary/edit.php b/mod/glossary/edit.php index 2a3b9ca006..7a2734ffd3 100644 --- a/mod/glossary/edit.php +++ b/mod/glossary/edit.php @@ -188,22 +188,11 @@ if ($mform->is_cancelled()){ } } -$strglossary = get_string("modulename", "glossary"); -$strglossaries = get_string("modulenameplural", "glossary"); $stredit = empty($e) ? get_string('addentry', 'glossary') : get_string("edit"); - -$navlinks = array(); -$navlinks[] = array('name' => $strglossaries, 'link' => "index.php?id=$course->id", 'type' => 'activity'); -$navlinks[] = array('name' => format_string($glossary->name), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance'); -$navlinks[] = array('name' => $stredit, 'link' => '', 'type' => 'title'); - -$navigation = build_navigation($navlinks); - +$navigation = build_navigation($stredit, $cm); print_header_simple(format_string($glossary->name), "", $navigation, "", "", true, "", navmenu($course, $cm)); - - print_heading(format_string($glossary->name)); /// Info box diff --git a/mod/glossary/export.php b/mod/glossary/export.php index dee4163739..0f91fabf21 100644 --- a/mod/glossary/export.php +++ b/mod/glossary/export.php @@ -37,12 +37,7 @@ $strexportfile = get_string("exportfile", "glossary"); $strexportentries = get_string('exportentries', 'glossary'); - $navlinks = array(); - $navlinks[] = array('name' => $strglossaries, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($glossary->name), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance'); - - $navigation = build_navigation($navlinks); - + $navigation = build_navigation('', $cm); print_header_simple(format_string($glossary->name), "",$navigation, "", "", true, update_module_button($cm->id, $course->id, $strglossary), navmenu($course, $cm)); diff --git a/mod/glossary/exportentry.php b/mod/glossary/exportentry.php index fd03e01c89..5013abd96d 100644 --- a/mod/glossary/exportentry.php +++ b/mod/glossary/exportentry.php @@ -38,12 +38,7 @@ $entryalreadyexist = get_string('entryalreadyexist','glossary'); $entryexported = get_string('entryexported','glossary'); - $navlinks = array(); - $navlinks[] = array('name' => $strglossaries, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($glossary->name), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance'); - - $navigation = build_navigation($navlinks); - + $navigation = build_navigation('', $cm); print_header_simple(format_string($glossary->name), '', $navigation, '', '', true, '', navmenu($course, $cm)); if ( $PermissionGranted ) { diff --git a/mod/glossary/import.php b/mod/glossary/import.php index a93d9bd57b..56edc02a42 100644 --- a/mod/glossary/import.php +++ b/mod/glossary/import.php @@ -45,13 +45,7 @@ $strsearch = get_string("search"); $strimportentries = get_string('importentriesfromxml', 'glossary'); - $navlinks = array(); - $navlinks[] = array('name' => $strglossaries, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($glossary->name), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance'); - $navlinks[] = array('name' => $strimportentries, 'link' => '', 'type' => 'title'); - - $navigation = build_navigation($navlinks); - + $navigation = build_navigation($strimportentries, $cm); print_header_simple(format_string($glossary->name), "", $navigation, "", "", true, update_module_button($cm->id, $course->id, $strglossary), navmenu($course, $cm)); diff --git a/mod/glossary/view.php b/mod/glossary/view.php index 44f99b5681..e807ef08e0 100644 --- a/mod/glossary/view.php +++ b/mod/glossary/view.php @@ -224,23 +224,17 @@ $strsearch = get_string("search"); $strwaitingapproval = get_string('waitingapproval', 'glossary'); - $navlinks = array(); - $navlinks[] = array('name' => $strglossaries, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($glossary->name), 'link' => "view.php?id=$id", 'type' => 'activityinstance'); - /// If we are in approval mode, prit special header if ($tab == GLOSSARY_APPROVAL_VIEW) { require_capability('mod/glossary:approve', $context); - $navlinks[] = array('name' => $strwaitingapproval, 'link' => '', 'type' => 'title'); - $navigation = build_navigation($navlinks); - + $navigation = build_navigation($strwaitingapproval, $cm); print_header_simple(format_string($glossary->name), "", $navigation, "", "", true, update_module_button($cm->id, $course->id, $strglossary), navmenu($course, $cm)); print_heading($strwaitingapproval); } else { /// Print standard header - $navigation = build_navigation($navlinks); + $navigation = build_navigation('', $cm); print_header_simple(format_string($glossary->name), "", $navigation, "", "", true, update_module_button($cm->id, $course->id, $strglossary), navmenu($course, $cm)); } diff --git a/mod/hotpot/report.php b/mod/hotpot/report.php index 32e2eb1f60..1e38dbc901 100644 --- a/mod/hotpot/report.php +++ b/mod/hotpot/report.php @@ -405,11 +405,6 @@ function hotpot_print_report_heading(&$course, &$cm, &$hotpot, &$mode) { $title = format_string($course->shortname) . ": $hotpot->name"; $heading = $course->fullname; - $navlinks = array(); - $navlinks[] = array('name' => $strmodulenameplural, 'link' => 'index.php?id='.$course->id, 'type' => 'activity'); - $navlinks[] = array('name' => $hotpot->name, 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance'); - - $modulecontext = get_context_instance(CONTEXT_MODULE, $cm->id); if (has_capability('mod/hotpot:viewreport',$modulecontext)) { if ($mode=='overview' || $mode=='simplestat' || $mode=='fullstat') { @@ -418,16 +413,12 @@ function hotpot_print_report_heading(&$course, &$cm, &$hotpot, &$mode) { $module = "hotpot"; } - $navlinks[] = array('name' => get_string("report$mode", $module), 'link' => '', 'type' => 'title'); - - + $navigation = build_navigation(get_string("report$mode", $module), $cm); } else { - - $navlinks[] = array('name' => get_string("report", "quiz"), 'link' => '', 'type' => 'title'); + $navigation = build_navigation(get_string("report", "quiz"), $cm); } $button = update_module_button($cm->id, $course->id, $strmodulename); - $navigation = build_navigation($navlinks); print_header($title, $heading, $navigation, "", "", true, $button, navmenu($course, $cm)); print_heading($hotpot->name); diff --git a/mod/hotpot/review.php b/mod/hotpot/review.php index 314fd3e9d3..0eef8953cf 100644 --- a/mod/hotpot/review.php +++ b/mod/hotpot/review.php @@ -54,12 +54,7 @@ $title = format_string($course->shortname) . ": $hotpot->name"; $heading = $course->fullname; - $navlinks = array(); - $navlinks[] = array('name' => $strmodulenameplural, 'link' => 'index.php?id='.$course->id, 'type' => 'activity'); - $navlinks[] = array('name' => get_string("review", "quiz"), 'link' => '', 'type' => 'activityinstance'); - $navigation = build_navigation($navlinks); - - + $navigation = build_navigation('', $cm); $button = update_module_button($cm->id, $course->id, $strmodulename); print_header($title, $heading, $navigation, "", "", true, $button, navmenu($course, $cm)); print ''; // for overlib diff --git a/mod/hotpot/view.php b/mod/hotpot/view.php index 2b43347cfd..3e18a599c6 100644 --- a/mod/hotpot/view.php +++ b/mod/hotpot/view.php @@ -43,11 +43,7 @@ $title = format_string($course->shortname.': '.$hotpot->name, true); $heading = $course->fullname; - $navlinks = array(); - $navlinks[] = array('name' => get_string("modulenameplural", "hotpot"), 'link' => $CFG->wwwroot.'/mod/hotpot/index.php?id='.$course->id, 'type' => 'activity'); - $navlinks[] = array('name' => $hotpot->name, 'link' => '', 'type' => 'activityinstance'); - - $navigation = build_navigation($navlinks); + $navigation = build_navigation('', $cm); $button = update_module_button($cm->id, $course->id, get_string("modulename", "hotpot")); $button = '
'.$button.'
'; diff --git a/mod/journal/edit.php b/mod/journal/edit.php index d3d547c33d..79ed2eada6 100644 --- a/mod/journal/edit.php +++ b/mod/journal/edit.php @@ -75,12 +75,7 @@ $entry->format = $defaultformat; } - $navlinks = array(); - $navlinks[] = array('name' => $strjournals, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($journal->name), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance'); - $navlinks[] = array('name' => $stredit, 'link' => '', 'type' => 'action'); - $navigation = build_navigation($navlinks); - + $navigation = build_navigation($stredit, $cm); print_header_simple(format_string($journal->name), "", $navigation, "", "", true, "", navmenu($course, $cm)); diff --git a/mod/journal/report.php b/mod/journal/report.php index eb687ae0c9..441f9d86f7 100644 --- a/mod/journal/report.php +++ b/mod/journal/report.php @@ -38,15 +38,9 @@ $strentries = get_string("entries", "journal"); $strjournals = get_string("modulenameplural", "journal"); - $navlinks = array(); - $navlinks[] = array('name' => $strjournals, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($journal->name), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance'); - $navlinks[] = array('name' => $strentries, 'link' => '', 'type' => 'title'); - $navigation = build_navigation($navlinks); - + $navigation = build_navigation($strentries, $cm); print_header_simple("$strjournals", "", $navigation, "", "", true); - /// Check to see if groups are being used in this journal $groupmode = groupmode($course, $cm); $currentgroup = setup_and_print_groups($course, $groupmode, "report.php?id=$cm->id"); diff --git a/mod/journal/view.php b/mod/journal/view.php index 7233ee88af..7dad3fcd82 100644 --- a/mod/journal/view.php +++ b/mod/journal/view.php @@ -28,11 +28,7 @@ $strjournal = get_string("modulename", "journal"); $strjournals = get_string("modulenameplural", "journal"); - $navlinks = array(); - $navlinks[] = array('name' => $strjournals, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($journal->name), 'link' => '', 'type' => 'activityinstance'); - $navigation = build_navigation($navlinks); - + $navigation = build_navigation('', $cm); print_header_simple(format_string($journal->name), '', $navigation, '', '', true, update_module_button($cm->id, $course->id, $strjournal), navmenu($course, $cm)); diff --git a/mod/lams/index.php b/mod/lams/index.php index 83d1ecb269..4fa817c899 100644 --- a/mod/lams/index.php +++ b/mod/lams/index.php @@ -24,9 +24,9 @@ /// Print the header - if ($course->id != SITEID) { - $navigation = "id\">$course->shortname ->"; - } + $navlinks = array(); + $navlinks[] = array('name' => $strlamss, 'link' => '', 'type' => 'activity'); + $navigation = build_navigation($navlinks); print_header("$course->shortname: $strlamss", $course->fullname, "$navigation $strlamss", "", "", true, "", navmenu($course)); diff --git a/mod/lams/view.php b/mod/lams/view.php index 353f719e04..527c7ab159 100644 --- a/mod/lams/view.php +++ b/mod/lams/view.php @@ -27,14 +27,7 @@ $context = get_context_instance(CONTEXT_MODULE, $cm->id); add_to_log($course->id, "lams", "view", "view.php?id=$cm->id", "$lams->id"); /// Print the page header - -//if ($course->id != SITEID) { -// $navigation = "id\">$course->shortname ->"; -//} -$navlinks = array(); -$navlinks[] = array('name' => $strchoices, 'link' => "index.php?id=$course->id", 'type' => 'misc'); -$navlinks[] = array('name' => format_string($lams->name), 'link' => null, 'type' => 'misc'); -$navigation = build_navigation($navlinks); +$navigation = build_navigation('', $cm); print_header_simple(format_string($lams->name), "", $navigation, "", "", true, update_module_button($cm->id, $course->id, get_string("lesson","lams")), navmenu($course, $cm)); diff --git a/mod/lesson/import.php b/mod/lesson/import.php index be1559a04b..8e41a64c38 100644 --- a/mod/lesson/import.php +++ b/mod/lesson/import.php @@ -35,13 +35,7 @@ $strimportquestions = get_string("importquestions", "lesson"); $strlessons = get_string("modulenameplural", "lesson"); - $navlinks = array(); - $navlinks[] = array('name' => $strlesson, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($lesson->name,true), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance'); - $navlinks[] = array('name' => $strimportquestions, 'link' => '', 'type' => 'title'); - - $navigation = build_navigation($navlinks); - + $navigation = build_navigation($strimportquestions, $cm); print_header_simple("$strimportquestions", " $strimportquestions", $navigation); if ($form = data_submitted()) { /// Filename diff --git a/mod/lesson/importppt.php b/mod/lesson/importppt.php index a211f78a68..a407515be3 100644 --- a/mod/lesson/importppt.php +++ b/mod/lesson/importppt.php @@ -44,13 +44,7 @@ $strimportppt = get_string("importppt", "lesson"); $strlessons = get_string("modulenameplural", "lesson"); - $navlinks = array(); - $navlinks[] = array('name' => $strlessons, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($mod->name,true), 'link' => "$CFG->wwwroot/mod/$modname/view.php?id=$cm->id", 'type' => 'activityinstance'); - $navlinks[] = array('name' => $strimportppt, 'link' => '', 'type' => 'title'); - - $navigation = build_navigation($navlinks); - + $navigation = build_navigation($strimportppt, $cm); print_header_simple("$strimportppt", " $strimportppt", $navigation); if ($form = data_submitted()) { /// Filename diff --git a/mod/lesson/locallib.php b/mod/lesson/locallib.php index 0c8044bd42..beea2a3d2e 100644 --- a/mod/lesson/locallib.php +++ b/mod/lesson/locallib.php @@ -226,9 +226,7 @@ if (!defined("LESSON_RESPONSE_EDITOR")) { function lesson_print_header($cm, $course, $lesson, $currenttab = '') { global $CFG, $USER; - $strlessons = get_string('modulenameplural', 'lesson'); $strlesson = get_string('modulename', 'lesson'); - $strname = format_string($lesson->name, true); $context = get_context_instance(CONTEXT_MODULE, $cm->id); @@ -239,11 +237,7 @@ function lesson_print_header($cm, $course, $lesson, $currenttab = '') { } /// Header setup - $navlinks = array(); - $navlinks[] = array('name' => $strlessons, 'link' => "$CFG->wwwroot/mod/lesson/index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => $strname, 'link' => '', 'type' => 'activityinstance'); - - $navigation = build_navigation($navlinks); + $navigation = build_navigation('', $cm); /// Print header, heading, tabs and messages print_header("$course->shortname: $strname", $course->fullname, $navigation, diff --git a/mod/lesson/pagelib.php b/mod/lesson/pagelib.php index e12429128d..41d869c0af 100644 --- a/mod/lesson/pagelib.php +++ b/mod/lesson/pagelib.php @@ -76,15 +76,6 @@ class page_lesson extends page_generic_activity { $title = "{$this->courserecord->shortname}: $activityname"; } - $navlinks = array(); - $navlinks[] = array('name' => get_string('modulenameplural', $this->activityname), 'link' => $CFG->wwwroot."/mod/{$this->activityname}/index.php?id={$this->courserecord->id}", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($this->activityrecord->name), 'link' => $CFG->wwwroot."/mod/{$this->activityname}/view.php?id={$this->modulerecord->id}", 'type' => 'activityinstance'); - - if (!empty($morenavlinks)) { - $navlinks = array_merge($navlinks, $morenavlinks); - } - - /// Build the buttons if (has_capability('mod/lesson:edit', $context)) { $buttons = ''.update_module_button($this->modulerecord->id, $this->courserecord->id, get_string('modulename', 'lesson')); @@ -133,8 +124,7 @@ class page_lesson extends page_generic_activity { $meta = ''; // } - $navigation = build_navigation($navlinks); - + $navigation = build_navigation($morenavlinks); print_header($title, $this->courserecord->fullname, $navigation, '', $meta, true, $buttons, navmenu($this->courserecord, $this->modulerecord)); if (has_capability('mod/lesson:manage', $context)) { diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php index 3f0fd0266c..0e14375de4 100644 --- a/mod/quiz/attempt.php +++ b/mod/quiz/attempt.php @@ -405,13 +405,7 @@ $strupdatemodule = has_capability('moodle/course:manageactivities', $coursecontext) ? update_module_button($cm->id, $course->id, get_string('modulename', 'quiz')) : ""; - $navlinks = array(); - $navlinks[] = array('name' => $strquizzes, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($quiz->name), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance'); - $navlinks[] = array('name' => $strattemptnum, 'link' => '', 'type' => 'title'); - - $navigation = build_navigation($navlinks); - + $navigation = build_navigation($strattemptnum, $cm); print_header_simple(format_string($quiz->name), "", $navigation, "", $headtags, true, $strupdatemodule); } diff --git a/mod/quiz/edit.php b/mod/quiz/edit.php index 094b6d2aef..03112733b3 100644 --- a/mod/quiz/edit.php +++ b/mod/quiz/edit.php @@ -293,12 +293,7 @@ $strupdatemodule = has_capability('moodle/course:manageactivities', $contexts->lowest()) ? update_module_button($cm->id, $course->id, get_string('modulename', 'quiz')) : ""; - $navlinks = array(); - $navlinks[] = array('name' => $strquizzes, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($quiz->name), 'link' => "view.php?q=$quiz->instance", 'type' => 'activityinstance'); - $navlinks[] = array('name' => $streditingquiz, 'link' => '', 'type' => 'title'); - $navigation = build_navigation($navlinks); - + $navigation = build_navigation($streditingquiz, $cm); print_header_simple($streditingquiz, '', $navigation, "", "", true, $strupdatemodule); @@ -331,12 +326,7 @@ $strupdatemodule = has_capability('moodle/course:manageactivities', $contexts->lowest()) ? update_module_button($cm->id, $course->id, get_string('modulename', 'quiz')) : ""; - $navlinks = array(); - $navlinks[] = array('name' => $strquizzes, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($quiz->name), 'link' => "view.php?q=$quiz->instance", 'type' => 'activityinstance'); - $navlinks[] = array('name' => $streditingquiz, 'link' => '', 'type' => 'title'); - $navigation = build_navigation($navlinks); - + $navigation = build_navigation($streditingquiz, $cm); print_header_simple($streditingquiz, '', $navigation, "", "", true, $strupdatemodule); $currenttab = 'edit'; diff --git a/mod/quiz/report/default.php b/mod/quiz/report/default.php index 612069c16b..a5a05c07aa 100644 --- a/mod/quiz/report/default.php +++ b/mod/quiz/report/default.php @@ -27,10 +27,7 @@ class quiz_default_report { $strquizzes = get_string("modulenameplural", "quiz"); $strquiz = get_string("modulename", "quiz"); /// Print the page header - $navlinks = array(); - $navlinks[] = array('name' => $strquizzes, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($quiz->name), 'link' => '', 'type' => 'activityinstance'); - $navigation = build_navigation($navlinks); + $navigation = build_navigation('', $cm); print_header_simple(format_string($quiz->name), "", $navigation, '', $meta, true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm)); diff --git a/mod/quiz/review.php b/mod/quiz/review.php index c21ac84f8d..d85f9861dd 100644 --- a/mod/quiz/review.php +++ b/mod/quiz/review.php @@ -106,8 +106,6 @@ /// Print the page header - $strquizzes = get_string("modulenameplural", "quiz"); - $strreview = get_string("review", "quiz"); $strscore = get_string("score", "quiz"); $strgrade = get_string("grade"); $strbestgrade = get_string("bestgrade", "quiz"); @@ -115,6 +113,13 @@ $strtimecompleted = get_string("completedon", "quiz"); $stroverdue = get_string("overdue", "quiz"); +/// Work out appropriate title. + if ($isteacher and $attempt->userid == $USER->id) { + $strreviewtitle = get_string('reviewofpreview', 'quiz'); + } else { + $strreviewtitle = get_string('reviewofattempt', 'quiz', $attempt->attempt); + } + $pagequestions = explode(',', $pagelist); $headtags = get_html_head_contributions($pagequestions, $questions, $states); if (!empty($popup)) { @@ -126,14 +131,8 @@ $strupdatemodule = has_capability('moodle/course:manageactivities', $coursecontext) ? update_module_button($cm->id, $course->id, get_string('modulename', 'quiz')) : ""; - - $navlinks = array(); - $navlinks[] = array('name' => $strquizzes, 'link' => "index.php?id=$course->id", 'type' => 'activity'); - $navlinks[] = array('name' => format_string($quiz->name), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance'); - $navlinks[] = array('name' => $strreview, 'link' => '', 'type' => 'title'); - - $navigation = build_navigation($navlinks); - + get_string('reviewofattempt', 'quiz', $attempt->attempt); + $navigation = build_navigation($strreviewtitle, $cm); print_header_simple(format_string($quiz->name), "", $navigation, "", $headtags, true, $strupdatemodule); } echo ''; // for overlib @@ -147,9 +146,8 @@ $mode = ''; } include('tabs.php'); - } else { - print_heading(format_string($quiz->name)); } + print_heading(format_string($quiz->name)); if ($isteacher and $attempt->userid == $USER->id) { // the teacher is at the end of a preview. Print button to start new preview unset($buttonoptions); @@ -158,9 +156,8 @@ echo '
'; print_single_button($CFG->wwwroot.'/mod/quiz/attempt.php', $buttonoptions, get_string('startagain', 'quiz')); echo '
'; - } else { // print number of the attempt - print_heading(get_string('reviewofattempt', 'quiz', $attempt->attempt)); } + print_heading($strreviewtitle); // print javascript button to close the window, if necessary if (!$isteacher) { diff --git a/mod/resource/lib.php b/mod/resource/lib.php index 2a2fc62a50..c6ae028234 100644 --- a/mod/resource/lib.php +++ b/mod/resource/lib.php @@ -81,7 +81,6 @@ class resource_base { var $cm; var $course; var $resource; - var $navigation; var $navlinks; /** @@ -113,14 +112,11 @@ class resource_base { $this->strresource = get_string("modulename", "resource"); $this->strresources = get_string("modulenameplural", "resource"); - $this->navlinks[] = array('name' => $this->strresources, 'link' => "index.php?id={$this->course->id}", 'type' => 'activity'); - if (!$this->cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE, $this->cm->id))) { $pagetitle = strip_tags($this->course->shortname.': '.$this->strresource); - $this->navlinks[] = array('name' => $this->strresource, 'link' => '', 'type' => 'activityinstance'); - $this->navigation = build_navigation($this->navlinks); + $navigation = build_navigation($this->navlinks, $this->cm); - print_header($pagetitle, $this->course->fullname, $this->navigation, "", "", true, '', navmenu($this->course, $this->cm)); + print_header($pagetitle, $this->course->fullname, $navigation, "", "", true, '', navmenu($this->course, $this->cm)); notice(get_string("activityiscurrentlyhidden"), "$CFG->wwwroot/course/view.php?id={$this->course->id}"); } diff --git a/mod/resource/type/directory/resource.class.php b/mod/resource/type/directory/resource.class.php index ed40f7e8a0..4ac61af878 100644 --- a/mod/resource/type/directory/resource.class.php +++ b/mod/resource/type/directory/resource.class.php @@ -61,10 +61,8 @@ function display() { array_shift($subs); $countsubs = count($subs); $count = 0; - $subnav = "id}\">".format_string($resource->name,true).""; $backsub = ''; - $this->navlinks[] = array('name' => format_string($resource->name,true), 'link' => "view.php?id={$cm->id}", 'type' => 'activity'); - + foreach ($subs as $sub) { $count++; if ($count < $countsubs) { @@ -75,8 +73,6 @@ function display() { $this->navlinks[] = array('name' => $sub, 'link' => '', 'type' => 'title'); } } - } else { - $this->navlinks[] = array('name' => format_string($resource->name), 'link' => '', 'type' => 'activity'); } $pagetitle = strip_tags($course->shortname.': '.format_string($resource->name)); @@ -87,8 +83,8 @@ function display() { $editfiles = print_single_button("$CFG->wwwroot/files/index.php", $options, get_string("editfiles"), 'get', '', true); $update = $editfiles.$update; } - $this->navigation = build_navigation($this->navlinks); - print_header($pagetitle, $course->fullname, $this->navigation, + $navigation = build_navigation($this->navlinks, $cm); + print_header($pagetitle, $course->fullname, $navigation, "", "", true, $update, navmenu($course, $cm)); diff --git a/mod/resource/type/file/resource.class.php b/mod/resource/type/file/resource.class.php index 2d164fa017..12fcd92ddb 100644 --- a/mod/resource/type/file/resource.class.php +++ b/mod/resource/type/file/resource.class.php @@ -324,9 +324,8 @@ class resource_file extends resource_base { if ($inpopup) { print_header($pagetitle, $course->fullname); } else { - $this->navlinks[] = array('name' => format_string($resource->name), 'link' => null, 'type' => 'misc'); - $this->navigation = build_navigation($this->navlinks); - print_header($pagetitle, $course->fullname, $this->navigation, + $navigation = build_navigation($this->navlinks, $cm); + print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm)); } notify(get_string('notallowedlocalfileaccess', 'resource', '')); @@ -340,13 +339,10 @@ class resource_file extends resource_base { /// Check whether this is supposed to be a popup, but was called directly if ($resource->popup and !$inpopup) { /// Make a page and a pop-up window - $this->navlinks[] = array('name' => format_string($resource->name), 'link' => null, 'type' => 'misc'); - $this->navigation = build_navigation($this->navlinks); - - print_header($pagetitle, $course->fullname, $this->navigation, + $navigation = build_navigation($this->navlinks, $cm); + print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm)); - echo "\n
'.update_module_button($this->modulerecord->id, $this->courserecord->id, get_string('modulename', $this->activityname)).'