mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Breadcrumbs: mod/forum changes
- Modified to use build_navigation() for breadcrumb generation. Author: Matt Clarkson <mattc@catalyst.net.nz>
This commit is contained in:
parent
ad7767be7a
commit
e3f58dfb4e
10 changed files with 107 additions and 132 deletions
|
@ -97,6 +97,11 @@
|
|||
|
||||
unset($SESSION->fromdiscussion);
|
||||
|
||||
$crumbs[] = array('name' => get_string("forums", "forum"), 'link' => "../forum/index.php?id=$course->id", 'type' => 'activity');
|
||||
$crumbs[] = array('name' => format_string($forum->name,true), 'link' => "../forum/view.php?f=$forum->id", 'type' => 'activityinstance');
|
||||
$crumbs[] = array('name' => format_string($discussion->name,true), 'link' => "discuss.php?d=$discussion->id", 'type' => 'title');
|
||||
|
||||
|
||||
if ($mode) {
|
||||
set_user_preference('forum_displaymode', $mode);
|
||||
}
|
||||
|
@ -107,10 +112,8 @@
|
|||
if (abs($displaymode) == 1) { // If flat AND parent, then force nested display this time
|
||||
$displaymode = 3;
|
||||
}
|
||||
$navtail = '';
|
||||
} else {
|
||||
$parent = $discussion->firstpost;
|
||||
$navtail = '-> '.format_string($discussion->name);
|
||||
}
|
||||
|
||||
if (!forum_user_can_view_post($parent, $course, $cm, $forum, $discussion)) {
|
||||
|
@ -131,30 +134,11 @@
|
|||
}
|
||||
|
||||
|
||||
if (empty($navtail)) {
|
||||
$navtail = "-> <a href=\"discuss.php?d=$discussion->id\">".
|
||||
format_string($discussion->name,true)."</a> -> ".
|
||||
format_string($post->subject);
|
||||
}
|
||||
if ($forum->type == 'single') {
|
||||
$navforum = '';
|
||||
} else {
|
||||
$navforum = "<a href=\"../forum/view.php?f=$forum->id\">".
|
||||
format_string($forum->name,true)."</a> ";
|
||||
}
|
||||
$navmiddle = "<a href=\"../forum/index.php?id=$course->id\">".
|
||||
get_string("forums", "forum").'</a> -> '.$navforum;
|
||||
|
||||
$searchform = forum_search_form($course);
|
||||
|
||||
if ($course->id != SITEID) {
|
||||
print_header("$course->shortname: ".format_string($discussion->name), $course->fullname,
|
||||
"<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
$navmiddle $navtail", "", "", true, $searchform, navmenu($course, $cm));
|
||||
} else {
|
||||
print_header("$course->shortname: ".format_string($discussion->name), $course->fullname,
|
||||
"$navmiddle $navtail", "", "", true, $searchform, navmenu($course, $cm));
|
||||
}
|
||||
$navigation = build_navigation($crumbs, $course);
|
||||
print_header("$course->shortname: ".format_string($discussion->name), $course->fullname,
|
||||
$navigation, "", "", true, $searchform, navmenu($course, $cm));
|
||||
|
||||
|
||||
/// Check to see if groups are being used in this forum
|
||||
|
|
|
@ -451,15 +451,11 @@
|
|||
|
||||
|
||||
/// Output the page
|
||||
$crumbs[] = array('name' => $strforums, 'link' => '', 'type' => 'activity');
|
||||
|
||||
if ($course->id != SITEID) {
|
||||
print_header("$course->shortname: $strforums", $course->fullname,
|
||||
"<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> -> $strforums",
|
||||
print_header("$course->shortname: $strforums", $course->fullname,
|
||||
build_navigation($crumbs, $course),
|
||||
"", "", true, $searchform, navmenu($course));
|
||||
} else {
|
||||
print_header("$course->shortname: $strforums", $course->fullname, "$strforums",
|
||||
"", "", true, $searchform, navmenu($course));
|
||||
}
|
||||
|
||||
if (!isguest()) {
|
||||
print_box_start('subscription');
|
||||
|
|
|
@ -33,16 +33,12 @@
|
|||
}
|
||||
|
||||
$strforums = get_string('modulenameplural', 'forum');
|
||||
if ($course->id != SITEID) {
|
||||
print_header($course->shortname, $course->fullname,
|
||||
"<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"../forum/index.php?id=$course->id\">$strforums</a> ->
|
||||
<a href=\"view.php?f=$forum->id\">".format_string($forum->name,true)."</a>", '', '', true, "", navmenu($course, $cm));
|
||||
} else {
|
||||
print_header($course->shortname, $course->fullname,
|
||||
"<a href=\"../forum/index.php?id=$course->id\">$strforums</a> ->
|
||||
<a href=\"view.php?f=$forum->id\">".format_string($forum->name,true)."</a>", '', '', true, "", navmenu($course, $cm));
|
||||
}
|
||||
$crumbs[] = array('name' => $strforums, 'link' => "index.php?id=$course->id", 'type' => 'activity');
|
||||
$crumbs[] = array('name' => format_string($forum->name), 'link' => "view.php?f=$forum->id", 'type' => 'activityinstance');
|
||||
|
||||
$navigation = build_navigation($crumbs, $course, $cm);
|
||||
|
||||
print_header($course->shortname, $course->fullname, $navigation, '', '', true, "", navmenu($course, $cm));
|
||||
notice_yesno(get_string('noguesttracking', 'forum').'<br /><br />'.get_string('liketologin'),
|
||||
$wwwroot, $_SERVER['HTTP_REFERER']);
|
||||
print_footer($course);
|
||||
|
|
|
@ -53,21 +53,19 @@
|
|||
}
|
||||
|
||||
$strforums = get_string('modulenameplural', 'forum');
|
||||
|
||||
if (!get_referer()) { // No referer - probably coming in via email See MDL-9052
|
||||
require_login();
|
||||
}
|
||||
if ($course->id != SITEID) {
|
||||
print_header($course->shortname, $course->fullname,
|
||||
"<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"../forum/index.php?id=$course->id\">$strforums</a> ->
|
||||
<a href=\"view.php?f=$forum->id\">".format_string($forum->name, true)."</a>",
|
||||
'', '', true, "", navmenu($course, $cm));
|
||||
} else {
|
||||
print_header($course->shortname, $course->fullname,
|
||||
"<a href=\"../forum/index.php?id=$course->id\">$strforums</a> ->
|
||||
<a href=\"view.php?f=$forum->id\">".format_string($forum->name)."</a>",
|
||||
'', '', true, "", navmenu($course, $cm));
|
||||
}
|
||||
|
||||
$crumbs[] = array('name' => get_string("forums", "forum"), 'link' => "../forum/view.php?f=$forum->id", 'type' => 'activity');
|
||||
$crumbs[] = array('name' => format_string($forum->name,true), 'link' => '../forum/index.php?id=$course->id', 'type' => 'activityinstance');
|
||||
|
||||
$navigation = build_navigation($crumbs, $course);
|
||||
|
||||
|
||||
print_header($course->shortname, $course->fullname, $navigation, '' , '', true, "", navmenu($course, $cm));
|
||||
|
||||
notice_yesno(get_string('noguestpost', 'forum').'<br /><br />'.get_string('liketologin'),
|
||||
$wwwroot, get_referer(false));
|
||||
print_footer($course);
|
||||
|
@ -404,11 +402,15 @@
|
|||
|
||||
$course = get_record('course', 'id', $forum->course);
|
||||
$strforums = get_string("modulenameplural", "forum");
|
||||
print_header_simple(format_string($discussion->name).": ".format_string($post->subject), "",
|
||||
"<a href=\"../forum/index.php?id=$course->id\">$strforums</a> ->
|
||||
<a href=\"view.php?f=$forum->id\">".format_string($forum->name, true)."</a> ->
|
||||
<a href=\"discuss.php?d=$discussion->id\">".format_string($post->subject, true)."</a> -> ".
|
||||
get_string("prune", "forum"), '', "", true, "", navmenu($course, $cm));
|
||||
|
||||
$crumbs[] = array('name' => $strforums, 'link' => "../forum/index.php?id=$course->id", 'type' => 'activity');
|
||||
$crumbs[] = array('name' => $forum->name, 'link' => "view.php?f=$forum->id", 'type' => 'activityinstance');
|
||||
$crumbs[] = array('name' => format_string($post->subject, true), 'link' => "discuss.php?d=$discussion->id", 'type' => 'title');
|
||||
$crumbs[] = array('name' => get_string("prune", "forum"), 'link' => '', 'type' => 'title');
|
||||
|
||||
$navigation = build_navigation($crumbs, $course);
|
||||
|
||||
print_header_simple(format_string($discussion->name).": ".format_string($post->subject), "", $navigation, '', "", true, "", navmenu($course, $cm));
|
||||
|
||||
print_heading(get_string('pruneheading', 'forum'));
|
||||
echo '<center>';
|
||||
|
@ -623,23 +625,24 @@
|
|||
get_string("addanewdiscussion", "forum");
|
||||
}
|
||||
|
||||
$strforums = get_string("modulenameplural", "forum");
|
||||
|
||||
|
||||
$crumbs[] = array('name' => $strforums, 'link' => "../forum/index.php?id=$course->id", 'type' => 'activity');
|
||||
$crumbs[] = array('name' => $forum->name, 'link' => "view.php?f=$forum->id", 'type' => 'activityinstance');
|
||||
|
||||
|
||||
if ($post->parent) {
|
||||
$navtail = ' -> <a href="discuss.php?d='.$discussion->id.'">'.format_string($toppost->subject, true).'</a> -> '.
|
||||
get_string('editing', 'forum');
|
||||
$crumbs[] = array('name' => format_string($toppost->subject, true), 'link' => "discuss.php?d=$discussion->id", 'type' => 'activityinstance');
|
||||
$crumbs[] = array('name' => get_string('editing', 'forum'), 'link' => '', 'type' => 'action');
|
||||
} else {
|
||||
$navtail = ' -> '.format_string($toppost->subject);
|
||||
$crumbs[] = array('name' => format_string($toppost->subject), 'link' => '', 'type' => 'action');
|
||||
}
|
||||
|
||||
if (empty($post->edit)) {
|
||||
$post->edit = '';
|
||||
}
|
||||
|
||||
$strforums = get_string("modulenameplural", "forum");
|
||||
|
||||
|
||||
$navmiddle = "<a href=\"../forum/index.php?id=$course->id\">$strforums</a> -> <a href=\"view.php?f=$forum->id\">".format_string($forum->name, true).'</a> ';
|
||||
|
||||
if (empty($discussion->name)) {
|
||||
if (empty($discussion)) {
|
||||
|
@ -660,18 +663,13 @@
|
|||
|
||||
$forcefocus = empty($reply) ? NULL : 'message';
|
||||
|
||||
if ($course->id != SITEID) {
|
||||
print_header("$course->shortname: $strdiscussionname ".
|
||||
format_string($toppost->subject), $course->fullname,
|
||||
"<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
$navmiddle $navtail", $mform_post->focus($forcefocus), "", true, "", navmenu($course, $cm));
|
||||
|
||||
} else {
|
||||
print_header("$course->shortname: $strdiscussionname ".
|
||||
format_string($toppost->subject), $course->fullname,
|
||||
"$navmiddle $navtail", $mform_post->focus($forcefocus), "", true, "", navmenu($course, $cm));
|
||||
$navigation = build_navigation($crumbs, $course);
|
||||
|
||||
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)) {
|
||||
|
|
|
@ -97,9 +97,14 @@
|
|||
$strsearchresults = get_string("searchresults", "forum");
|
||||
$strpage = get_string("page");
|
||||
|
||||
$crumbs[] = array('name' => $strforums, 'link' => "index.php?id=$course->id", 'type' => 'activity');
|
||||
|
||||
if (!$search || $showform) {
|
||||
print_header_simple("$strsearch", "",
|
||||
"<a href=\"index.php?id=$course->id\">$strforums</a> -> $strsearch", 'search.words',
|
||||
|
||||
$crumns[] = array('name' => $strsearch, 'link' => '', 'type' => 'title');
|
||||
$navigation = build_navigation($crumbs, $course);
|
||||
|
||||
print_header_simple("$strsearch", "", $navigation, 'search.words',
|
||||
"", "", " ", navmenu($course));
|
||||
|
||||
forum_print_big_search_form($course);
|
||||
|
@ -114,13 +119,13 @@
|
|||
|
||||
$searchform = forum_search_form($course, $search);
|
||||
|
||||
$crumbs[] = array('name' => $strsearch, 'link' => "search.php?id=$course->id", 'type' => 'activityinstance');
|
||||
$crumbs[] = array('name' => s($search, true), 'link' => '', 'type' => 'link');
|
||||
$navigation = build_navigation($crumbs, $course);
|
||||
|
||||
|
||||
if (!$posts = forum_search_posts($searchterms, $course->id, $page*$perpage, $perpage, $totalcount)) {
|
||||
|
||||
print_header_simple("$strsearchresults", "",
|
||||
"<a href=\"index.php?id=$course->id\">$strforums</a> ->
|
||||
<a href=\"search.php?id=$course->id\">$strsearch</a> -> ".s($search, true), 'search.words',
|
||||
"", "", " ", navmenu($course));
|
||||
print_header_simple("$strsearchresults", "", $navigation, 'search.words', "", "", " ", navmenu($course));
|
||||
print_heading(get_string("nopostscontaining", "forum", $search));
|
||||
|
||||
if (!$individualparams) {
|
||||
|
@ -133,10 +138,8 @@
|
|||
exit;
|
||||
}
|
||||
|
||||
print_header_simple("$strsearchresults", "",
|
||||
"<a href=\"index.php?id=$course->id\">$strforums</a> ->
|
||||
<a href=\"search.php?id=$course->id\">$strsearch</a> -> ".s($search, true), '',
|
||||
"", "", $searchform, navmenu($course));
|
||||
|
||||
print_header_simple("$strsearchresults", "", $navigation, '', "", "", $searchform, navmenu($course));
|
||||
|
||||
echo '<div class="reportlink">';
|
||||
echo '<a href="search.php?id='.$course->id.
|
||||
|
|
|
@ -31,16 +31,12 @@
|
|||
}
|
||||
|
||||
$strforums = get_string('modulenameplural', 'forum');
|
||||
if ($course->id != SITEID) {
|
||||
print_header($course->shortname, $course->fullname,
|
||||
"<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"../forum/index.php?id=$course->id\">$strforums</a> ->
|
||||
<a href=\"view.php?f=$forum->id\">".format_string($forum->name,true)."</a>", '', '', true, "", navmenu($course, $cm));
|
||||
} else {
|
||||
print_header($course->shortname, $course->fullname,
|
||||
"<a href=\"../forum/index.php?id=$course->id\">$strforums</a> ->
|
||||
<a href=\"view.php?f=$forum->id\">".format_string($forum->name,true)."</a>", '', '', true, "", navmenu($course, $cm));
|
||||
}
|
||||
$crumbs[] = array('name' => $strforums, 'link' => "index.php?id=$course->id", 'type' => 'activity');
|
||||
$crumbs[] = array('name' => format_string($forum->name), 'link' => "view.php?f=$forum->id", 'type' => 'activityinstance');
|
||||
|
||||
$navigation = build_navigation($crumbs, $course, $cm);
|
||||
|
||||
print_header($course->shortname, $course->fullname, $navigation, '', '', true, "", navmenu($course, $cm));
|
||||
notice_yesno(get_string('noguesttracking', 'forum').'<br /><br />'.get_string('liketologin'),
|
||||
$wwwroot, $_SERVER['HTTP_REFERER']);
|
||||
print_footer($course);
|
||||
|
|
|
@ -52,16 +52,13 @@
|
|||
}
|
||||
|
||||
$strforums = get_string('modulenameplural', 'forum');
|
||||
if ($course->id != SITEID) {
|
||||
print_header($course->shortname, $course->fullname,
|
||||
"<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"../forum/index.php?id=$course->id\">$strforums</a> ->
|
||||
<a href=\"view.php?f=$forum->id\">".format_string($forum->name,true)."</a>", '', '', true, "", navmenu($course, $cm));
|
||||
} else {
|
||||
print_header($course->shortname, $course->fullname,
|
||||
"<a href=\"../forum/index.php?id=$course->id\">$strforums</a> ->
|
||||
<a href=\"view.php?f=$forum->id\">".format_string($forum->name,true)."</a>", '', '', true, "", navmenu($course, $cm));
|
||||
}
|
||||
$crumbs[] = array('name' => $strforums, 'link' => "index.php?id=$course->id", 'type' => 'activity');
|
||||
$crumbs[] = array('name' => format_string($forum->name), 'link' => "view.php?f=$forum->id", 'type' => 'activityinstance');
|
||||
|
||||
$navigation = build_navigation($crumbs, $course, $cm);
|
||||
|
||||
print_header($course->shortname, $course->fullname, $navigation, '', '', true, "", navmenu($course, $cm));
|
||||
|
||||
notice_yesno(get_string('noguestsubscribe', 'forum').'<br /><br />'.get_string('liketologin'),
|
||||
$wwwroot, $_SERVER['HTTP_REFERER']);
|
||||
print_footer($course);
|
||||
|
|
|
@ -36,17 +36,20 @@
|
|||
$strsubscribers = get_string("subscribers", "forum");
|
||||
$strforums = get_string("forums", "forum");
|
||||
|
||||
$navigation = "<a href=\"index.php?id=$course->id\">$strforums</a> ->
|
||||
<a href=\"view.php?f=$forum->id\">".format_string($forum->name,true)."</a> -> $strsubscribers";
|
||||
$crumbs[] = array('name' => $strforums, 'link' => "index.php?id=$course->id", 'type' => 'activity');
|
||||
$crumbs[] = array('name' => format_string($forum->name), 'link' => "view.php?f=$forum->id", 'type' => 'activityinstance');
|
||||
$crumbs[] = array('name' => $strsubscribers, 'link' => '', 'type' => 'title');
|
||||
|
||||
$navigation = build_navigation($crumbs, $course);
|
||||
|
||||
if (has_capability('mod/forum:managesubscriptions', $context)) {
|
||||
print_header_simple("$strsubscribers", "", "$navigation",
|
||||
print_header_simple("$strsubscribers", "", $navigation,
|
||||
"", "", true, forum_update_subscriptions_button($course->id, $id));
|
||||
if ($edit != -1) {
|
||||
$USER->subscriptionsediting = $edit;
|
||||
}
|
||||
} else {
|
||||
print_header_simple("$strsubscribers", "", "$navigation", "", "", true, '');
|
||||
print_header_simple("$strsubscribers", "", $navigation, "", "", true, '');
|
||||
unset($USER->subscriptionsediting);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,17 +39,16 @@
|
|||
$strmode = get_string($mode, 'forum');
|
||||
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $syscontext));
|
||||
|
||||
if ($course->id != SITEID) {
|
||||
print_header("$course->shortname: $fullname: $strmode", $course->fullname,
|
||||
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"$CFG->wwwroot/user/index.php?id=$course->id\">$strparticipants</a> ->
|
||||
<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&course=$course->id\">$fullname</a> ->
|
||||
$strforumposts -> $strmode");
|
||||
} else {
|
||||
print_header("$course->shortname: $fullname: $strmode", $course->fullname,
|
||||
"<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&course=$course->id\">$fullname</a> ->
|
||||
$strforumposts -> $strmode");
|
||||
}
|
||||
// TODO: add new cookie tail here!
|
||||
$crumbs[] = array('name' => $strparticipants, 'link' => "$CFG->wwwroot/user/index.php?id=$course->id", 'type' => 'core');
|
||||
$crumbs[] = array('name' => $fullname, 'link' => "$CFG->wwwroot/user/view.php?id=$user->id&course=$course->id", 'type' => 'title');
|
||||
$crumbs[] = array('name' => $strforumposts, 'link' => '', 'type' => 'title');
|
||||
$crumbs[] = array('name' => $strmode, 'link' => '', 'type' => 'title');
|
||||
|
||||
$navigation = build_navigation($crumbs, $course);
|
||||
|
||||
print_header("$course->shortname: $fullname: $strmode", $course->fullname,$navigation);
|
||||
|
||||
|
||||
$currenttab = $mode;
|
||||
$showroles = 1;
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
$cm->course = $course->id;
|
||||
$buttontext = "";
|
||||
}
|
||||
|
||||
} else {
|
||||
error('Must specify a course module or a forum ID');
|
||||
}
|
||||
|
@ -65,9 +64,13 @@
|
|||
|
||||
|
||||
/// Print header.
|
||||
$navigation = "<a href=\"index.php?id=$course->id\">$strforums</a> ->";
|
||||
$crumbs[] = array('name' => $strforums, 'link' => "index.php?id=$course->id", 'type' => 'activity');
|
||||
$crumbs[] = array('name' => format_string($forum->name), 'link' => "view.php?f=$forum->id", 'type' => 'activityinstance');
|
||||
|
||||
$navigation = build_navigation($crumbs, $course, $cm);
|
||||
|
||||
print_header_simple(format_string($forum->name), "",
|
||||
"$navigation ".format_string($forum->name), "", "", true, $buttontext, navmenu($course, $cm));
|
||||
$navigation, "", "", true, $buttontext, navmenu($course, $cm));
|
||||
|
||||
|
||||
/// Some capability checks.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue