mirror of
https://github.com/moodle/moodle.git
synced 2025-04-24 09:55:33 +02:00
MDL-49845 notes: Changed headers for notes index
This commit is contained in:
parent
a7e98a6900
commit
327e68e69d
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user