MDL-55074 navigation: Always show dashboard/home in flat nav

This commit is contained in:
Damyon Wiese
2016-10-21 12:37:33 +08:00
parent 0f73f3ab42
commit 8a2ab5f72d
3 changed files with 33 additions and 17 deletions
+4 -7
View File
@@ -1186,10 +1186,12 @@ class global_navigation extends navigation_node {
// The home element should be my moodle because the root element is the site
if (isloggedin() && !isguestuser()) { // Makes no sense if you aren't logged in
$this->rootnodes['home'] = $this->add(get_string('myhome'), new moodle_url('/my/'), self::TYPE_SETTING, null, 'home');
$this->rootnodes['home']->showinflatnavigation = true;
}
} else {
// The home element should be the site because the root node is my moodle
$this->rootnodes['home'] = $this->add(get_string('sitehome'), new moodle_url('/'), self::TYPE_SETTING, null, 'home');
$this->rootnodes['home']->showinflatnavigation = true;
if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_MY)) {
// We need to stop automatic redirection
$this->rootnodes['home']->action->param('redirect', '0');
@@ -1230,13 +1232,8 @@ class global_navigation extends navigation_node {
// Load the users enrolled courses if they are viewing the My Moodle page AND the admin has not
// set that they wish to keep the My Courses branch collapsed by default.
if (!empty($CFG->navexpandmycourses) && $this->page->pagelayout === 'mydashboard'){
$this->rootnodes['mycourses']->forceopen = true;
$this->load_courses_enrolled();
} else {
$this->rootnodes['mycourses']->collapse = true;
$this->rootnodes['mycourses']->make_inactive();
}
$this->rootnodes['mycourses']->forceopen = true;
$this->load_courses_enrolled();
$canviewcourseprofile = true;