MDL-49845 navigation: Fix breadcrumbs for links in my profile.

This commit is contained in:
Dave Cooper 2015-04-22 14:05:06 +08:00
parent 6e9abef568
commit 298c9da5f1
2 changed files with 8 additions and 4 deletions

View File

@ -4226,7 +4226,7 @@ class settings_navigation extends navigation_node {
// Add nodes for forum posts and discussions if the user can view either or both
// There are no capability checks here as the content of the page is based
// purely on the forums the current user has access too.
$forumtab = $dashboard->add(get_string('forumposts', 'forum'));
$forumtab = $profilenode->add(get_string('forumposts', 'forum'));
$forumtab->add(get_string('posts', 'forum'), new moodle_url('/mod/forum/user.php', $baseargs), null, 'myposts');
$forumtab->add(get_string('discussions', 'forum'), new moodle_url('/mod/forum/user.php',
array_merge($baseargs, array('mode' => 'discussions'))), null, 'mydiscussions');
@ -4244,7 +4244,7 @@ class settings_navigation extends navigation_node {
}
if (count($options) > 0) {
$blogs = $dashboard->add(get_string('blogs', 'blog'), null, navigation_node::TYPE_CONTAINER);
$blogs = $profilenode->add(get_string('blogs', 'blog'), null, navigation_node::TYPE_CONTAINER);
foreach ($options as $type => $option) {
if ($type == "rss") {
$blogs->add($option['string'], $option['link'], self::TYPE_SETTING, null, null,
@ -4284,7 +4284,7 @@ class settings_navigation extends navigation_node {
if ($coursecontext->instanceid != SITEID) {
$url->param('course', $coursecontext->instanceid);
}
$dashboard->add(get_string('notes', 'notes'), $url);
$profilenode->add(get_string('notes', 'notes'), $url);
}
// Show the grades node.

View File

@ -379,6 +379,8 @@ function note_view($context, $userid) {
* @return bool
*/
function core_notes_myprofile_navigation(core_user\output\myprofile\tree $tree, $user, $iscurrentuser, $course) {
global $USER;
$url = new moodle_url("/notes/index.php", array('user' => $user->id));
$title = get_string('notes', 'core_notes');
if (empty($course)) {
@ -387,7 +389,9 @@ function core_notes_myprofile_navigation(core_user\output\myprofile\tree $tree,
// No cap, nothing to do.
return false;
}
$url->param('course', 0);
if ($user->id != $USER->id) {
$url->param('course', 0);
}
} else {
if (!has_capability('moodle/notes:view', context_course::instance($course->id))) {
// No cap, nothing to do.