コード例 #1
0
function UpdateSystemTabs($action, $installed_modules)
{
    require_once "modules/MySettings/TabController.php";
    $controller = new TabController();
    $isSystemTabsInDB = $controller->is_system_tabs_in_db();
    if ($isSystemTabsInDB && !empty($installed_modules)) {
        global $moduleList;
        switch ($action) {
            case 'Restore':
                $currentTabs = $controller->get_system_tabs();
                foreach ($installed_modules as $module) {
                    if (in_array($module, $currentTabs)) {
                        unset($currentTabs[$module]);
                    }
                }
                $controller->set_system_tabs($currentTabs);
                break;
            case 'Add':
                $currentTabs = $controller->get_system_tabs();
                foreach ($installed_modules as $module) {
                    if (!in_array($module, $currentTabs)) {
                        $currentTabs[$module] = $module;
                    }
                }
                $controller->set_system_tabs($currentTabs);
            default:
                break;
        }
    }
}
コード例 #2
0
 /**
  * Updates systems tabs
  *
  * @param string $action The action to take
  * @param array $installed_modules The list of modules to add for this action
  */
 protected function updateSystemTabs($action, $installed_modules)
 {
     global $moduleList;
     $controller = new TabController();
     $isSystemTabsInDB = $controller->is_system_tabs_in_db();
     if ($isSystemTabsInDB && !empty($installed_modules)) {
         switch ($action) {
             case 'Restore':
                 $currentTabs = $controller->get_system_tabs();
                 foreach ($installed_modules as $module) {
                     if (in_array($module, $currentTabs)) {
                         unset($currentTabs[$module]);
                     }
                 }
                 $controller->set_system_tabs($currentTabs);
                 break;
             case 'Add':
                 $currentTabs = $controller->get_system_tabs();
                 foreach ($installed_modules as $module) {
                     if (!in_array($module, $currentTabs)) {
                         $currentTabs[$module] = $module;
                     }
                 }
                 $controller->set_system_tabs($currentTabs);
                 break;
         }
         if (isset($_SESSION['get_workflow_admin_modules_for_user'])) {
             return $_SESSION['get_workflow_admin_modules_for_user'];
         }
     }
 }