public function action_savetabs() { require_once 'include/SubPanel/SubPanelDefinitions.php'; require_once 'modules/MySettings/TabController.php'; global $current_user, $app_strings, $modInvisList; if (!is_admin($current_user)) { sugar_die($app_strings['ERR_NOT_ADMIN']); } // handle the tabs listing $toDecode = html_entity_decode($_REQUEST['enabled_tabs'], ENT_QUOTES); $enabled_tabs = json_decode($toDecode); // Add Home back in so that it always appears first in Sugar 7 array_unshift($enabled_tabs, 'Home'); $tabs = new TabController(); $tabs->set_system_tabs($enabled_tabs); $tabs->setPortalTabs(array_values(array_intersect($enabled_tabs, $tabs->getAllPortalTabs()))); $tabs->set_users_can_edit(isset($_REQUEST['user_edit_tabs']) && $_REQUEST['user_edit_tabs'] == 1); // handle the subpanels if (isset($_REQUEST['disabled_tabs'])) { $disabledTabs = json_decode(html_entity_decode($_REQUEST['disabled_tabs'], ENT_QUOTES)); $disabledTabsKeyArray = TabController::get_key_array($disabledTabs); //Never show Project subpanels if Project module is hidden if (!in_array('project', $disabledTabsKeyArray) && in_array('Project', $modInvisList)) { $disabledTabsKeyArray[] = 'project'; } // if RLI is hidden, always hide the RLI subpanel. if (!in_array('revenuelineitems', $disabledTabsKeyArray) && in_array('RevenueLineItems', $modInvisList)) { $disabledTabsKeyArray[] = 'revenuelineitems'; } SubPanelDefinitions::set_hidden_subpanels($disabledTabsKeyArray); } // Only rebuild the relevent metadata sections. MetaDataManager::refreshSectionCache(MetaDataManager::MM_MODULESINFO, array('base')); MetaDataManager::refreshSectionCache(MetaDataManager::MM_HIDDENSUBPANELS, array('base')); if (!headers_sent()) { header("Location: index.php?module=Administration&action=ConfigureTabs"); } }