if (!isset($_SESSION['logged_from_id'])) { $_SESSION['user_theme_color'] = $_POST['layoutColor']; set_page_message(tr('Layout color successfully updated.'), 'success'); } else { set_page_message(tr("Customer's layout color successfully updated."), 'success'); } } else { set_page_message(tr('Unknown layout color.'), 'error'); } } elseif ($_POST['uaction'] == 'changeShowLabels') { layout_setMainMenuLabelsVisibility($_SESSION['user_id'], clean_input($_POST['mainMenuShowLabels'])); set_page_message(tr('Main menu labels visibility successfully updated.'), 'success'); } else { set_page_message(tr('Unknown action: %s', tohtml($_POST['uaction'])), 'error'); } } $html_selected = $cfg->HTML_SELECTED; $userId = $_SESSION['user_id']; if (layout_isMainMenuLabelsVisible($userId)) { $tpl->assign(array('MAIN_MENU_SHOW_LABELS_ON' => $html_selected, 'MAIN_MENU_SHOW_LABELS_OFF' => '')); } else { $tpl->assign(array('MAIN_MENU_SHOW_LABELS_ON' => '', 'MAIN_MENU_SHOW_LABELS_OFF' => $html_selected)); } $tpl->assign(array('TR_PAGE_TITLE' => tr('Client / Profile / Layout'), 'TR_LAYOUT_COLOR' => tr('Layout color'), 'TR_CHOOSE_LAYOUT_COLOR' => tr('Choose layout color'), 'TR_ENABLED' => tr('Enabled'), 'TR_DISABLED' => tr('Disabled'), 'TR_UPDATE' => tr('Update'), 'TR_OTHER_SETTINGS' => tr('Other settings'), 'TR_MAIN_MENU_SHOW_LABELS' => tr('Show labels for main menu links'))); generateNavigation($tpl); client_generateLayoutColorForm($tpl); generatePageMessage($tpl); $tpl->parse('LAYOUT_CONTENT', 'page'); iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onClientScriptEnd, array('templateEngine' => $tpl)); $tpl->prnt(); unsetMessages();
/** * Sets main menu visibility for current environment * * @return void */ function layout_setMainMenuLabelsVisibilityEvt() { if (!isset($_SESSION['show_main_menu_labels']) && isset($_SESSION['user_type'])) { $userId = isset($_SESSION['logged_from_id']) ? $_SESSION['logged_from_id'] : $_SESSION['user_id']; $_SESSION['show_main_menu_labels'] = layout_isMainMenuLabelsVisible($userId); } }