本文整理汇总了PHP中TabController类的典型用法代码示例。如果您正苦于以下问题:PHP TabController类的具体用法?PHP TabController怎么用?PHP TabController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TabController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: query_module_access_list
function query_module_access_list(&$user)
{
require_once 'modules/MySettings/TabController.php';
$controller = new TabController();
$tabArray = $controller->get_tabs($user);
return $tabArray[0];
}
示例2: display
/**
* @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');
}
示例3: display
/**
* 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();
}
示例4: run
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');
}
示例5: setUpPortal
/**
* 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();
}
示例6: run
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');
}
示例7: __construct
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));
}
示例8: action_savetabs
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");
}
示例9: action_savetabs
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");
}
}
示例10: BaseBlogData
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;
}
示例11: TabController
}
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');
}
}
示例12: LastListAction
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();
}
示例13: upgradeDisplayedTabsAndSubpanels
/**
* 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');
}
}
示例14: UpdateSystemTabs
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;
}
}
}
示例15: addNewSystemTabsFromUpgrade
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);
}
}