mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Merge branch 'MDL-49845-master' of git://github.com/gurgus/moodle
This commit is contained in:
commit
9787c4caba
@ -63,8 +63,10 @@ if ($entryid and !isset($userid)) {
|
||||
$userid = $entry->userid;
|
||||
}
|
||||
|
||||
if (isset($userid)) {
|
||||
if (isset($userid) && !isset($courseid)) {
|
||||
$context = context_user::instance($userid);
|
||||
} else if (isset($courseid) && $courseid != SITEID) {
|
||||
$context = context_course::instance($courseid);
|
||||
} else {
|
||||
$context = context_system::instance();
|
||||
}
|
||||
@ -241,11 +243,32 @@ if ($CFG->enablerssfeeds) {
|
||||
blog_rss_add_http_header($rsscontext, $rsstitle, $filtertype, $thingid, $tagid);
|
||||
}
|
||||
}
|
||||
if (isset($userid)) {
|
||||
$PAGE->set_heading(fullname($user));
|
||||
|
||||
$usernode = $PAGE->navigation->find('user'.$userid, null);
|
||||
if ($usernode && $courseid != SITEID) {
|
||||
$courseblogsnode = $PAGE->navigation->find('courseblogs', null);
|
||||
if ($courseblogsnode) {
|
||||
$courseblogsnode->remove();
|
||||
}
|
||||
$blogurl = new moodle_url($PAGE->url);
|
||||
$blognode = $usernode->add(get_string('blogscourse', 'blog'), $blogurl);
|
||||
$blognode->make_active();
|
||||
}
|
||||
|
||||
if ($courseid != SITEID) {
|
||||
$PAGE->set_heading($course->fullname);
|
||||
echo $OUTPUT->header();
|
||||
if (!empty($user)) {
|
||||
$headerinfo = array('heading' => fullname($user), 'user' => $user);
|
||||
echo $OUTPUT->context_header($headerinfo, 2);
|
||||
}
|
||||
} else if (isset($userid)) {
|
||||
$PAGE->set_heading(fullname($user));
|
||||
echo $OUTPUT->header();
|
||||
} else if ($courseid == SITEID) {
|
||||
echo $OUTPUT->header();
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($blogheaders['heading'], 2);
|
||||
|
||||
$bloglisting = new blog_listing($blogheaders['filters']);
|
||||
|
@ -770,8 +770,6 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
|
||||
$blogurl->param('userid', $userid);
|
||||
$blogurl->param('courseid', $courseid);
|
||||
|
||||
$PAGE->navbar->add($strblogentries, $blogurl);
|
||||
|
||||
$PAGE->set_title($course->fullname);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
|
||||
@ -1043,4 +1041,4 @@ function core_blog_myprofile_navigation(core_user\output\myprofile\tree $tree, $
|
||||
$blognode = new core_user\output\myprofile\node('miscellaneous', 'blogs', $title, null, $url);
|
||||
$tree->add_node($blognode);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -23,3 +23,4 @@ mypreferences,core_grades
|
||||
myprofile,core
|
||||
myprofilemyblogs,core_blog
|
||||
viewallmyentries,core_blog
|
||||
userspreferences,core_moodle
|
||||
|
@ -1934,7 +1934,6 @@ $string['usernameoremail'] = 'Enter either username or email address';
|
||||
$string['usernotconfirmed'] = 'Could not confirm {$a}';
|
||||
$string['userpic'] = 'User picture';
|
||||
$string['users'] = 'Users';
|
||||
$string['userspreferences'] = 'User {$a}\'s preferences';
|
||||
$string['userselectorautoselectunique'] = 'If only one user matches the search, select them automatically';
|
||||
$string['userselectorpreserveselected'] = 'Keep selected users, even if they no longer match the search';
|
||||
$string['userselectorsearchanywhere'] = 'Match the search text anywhere in the displayed fields';
|
||||
@ -2042,3 +2041,5 @@ $string['yourself'] = 'yourself';
|
||||
$string['yourteacher'] = 'your {$a}';
|
||||
$string['yourwordforx'] = 'Your word for \'{$a}\'';
|
||||
$string['zippingbackup'] = 'Zipping backup';
|
||||
// Deprecated since Moodle 2.9
|
||||
$string['userspreferences'] = 'User {$a}\'s preferences';
|
||||
|
@ -100,9 +100,9 @@ function core_myprofile_navigation(core_user\output\myprofile\tree $tree, $user,
|
||||
}
|
||||
|
||||
// Preference page. Only visible by administrators.
|
||||
if (is_siteadmin()) {
|
||||
if (!$iscurrentuser && is_siteadmin()) {
|
||||
$url = new moodle_url('/user/preferences.php', array('userid' => $user->id));
|
||||
$title = $iscurrentuser ? get_string('preferences') : get_string('userspreferences', 'moodle', fullname($user));
|
||||
$title = get_string('preferences', 'moodle');
|
||||
$node = new core_user\output\myprofile\node('administration', 'preferences', $title, null, $url);
|
||||
$tree->add_node($node);
|
||||
}
|
||||
|
@ -2553,18 +2553,16 @@ class global_navigation extends navigation_node {
|
||||
if (($CFG->bloglevel == BLOG_GLOBAL_LEVEL or ($CFG->bloglevel == BLOG_SITE_LEVEL and (isloggedin() and !isguestuser())))
|
||||
and has_capability('moodle/blog:view', context_system::instance())) {
|
||||
$blogsurls = new moodle_url('/blog/index.php');
|
||||
if ($course->id == $SITE->id) {
|
||||
$blogsurls->param('courseid', 0);
|
||||
} else if ($currentgroup = groups_get_course_group($course, true)) {
|
||||
if ($currentgroup = groups_get_course_group($course, true)) {
|
||||
$blogsurls->param('groupid', $currentgroup);
|
||||
} else {
|
||||
$blogsurls->param('courseid', $course->id);
|
||||
}
|
||||
$participants->add(get_string('blogscourse','blog'), $blogsurls->out());
|
||||
$participants->add(get_string('blogscourse', 'blog'), $blogsurls->out(), self::TYPE_SETTING, null, 'courseblogs');
|
||||
}
|
||||
}
|
||||
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');
|
||||
@ -2611,16 +2609,16 @@ class global_navigation extends navigation_node {
|
||||
$coursenode->add(get_string('participants'), new moodle_url('/user/index.php?id='.$course->id), self::TYPE_CUSTOM, get_string('participants'), 'participants');
|
||||
}
|
||||
|
||||
$filterselect = 0;
|
||||
|
||||
// Blogs
|
||||
if (!empty($CFG->enableblogs)
|
||||
and ($CFG->bloglevel == BLOG_GLOBAL_LEVEL or ($CFG->bloglevel == BLOG_SITE_LEVEL and (isloggedin() and !isguestuser())))
|
||||
and has_capability('moodle/blog:view', context_system::instance())) {
|
||||
$blogsurls = new moodle_url('/blog/index.php', array('courseid' => $filterselect));
|
||||
$blogsurls = new moodle_url('/blog/index.php');
|
||||
$coursenode->add(get_string('blogssite', 'blog'), $blogsurls->out(), self::TYPE_SYSTEM, null, 'siteblog');
|
||||
}
|
||||
|
||||
$filterselect = 0;
|
||||
|
||||
//Badges
|
||||
if (!empty($CFG->enablebadges) && has_capability('moodle/badges:viewbadges', $this->page->context)) {
|
||||
$url = new moodle_url($CFG->wwwroot . '/badges/view.php', array('type' => 1));
|
||||
@ -4226,7 +4224,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 +4242,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 +4282,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.
|
||||
|
@ -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');
|
||||
|
@ -387,7 +387,6 @@ function core_notes_myprofile_navigation(core_user\output\myprofile\tree $tree,
|
||||
// No cap, nothing to do.
|
||||
return false;
|
||||
}
|
||||
$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