Commit a1ad5685 authored by Robert Lyon's avatar Robert Lyon

Bug 1852020: Cache nav menu for mobile different to desktop

As the menus are slightly different - the mobile one doesn't have
import/export menu items

behat not needed

Change-Id: Ia84f68cbe12a5a6555b7e2e378b44b41875b9328
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent fc073b25
......@@ -2974,35 +2974,35 @@ function mahara_standard_nav() {
* @return array
*/
function main_nav($type = null) {
global $USER;
global $USER, $SESSION;
$language = current_language();
$cachemenu = false;
// Get the first institution
$institution = $USER->get_primary_institution();
$menutype = '';
$menutype = $SESSION->get('handheld_device') ? 'mob_' : '';
if ($type == 'adminnav') {
global $USER, $SESSION;
if ($USER->get('admin')) {
$menutype = 'admin_nav';
$menutype .= 'admin_nav';
if (!($cachemenu = get_config_institution($institution, $menutype . '_' . $language))) {
$menu = admin_nav();
}
}
else if ($USER->get('staff')) {
$menutype = 'staff_nav';
$menutype .= 'staff_nav';
if (!($cachemenu = get_config_institution($institution, $menutype . '_' . $language))) {
$menu = staff_nav();
}
}
else if ($USER->is_institutional_admin()) {
$menutype = 'instadmin_nav';
$menutype .= 'instadmin_nav';
if (!($cachemenu = get_config_institution($institution, $menutype . '_' . $language))) {
$menu = institutional_admin_nav();
}
}
else {
$menutype = 'inststaff_nav';
$menutype .= 'inststaff_nav';
if (!($cachemenu = get_config_institution($institution, $menutype . '_' . $language))) {
$menu = institutional_staff_nav();
}
......@@ -3010,7 +3010,7 @@ function main_nav($type = null) {
}
else {
// Build the menu structure for the site
$menutype = 'standard_nav';
$menutype .= 'standard_nav';
if (!($cachemenu = get_config_institution($institution, $menutype . '_' . $language))) {
$menu = mahara_standard_nav();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment