mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-49845 blog: Fixed navigation logic for blog
This commit is contained in:
parent
298c9da5f1
commit
c1f97c777f
3 changed files with 32 additions and 12 deletions
|
@ -63,8 +63,10 @@ if ($entryid and !isset($userid)) {
|
||||||
$userid = $entry->userid;
|
$userid = $entry->userid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($userid)) {
|
if (isset($userid) && !isset($courseid)) {
|
||||||
$context = context_user::instance($userid);
|
$context = context_user::instance($userid);
|
||||||
|
} else if (isset($courseid) && $courseid != SITEID) {
|
||||||
|
$context = context_course::instance($courseid);
|
||||||
} else {
|
} else {
|
||||||
$context = context_system::instance();
|
$context = context_system::instance();
|
||||||
}
|
}
|
||||||
|
@ -241,8 +243,30 @@ if ($CFG->enablerssfeeds) {
|
||||||
blog_rss_add_http_header($rsscontext, $rsstitle, $filtertype, $thingid, $tagid);
|
blog_rss_add_http_header($rsscontext, $rsstitle, $filtertype, $thingid, $tagid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($userid)) {
|
|
||||||
|
$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));
|
$PAGE->set_heading(fullname($user));
|
||||||
|
echo $OUTPUT->header();
|
||||||
|
} else if ($courseid == SITEID) {
|
||||||
|
echo $OUTPUT->header();
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $OUTPUT->header();
|
echo $OUTPUT->header();
|
||||||
|
|
|
@ -770,8 +770,6 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
|
||||||
$blogurl->param('userid', $userid);
|
$blogurl->param('userid', $userid);
|
||||||
$blogurl->param('courseid', $courseid);
|
$blogurl->param('courseid', $courseid);
|
||||||
|
|
||||||
$PAGE->navbar->add($strblogentries, $blogurl);
|
|
||||||
|
|
||||||
$PAGE->set_title($course->fullname);
|
$PAGE->set_title($course->fullname);
|
||||||
$PAGE->set_heading($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);
|
$blognode = new core_user\output\myprofile\node('miscellaneous', 'blogs', $title, null, $url);
|
||||||
$tree->add_node($blognode);
|
$tree->add_node($blognode);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2553,14 +2553,12 @@ class global_navigation extends navigation_node {
|
||||||
if (($CFG->bloglevel == BLOG_GLOBAL_LEVEL or ($CFG->bloglevel == BLOG_SITE_LEVEL and (isloggedin() and !isguestuser())))
|
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())) {
|
and has_capability('moodle/blog:view', context_system::instance())) {
|
||||||
$blogsurls = new moodle_url('/blog/index.php');
|
$blogsurls = new moodle_url('/blog/index.php');
|
||||||
if ($course->id == $SITE->id) {
|
if ($currentgroup = groups_get_course_group($course, true)) {
|
||||||
$blogsurls->param('courseid', 0);
|
|
||||||
} else if ($currentgroup = groups_get_course_group($course, true)) {
|
|
||||||
$blogsurls->param('groupid', $currentgroup);
|
$blogsurls->param('groupid', $currentgroup);
|
||||||
} else {
|
} else {
|
||||||
$blogsurls->param('courseid', $course->id);
|
$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))) {
|
if (!empty($CFG->enablenotes) && (has_capability('moodle/notes:manage', $this->page->context) || has_capability('moodle/notes:view', $this->page->context))) {
|
||||||
|
@ -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');
|
$coursenode->add(get_string('participants'), new moodle_url('/user/index.php?id='.$course->id), self::TYPE_CUSTOM, get_string('participants'), 'participants');
|
||||||
}
|
}
|
||||||
|
|
||||||
$filterselect = 0;
|
|
||||||
|
|
||||||
// Blogs
|
// Blogs
|
||||||
if (!empty($CFG->enableblogs)
|
if (!empty($CFG->enableblogs)
|
||||||
and ($CFG->bloglevel == BLOG_GLOBAL_LEVEL or ($CFG->bloglevel == BLOG_SITE_LEVEL and (isloggedin() and !isguestuser())))
|
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())) {
|
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');
|
$coursenode->add(get_string('blogssite', 'blog'), $blogsurls->out(), self::TYPE_SYSTEM, null, 'siteblog');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$filterselect = 0;
|
||||||
|
|
||||||
//Badges
|
//Badges
|
||||||
if (!empty($CFG->enablebadges) && has_capability('moodle/badges:viewbadges', $this->page->context)) {
|
if (!empty($CFG->enablebadges) && has_capability('moodle/badges:viewbadges', $this->page->context)) {
|
||||||
$url = new moodle_url($CFG->wwwroot . '/badges/view.php', array('type' => 1));
|
$url = new moodle_url($CFG->wwwroot . '/badges/view.php', array('type' => 1));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue