/**
  * @see SugarView::display()
  */
 public function display()
 {
     global $mod_strings;
     global $app_list_strings;
     global $app_strings;
     require_once "modules/MySettings/TabController.php";
     $controller = new TabController();
     $tabs = $controller->get_tabs_system();
     $enabled = [];
     foreach ($tabs[0] as $key => $value) {
         $enabled[] = ["module" => $key, 'label' => translate($key)];
     }
     $disabled = [];
     foreach ($tabs[1] as $key => $value) {
         $disabled[] = ["module" => $key, 'label' => translate($key)];
     }
     $user_can_edit = $controller->get_users_can_edit();
     $this->ss->assign('APP', $GLOBALS['app_strings']);
     $this->ss->assign('MOD', $GLOBALS['mod_strings']);
     $this->ss->assign('user_can_edit', $user_can_edit);
     $this->ss->assign('enabled_tabs', json_encode($enabled));
     $this->ss->assign('disabled_tabs', json_encode($disabled));
     $this->ss->assign('title', $this->getModuleTitle(false));
     //get list of all subpanels and panels to hide
     $mod_list_strings_key_to_lower = array_change_key_case($app_list_strings['moduleList']);
     $panels_arr = SubPanelDefinitions::get_all_subpanels();
     $hidpanels_arr = SubPanelDefinitions::get_hidden_subpanels();
     if (!$hidpanels_arr || !is_array($hidpanels_arr)) {
         $hidpanels_arr = [];
     }
     //create array of subpanels to show, used to create Drag and Drop widget
     $enabled = [];
     foreach ($panels_arr as $key) {
         if (empty($key)) {
             continue;
         }
         $key = strtolower($key);
         $enabled[] = ["module" => $key, "label" => $mod_list_strings_key_to_lower[$key]];
     }
     //now create array of subpanels to hide for use in Drag and Drop widget
     $disabled = [];
     foreach ($hidpanels_arr as $key) {
         if (empty($key)) {
             continue;
         }
         $key = strtolower($key);
         $disabled[] = ["module" => $key, "label" => $mod_list_strings_key_to_lower[$key]];
     }
     $this->ss->assign('enabled_panels', json_encode($enabled));
     $this->ss->assign('disabled_panels', json_encode($disabled));
     echo $this->ss->fetch('modules/Administration/templates/ConfigureTabs.tpl');
 }
 /**
  * Examine the application to determine which modules have been enabled..
  *
  * @param array $availModules An array of all the modules the user already has access to.
  * @return array Modules enabled within the application.
  */
 function get_visible_modules($availModules)
 {
     require_once "modules/MySettings/TabController.php";
     $controller = new TabController();
     $tabs = $controller->get_tabs_system();
     return $this->getModulesFromList($tabs[0], $availModules);
 }
Пример #3
0
 /**
  * Examine the application to determine which modules have been enabled..
  *
  * @param array $availModules An array of all the modules the user already has access to.
  * @return array Modules enabled within the application.
  */
 function get_visible_modules($availModules)
 {
     require_once "modules/MySettings/TabController.php";
     $controller = new TabController();
     $tabs = $controller->get_tabs_system();
     $enabled_modules = array();
     $availModulesKey = array_flip($availModules);
     foreach ($tabs[0] as $key => $value) {
         if (isset($availModulesKey[$key])) {
             $enabled_modules[] = $key;
         }
     }
     return $enabled_modules;
 }
Пример #4
0
/**
 * upgradeDisplayedTabsAndSubpanels
 *
 * @param $version String value of current system version (pre upgrade)
 */
function upgradeDisplayedTabsAndSubpanels($version)
{
    if ($version < '620') {
        logThis('start upgrading system displayed tabs and subpanels');
        require_once 'modules/MySettings/TabController.php';
        $tc = new TabController();
        //grab the existing system tabs
        $tabs = $tc->get_tabs_system();
        //add Calls, Meetings, Tasks, Notes, Prospects (Targets) and ProspectLists (Target Lists)
        //to displayed tabs unless explicitly set to hidden
        $modules_to_add = array('Calls', 'Meetings', 'Tasks', 'Notes', 'Prospects', 'ProspectLists');
        $added_tabs = array();
        foreach ($modules_to_add as $module) {
            $tabs[0][$module] = $module;
            $added_tabs[] = $module;
        }
        logThis('calling set_system_tabs on TabController to add tabs: ' . var_export($added_tabs, true));
        $tc->set_system_tabs($tabs[0]);
        logThis('finish upgrading system displayed tabs and subpanels');
    }
}
Пример #5
0
$chooser = new TemplateGroupChooser();
$controller = new TabController();
$chooser->args['id'] = 'edit_tabs';
if (isset($_REQUEST['record'])) {
    $chooser->args['values_array'][0] = $focus->query_modules(1);
    $chooser->args['values_array'][1] = $focus->query_modules(0);
    foreach ($chooser->args['values_array'][0] as $key => $value) {
        $chooser->args['values_array'][0][$value] = $app_list_strings['moduleList'][$value];
        unset($chooser->args['values_array'][0][$key]);
    }
    foreach ($chooser->args['values_array'][1] as $key => $value) {
        $chooser->args['values_array'][1][$value] = $app_list_strings['moduleList'][$value];
        unset($chooser->args['values_array'][1][$key]);
    }
} else {
    $chooser->args['values_array'] = $controller->get_tabs_system();
    foreach ($chooser->args['values_array'][0] as $key => $value) {
        $chooser->args['values_array'][0][$key] = $app_list_strings['moduleList'][$key];
    }
    foreach ($chooser->args['values_array'][1] as $key => $value) {
        $chooser->args['values_array'][1][$key] = $app_list_strings['moduleList'][$key];
    }
}
$chooser->args['left_name'] = 'display_tabs';
$chooser->args['right_name'] = 'hide_tabs';
$chooser->args['left_label'] = $mod_strings['LBL_ALLOWED_MODULES'];
$chooser->args['right_label'] = $mod_strings['LBL_DISALLOWED_MODULES'];
$chooser->args['title'] = $mod_strings['LBL_ASSIGN_MODULES'];
$xtpl->assign("TAB_CHOOSER", $chooser->display());
$xtpl->parse("main");
$xtpl->out("main");
Пример #6
0
/**
 * Helper function for this file.
 */
function getAllowedReportModules(&$local_modListHeader, $skipCache = false)
{
    static $reports_mod = null;
    if (isset($reports_mod) && !$skipCache) {
        return $reports_mod;
    }
    require_once "modules/MySettings/TabController.php";
    $controller = new TabController();
    $tabs = $controller->get_tabs_system();
    $all_modules = array_merge($tabs[0], $tabs[1]);
    if (!is_array($all_modules)) {
        return array();
    }
    global $report_map, $beanList, $report_include_modules;
    if (empty($beanList)) {
        require 'include/modules.php';
    }
    $report_modules = array();
    $subModuleCheckArray = array("Tasks", "Calls", "Meetings", "Notes");
    $subModuleProjectArray = array("ProjectTask");
    foreach ($beanList as $key => $value) {
        if (isset($all_modules[$key])) {
            $report_modules[$key] = $value;
        }
        //need to include subpanel only modules
        if (!empty($report_include_modules[$key])) {
            $report_modules[$key] = $value;
        }
        if (in_array($key, $subModuleCheckArray) && (array_key_exists("Calendar", $all_modules) || array_key_exists("Activities", $all_modules))) {
            $report_modules[$key] = $value;
        }
        if (in_array($key, $subModuleProjectArray) && array_key_exists("Project", $all_modules)) {
            $report_modules[$key] = $value;
        }
        if ($key == 'Users' || $key == 'Teams' || $key == 'EmailAddresses') {
            $report_modules[$key] = $value;
        }
        if ($key == 'Releases' || $key == 'CampaignLog' || $key == 'Manufacturers') {
            $report_modules[$key] = $value;
        }
    }
    global $beanFiles;
    // Bug 38864 - Parse the reportmoduledefs.php file for a list of modules we should include or disclude from this list
    //             Provides contents of $exemptModules and $additionalModules arrays
    $exemptModules = array();
    $additionalModules = array();
    foreach (SugarAutoLoader::existingCustom('modules/Reports/metadata/reportmodulesdefs.php') as $file) {
        include $file;
    }
    foreach ($report_modules as $module => $class_name) {
        if (!isset($beanFiles[$class_name]) || in_array($module, $exemptModules)) {
            unset($report_modules[$module]);
        }
    }
    foreach ($additionalModules as $module) {
        if (isset($beanList[$module])) {
            $report_modules[$module] = $beanList[$module];
        }
    }
    if (should_hide_iframes() && isset($report_modules['iFrames'])) {
        unset($report_modules['iFrames']);
    }
    return $report_modules;
}
 ********************************************************************************/
require_once 'modules/Administration/Forms.php';
global $mod_strings;
global $app_list_strings;
global $app_strings;
global $current_user;
if (!is_admin($current_user)) {
    sugar_die("Unauthorized access to administration.");
}
$title = get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_MODULE_NAME'] . ": " . $mod_strings['LBL_CONFIGURE_TABS'], true);
global $theme;
global $currentModule;
$GLOBALS['log']->info("Administration ConfigureTabs view");
require_once "modules/MySettings/TabController.php";
$controller = new TabController();
$tabs = $controller->get_tabs_system();
$groups = array();
$groups[$mod_strings['LBL_DISPLAY_TABS']] = array();
foreach ($tabs[0] as $key => $value) {
    $groups[$mod_strings['LBL_DISPLAY_TABS']][$key] = array('label' => '<span>' . $app_list_strings['moduleList'][$key] . '</span>');
}
$groups[$mod_strings['LBL_HIDE_TABS']] = array();
foreach ($tabs[1] as $key => $value) {
    $groups[$mod_strings['LBL_HIDE_TABS']][$key] = array('label' => $app_list_strings['moduleList'][$key]);
}
global $app_list_strings, $app_strings;
$smarty = new Sugar_Smarty();
$user_can_edit = $controller->get_users_can_edit();
$smarty->assign('APP', $GLOBALS['app_strings']);
$smarty->assign('MOD', $GLOBALS['mod_strings']);
$smarty->assign('title', $title);
Пример #8
0
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     global $mod_strings;
     global $app_list_strings;
     global $app_strings;
     require_once "modules/MySettings/TabController.php";
     $controller = new TabController();
     $tabs = $controller->get_tabs_system();
     // Remove Home module from UI.  We add it back to front of display tab list on save.
     if (isset($tabs[0]['Home'])) {
         unset($tabs[0]['Home']);
     }
     if (isset($tabs[1]['Home'])) {
         unset($tabs[1]['Home']);
     }
     $enabled = array();
     foreach ($tabs[0] as $key => $value) {
         $enabled[] = array("module" => $key, 'label' => translate($key));
     }
     $disabled = array();
     foreach ($tabs[1] as $key => $value) {
         $disabled[] = array("module" => $key, 'label' => translate($key));
     }
     $user_can_edit = $controller->get_users_can_edit();
     $this->ss->assign('APP', $GLOBALS['app_strings']);
     $this->ss->assign('MOD', $GLOBALS['mod_strings']);
     $this->ss->assign('user_can_edit', $user_can_edit);
     $this->ss->assign('enabled_tabs', json_encode($enabled));
     $this->ss->assign('disabled_tabs', json_encode($disabled));
     $this->ss->assign('title', $this->getModuleTitle(false));
     //get list of all subpanels and panels to hide
     $mod_list_strings_key_to_lower = array_change_key_case($app_list_strings['moduleList']);
     $panels_arr = SubPanelDefinitions::get_all_subpanels();
     $hidpanels_arr = SubPanelDefinitions::get_hidden_subpanels();
     if (!$hidpanels_arr || !is_array($hidpanels_arr)) {
         $hidpanels_arr = array();
     }
     //create array of subpanels to show, used to create Drag and Drop widget
     $enabled = array();
     foreach ($panels_arr as $key) {
         if (empty($key)) {
             continue;
         }
         $key = strtolower($key);
         $enabled[] = array("module" => $key, "label" => $mod_list_strings_key_to_lower[$key]);
     }
     //now create array of subpanels to hide for use in Drag and Drop widget
     $disabled = array();
     foreach ($hidpanels_arr as $key) {
         if (empty($key)) {
             continue;
         }
         $key = strtolower($key);
         // we need this here for with RLI's are disabled as they shouldn't be seen in the list
         if ($key == 'revenuelineitems' && in_array('RevenueLineItems', $GLOBALS['modInvisList'])) {
             continue;
         }
         $disabled[] = array("module" => $key, "label" => $mod_list_strings_key_to_lower[$key]);
     }
     $this->ss->assign('enabled_panels', json_encode($enabled));
     $this->ss->assign('disabled_panels', json_encode($disabled));
     echo $this->ss->fetch('modules/Administration/templates/ConfigureTabs.tpl');
 }