Skip to content

Commit

Permalink
MDL-49689 navigation: Allow the user to set their homepage.
Browse files Browse the repository at this point in the history
Part of MDL-45774.
  • Loading branch information
abgreeve committed Apr 13, 2015
1 parent 7232452 commit d9926e8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
17 changes: 13 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,19 @@
} 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);
}
}
}

Expand Down
6 changes: 4 additions & 2 deletions my/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@
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);
}
}
}
Expand Down

0 comments on commit d9926e8

Please sign in to comment.