function query_module_access_list(&$user)
{
    require_once 'modules/MySettings/TabController.php';
    $controller = new TabController();
    $tabArray = $controller->get_tabs($user);
    return $tabArray[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();
     $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');
 }
 /**
  * This function loads portal config vars from db and sets them for the view
  * @see SugarView::display() for more info
  */
 function display()
 {
     $portalFields = array('appStatus' => 'offline', 'logoURL' => '', 'maxQueryResult' => '20', 'maxSearchQueryResult' => '5', 'defaultUser' => '');
     $userList = get_user_array();
     $userList[''] = '';
     require_once "modules/MySettings/TabController.php";
     $controller = new TabController();
     $disabledModulesFlag = false;
     $disabledModules = array_diff($controller->getAllPortalTabs(), $controller->getPortalTabs());
     if (!empty($disabledModules)) {
         $disabledModulesFlag = true;
         array_walk($disabledModules, function (&$item) {
             $item = translate($item);
         });
     }
     $admin = Administration::getSettings();
     $portalConfig = $admin->getConfigForModule('portal', 'support', true);
     $portalConfig['appStatus'] = !empty($portalConfig['on']) ? 'online' : 'offline';
     $smarty = new Sugar_Smarty();
     $smarty->assign('disabledDisplayModulesList', $disabledModules);
     $smarty->assign('disabledDisplayModules', $disabledModulesFlag);
     foreach ($portalFields as $fieldName => $fieldDefault) {
         if (isset($portalConfig[$fieldName])) {
             $smarty->assign($fieldName, html_entity_decode($portalConfig[$fieldName]));
         } else {
             $smarty->assign($fieldName, $fieldDefault);
         }
     }
     $smarty->assign('userList', $userList);
     $smarty->assign('welcome', $GLOBALS['mod_strings']['LBL_SYNCP_WELCOME']);
     $smarty->assign('mod', $GLOBALS['mod_strings']);
     $smarty->assign('siteURL', $GLOBALS['sugar_config']['site_url']);
     if (isset($_REQUEST['label'])) {
         $smarty->assign('label', $_REQUEST['label']);
     }
     $options = !empty($GLOBALS['system_config']->settings['system_portal_url']) ? $GLOBALS['system_config']->settings['system_portal_url'] : 'https://';
     $smarty->assign('options', $options);
     $ajax = new AjaxCompose();
     $ajax->addCrumb(translate('LBL_SUGARPORTAL', 'ModuleBuilder'), 'ModuleBuilder.main("sugarportal")');
     $ajax->addCrumb(ucwords(translate('LBL_PORTAL_CONFIGURE')), '');
     $ajax->addSection('center', translate('LBL_SUGARPORTAL', 'ModuleBuilder'), $smarty->fetch('modules/ModuleBuilder/tpls/portalconfig.tpl'));
     $GLOBALS['log']->debug($smarty->fetch('modules/ModuleBuilder/tpls/portalconfig.tpl'));
     echo $ajax->getJavascript();
 }
 public function run()
 {
     if (!($this->from_flavor == 'ce' && $this->toFlavor('pro'))) {
         return;
     }
     //check to see if there are any new files that need to be added to systems tab
     //retrieve old modules list
     $this->log('check to see if new modules exist');
     if (empty($this->state['old_modules'])) {
         $this->log('No old modules info, skipping it');
         return;
     } else {
         $oldModuleList = $this->state['old_modules'];
     }
     $newModuleList = array();
     include 'include/modules.php';
     $newModuleList = $moduleList;
     //include tab controller
     require_once 'modules/MySettings/TabController.php';
     $newTB = new TabController();
     //make sure new modules list has a key we can reference directly
     $newModuleList = $newTB->get_key_array($newModuleList);
     $oldModuleList = $newTB->get_key_array($oldModuleList);
     //iterate through list and remove commonalities to get new modules
     foreach ($newModuleList as $remove_mod) {
         if (in_array($remove_mod, $oldModuleList)) {
             unset($newModuleList[$remove_mod]);
         }
     }
     $must_have_modules = array('Activities' => 'Activities', 'Calendar' => 'Calendar', 'Reports' => 'Reports', 'Quotes' => 'Quotes', 'Products' => 'Products', 'Forecasts' => 'Forecasts', 'Contracts' => 'Contracts', 'KBDocuments' => 'KBDocuments');
     $newModuleList = array_merge($newModuleList, $must_have_modules);
     //new modules list now has left over modules which are new to this install, so lets add them to the system tabs
     $this->log('new modules to add are ' . var_export($newModuleList, true));
     //grab the existing system tabs
     $tabs = $newTB->get_system_tabs();
     //add the new tabs to the array
     foreach ($newModuleList as $nm) {
         $tabs[$nm] = $nm;
     }
     //now assign the modules to system tabs
     $newTB->set_system_tabs($tabs);
     $this->log('module tabs updated');
 }
 /**
  * Sets up Portal.
  *
  * @param array $settings (optional) the array of portal settings.
  */
 public function setUpPortal(array $settings = array())
 {
     // Initialize `MySettings_tab` (setting containing the list of module
     // tabs) if not set.
     $tabController = new TabController();
     $tabController->getPortalTabs();
     $portalFields = array('defaultUser', 'appName', 'logoURL', 'serverUrl', 'maxQueryResult', 'maxSearchQueryResult');
     $portalConfig = $this->getDefaultPortalSettings();
     foreach ($portalFields as $field) {
         if (isset($settings[$field])) {
             $portalConfig[$field] = $settings[$field];
         }
     }
     $portalConfig['appStatus'] = 'online';
     $portalConfig['on'] = 1;
     $this->savePortalSettings($portalConfig);
     $this->setUpUser();
     $this->refreshCache();
 }
 public function run()
 {
     if ($this->fromFlavor('ent') && version_compare($this->from_version, '7.6.0', '>=')) {
         return;
     }
     //include tab controller
     require_once 'modules/MySettings/TabController.php';
     $newTB = new TabController();
     $must_have_modules = array('pmse_Project', 'pmse_Inbox', 'pmse_Business_Rules', 'pmse_Emails_Templates');
     //grab the existing system tabs
     $tabs = $newTB->get_system_tabs();
     //add the new tabs to the array
     foreach ($must_have_modules as $nm) {
         $tabs[$nm] = $nm;
     }
     //now assign the modules to system tabs
     $newTB->set_system_tabs($tabs);
     $this->log('module tabs updated with pmse');
 }
Exemple #7
0
 function __construct($view_class = null)
 {
     if ($view_class === null) {
         $view_class = "PlacesView";
     }
     $this->session = Project::getSession();
     parent::__construct($view_class);
     $this->_view->assign('tab_list', TabController::getOwnTabs(true));
     $this->user = Project::getUser()->getShowedUser();
     $this->_view->assign('user_profile', $this->user->data());
     $this->_view->assign('session', $this->session);
     $this->_view->assign('user_default_avatar', $this->user->getUserAvatar($this->user->id));
 }
Exemple #8
0
 public function action_savetabs()
 {
     require_once 'include/SubPanel/SubPanelDefinitions.php';
     require_once 'modules/MySettings/TabController.php';
     global $current_user, $app_strings;
     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);
     $tabs = new TabController();
     $tabs->set_system_tabs($enabled_tabs);
     $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);
         SubPanelDefinitions::set_hidden_subpanels($disabledTabsKeyArray);
     }
     header("Location: index.php?module=Administration&action=ConfigureTabs");
 }
Exemple #9
0
 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");
     }
 }
 function BaseBlogData(&$info)
 {
     $request = Project::getRequest();
     $request_user_id = (int) Project::getUser()->getShowedUser()->id;
     if ($request_user_id <= 0) {
         Project::getResponse()->redirect($request->createUrl('Index', 'Index', null, false));
     }
     $user_id = (int) Project::getUser()->getDbUser()->id;
     if ($request_user_id === $user_id) {
         $v = new BlogViewSocieties();
         $v->ControlPanel();
         $info['control_panel'] = $v->parse();
         $info['blog_owner'] = true;
     } else {
         $info['control_panel'] = null;
         $info['blog_owner'] = false;
     }
     $info['tab_list'] = TabController::getOwnTabs(false, false, false, false, false, false, false, true);
     // User blog tree
     $blog_model = Project::getUser()->getShowedUser()->getBlogSocieties();
     $tree_model = new BlogTreeModelSocieties();
     $info['branch_list'] = $tree_model->getBranchList($blog_model->id, $user_id);
     $info['blog_info']['title'] = $blog_model->title;
 }
Exemple #11
0
 }
 if (isset($_POST['user_subpanel_tabs'])) {
     $focus->setPreference('subpanel_tabs', $_POST['user_subpanel_tabs'], 0, 'global');
 } else {
     $focus->setPreference('subpanel_tabs', '', 0, 'global');
 }
 if (isset($_POST['user_theme'])) {
     $focus->setPreference('user_theme', $_POST['user_theme'], 0, 'global');
     $_SESSION['authenticated_user_theme'] = $_POST['user_theme'];
 }
 if (isset($_POST['user_module_favicon'])) {
     $focus->setPreference('module_favicon', $_POST['user_module_favicon'], 0, 'global');
 } else {
     $focus->setPreference('module_favicon', '', 0, 'global');
 }
 $tabs = new TabController();
 if (isset($_POST['display_tabs'])) {
     $tabs->set_user_tabs($DISPLAY_ARR['display_tabs'], $focus, 'display');
 }
 if (isset($HIDE_ARR['hide_tabs'])) {
     $tabs->set_user_tabs($HIDE_ARR['hide_tabs'], $focus, 'hide');
 } else {
     $tabs->set_user_tabs(array(), $focus, 'hide');
 }
 if (is_admin($current_user)) {
     if (isset($REMOVE_ARR['remove_tabs'])) {
         $tabs->set_user_tabs($REMOVE_ARR['remove_tabs'], $focus, 'remove');
     } else {
         $tabs->set_user_tabs(array(), $focus, 'remove');
     }
 }
Exemple #12
0
 function LastListAction($info = array())
 {
     $this->BaseSiteData();
     $info['tab_list'] = TabController::getMainAlbumTabs(false, true, false);
     $request_user_id = (int) Project::getUser()->getShowedUser()->id;
     $user_id = (int) Project::getUser()->getDbUser()->id;
     $album_id = isset($album_id) && (int) $album_id > 0 ? $album_id : (int) Project::getRequest()->getKeyByNumber(0);
     $this->BaseAlbumData($info, $album_id);
     $photo_model = new PhotoModel();
     $pager = new DbPager(Project::getRequest()->getValueByNumber(1), $this->getParam('last_photo_per_page', self::DEFAULT_PHOTO_PER_PAGE));
     $photo_model->setPager($pager);
     $list = $photo_model->loadAll($request_user_id, $album_id);
     $this->checkImages($list);
     $info['photo_list'] = $list;
     $info['list_pager'] = $photo_model->getPager();
     $info['list_controller'] = 'Photo';
     $info['list_action'] = 'Album';
     $info['list_user'] = null;
     $this->_view->LastList($info);
     $this->_view->parse();
 }
Exemple #13
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');
    }
}
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;
        }
    }
}
Exemple #15
0
function addNewSystemTabsFromUpgrade($from_dir)
{
    global $path;
    if (isset($_SESSION['upgrade_from_flavor'])) {
        //check to see if there are any new files that need to be added to systems tab
        //retrieve old modules list
        logThis('check to see if new modules exist', $path);
        $oldModuleList = array();
        $newModuleList = array();
        include $from_dir . '/include/modules.php';
        $oldModuleList = $moduleList;
        include 'include/modules.php';
        $newModuleList = $moduleList;
        //include tab controller
        require_once 'modules/MySettings/TabController.php';
        $newTB = new TabController();
        //make sure new modules list has a key we can reference directly
        $newModuleList = $newTB->get_key_array($newModuleList);
        $oldModuleList = $newTB->get_key_array($oldModuleList);
        //iterate through list and remove commonalities to get new modules
        foreach ($newModuleList as $remove_mod) {
            if (in_array($remove_mod, $oldModuleList)) {
                unset($newModuleList[$remove_mod]);
            }
        }
        //new modules list now has left over modules which are new to this install, so lets add them to the system tabs
        logThis('new modules to add are ' . var_export($newModuleList, true), $path);
        //grab the existing system tabs
        $tabs = $newTB->get_system_tabs();
        //add the new tabs to the array
        foreach ($newModuleList as $nm) {
            $tabs[$nm] = $nm;
        }
        //now assign the modules to system tabs
        $newTB->set_system_tabs($tabs);
        logThis('module tabs updated', $path);
    }
}
Exemple #16
0
if (isset($_REQUEST['return_id'])) {
    $xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
}
// handle Create $module then Cancel
if (empty($_REQUEST['return_id'])) {
    $xtpl->assign("RETURN_ACTION", 'index');
}
$xtpl->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']);
$xtpl->assign("JAVASCRIPT", get_set_focus_js() . get_chooser_js() . get_validate_record_js());
$xtpl->assign("ID", $focus->id);
$xtpl->assign("NAME", $focus->name);
$xtpl->assign("DESCRIPTION", $focus->description);
require_once "include/templates/TemplateGroupChooser.php";
require_once "modules/MySettings/TabController.php";
$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) {
Exemple #17
0
 public function AddSubjectAction()
 {
     //$request = Project::getRequest();
     $data = array();
     $this->BaseSiteData();
     $article_model = new ArticleModel();
     $data['tab_list'] = TabController::getMainArticleTabs(false, false, false, true);
     if (count($article_model->loadByParentId(0, array(ARTICLE_COMPETITION_STATUS::NEW_ARTICLE), Project::getUser()->getDbUser()->id)) >= 5) {
         $data['message'] = "Нельзя добавить больше 5 тем за конкурс";
         $data['active'] = false;
     } else {
         $data['active'] = true;
         $n = Node::by_key('', 'articles_tree');
         $data['tree'] = $n->getBranch();
     }
     $this->_view->AddSubject($data);
     $this->_view->parse();
 }
 function getParentModulesOfSubpanel($subpanel)
 {
     global $moduleList, $beanFiles, $beanList, $module;
     //use tab controller function to get module list with named keys
     require_once "modules/MySettings/TabController.php";
     require_once "include/SubPanel/SubPanelDefinitions.php";
     $modules_to_check = TabController::get_key_array($moduleList);
     //change case to match subpanel processing later on
     $modules_to_check = array_change_key_case($modules_to_check);
     $spd = '';
     $spd_arr = array();
     //iterate through modules and build subpanel array
     foreach ($modules_to_check as $mod_name) {
         //skip if module name is not in bean list, otherwise get the bean class name
         if (!isset($beanList[$mod_name])) {
             continue;
         }
         $class = $beanList[$mod_name];
         //skip if class name is not in file list, otherwise require the bean file and create new class
         if (!isset($beanFiles[$class]) || !file_exists($beanFiles[$class])) {
             continue;
         }
         //retrieve subpanels for this bean
         require_once $beanFiles[$class];
         $bean_class = new $class();
         //create new subpanel definition instance and get list of tabs
         $spd = new SubPanelDefinitions($bean_class);
         if (isset($spd->layout_defs['subpanel_setup'][strtolower($subpanel)]['module'])) {
             $spd_arr[] = $mod_name;
         }
     }
     return $spd_arr;
 }
 /**
  * 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);
 }
    $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'EditView', 'field_to_name_array' => array('id' => 'reports_to_id', 'name' => 'reports_to_name'));
    $json = getJSONobj();
    $encoded_popup_request_data = $json->encode($popup_request_data);
    $xtpl->assign('encoded_popup_request_data', $encoded_popup_request_data);
    //
    ///////////////////////////////////////
    $reports_to_change_button_html = '<input type="button"' . " title=\"{$app_strings['LBL_SELECT_BUTTON_TITLE']}\"" . " accesskey=\"{$app_strings['LBL_SELECT_BUTTON_KEY']}\"" . " value=\"{$app_strings['LBL_SELECT_BUTTON_LABEL']}\"" . ' tabindex="5" class="button" name="btn1"' . " onclick='open_popup(\"Users\", 600, 400, \"\", true, false, {$encoded_popup_request_data});'" . "' />";
} else {
    $xtpl->assign('IS_ADMIN_DISABLED', 'disabled="disabled"');
}
$xtpl->assign('REPORTS_TO_CHANGE_BUTTON', $reports_to_change_button_html);
/* Module Tab Chooser */
require_once 'include/templates/TemplateGroupChooser.php';
require_once 'modules/MySettings/TabController.php';
$chooser = new TemplateGroupChooser();
$controller = new TabController();
echo "<script>SUGAR.tabChooser.freezeOptions('display_tabs', 'hide_tabs', 'Home');</script>";
if (is_admin($current_user)) {
    $chooser->display_hide_tabs = true;
    $chooser->display_third_tabs = true;
    $chooser->args['third_name'] = 'remove_tabs';
    $chooser->args['third_label'] = $mod_strings['LBL_REMOVED_TABS'];
    //$xtpl->parse("main.tabchooser");
}
if (is_admin($current_user) || $controller->get_users_can_edit()) {
    $chooser->display_hide_tabs = true;
} else {
    $chooser->display_hide_tabs = false;
}
$chooser->args['id'] = 'edit_tabs';
$chooser->args['values_array'] = $controller->get_tabs($focus);
Exemple #21
0
        $reset_pref_warning = $mod_strings['LBL_RESET_PREFERENCES_WARNING'];
        $reset_home_warning = $mod_strings['LBL_RESET_HOMEPAGE_WARNING'];
    } else {
        $reset_pref_warning = $mod_strings['LBL_RESET_PREFERENCES_WARNING_USER'];
        $reset_home_warning = $mod_strings['LBL_RESET_HOMEPAGE_WARNING_USER'];
    }
    $buttons .= "<input type='button' class='button' onclick='if(confirm(\"{$reset_pref_warning}\"))window.location=\"" . $_SERVER['PHP_SELF'] . '?' . $the_query_string . "&reset_preferences=true\";' value='" . $mod_strings['LBL_RESET_PREFERENCES'] . "' />";
    $buttons .= "&nbsp;<input type='button' class='button' onclick='if(confirm(\"{$reset_home_warning}\"))window.location=\"" . $_SERVER['PHP_SELF'] . '?' . $the_query_string . "&reset_homepage=true\";' value='" . $mod_strings['LBL_RESET_HOMEPAGE'] . "' />";
}
if (isset($buttons)) {
    $sugar_smarty->assign("BUTTONS", $buttons);
}
require_once "include/templates/TemplateGroupChooser.php";
require_once "modules/MySettings/TabController.php";
$chooser = new TemplateGroupChooser();
$controller = new TabController();
//if(is_admin($current_user) || $controller->get_users_can_edit())
if (is_admin($current_user) || $GLOBALS['current_user']->isAdminForModule('Users')) {
    $chooser->display_third_tabs = true;
    $chooser->args['third_name'] = 'remove_tabs';
    $chooser->args['third_label'] = $mod_strings['LBL_REMOVED_TABS'];
} elseif (!$controller->get_users_can_edit()) {
    $chooser->display_hide_tabs = false;
} else {
    $chooser->display_hide_tabs = true;
}
$chooser->args['id'] = 'edit_tabs';
$chooser->args['values_array'] = $controller->get_tabs($focus);
$chooser->args['left_name'] = 'display_tabs';
$chooser->args['right_name'] = 'hide_tabs';
$chooser->args['left_label'] = $mod_strings['LBL_DISPLAY_TABS'];
 protected function setupAdvancedTabNavSettings()
 {
     global $app_list_strings;
     /* Module Tab Chooser */
     require_once 'include/templates/TemplateGroupChooser.php';
     require_once 'modules/MySettings/TabController.php';
     $chooser = new TemplateGroupChooser();
     $controller = new TabController();
     if ($this->is_current_admin || $controller->get_users_can_edit()) {
         $chooser->display_hide_tabs = true;
     } else {
         $chooser->display_hide_tabs = false;
     }
     $chooser->args['id'] = 'edit_tabs';
     $chooser->args['values_array'] = $controller->get_tabs($this->bean);
     //Remove 'Home' module from tab configuration UI (we add it back in at top of display tabs on save)
     if (isset($chooser->args['values_array'][0]['Home'])) {
         unset($chooser->args['values_array'][0]['Home']);
     }
     if (isset($chooser->args['values_array'][1]['Home'])) {
         unset($chooser->args['values_array'][1]['Home']);
     }
     if (isset($chooser->args['values_array'][2]['Home'])) {
         unset($chooser->args['values_array'][2]['Home']);
     }
     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];
     }
     foreach ($chooser->args['values_array'][2] as $key => $value) {
         $chooser->args['values_array'][2][$key] = $app_list_strings['moduleList'][$key];
     }
     $chooser->args['left_name'] = 'display_tabs';
     $chooser->args['right_name'] = 'hide_tabs';
     $chooser->args['left_label'] = translate('LBL_DISPLAY_TABS', 'Users');
     $chooser->args['right_label'] = translate('LBL_HIDE_TABS', 'Users');
     require_once 'include/SugarSmarty/plugins/function.sugar_help.php';
     $chooser->args['title'] = translate('LBL_EDIT_TABS', 'Users') . smarty_function_sugar_help(array("text" => translate('LBL_CHOOSE_WHICH', 'Users')), $ss);
     $this->ss->assign('TAB_CHOOSER', $chooser->display());
     $this->ss->assign('CHOOSER_SCRIPT', 'set_chooser();');
     $this->ss->assign('CHOOSE_WHICH', translate('LBL_CHOOSE_WHICH', 'Users'));
 }
Exemple #23
0
 /**
  *  Action: Открытие формы создания соц.позиции
  */
 public function SocialPosAddAction()
 {
     $v_request = Project::getRequest();
     $data = array();
     $data['action'] = 'SocialPosAdd';
     $v_current_userID = Project::getUser()->getDbUser()->id;
     // ID залогиненного пользователя
     $v_sp_model = new SocialModel();
     $data['arr_social_tree_criteria'] = $v_sp_model->loadTreeCriteria();
     $data['arr_categories'] = $v_sp_model->loadCategories();
     //$this->_BaseSiteData($data);
     if ($v_request->btn_submit == null) {
         // -- Открытие формы для создания
         $country_model = new CountryModel();
         $country_list = $country_model->loadAll();
         $this->_get_categories($data, $v_categoryID);
         $change_country_param = AjaxRequest::getJsonParam("Social", "ChangeCountry", array('#id#'));
         $this->_view->assign('country_list', $country_list);
         $this->_view->assign('change_country_param', $change_country_param);
         $this->_view->__set('product_places', $v_sp_model->getProductPlaces());
         $this->_view->assign('tab_list', TabController::getSocialTabs(false, false, false, true));
         // Show tabs
         $this->_view->Social_PosAdd($data);
         $this->_view->parse();
     } else {
         // -- Анализ данных и сохранение
         if ($v_request->inp_sp_name == "" or $v_request->inp_sp_comment == "") {
             // -- Данные неполные
             $data['inp_sp_name'] = $v_request->inp_sp_name;
             $data['inp_sp_comment'] = $v_request->inp_sp_comment;
             $this->_view->Social_PosAdd($data);
             $this->_view->addFlashMessage(FM::ERROR, 'Поля " * " должны быть заполнены');
             $this->_view->assign('tab_list', TabController::getSocialTabs(false, false, false, true));
             // Show tabs
             $this->_view->parse();
         } else {
             // -- Сохранение данных
             $v_model = new SocialModel();
             $v_model->social_tree_id = $v_request->inp_sp_category;
             $v_model->user_id = $v_current_userID;
             $v_model->name = $v_request->inp_sp_name;
             $v_model->creation_date = date("Y-m-d H:i:s");
             if ($v_request->type_prod) {
                 $v_model->id_product = $v_request->id_product;
             }
             if ($v_request->type_place) {
                 $country_model = new CountryModel();
                 $state_model = new StateModel();
                 $city_model = new CityModel();
                 $country = $country_model->getCountryNameById($v_request->country);
                 if ($country) {
                     $country .= ', ';
                 }
                 $state = $state_model->getStateNameById($v_request->select_social_state);
                 if ($state) {
                     $state .= ', ';
                 }
                 $city = $city_model->getCityNameById($v_request->select_social_city);
                 if ($city) {
                     $city .= ', ';
                 }
                 $street = $v_request->street;
                 if ($street) {
                     $street .= ', ';
                 }
                 $house = $v_request->house;
                 if ($house) {
                     $house .= ', ';
                 }
                 $address = urlencode($country . $state . $city . $street . $house);
                 //echo $address;
                 $Coords = file_get_contents('http://maps.google.com/maps/geo?q=' . $address . '&output=csv&key=ABQIAAAAIMN2iaCMFuGQ7iw1w3khQhRJcbERdBxj2ey4tItiMN02nh3_tBSPZ_cpbhowAtSVcVvvdpej4XMW1Q');
                 //home ABQIAAAAIMN2iaCMFuGQ7iw1w3khQhR-v9yHoD50evrZ-pbO1wgn-sHpRBTCwGDBW1h8fK3f31phKFZTanuxDA
                 //site ABQIAAAAIMN2iaCMFuGQ7iw1w3khQhRJcbERdBxj2ey4tItiMN02nh3_tBSPZ_cpbhowAtSVcVvvdpej4XMW1Q
                 list($status, $Zoom, $Xcoord, $Ycoord) = split(',', $Coords);
                 if ($status == 200) {
                     $v_model->Xcoord = $Xcoord;
                     $v_model->Ycoord = $Ycoord;
                     $v_model->Zoom = $Zoom;
                 }
             }
             $v_new_id = $v_model->save();
             // -- Сохранение коммента
             $v_comment_model = new SocialCommentModel();
             $v_comment_model->addComment(Project::getUser()->getDbUser()->id, 0, 0, $v_new_id, $v_request->inp_sp_comment, 0, 0);
             // -- Сохранения связи соц.позиции и критериев
             $this->_SetVote($v_new_id, $v_request->inp_num_criteria_1, $v_request->inp_select_1);
             $this->_SetVote($v_new_id, $v_request->inp_num_criteria_2, $v_request->inp_select_2);
             $this->_SetVote($v_new_id, $v_request->inp_num_criteria_3, $v_request->inp_select_3);
             // = Запись в таблицу локировки голосования
             $v_sp_votes_model = new SocialVotesModel();
             $v_sp_votes_model->social_pos_id = $v_new_id;
             $v_sp_votes_model->user_id = (int) Project::getUser()->getDbUser()->id;
             $v_sp_votes_model->ip = $_SERVER['REMOTE_ADDR'];
             $v_sp_votes_model->save();
             Project::getResponse()->redirect($v_request->createUrl('Social', 'SocialUserList'));
         }
     }
 }
Exemple #24
0
 public function getUserMDHash()
 {
     //Add the tab hash to include the change of tabs (e.g. module order) as a part of the user hash
     $tabs = new TabController();
     $tabHash = $tabs->getMySettingsTabHash();
     return md5($this->hashTS . $tabHash);
 }
 /**
  * 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;
 }
Exemple #26
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;
}
Exemple #27
0
$enabled_tabs[] = 'Opportunities';
$enabled_tabs[] = 'Leads';
$enabled_tabs[] = 'Calendar';
$enabled_tabs[] = 'Documents';
$enabled_tabs[] = 'Emails';
$enabled_tabs[] = 'Campaigns';
$enabled_tabs[] = 'Calls';
$enabled_tabs[] = 'Meetings';
$enabled_tabs[] = 'Tasks';
$enabled_tabs[] = 'Notes';
$enabled_tabs[] = 'Cases';
$enabled_tabs[] = 'Prospects';
$enabled_tabs[] = 'ProspectLists';
installerHook('pre_setSystemTabs');
require_once 'modules/MySettings/TabController.php';
$tabs = new TabController();
$tabs->set_system_tabs($enabled_tabs);
installerHook('post_setSystemTabs');
post_install_modules();
//Call rebuildSprites
if (function_exists('imagecreatetruecolor')) {
    require_once 'modules/UpgradeWizard/uw_utils.php';
    rebuildSprites(true);
}
if (count($bottle) > 0) {
    foreach ($bottle as $bottle_message) {
        $bottleMsg .= "{$bottle_message}\n";
    }
} else {
    $bottleMsg = $mod_strings['LBL_PERFORM_SUCCESS'];
}
 /**
  * return all available subpanels that belong to the list of tab modules.  You can optionally return all
  * available subpanels, and also optionally group by module (prepends the key with the bean class name).
  */
 function get_all_subpanels($return_tab_modules_only = true, $group_by_module = false)
 {
     global $moduleList, $beanFiles, $beanList, $module;
     //use tab controller function to get module list with named keys
     require_once "modules/MySettings/TabController.php";
     $modules_to_check = TabController::get_key_array($moduleList);
     //change case to match subpanel processing later on
     $modules_to_check = array_change_key_case($modules_to_check);
     // Append on the CampaignLog module, because that is where the subpanels point, not directly to Campaigns
     $modules_to_check['campaignlog'] = "CampaignLog";
     $spd = '';
     $spd_arr = array();
     //iterate through modules and build subpanel array
     foreach ($modules_to_check as $mod_name) {
         //skip if module name is not in bean list, otherwise get the bean class name
         if (!isset($beanList[$mod_name])) {
             continue;
         }
         $class = $beanList[$mod_name];
         //skip if class name is not in file list, otherwise require the bean file and create new class
         if (!isset($beanFiles[$class]) || !file_exists($beanFiles[$class])) {
             continue;
         }
         //retrieve subpanels for this bean
         require_once $beanFiles[$class];
         $bean_class = new $class();
         //create new subpanel definition instance and get list of tabs
         $spd = new SubPanelDefinitions($bean_class);
         $sub_tabs = $spd->get_available_tabs();
         //add each subpanel to array of total subpanles
         foreach ($sub_tabs as $panel_key) {
             $panel_key = strtolower($panel_key);
             $panel_module = $panel_key;
             if (isset($spd->layout_defs['subpanel_setup'][$panel_key]['module'])) {
                 $panel_module = strtolower($spd->layout_defs['subpanel_setup'][$panel_key]['module']);
             }
             //if module_only flag is set, only if it is also in module array
             if ($return_tab_modules_only && !array_key_exists($panel_module, $modules_to_check)) {
                 continue;
             }
             $panel_key_name = $panel_module;
             //group_by_key_name is set to true, then array will hold an entry for each
             //subpanel, with the module name prepended in the key
             if ($group_by_module) {
                 $panel_key_name = $class . '_' . $panel_key_name;
             }
             //add panel name to subpanel array
             $spd_arr[$panel_key_name] = $panel_module;
         }
     }
     return $spd_arr;
 }
 require_once 'modules/Administration/Administration.php';
 $admin = new Administration();
 $admin->saveSetting('system', 'adminwizard', 1);
 if ($ce_to_pro_ent) {
     //check to see if there are any new files that need to be added to systems tab
     //retrieve old modules list
     logThis('check to see if new modules exist', $path);
     $oldModuleList = array();
     $newModuleList = array();
     include $argv[3] . '/include/modules.php';
     $oldModuleList = $moduleList;
     include 'include/modules.php';
     $newModuleList = $moduleList;
     //include tab controller
     require_once 'modules/MySettings/TabController.php';
     $newTB = new TabController();
     //make sure new modules list has a key we can reference directly
     $newModuleList = $newTB->get_key_array($newModuleList);
     $oldModuleList = $newTB->get_key_array($oldModuleList);
     //iterate through list and remove commonalities to get new modules
     foreach ($newModuleList as $remove_mod) {
         if (in_array($remove_mod, $oldModuleList)) {
             unset($newModuleList[$remove_mod]);
         }
     }
     $must_have_modules = array('Activities' => 'Activities', 'Calendar' => 'Calendar', 'Reports' => 'Reports', 'Quotes' => 'Quotes', 'Products' => 'Products', 'Forecasts' => 'Forecasts', 'Contracts' => 'Contracts', 'KBDocuments' => 'KBDocuments');
     $newModuleList = array_merge($newModuleList, $must_have_modules);
     //new modules list now has left over modules which are new to this install, so lets add them to the system tabs
     logThis('new modules to add are ' . var_export($newModuleList, true), $path);
     //grab the existing system tabs
     $tabs = $newTB->get_system_tabs();
 /**
  * Gets display module list per user defined tabs
  *
  * @return array The list of module names
  */
 public function getUserModuleList()
 {
     // Loading a standard module list
     require_once "modules/MySettings/TabController.php";
     $controller = new TabController();
     $tabs = $controller->get_tabs($this->getCurrentUser());
     $moduleList = array_keys($tabs[0]);
     $moduleList = $this->addHomeToModuleList($moduleList);
     return $moduleList;
 }