mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 13:38:32 +01:00
MDL-55074 navigation: Always show dashboard/home in flat nav
This commit is contained in:
parent
0f73f3ab42
commit
8a2ab5f72d
@ -34,13 +34,20 @@ require_login($course);
|
||||
$context = context_course::instance($course->id);
|
||||
|
||||
$PAGE->set_pagelayout('incourse');
|
||||
$PAGE->set_title(get_string('courseadministration'));
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->navbar->add(get_string('courseadministration'));
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('courseadministration'));
|
||||
|
||||
$node = $PAGE->settingsnav->find('courseadmin', navigation_node::TYPE_COURSE);
|
||||
if ($courseid == $SITE->id) {
|
||||
$title = get_string('frontpagesettings');
|
||||
$node = $PAGE->settingsnav->find('frontpage', navigation_node::TYPE_SETTING);
|
||||
} else {
|
||||
$title = get_string('courseadministration');
|
||||
$node = $PAGE->settingsnav->find('courseadmin', navigation_node::TYPE_COURSE);
|
||||
}
|
||||
$PAGE->set_title($title);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->navbar->add($title);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($title);
|
||||
|
||||
if ($node) {
|
||||
echo $OUTPUT->render_from_template('core/settings_link_page', ['node' => $node]);
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -505,11 +505,23 @@ class core_renderer extends \core_renderer {
|
||||
// Get the course admin node from the settings navigation.
|
||||
$items = $this->page->navbar->get_items();
|
||||
$node = end($items);
|
||||
if (($node->type == navigation_node::TYPE_COURSE)) {
|
||||
$node = $this->page->settingsnav->find('courseadmin', navigation_node::TYPE_COURSE);
|
||||
if ($node) {
|
||||
$settingsnode = false;
|
||||
if ($node->key === 'home') {
|
||||
$settingsnode = $this->page->settingsnav->find('frontpage', navigation_node::TYPE_SETTING);
|
||||
if ($settingsnode) {
|
||||
// Build an action menu based on the visible nodes from this navigation tree.
|
||||
$this->build_action_menu_from_navigation($menu, $node, false, true);
|
||||
$this->build_action_menu_from_navigation($menu, $settingsnode, false, true);
|
||||
|
||||
$text = get_string('frontpagesettings');
|
||||
$url = new moodle_url('/course/admin.php', array('courseid' => $this->page->course->id));
|
||||
$link = new action_link($url, $text, null, null, new pix_icon('t/edit', $text));
|
||||
$menu->add_secondary_action($link);
|
||||
}
|
||||
} else if ($node->type == navigation_node::TYPE_COURSE) {
|
||||
$settingsnode = $this->page->settingsnav->find('courseadmin', navigation_node::TYPE_COURSE);
|
||||
if ($settingsnode) {
|
||||
// Build an action menu based on the visible nodes from this navigation tree.
|
||||
$this->build_action_menu_from_navigation($menu, $settingsnode, false, true);
|
||||
|
||||
$text = get_string('courseadministration');
|
||||
$url = new moodle_url('/course/admin.php', array('courseid' => $this->page->course->id));
|
||||
|
Loading…
x
Reference in New Issue
Block a user