MDL-45774 navigation: General fixes for the user navigation.

This commit is contained in:
Adrian Greeve
2015-04-13 15:54:24 +08:00
parent 52f2075d61
commit 6e918b6437
7 changed files with 27 additions and 15 deletions
+2 -2
View File
@@ -77,8 +77,8 @@ function tool_monitor_extend_navigation_frontpage($navigation, $course, $context
function tool_monitor_extend_navigation_user_settings($navigation, $user, $usercontext, $course, $coursecontext) {
global $USER, $SITE;
// Don't show the setting if the event monitor isn't turned on.
if (get_config('tool_monitor', 'enablemonitor')) {
// Don't show the setting if the event monitor isn't turned on. No access to other peoples subscriptions.
if (get_config('tool_monitor', 'enablemonitor') && $USER->id == $user->id) {
// The $course->id will always be the course that corresponds to the current context.
$courseid = $course->id;
// A $course->id of $SITE->id might either be the frontpage or the site. So if we get the site ID back, check the...
+3
View File
@@ -1032,6 +1032,9 @@ function core_blog_myprofile_navigation(core_user\output\myprofile\tree $tree, $
return true;
}
$url = new moodle_url("/blog/index.php", array('userid' => $user->id));
if (!empty($course)) {
$url->param('courseid', $course->id);
}
if ($iscurrentuser) {
$title = get_string('myprofilemyblogs', 'core_blog');
} else {
-5
View File
@@ -58,11 +58,6 @@ dir-rtl.path-grade-report-singleview div.groupselector select {
margin: 0 2px;
}
.path-grade-report-singleview #region-main h2, .paging{
text-align: center;
clear: both;
}
.path-grade-report-singleview .itemnav {
font-size: small;
display: inline;
-7
View File
@@ -4508,13 +4508,6 @@ class settings_navigation extends navigation_node {
}
}
// Login as ...
if (!$user->deleted and !$currentuser && !\core\session\manager::is_loggedinas() &&
has_capability('moodle/user:loginas', $coursecontext) && !is_siteadmin($user->id)) {
$url = new moodle_url('/course/loginas.php', array('id'=>$course->id, 'user'=>$user->id, 'sesskey'=>sesskey()));
$useraccount->add(get_string('loginas'), $url, self::TYPE_SETTING);
}
// Let admin tools hook into user settings navigation.
$tools = get_plugin_list_with_function('tool', 'extend_navigation_user_settings', 'lib.php');
foreach ($tools as $toolfunction) {
+1 -1
View File
@@ -7840,7 +7840,7 @@ function mod_forum_myprofile_navigation(core_user\output\myprofile\tree $tree, $
$discussionssurl = new moodle_url('/mod/forum/user.php', array('id' => $user->id, 'mode' => 'discussions'));
if (!empty($course)) {
$postsurl->param('course', $course->id);
$discussionssurl->param('course', $course->id);
}
$string = $iscurrentuser ? get_string('myprofileowndis', 'mod_forum') :
get_string('myprofileotherdis', 'mod_forum');
+10
View File
@@ -76,6 +76,16 @@ $PAGE->navigation->extend_for_user($user);
$PAGE->navigation->set_userid_for_parent_checks($user->id); // see MDL-25805 for reasons and for full commit reference for reversal when fixed.
$PAGE->set_title("$course->shortname: $stractivityreport");
// Create the appropriate breadcrumb.
$newusernode = $PAGE->navigation->find('user' . $user->id, null);
$reportnode = $newusernode->add(get_string('reports'));
$url = new moodle_url('/report/log/user.php', array('id' => $user->id, 'course' => $course->id, 'mode' => $mode));
if ($mode === 'today') {
$reportnode->add(get_string('todaylogs'), $url, navigation_node::TYPE_SETTING);
} else {
$reportnode->add(get_string('alllogs'), $url, navigation_node::TYPE_SETTING);
}
if ($courseid == SITEID) {
$PAGE->set_heading(fullname($user));
} else {
+11
View File
@@ -66,6 +66,17 @@ $PAGE->set_url('/report/outline/user.php', array('id'=>$user->id, 'course'=>$cou
$PAGE->navigation->extend_for_user($user);
$PAGE->navigation->set_userid_for_parent_checks($user->id); // see MDL-25805 for reasons and for full commit reference for reversal when fixed.
$PAGE->set_title("$course->shortname: $stractivityreport");
// Create the appropriate breadcrumb.
$newusernode = $PAGE->navigation->find('user' . $user->id, null);
$reportnode = $newusernode->add(get_string('reports'));
$url = new moodle_url('/report/outline/user.php', array('id' => $user->id, 'course' => $course->id, 'mode' => $mode));
if ($mode === 'complete') {
$reportnode->add(get_string('completereport'), $url, navigation_node::TYPE_COURSE);
} else {
$reportnode->add(get_string('outlinereport'), $url, navigation_node::TYPE_COURSE);
}
if ($courseid == SITEID) {
$PAGE->set_heading(fullname($user));
} else {