mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-49689 navigation: Allow the user to set their homepage.
Part of MDL-45774.
This commit is contained in:
parent
72324523ad
commit
d9926e8664
17
index.php
17
index.php
@ -71,10 +71,19 @@ if (get_home_page() != HOMEPAGE_SITE) {
|
||||
} else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_MY) && $redirect === 1) {
|
||||
redirect($CFG->wwwroot .'/my/');
|
||||
} else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_USER)) {
|
||||
$PAGE->settingsnav->find('usercurrentsettings', null)->add(
|
||||
get_string('makethismyhome'),
|
||||
new moodle_url('/', array('setdefaulthome' => true)),
|
||||
navigation_node::TYPE_SETTING);
|
||||
$frontpagenode = $PAGE->settingsnav->find('frontpage', null);
|
||||
if ($frontpagenode) {
|
||||
$frontpagenode->add(
|
||||
get_string('makethismyhome'),
|
||||
new moodle_url('/', array('setdefaulthome' => true)),
|
||||
navigation_node::TYPE_SETTING);
|
||||
} else {
|
||||
$frontpagenode = $PAGE->settingsnav->add(get_string('frontpagesettings'), null, navigation_node::TYPE_SETTING, null);
|
||||
$frontpagenode->force_open();
|
||||
$frontpagenode->add(get_string('makethismyhome'),
|
||||
new moodle_url('/', array('setdefaulthome' => true)),
|
||||
navigation_node::TYPE_SETTING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,8 +90,10 @@ if (!isguestuser()) { // Skip default home page for guests
|
||||
if (optional_param('setdefaulthome', false, PARAM_BOOL)) {
|
||||
set_user_preference('user_home_page_preference', HOMEPAGE_MY);
|
||||
} else if (!empty($CFG->defaulthomepage) && $CFG->defaulthomepage == HOMEPAGE_USER) {
|
||||
$PAGE->settingsnav->find('usercurrentsettings', null)->add(get_string('makethismyhome'),
|
||||
new moodle_url('/my/', array('setdefaulthome' => true)), navigation_node::TYPE_SETTING);
|
||||
$frontpagenode = $PAGE->settingsnav->add(get_string('frontpagesettings'), null, navigation_node::TYPE_SETTING, null);
|
||||
$frontpagenode->force_open();
|
||||
$frontpagenode->add(get_string('makethismyhome'), new moodle_url('/my/', array('setdefaulthome' => true)),
|
||||
navigation_node::TYPE_SETTING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user