/** * Initializing global variables * * @return void */ function init() { $this->MCONF = $GLOBALS['MCONF']; parent::init(); // initialize IconFactory $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); $temp = BackendUtility::getModTSconfig($this->id, 'mod.web_modules.dmail'); if (!is_array($temp['properties'])) { $temp['properties'] = array(); } $this->params = $temp['properties']; $this->implodedParams = DirectMailUtility::implodeTSParams($this->params); if ($this->params['userTable'] && is_array($GLOBALS["TCA"][$this->params['userTable']])) { $this->userTable = $this->params['userTable']; $this->allowedTables[] = $this->userTable; } $this->MOD_MENU['dmail_mode'] = BackendUtility::unsetMenuItems($this->params, $this->MOD_MENU['dmail_mode'], 'menu.dmail_mode'); // initialize backend user language if ($this->getLanguageService()->lang && ExtensionManagementUtility::isLoaded('static_info_tables')) { $res = $GLOBALS["TYPO3_DB"]->exec_SELECTquery('sys_language.uid', 'sys_language LEFT JOIN static_languages ON sys_language.static_lang_isocode=static_languages.uid', 'static_languages.lg_typo3=' . $GLOBALS["TYPO3_DB"]->fullQuoteStr($this->getLanguageService()->lang, 'static_languages') . BackendUtility::BEenableFields('sys_language') . BackendUtility::deleteClause('sys_language') . BackendUtility::deleteClause('static_languages')); while ($row = $GLOBALS["TYPO3_DB"]->sql_fetch_assoc($res)) { $this->sys_language_uid = $row['uid']; } $GLOBALS["TYPO3_DB"]->sql_free_result($res); } // load contextual help $this->cshTable = '_MOD_' . $this->MCONF['name']; if ($GLOBALS["BE_USER"]->uc['edit_showFieldHelp']) { $this->getLanguageService()->loadSingleTableDescription($this->cshTable); } }
/** * Modifies parent objects internal MOD_MENU array, adding items this module needs. * * @return array Items merged with the parent objects. */ public function modMenu() { $GLOBALS['LANG']->includeLLFile('EXT:func_wizards/locallang.xlf'); $modMenuAdd = array($this->function_key => array()); $modMenuAdd[$this->function_key] = $this->pObj->mergeExternalItems($this->pObj->MCONF['name'], $this->function_key, $modMenuAdd[$this->function_key]); $modMenuAdd[$this->function_key] = \TYPO3\CMS\Backend\Utility\BackendUtility::unsetMenuItems($this->pObj->modTSconfig['properties'], $modMenuAdd[$this->function_key], 'menu.' . $this->function_key); return $modMenuAdd; }
/** * Modifies parent objects internal MOD_MENU array, adding items this module needs. * * @return array Items merged with the parent objects. * @see t3lib_extobjbase::init() * @todo Define visibility */ public function modMenu() { global $LANG; $modMenuAdd = array($this->function_key => array()); $modMenuAdd[$this->function_key] = $this->pObj->mergeExternalItems($this->pObj->MCONF['name'], $this->function_key, $modMenuAdd[$this->function_key]); $modMenuAdd[$this->function_key] = \TYPO3\CMS\Backend\Utility\BackendUtility::unsetMenuItems($this->pObj->modTSconfig['properties'], $modMenuAdd[$this->function_key], 'menu.' . $this->function_key); return $modMenuAdd; }
/** * Adds items to the ->MOD_MENU array. Used for the function menu selector. * * @return void */ public function menuConfig() { $this->MOD_MENU = array('mode' => array()); $this->MOD_MENU['mode']['information'] = $this->getLanguageService()->sL('LLL:EXT:taskcenter/Resources/Private/Language/locallang.xlf:task_overview'); $this->MOD_MENU['mode']['tasks'] = $this->getLanguageService()->sL('LLL:EXT:taskcenter/Resources/Private/Language/locallang.xlf:task_tasks'); /* Copied from parent::menuConfig, because parent is hardcoded to menu.function, * however menu.function is already used for the individual tasks. * Therefore we use menu.mode here. */ // Page/be_user TSconfig settings and blinding of menu-items $this->modTSconfig = BackendUtility::getModTSconfig($this->id, 'mod.' . $this->moduleName); $this->MOD_MENU['mode'] = $this->mergeExternalItems($this->MCONF['name'], 'mode', $this->MOD_MENU['mode']); $this->MOD_MENU['mode'] = BackendUtility::unsetMenuItems($this->modTSconfig['properties'], $this->MOD_MENU['mode'], 'menu.mode'); parent::menuConfig(); }
/** * Initializes the internal MOD_MENU array setting and unsetting items based on various conditions. It also merges in external menu items from the global array TBE_MODULES_EXT (see mergeExternalItems()) * Then MOD_SETTINGS array is cleaned up (see \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleData()) so it contains only valid values. It's also updated with any SET[] values submitted. * Also loads the modTSconfig internal variable. * * @return void * @see init(), $MOD_MENU, $MOD_SETTINGS, \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleData(), mergeExternalItems() */ public function menuConfig() { // Page/be_user TSconfig settings and blinding of menu-items $this->modTSconfig = BackendUtility::getModTSconfig($this->id, 'mod.' . $this->MCONF['name']); $this->MOD_MENU['function'] = $this->mergeExternalItems($this->MCONF['name'], 'function', $this->MOD_MENU['function']); $this->MOD_MENU['function'] = BackendUtility::unsetMenuItems($this->modTSconfig['properties'], $this->MOD_MENU['function'], 'menu.function'); $this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, GeneralUtility::_GP('SET'), $this->MCONF['name'], $this->modMenu_type, $this->modMenu_dontValidateList, $this->modMenu_setDefaultList); }
/** * This creates the dropdown menu with the different actions this module is able to provide. * For now they are Columns, Quick Edit and Languages. * * @return void */ protected function makeActionMenu() { $availableActionArray = array(0 => $this->getLanguageService()->getLL('m_function_0'), 1 => $this->getLanguageService()->getLL('m_function_1'), 2 => $this->getLanguageService()->getLL('m_function_2')); // Find if there are ANY languages at all (and if not, remove the language option from function menu). $count = $this->getDatabaseConnection()->exec_SELECTcountRows('uid', 'sys_language', $this->getBackendUser()->isAdmin() ? '' : 'hidden=0'); if (!$count) { unset($availableActionArray['2']); } // page/be_user TSconfig settings and blinding of menu-items $this->modSharedTSconfig = BackendUtility::getModTSconfig($this->id, 'mod.SHARED'); $this->modTSconfig = BackendUtility::getModTSconfig($this->id, 'mod.' . $this->moduleName); if ($this->modTSconfig['properties']['QEisDefault']) { ksort($availableActionArray); } $availableActionArray = BackendUtility::unsetMenuItems($this->modTSconfig['properties'], $availableActionArray, 'menu.function'); // Remove QuickEdit as option if page type is not... if (!GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'] . ',6', $this->pageinfo['doktype'])) { unset($availableActionArray[0]); } $actionMenu = $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->makeMenu(); $actionMenu->setIdentifier('actionMenu'); $actionMenu->setLabel(''); $defaultKey = null; $foundDefaultKey = false; foreach ($availableActionArray as $key => $action) { $menuItem = $actionMenu->makeMenuItem()->setTitle($action)->setHref(BackendUtility::getModuleUrl($this->moduleName) . '&id=' . $this->id . '&SET[function]=' . $key); if (!$foundDefaultKey) { $defaultKey = $key; $foundDefaultKey = true; } if ((int) $this->MOD_SETTINGS['function'] === $key) { $menuItem->setActive(true); $defaultKey = null; } $actionMenu->addMenuItem($menuItem); } if (isset($defaultKey)) { $this->MOD_SETTINGS['function'] = $defaultKey; } $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->addMenu($actionMenu); }
/** * Returns the menu array * * @return array */ public function modMenu() { $modMenu = array('depth' => array(0 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_0'), 1 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_1'), 2 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_2'), 3 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_3'), 99 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_infi')), 'type' => array('pathcache' => 'ID-to-path mapping', 'decode' => 'Decode cache', 'encode' => 'Encode cache', 'uniqalias' => 'Unique Aliases', 'redirects' => 'Redirects', 'config' => 'Configuration', 'log' => 'Error Log')); $modMenu['type'] = \TYPO3\CMS\Backend\Utility\BackendUtility::unsetMenuItems($this->pObj->modTSconfig['properties'], $modMenu['type'], 'menu.realurl_type'); return $modMenu; }
/** * Initialize menu array * * @return void */ public function menuConfig() { $lang = $this->getLanguageService(); // MENU-ITEMS: $this->MOD_MENU = array('tt_content_showHidden' => '', 'function' => array(0 => $lang->getLL('m_function_0'), 1 => $lang->getLL('m_function_1'), 2 => $lang->getLL('m_function_2')), 'language' => array(0 => $lang->getLL('m_default'))); // example settings: // $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables']['tx_myext'] = // array ('default' => array( // 'MENU' => 'LLL:EXT:tx_myext/locallang_db.xlf:menuDefault', // 'fList' => 'title,description,image', // 'icon' => TRUE)); if (is_array($this->externalTables)) { foreach ($this->externalTables as $table => $tableSettings) { // delete the default settings from above if (is_array($this->MOD_MENU[$table])) { unset($this->MOD_MENU[$table]); } if (is_array($tableSettings) && count($tableSettings) > 1) { foreach ($tableSettings as $key => $settings) { $this->MOD_MENU[$table][$key] = $lang->sL($settings['MENU']); } } } } // First, select all pages_language_overlay records on the current page. Each represents a possibility for a language on the page. Add these to language selector. $res = $this->exec_languageQuery($this->id); while ($lRow = $this->getDatabaseConnection()->sql_fetch_assoc($res)) { if ($this->getBackendUser()->checkLanguageAccess($lRow['uid'])) { $this->MOD_MENU['language'][$lRow['uid']] = $lRow['hidden'] ? '(' . $lRow['title'] . ')' : $lRow['title']; } } // Find if there are ANY languages at all (and if not, remove the language option from function menu). $count = $this->getDatabaseConnection()->exec_SELECTcountRows('uid', 'sys_language', $this->getBackendUser()->isAdmin() ? '' : 'hidden=0'); if (!$count) { unset($this->MOD_MENU['function']['2']); } // page/be_user TSconfig settings and blinding of menu-items $this->modSharedTSconfig = BackendUtility::getModTSconfig($this->id, 'mod.SHARED'); $this->modTSconfig = BackendUtility::getModTSconfig($this->id, 'mod.' . $this->MCONF['name']); if ($this->modTSconfig['properties']['QEisDefault']) { ksort($this->MOD_MENU['function']); } $this->MOD_MENU['function'] = BackendUtility::unsetMenuItems($this->modTSconfig['properties'], $this->MOD_MENU['function'], 'menu.function'); // Remove QuickEdit as option if page type is not... if (!GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'] . ',6', $this->pageinfo['doktype'])) { unset($this->MOD_MENU['function'][0]); } // Setting alternative default label: if (($this->modSharedTSconfig['properties']['defaultLanguageLabel'] || $this->modTSconfig['properties']['defaultLanguageLabel']) && isset($this->MOD_MENU['language'][0])) { $this->MOD_MENU['language'][0] = $this->modTSconfig['properties']['defaultLanguageLabel'] ? $this->modSharedTSconfig['properties']['defaultLanguageLabel'] : $this->modSharedTSconfig['properties']['defaultLanguageLabel']; } // Clean up settings $this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, GeneralUtility::_GP('SET'), 'web_layout'); // For all elements to be shown in draft workspaces & to also show hidden elements by default if user hasn't disabled the option if ($this->getBackendUser()->workspace != 0 || $this->MOD_SETTINGS['tt_content_showHidden'] !== '0') { $this->MOD_SETTINGS['tt_content_showHidden'] = 1; } }
/** * @param array $modTSconfig Module TS config array * @param array $itemArray Array of items from which to remove items. * @param string $TSref $TSref points to the "object string" in $modTSconfig * @return array The modified $itemArray is returned. */ public function unsetMenuItems($modTSconfig, $itemArray, $TSref) { return BackendUtility::unsetMenuItems($modTSconfig, $itemArray, $TSref); }
/** * First initialization of global variables * * @return void */ public function init() { parent::init(); // initialize IconFactory $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); // get the config from pageTS $temp = BackendUtility::getModTSconfig($this->id, 'mod.web_modules.dmail'); if (!is_array($temp['properties'])) { $temp['properties'] = array(); } $this->params = $temp['properties']; $this->implodedParams = DirectMailUtility::implodeTSParams($this->params); if ($this->params['userTable'] && is_array($GLOBALS['TCA'][$this->params['userTable']])) { $this->userTable = $this->params['userTable']; $this->allowedTables[] = $this->userTable; } // check if the right domain shoud be set if (!$this->params['use_domain']) { $rootLine = BackendUtility::BEgetRootLine($this->id); if ($rootLine) { $parts = parse_url(GeneralUtility::getIndpEnv('TYPO3_SITE_URL')); if (BackendUtility::getDomainStartPage($parts['host'], $parts['path'])) { $temporaryPreUrl = BackendUtility::firstDomainRecord($rootLine); $domain = BackendUtility::getRecordsByField('sys_domain', 'domainName', $temporaryPreUrl, ' AND hidden=0', '', 'sorting'); if (is_array($domain)) { reset($domain); $dom = current($domain); $this->params['use_domain'] = $dom['uid']; } } } } $this->MOD_MENU['dmail_mode'] = BackendUtility::unsetMenuItems($this->params, $this->MOD_MENU['dmail_mode'], 'menu.dmail_mode'); // initialize backend user language if ($this->getLanguageService()->lang && ExtensionManagementUtility::isLoaded('static_info_tables')) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('sys_language.uid', 'sys_language LEFT JOIN static_languages ON sys_language.static_lang_isocode=static_languages.uid', 'static_languages.lg_typo3=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->getLanguageService()->lang, 'static_languages') . BackendUtility::BEenableFields('sys_language') . BackendUtility::deleteClause('sys_language') . BackendUtility::deleteClause('static_languages')); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $this->sys_language_uid = $row['uid']; } $GLOBALS['TYPO3_DB']->sql_free_result($res); } // load contextual help $this->cshTable = '_MOD_' . $this->MCONF['name']; if ($GLOBALS['BE_USER']->uc['edit_showFieldHelp']) { $this->getLanguageService()->loadSingleTableDescription($this->cshTable); } }
/** * This creates the dropdown menu with the different actions this module is able to provide. * For now they are Columns, Quick Edit and Languages. * * @return void */ protected function makeActionMenu() { $availableActionArray = [0 => $this->getLanguageService()->getLL('m_function_0'), 1 => $this->getLanguageService()->getLL('m_function_1'), 2 => $this->getLanguageService()->getLL('m_function_2')]; // Find if there are ANY languages at all (and if not, remove the language option from function menu). $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_language'); if ($this->getBackendUser()->isAdmin()) { $queryBuilder->getRestrictions()->removeAll(); } $count = $queryBuilder->count('uid')->from('sys_language')->execute()->fetchColumn(0); if (!$count) { unset($availableActionArray['2']); } // page/be_user TSconfig settings and blinding of menu-items if ($this->modTSconfig['properties']['QEisDefault']) { ksort($availableActionArray); } $availableActionArray = BackendUtility::unsetMenuItems($this->modTSconfig['properties'], $availableActionArray, 'menu.function'); // Remove QuickEdit as option if page type is not... if (!GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'] . ',6', $this->pageinfo['doktype'])) { unset($availableActionArray[0]); } $actionMenu = $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->makeMenu(); $actionMenu->setIdentifier('actionMenu'); $actionMenu->setLabel(''); $defaultKey = null; $foundDefaultKey = false; foreach ($availableActionArray as $key => $action) { $menuItem = $actionMenu->makeMenuItem()->setTitle($action)->setHref(BackendUtility::getModuleUrl($this->moduleName) . '&id=' . $this->id . '&SET[function]=' . $key); if (!$foundDefaultKey) { $defaultKey = $key; $foundDefaultKey = true; } if ((int) $this->MOD_SETTINGS['function'] === $key) { $menuItem->setActive(true); $defaultKey = null; } $actionMenu->addMenuItem($menuItem); } if (isset($defaultKey)) { $this->MOD_SETTINGS['function'] = $defaultKey; } $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->addMenu($actionMenu); }
/** * first initialization of global variables * * @return void no return values: initialize global variables */ function init() { $this->MCONF = $GLOBALS['MCONF']; parent::init(); // get TS Params $temp = BackendUtility::getModTSconfig($this->id, 'mod.web_modules.dmail'); $this->params = $temp['properties']; $this->implodedParams = BackendUtility::implodeTSParams($this->params); $this->MOD_MENU['dmail_mode'] = BackendUtility::unsetMenuItems($this->params, $this->MOD_MENU['dmail_mode'], 'menu.dmail_mode'); // initialize the page selector $this->sys_page = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); $this->sys_page->init(true); // initialize backend user language if ($GLOBALS["LANG"]->lang && ExtensionManagementUtility::isLoaded('static_info_tables')) { $res = $GLOBALS["TYPO3_DB"]->exec_SELECTquery('sys_language.uid', 'sys_language LEFT JOIN static_languages ON sys_language.static_lang_isocode=static_languages.uid', 'static_languages.lg_typo3=' . $GLOBALS["TYPO3_DB"]->fullQuoteStr($GLOBALS["LANG"]->lang, 'static_languages') . BackendUtility::BEenableFields('sys_language') . BackendUtility::deleteClause('sys_language') . BackendUtility::deleteClause('static_languages')); while ($row = $GLOBALS["TYPO3_DB"]->sql_fetch_assoc($res)) { $this->sys_language_uid = $row['uid']; } } // load contextual help $this->cshTable = '_MOD_' . $this->MCONF['name']; if ($GLOBALS["BE_USER"]->uc['edit_showFieldHelp']) { $GLOBALS["LANG"]->loadSingleTableDescription($this->cshTable); } }
/** * Adds items to the ->MOD_MENU array. Used for the function menu selector. * * @return void */ function menuConfig() { $this->MOD_MENU = array('function' => array('1' => $GLOBALS['LANG']->getLL('function1')), 'showEditIcons' => 0, 'expandAll' => 0, 'showOnlyEditable' => 0, 'showHiddenCategories' => 0, 'searchLevels' => array(-1 => $GLOBALS['LANG']->getLL('allPages'), 0 => $GLOBALS['LANG']->getLL('thisPage'), 1 => $GLOBALS['LANG']->getLL('oneLevel'), 2 => $GLOBALS['LANG']->getLL('twoLevels'), 3 => $GLOBALS['LANG']->getLL('threeLevels'), 4 => $GLOBALS['LANG']->getLL('fourLevels')), 'showThumbs' => 1, 'showLimit' => 0, 'language' => array(0 => $GLOBALS['LANG']->getLL('defaultLangLabel'))); $this->initLanguageMenu(); $this->MOD_MENU['function'] = $this->mergeExternalItems($this->MCONF['name'], 'function', $this->MOD_MENU['function']); $this->MOD_MENU['function'] = \TYPO3\CMS\Backend\Utility\BackendUtility::unsetMenuItems($this->modTSconfig['properties'], $this->MOD_MENU['function'], 'menu.function'); $this->MOD_SETTINGS = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleData($this->MOD_MENU, \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('SET'), $this->MCONF['name'], $this->modMenu_type, $this->modMenu_dontValidateList, $this->modMenu_setDefaultList); }