From 327e68e69db6713be85faec8cb8b71e43ec5a77b Mon Sep 17 00:00:00 2001 From: Dave Cooper Date: Wed, 29 Apr 2015 12:11:56 +0800 Subject: [PATCH] MDL-49845 notes: Changed headers for notes index --- lib/navigationlib.php | 2 +- notes/index.php | 29 +++++++++++++++++++++++++++-- notes/lib.php | 5 ----- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/lib/navigationlib.php b/lib/navigationlib.php index 96e6eab4b44..564418674a6 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -2562,7 +2562,7 @@ class global_navigation extends navigation_node { } } if (!empty($CFG->enablenotes) && (has_capability('moodle/notes:manage', $this->page->context) || has_capability('moodle/notes:view', $this->page->context))) { - $participants->add(get_string('notes','notes'), new moodle_url('/notes/index.php', array('filtertype'=>'course', 'filterselect'=>$course->id))); + $participants->add(get_string('notes', 'notes'), new moodle_url('/notes/index.php', array('filtertype' => 'course', 'filterselect' => $course->id)), self::TYPE_SETTING, null, 'currentcoursenotes'); } } else if (count($this->extendforuser) > 0 || $this->page->course->id == $course->id) { $participants = $coursenode->add(get_string('participants'), null, self::TYPE_CONTAINER, get_string('participants'), 'participants'); diff --git a/notes/index.php b/notes/index.php index 0542c972d7d..6ba0099c6ef 100644 --- a/notes/index.php +++ b/notes/index.php @@ -91,13 +91,28 @@ $systemcontext = context_system::instance(); note_view($coursecontext, $userid); $strnotes = get_string('notes', 'notes'); -if ($userid) { +if ($userid && $course->id == SITEID) { $PAGE->set_context(context_user::instance($user->id)); $PAGE->navigation->extend_for_user($user); // If we are looking at our own notes, then change focus to 'my notes'. if ($userid == $USER->id) { $notenode = $PAGE->navigation->find('notes', null)->make_inactive(); } + + $notesurl = new moodle_url('/notes/index.php', array('user' => $userid)); + $PAGE->navbar->add(get_string('notes', 'notes'), $notesurl); +} else if ($course->id != SITEID) { + $notenode = $PAGE->navigation->find('currentcoursenotes', null)->make_inactive(); + $participantsurl = new moodle_url('/user/view.php', array('id' => $userid, 'course' => $course->id)); + $currentcoursenode = $PAGE->navigation->find('currentcourse', null); + $participantsnode = $currentcoursenode->find('participants', null); + $usernode = $participantsnode->add(fullname($user), $participantsurl); + $usernode->make_active(); + + $notesurl = new moodle_url('/notes/index.php', array('user' => $userid, 'course' => $courseid)); + $PAGE->navbar->add(get_string('notes', 'notes'), $notesurl); + + $PAGE->set_context(context_course::instance($courseid)); } else { $link = null; if (has_capability('moodle/course:viewparticipants', $coursecontext) @@ -109,9 +124,19 @@ if ($userid) { $PAGE->set_pagelayout('incourse'); $PAGE->set_title($course->fullname); -$PAGE->set_heading($course->fullname); +if ($course->id == SITEID) { + $PAGE->set_heading(fullname($user)); +} else { + $PAGE->set_heading($course->fullname); +} echo $OUTPUT->header(); + +if ($course->id != SITEID) { + $headerinfo = array('heading' => fullname($user), 'user' => $user); + echo $OUTPUT->context_header($headerinfo, 2); +} + echo $OUTPUT->heading($strnotes); $strsitenotes = get_string('sitenotes', 'notes'); diff --git a/notes/lib.php b/notes/lib.php index ef83ceefdd7..7b86046f436 100644 --- a/notes/lib.php +++ b/notes/lib.php @@ -379,8 +379,6 @@ 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)) { @@ -389,9 +387,6 @@ function core_notes_myprofile_navigation(core_user\output\myprofile\tree $tree, // No cap, nothing to do. return false; } - 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.