/** * First initialization of global variables * * @return void */ function init() { $this->MCONF = $GLOBALS['MCONF']; parent::init(); // initialize IconFactory $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); // get TS Params $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); $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 ($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']; } } // load contextual help $this->cshTable = '_MOD_' . $this->MCONF['name']; if ($GLOBALS["BE_USER"]->uc['edit_showFieldHelp']) { $this->getLanguageService()->loadSingleTableDescription($this->cshTable); } }
/** * Returns array of system languages * * Since TYPO3 4.5 the flagIcon is not returned as a filename in "gfx/flags/*" anymore, * but as a string <flags-xx>. The calling party should call * t3lib_iconWorks::getSpriteIcon(<flags-xx>) to get an HTML which will represent * the flag of this language. * * @param integer $page_id Page id (only used to get TSconfig configuration setting flag and label for default language) * @param string $backPath Backpath for flags * @return array Array with languages (title, uid, flagIcon) * @todo Define visibility */ public function getSystemLanguages($page_id = 0, $backPath = '') { $modSharedTSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($page_id, 'mod.SHARED'); $languageIconTitles = array(); // fallback "old iconstyles" if (preg_match('/\\.gif$/', $modSharedTSconfig['properties']['defaultLanguageFlag'])) { $modSharedTSconfig['properties']['defaultLanguageFlag'] = str_replace('.gif', '', $modSharedTSconfig['properties']['defaultLanguageFlag']); } $languageIconTitles[0] = array('uid' => 0, 'title' => strlen($modSharedTSconfig['properties']['defaultLanguageLabel']) ? $modSharedTSconfig['properties']['defaultLanguageLabel'] . ' (' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xml:defaultLanguage') . ')' : $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xml:defaultLanguage'), 'ISOcode' => 'DEF', 'flagIcon' => strlen($modSharedTSconfig['properties']['defaultLanguageFlag']) ? 'flags-' . $modSharedTSconfig['properties']['defaultLanguageFlag'] : 'empty-empty'); // Set "All" language: $languageIconTitles[-1] = array('uid' => -1, 'title' => $GLOBALS['LANG']->getLL('multipleLanguages'), 'ISOcode' => 'DEF', 'flagIcon' => 'flags-multiple'); // Find all system languages: $sys_languages = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_language', ''); foreach ($sys_languages as $row) { $languageIconTitles[$row['uid']] = $row; if ($row['static_lang_isocode'] && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('static_info_tables')) { $staticLangRow = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('static_languages', $row['static_lang_isocode'], 'lg_iso_2'); if ($staticLangRow['lg_iso_2']) { $languageIconTitles[$row['uid']]['ISOcode'] = $staticLangRow['lg_iso_2']; } } if (strlen($row['flag'])) { $languageIconTitles[$row['uid']]['flagIcon'] = \TYPO3\CMS\Backend\Utility\IconUtility::mapRecordTypeToSpriteIconName('sys_language', $row); } } return $languageIconTitles; }
/** * Initializes the Module * @return void */ function init() { $id = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id')); $tsconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($id, 'tx_formhandler_mod1'); $this->settings = $tsconfig['properties']['config.']; parent::init(); }
/** * Initializing global variables * * @return void no return values: first initialisation of global variables */ function init() { $this->MCONF = $GLOBALS['MCONF']; parent::init(); $temp = BackendUtility::getModTSconfig($this->id, 'mod.web_modules.dmail'); $this->params = $temp['properties']; $this->implodedParams = BackendUtility::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 ($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']; } $GLOBALS["TYPO3_DB"]->sql_free_result($res); } // load contextual help $this->cshTable = '_MOD_' . $this->MCONF['name']; if ($GLOBALS["BE_USER"]->uc['edit_showFieldHelp']) { $GLOBALS["LANG"]->loadSingleTableDescription($this->cshTable); } }
/** * Main processing, creating the list of new record tables to select from. * * @return void */ public function main() { // if commerce parameter is missing use default controller if (!GeneralUtility::_GP('parentCategory')) { parent::main(); return; } // If there was a page - or if the user is admin // (admins has access to the root) we proceed: if ($this->pageinfo['uid'] || $this->getBackendUserAuthentication()->isAdmin()) { // Acquiring TSconfig for this module/current page: $this->web_list_modTSconfig = BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod.web_list'); // allow only commerce related tables $this->allowedNewTables = array('tx_commerce_categories', 'tx_commerce_products'); $this->deniedNewTables = GeneralUtility::trimExplode(',', $this->web_list_modTSconfig['properties']['deniedNewTables'], true); // Acquiring TSconfig for this module/parent page: $this->web_list_modTSconfig_pid = BackendUtility::getModTSconfig($this->pageinfo['pid'], 'mod.web_list'); $this->allowedNewTables_pid = GeneralUtility::trimExplode(',', $this->web_list_modTSconfig_pid['properties']['allowedNewTables'], true); $this->deniedNewTables_pid = GeneralUtility::trimExplode(',', $this->web_list_modTSconfig_pid['properties']['deniedNewTables'], true); // More init: if (!$this->showNewRecLink('pages')) { $this->newPagesInto = 0; } if (!$this->showNewRecLink('pages', $this->allowedNewTables_pid, $this->deniedNewTables_pid)) { $this->newPagesAfter = 0; } // Set header-HTML and return_url if (is_array($this->pageinfo) && $this->pageinfo['uid']) { $iconImgTag = IconUtility::getSpriteIconForRecord('pages', $this->pageinfo, array('title' => htmlspecialchars($this->pageinfo['_thePath']))); $title = strip_tags($this->pageinfo[SettingsFactory::getInstance()->getTcaValue('pages.ctrl.label')]); } else { $iconImgTag = IconUtility::getSpriteIcon('apps-pagetree-root', array('title' => htmlspecialchars($this->pageinfo['_thePath']))); $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']; } $this->code = '<span class="typo3-moduleHeader">' . $this->doc->wrapClickMenuOnIcon($iconImgTag, 'pages', $this->pageinfo['uid']) . htmlspecialchars(GeneralUtility::fixed_lgd_cs($title, 45)) . '</span><br />'; $this->R_URI = $this->returnUrl; // GENERATE the HTML-output depending on mode (pagesOnly is the page wizard) // Regular new element: if (!$this->pagesOnly) { $this->regularNew(); } elseif ($this->showNewRecLink('pages')) { // Pages only wizard $this->pagesOnly(); } // Add all the content to an output section $this->content .= $this->doc->section('', $this->code); // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers['CSH'] = $docHeaderButtons['csh']; $markers['CONTENT'] = $this->content; // Build the <body> for the module $this->content = $this->doc->startPage($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.pagetitle')); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); } }
/** * * Initializes the Module * @return void * */ function init() { global $TBE_STYLES; $this->id = (int) GeneralUtility::_GP('id'); #$this->modTSconfig = BackendUtility::getModTSconfig($this->id, 'mod.' . $this->MCONF['name']); $this->modTSconfig = BackendUtility::getModTSconfig($this->id, 'mod.' . $GLOBALS["MCONF"]["name"]); parent::init(); $TBE_STYLES['stylesheet2'] = ExtensionManagementUtility::extRelPath('mm_forum') . 'mod1/css/style.css'; $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); }
/** * Initialize action * * @return void */ protected function initializeAction() { // initialize page/be_user TSconfig settings $this->modSharedTSconfig = BackendUtility::getModTSconfig($this->id, 'mod.SHARED'); $this->modTSconfig = BackendUtility::getModTSconfig($this->id, 'mod.' . $this->moduleName); // initialize settings of the module $this->initializeModParams(); if (!$this->request->hasArgument('action') && $this->modParams['action']) { $this->request->setArgument('action', $this->modParams['action']); $this->forward($this->modParams['action']); } // get languages $this->languages = $this->getLanguages(); }
/** * Function executed from scheduler. * Creates a new newsletter record, and sets the scheduled time to "now" * * @return bool */ public function execute() { if ($this->draftUid > 0) { $this->initializeHookObjects(); $hookParams = array(); $draftRecord = BackendUtility::getRecord('sys_dmail', $this->draftUid); // get some parameters from tsConfig $tsConfig = BackendUtility::getModTSconfig($draftRecord['pid'], 'mod.web_modules.dmail'); $defaultParams = $tsConfig['properties']; // make a real record out of it unset($draftRecord['uid']); $draftRecord['tstamp'] = time(); // set the right type (3 => 1, 2 => 0) $draftRecord['type'] -= 2; // check if domain record is set if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI && (int) $draftRecord['type'] !== 1 && empty($draftRecord['use_domain'])) { throw new \Exception('No domain record set!'); } // Insert the new dmail record into the DB $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_dmail', $draftRecord); $this->dmailUid = $GLOBALS['TYPO3_DB']->sql_insert_id(); // Call a hook after insertion of the cloned dmail record // This hook can get used to modify fields of the direct mail. // For example the current date could get appended to the subject. $hookParams['draftRecord'] =& $draftRecord; $hookParams['defaultParams'] =& $defaultParams; $this->callHooks('postInsertClone', $hookParams); // fetch the cloned record $mailRecord = BackendUtility::getRecord('sys_dmail', $this->dmailUid); // fetch mail content $result = DirectMailUtility::fetchUrlContentsForDirectMailRecord($mailRecord, $defaultParams, TRUE); if ($result['errors'] !== array()) { throw new \Exception('Failed to fetch contents: ' . implode(', ', $result['errors'])); } $mailRecord = BackendUtility::getRecord('sys_dmail', $this->dmailUid); if ($mailRecord['mailContent'] && $mailRecord['renderedsize'] > 0) { $updateData = array('scheduled' => time(), 'issent' => 1); // Call a hook before enqueuing the cloned dmail record into // the direct mail delivery queue $hookParams['mailRecord'] =& $mailRecord; $hookParams['updateData'] =& $updateData; $this->callHooks('enqueueClonedDmail', $hookParams); // Update the cloned dmail so it will get sent upon next // invocation of the mailer engine $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_dmail', 'uid = ' . intval($this->dmailUid), $updateData); } } return true; }
/** * 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(); }
/** * First initialization of global variables * * @return void */ function init() { $this->MCONF = $GLOBALS['MCONF']; 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); } }
public function getWeekStartDay($PA) { $pageID = $PA['row']['pid']; $tsConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($pageID, 'options.tx_cal_controller.weekStartDay'); $weekStartDay = strtolower($tsConfig['value']); switch ($weekStartDay) { case 'sunday': $startDay = 'su'; break; /* If there's any value other than sunday, assume we want Monday */ /* If there's any value other than sunday, assume we want Monday */ default: $startDay = 'mo'; break; } return $startDay; }
/** * Gets the list of available columns for a given page id * * @param integer $id * @return array $tcaItems */ public function getColPosListItemsParsed($id) { $tsConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($id, 'TCEFORM.tt_content.colPos'); $tcaConfig = $GLOBALS['TCA']['tt_content']['columns']['colPos']['config']; /** @var $tceForms t3lib_TCEForms */ $tceForms = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_TCEForms'); $tcaItems = $tcaConfig['items']; $tcaItems = $tceForms->addItems($tcaItems, $tsConfig['properties']['addItems.']); if (isset($tcaConfig['itemsProcFunc']) && $tcaConfig['itemsProcFunc']) { $tcaItems = $this->addColPosListLayoutItems($id, $tcaItems); } foreach (\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $tsConfig['properties']['removeItems'], 1) as $removeId) { foreach ($tcaItems as $key => $item) { if ($item[1] == $removeId) { unset($tcaItems[$key]); } } } return $tcaItems; }
/** * Returns the list of categories with their ID. * * @param array $config Associative array of existing configurations * @param \TYPO3\CMS\Backend\Form\FormEngine|\TYPO3\CMS\Backend\Form\DataPreprocessor $tceForms TCE forms object * @param string $sitecode Unique code of the site to retrieve the categories for * @return array Associative array with existing and new entries */ public function getCategories(array $config, $tceForms = null, $sitecode = 'default') { if (isset($config['row']) && isset($config['row']['pid'])) { $pageTSConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($config['row']['pid'], 'tx_aimeos'); if (isset($pageTSConfig['properties']['mshop.']['locale.']['site'])) { $sitecode = $pageTSConfig['properties']['mshop.']['locale.']['site']; } } try { $context = Base::getContext(Base::getConfig()); $context->setEditor('flexform'); $localeManager = \MShop_Locale_Manager_Factory::createManager($context); $context->setLocale($localeManager->bootstrap($sitecode, '', '', false)); $manager = \MShop_Catalog_Manager_Factory::createManager($context); $item = $manager->getTree(null, array(), \MW_Tree_Manager_Abstract::LEVEL_TREE); $config['items'] = array_merge($config['items'], $this->getCategoryList($item, 0)); } catch (Exception $e) { error_log($e->getMessage() . PHP_EOL . $e->getTraceAsString()); } return $config; }
/** * Returns array of system languages * * The property flagIcon returns a string <flags-xx>. The calling party should call * \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon(<flags-xx>) to get an HTML * which will represent the flag of this language. * * @param int $pageId Page id (used to get TSconfig configuration setting flag and label for default language) * @return array Array with languages (uid, title, ISOcode, flagIcon) */ public function getSystemLanguages($pageId = 0) { $modSharedTSconfig = BackendUtility::getModTSconfig($pageId, 'mod.SHARED'); // default language and "all languages" are always present $languages = array(0 => array('uid' => 0, 'title' => $this->getDefaultLanguageLabel($modSharedTSconfig), 'ISOcode' => 'DEF', 'flagIcon' => $this->getDefaultLanguageFlag($modSharedTSconfig)), -1 => array('uid' => -1, 'title' => $this->getLanguageService()->getLL('multipleLanguages'), 'ISOcode' => 'DEF', 'flagIcon' => 'flags-multiple')); // add the additional languages from database records $languageRecords = $this->getDatabaseConnection()->exec_SELECTgetRows('*', 'sys_language', ''); foreach ($languageRecords as $languageRecord) { $languages[$languageRecord['uid']] = $languageRecord; if ($languageRecord['static_lang_isocode'] && ExtensionManagementUtility::isLoaded('static_info_tables')) { $staticLangRow = BackendUtility::getRecord('static_languages', $languageRecord['static_lang_isocode'], 'lg_iso_2'); if ($staticLangRow['lg_iso_2']) { $languages[$languageRecord['uid']]['ISOcode'] = $staticLangRow['lg_iso_2']; } } if ($languageRecord['flag'] !== '') { $languages[$languageRecord['uid']]['flagIcon'] = IconUtility::mapRecordTypeToSpriteIconName('sys_language', $languageRecord); } } return $languages; }
/** * Returns array of system languages * The property flagIcon returns a string <flags-xx>. * * @param int $pageId Page id (used to get TSconfig configuration setting flag and label for default language) * @return array Array with languages (uid, title, ISOcode, flagIcon) */ public function getSystemLanguages($pageId = 0) { $modSharedTSconfig = BackendUtility::getModTSconfig($pageId, 'mod.SHARED'); // default language and "all languages" are always present $languages = [0 => ['uid' => 0, 'title' => $this->getDefaultLanguageLabel($modSharedTSconfig), 'ISOcode' => 'DEF', 'flagIcon' => $this->getDefaultLanguageFlag($modSharedTSconfig)], -1 => ['uid' => -1, 'title' => $this->getLanguageService()->getLL('multipleLanguages'), 'ISOcode' => 'DEF', 'flagIcon' => 'flags-multiple']]; // add the additional languages from database records $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_language'); $languageRecords = $queryBuilder->select('*')->from('sys_language')->orderBy('sorting')->execute()->fetchAll(); foreach ($languageRecords as $languageRecord) { $languages[$languageRecord['uid']] = $languageRecord; // @todo: this should probably resolve language_isocode too and throw a deprecation if not filled if ($languageRecord['static_lang_isocode'] && ExtensionManagementUtility::isLoaded('static_info_tables')) { $staticLangRow = BackendUtility::getRecord('static_languages', $languageRecord['static_lang_isocode'], 'lg_iso_2'); if ($staticLangRow['lg_iso_2']) { $languages[$languageRecord['uid']]['ISOcode'] = $staticLangRow['lg_iso_2']; } } if ($languageRecord['flag'] !== '') { $languages[$languageRecord['uid']]['flagIcon'] = 'flags-' . $languageRecord['flag']; } } return $languages; }
/** * Adding CM element for Create new wizard (either db_new.php or sysext/cms/layout/db_new_content_el.php or custom wizard) * * @param string $table Table name * @param integer $uid UID for the current record. * @param array $rec Record. * @return array Item array, element in $menuItems * @internal * @todo Define visibility */ public function DB_newWizard($table, $uid, $rec) { // If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead: $tmpTSc = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod.web_list'); $tmpTSc = $tmpTSc['properties']['newContentWiz.']['overrideWithExtension']; $newContentWizScriptPath = \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded($tmpTSc) ? \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath($tmpTSc) . 'mod1/db_new_content_el.php' : 'sysext/cms/layout/db_new_content_el.php'; $url = $table == 'pages' || !\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms') ? 'db_new.php?id=' . $uid . '&pagesOnly=1' : $newContentWizScriptPath . '?id=' . $rec['pid'] . '&sys_language_uid=' . intval($rec['sys_language_uid']); return $this->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_newWizard')), $this->excludeIcon(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-' . ($table === 'pages' ? 'page' : 'document') . '-new')), $this->urlRefForCM($url, 'returnUrl'), 0); }
/** * Main function of class * * @return string HTML output */ public function main() { $pageId = (int) GeneralUtility::_GP('id'); if ($pageId === 0) { $this->view->assign('pageZero', 1); $this->view->assign('overviewOfPagesUsingTSConfig', $this->getOverviewOfPagesUsingTSConfig()); } else { if ($this->pObj->MOD_SETTINGS['tsconf_parts'] == 99) { $TSparts = BackendUtility::getPagesTSconfig($this->pObj->id, null, true); $lines = array(); $pUids = array(); foreach ($TSparts as $k => $v) { if ($k != 'uid_0') { $line = array(); if ($k == 'defaultPageTSconfig') { $line['defaultPageTSconfig'] = 1; } else { $pUids[] = substr($k, 4); $row = BackendUtility::getRecordWSOL('pages', substr($k, 4)); $icon = $this->iconFactory->getIconForRecord('pages', $row, Icon::SIZE_SMALL); $editIdList = substr($k, 4); $urlParameters = ['edit' => ['pages' => [$editIdList => 'edit']], 'columnsOnly' => 'TSconfig', 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]; $line['editIcon'] = BackendUtility::getModuleUrl('record_edit', $urlParameters); $line['editTitle'] = 'editTSconfig'; $line['title'] = BackendUtility::wrapClickMenuOnIcon($icon, 'pages', $row['uid']) . ' ' . htmlspecialchars(BackendUtility::getRecordTitle('pages', $row)); } $tsparser = GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::class); $tsparser->lineNumberOffset = 0; $line['content'] = $tsparser->doSyntaxHighlight(trim($v) . LF); $lines[] = $line; } } if (!empty($pUids)) { $urlParameters = ['edit' => ['pages' => [implode(',', $pUids) => 'edit']], 'columnsOnly' => 'TSconfig', 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]; $url = BackendUtility::getModuleUrl('record_edit', $urlParameters); $editIcon = htmlspecialchars($url); $editTitle = 'editTSconfig_all'; } else { $editIcon = ''; $editTitle = ''; } $this->view->assign('tsconfParts99', 1); $this->view->assign('csh', BackendUtility::cshItem('_MOD_web_info', 'tsconfig_edit', null, '|')); $this->view->assign('lines', $lines); $this->view->assign('editIcon', $editIcon); $this->view->assign('editTitle', $editTitle); } else { $this->view->assign('tsconfParts99', 0); // Defined global here! $tmpl = GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\ExtendedTemplateService::class); // Do not log time-performance information $tmpl->tt_track = 0; $tmpl->fixedLgd = 0; $tmpl->linkObjects = 0; $tmpl->bType = ''; $tmpl->ext_expandAllNotes = 1; $tmpl->ext_noPMicons = 1; $beUser = $this->getBackendUser(); switch ($this->pObj->MOD_SETTINGS['tsconf_parts']) { case '1': $modTSconfig = BackendUtility::getModTSconfig($this->pObj->id, 'mod'); break; case '1a': $modTSconfig = $beUser->getTSConfig('mod.web_layout', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '1b': $modTSconfig = $beUser->getTSConfig('mod.web_view', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '1c': $modTSconfig = $beUser->getTSConfig('mod.web_modules', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '1d': $modTSconfig = $beUser->getTSConfig('mod.web_list', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '1e': $modTSconfig = $beUser->getTSConfig('mod.web_info', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '1f': $modTSconfig = $beUser->getTSConfig('mod.web_func', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '1g': $modTSconfig = $beUser->getTSConfig('mod.web_ts', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '2': $modTSconfig = $beUser->getTSConfig('RTE', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '5': $modTSconfig = $beUser->getTSConfig('TCEFORM', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '6': $modTSconfig = $beUser->getTSConfig('TCEMAIN', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '3': $modTSconfig = $beUser->getTSConfig('TSFE', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '4': $modTSconfig = $beUser->getTSConfig('user', BackendUtility::getPagesTSconfig($this->pObj->id)); break; default: $modTSconfig['properties'] = BackendUtility::getPagesTSconfig($this->pObj->id); } $modTSconfig = $modTSconfig['properties']; if (!is_array($modTSconfig)) { $modTSconfig = array(); } $this->view->assign('csh', BackendUtility::cshItem('_MOD_web_info', 'tsconfig_hierarchy', null, '|')); $this->view->assign('tree', $tmpl->ext_getObjTree($modTSconfig, '', '', '', '', $this->pObj->MOD_SETTINGS['tsconf_alphaSort'])); } $this->view->assign('alphaSort', BackendUtility::getFuncCheck($this->pObj->id, 'SET[tsconf_alphaSort]', $this->pObj->MOD_SETTINGS['tsconf_alphaSort'], '', '', 'id="checkTsconf_alphaSort"')); $this->view->assign('dropdownMenu', BackendUtility::getDropdownMenu($this->pObj->id, 'SET[tsconf_parts]', $this->pObj->MOD_SETTINGS['tsconf_parts'], $this->pObj->MOD_MENU['tsconf_parts'])); } return $this->view->render(); }
/** * Rendering the header row for a table * * @param string $table Table name * @param int[] $currentIdList Array of the currently displayed uids of the table * @throws \UnexpectedValueException * @return string Header table row * @access private * @see getTable() */ public function renderListHeader($table, $currentIdList) { $lang = $this->getLanguageService(); // Init: $theData = array(); $icon = ''; // Traverse the fields: foreach ($this->fieldArray as $fCol) { // Calculate users permissions to edit records in the table: $permsEdit = $this->calcPerms & ($table == 'pages' ? 2 : 16) && $this->overlayEditLockPermissions($table); switch ((string) $fCol) { case '_PATH_': // Path $theData[$fCol] = '<i>[' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels._PATH_', true) . ']</i>'; break; case '_REF_': // References $theData[$fCol] = '<i>[' . $lang->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:c__REF_', true) . ']</i>'; break; case '_LOCALIZATION_': // Path $theData[$fCol] = '<i>[' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels._LOCALIZATION_', true) . ']</i>'; break; case '_LOCALIZATION_b': // Path $theData[$fCol] = $lang->getLL('Localize', true); break; case '_CLIPBOARD_': if (!$this->getModule()->MOD_SETTINGS['clipBoard']) { break; } // Clipboard: $cells = array(); // If there are elements on the clipboard for this table, and the parent page is not locked by editlock // then display the "paste into" icon: $elFromTable = $this->clipObj->elFromTable($table); if (!empty($elFromTable) && $this->overlayEditLockPermissions($table)) { $href = htmlspecialchars($this->clipObj->pasteUrl($table, $this->id)); $onClick = htmlspecialchars('return ' . $this->clipObj->confirmMsg('pages', $this->pageRow, 'into', $elFromTable)); $cells['pasteAfter'] = '<a class="btn btn-default" href="' . $href . '" onclick="' . $onClick . '" title="' . $lang->getLL('clip_paste', true) . '">' . $this->iconFactory->getIcon('actions-document-paste-after', Icon::SIZE_SMALL)->render() . '</a>'; } // If the numeric clipboard pads are enabled, display the control icons for that: if ($this->clipObj->current != 'normal') { // The "select" link: $spriteIcon = '<span title="' . $lang->getLL('clip_selectMarked', true) . '">' . $this->iconFactory->getIcon('actions-edit-copy', Icon::SIZE_SMALL)->render() . '</span>'; $cells['copyMarked'] = $this->linkClipboardHeaderIcon($spriteIcon, $table, 'setCB'); // The "edit marked" link: $editIdList = implode(',', $currentIdList); $editIdList = '\'+editList(' . GeneralUtility::quoteJSvalue($table) . ',' . GeneralUtility::quoteJSvalue($editIdList) . ')+\''; $params = 'edit[' . $table . '][' . $editIdList . ']=edit'; $onClick = BackendUtility::editOnClick('', '', -1); $onClickArray = explode('?', $onClick, 2); $lastElement = array_pop($onClickArray); array_push($onClickArray, $params . '&' . $lastElement); $onClick = implode('?', $onClickArray); $cells['edit'] = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $lang->getLL('clip_editMarked', true) . '">' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>'; // The "Delete marked" link: $cells['delete'] = $this->linkClipboardHeaderIcon('<span title="' . $lang->getLL('clip_deleteMarked', true) . '">' . $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</span>', $table, 'delete', sprintf($lang->getLL('clip_deleteMarkedWarning'), $lang->sL($GLOBALS['TCA'][$table]['ctrl']['title']))); // The "Select all" link: $onClick = htmlspecialchars('checkOffCB(' . GeneralUtility::quoteJSvalue(implode(',', $this->CBnames)) . ', this); return false;'); $cells['markAll'] = '<a class="btn btn-default" rel="" href="#" onclick="' . $onClick . '" title="' . $lang->getLL('clip_markRecords', true) . '">' . $this->iconFactory->getIcon('actions-document-select', Icon::SIZE_SMALL)->render() . '</a>'; } else { $cells['empty'] = ''; } /** * @hook renderListHeaderActions: Allows to change the clipboard icons of the Web>List table headers * @usage Above each listed table in Web>List a header row is shown. * This hook allows to modify the icons responsible for the clipboard functions * (shown above the clipboard checkboxes when a clipboard other than "Normal" is selected), * or other "Action" functions which perform operations on the listed records. */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) { $hookObject = GeneralUtility::getUserObj($classData); if (!$hookObject instanceof RecordListHookInterface) { throw new \UnexpectedValueException('$hookObject must implement interface ' . RecordListHookInterface::class, 1195567850); } $cells = $hookObject->renderListHeaderActions($table, $currentIdList, $cells, $this); } } $theData[$fCol] = '<div class="btn-group" role="group">' . implode('', $cells) . '</div>'; break; case '_CONTROL_': // Control panel: if ($this->isEditable($table)) { // If new records can be created on this page, add links: $permsAdditional = $table === 'pages' ? 8 : 16; if ($this->calcPerms & $permsAdditional && $this->showNewRecLink($table)) { $spriteIcon = $table === 'pages' ? $this->iconFactory->getIcon('actions-page-new', Icon::SIZE_SMALL) : $this->iconFactory->getIcon('actions-add', Icon::SIZE_SMALL); if ($table === 'tt_content' && $this->newWizards) { // If mod.newContentElementWizard.override is set, use that extension's create new content wizard instead: $tmpTSc = BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod'); $newContentElementWizard = $tmpTSc['properties']['newContentElementWizard.']['override'] ?: 'new_content_element'; $newContentWizScriptPath = BackendUtility::getModuleUrl($newContentElementWizard, array('id' => $this->id)); $onClick = 'return jumpExt(' . GeneralUtility::quoteJSvalue($newContentWizScriptPath) . ');'; $icon = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $lang->getLL('new', true) . '">' . $spriteIcon->render() . '</a>'; } elseif ($table == 'pages' && $this->newWizards) { $parameters = ['id' => $this->id, 'pagesOnly' => 1, 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]; $href = BackendUtility::getModuleUrl('db_new', $parameters); $icon = '<a class="btn btn-default" href="' . htmlspecialchars($href) . '" title="' . $lang->getLL('new', true) . '">' . $spriteIcon->render() . '</a>'; } else { $params = '&edit[' . $table . '][' . $this->id . ']=new'; if ($table == 'pages_language_overlay') { $params .= '&overrideVals[pages_language_overlay][doktype]=' . (int) $this->pageRow['doktype']; } $icon = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, '', -1)) . '" title="' . $lang->getLL('new', true) . '">' . $spriteIcon->render() . '</a>'; } } // If the table can be edited, add link for editing ALL SHOWN fields for all listed records: if ($permsEdit && $this->table && is_array($currentIdList)) { $editIdList = implode(',', $currentIdList); if ($this->clipNumPane()) { $editIdList = '\'+editList(' . GeneralUtility::quoteJSvalue($table) . ',' . GeneralUtility::quoteJSvalue($editIdList) . ')+\''; } $params = 'edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . implode(',', $this->fieldArray); // we need to build this uri differently, otherwise GeneralUtility::quoteJSvalue messes up the edit list function $onClick = BackendUtility::editOnClick('', '', -1); $onClickArray = explode('?', $onClick, 2); $lastElement = array_pop($onClickArray); array_push($onClickArray, $params . '&' . $lastElement); $onClick = implode('?', $onClickArray); $icon .= '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $lang->getLL('editShownColumns', true) . '">' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>'; $icon = '<div class="btn-group" role="group">' . $icon . '</div>'; } // Add an empty entry, so column count fits again after moving this into $icon $theData[$fCol] = ' '; } break; default: // Regular fields header: $theData[$fCol] = ''; // Check if $fCol is really a field and get the label and remove the colons // at the end $sortLabel = BackendUtility::getItemLabel($table, $fCol); if ($sortLabel !== null) { $sortLabel = $lang->sL($sortLabel, true); $sortLabel = rtrim(trim($sortLabel), ':'); } else { // No TCA field, only output the $fCol variable with square brackets [] $sortLabel = htmlspecialchars($fCol); $sortLabel = '<i>[' . rtrim(trim($sortLabel), ':') . ']</i>'; } if ($this->table && is_array($currentIdList)) { // If the numeric clipboard pads are selected, show duplicate sorting link: if ($this->clipNumPane()) { $theData[$fCol] .= '<a class="btn btn-default" href="' . htmlspecialchars($this->listURL('', '-1') . '&duplicateField=' . $fCol) . '" title="' . $lang->getLL('clip_duplicates', true) . '">' . $this->iconFactory->getIcon('actions-document-duplicates-select', Icon::SIZE_SMALL)->render() . '</a>'; } // If the table can be edited, add link for editing THIS field for all // listed records: if ($this->isEditable($table) && $permsEdit && $GLOBALS['TCA'][$table]['columns'][$fCol]) { $editIdList = implode(',', $currentIdList); if ($this->clipNumPane()) { $editIdList = '\'+editList(' . GeneralUtility::quoteJSvalue($table) . ',' . GeneralUtility::quoteJSvalue($editIdList) . ')+\''; } $params = 'edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . $fCol; // we need to build this uri differently, otherwise GeneralUtility::quoteJSvalue messes up the edit list function $onClick = BackendUtility::editOnClick('', '', -1); $onClickArray = explode('?', $onClick, 2); $lastElement = array_pop($onClickArray); array_push($onClickArray, $params . '&' . $lastElement); $onClick = implode('?', $onClickArray); $iTitle = sprintf($lang->getLL('editThisColumn'), $sortLabel); $theData[$fCol] .= '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . htmlspecialchars($iTitle) . '">' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>'; } if (strlen($theData[$fCol]) > 0) { $theData[$fCol] = '<div class="btn-group" role="group">' . $theData[$fCol] . '</div> '; } } $theData[$fCol] .= $this->addSortLink($sortLabel, $fCol, $table); } } /** * @hook renderListHeader: Allows to change the contents of columns/cells of the Web>List table headers * @usage Above each listed table in Web>List a header row is shown. * Containing the labels of all shown fields and additional icons to create new records for this * table or perform special clipboard tasks like mark and copy all listed records to clipboard, etc. */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) { $hookObject = GeneralUtility::getUserObj($classData); if (!$hookObject instanceof RecordListHookInterface) { throw new \UnexpectedValueException('$hookObject must implement interface ' . RecordListHookInterface::class, 1195567855); } $theData = $hookObject->renderListHeader($table, $currentIdList, $theData, $this); } } // Create and return header table row: return '<thead>' . $this->addElement(1, $icon, $theData, '', '', '', 'th') . '</thead>'; }
/** * Returns the default language configured by TSConfig. * * @return array */ public function getDefaultFlag() { if (is_null($this->defaultIcon)) { $defaultFlag = ''; // default value $tsConfig = BackendUtility::getModTSconfig(0, 'mod.SHARED'); // Fallback non sprite-configuration if (($pos = strrpos($tsConfig['properties']['defaultLanguageFlag'], '.')) !== FALSE) { $defaultFlag = substr($tsConfig['properties']['defaultLanguageFlag'], 0, $pos); } $this->defaultIcon = $defaultFlag; } return $this->defaultIcon; }
/** * Get available widths for preview frame * * @return array */ protected function getPreviewFrameWidths() { $pageId = (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id'); $modTSconfig = BackendUtility::getModTSconfig($pageId, 'mod.web_view'); $data = json_encode(array('width' => '100%', 'height' => "100%")); $widths = array($data => $GLOBALS['LANG']->getLL('autoSize')); if (is_array($modTSconfig['properties']['previewFrameWidths.'])) { foreach ($modTSconfig['properties']['previewFrameWidths.'] as $item => $conf) { $label = ''; $width = substr($item, 0, -1); $data = array('width' => $width); $label .= $width . 'px '; //if height is set if (isset($conf['height'])) { $label .= ' × ' . $conf['height'] . 'px '; $data['height'] = $conf['height']; } if (substr($conf['label'], 0, 4) !== 'LLL:') { $label .= $conf['label']; } else { $label .= $GLOBALS['LANG']->sL(trim($conf['label'])); } $widths[json_encode($data)] = $label; } } return $widths; }
/** * Gets the list of available columns for a given page id * * @param int $id * @return array $tcaItems */ public function getColPosListItemsParsed($id) { $tsConfig = BackendUtility::getModTSconfig($id, 'TCEFORM.tt_content.colPos'); $tcaConfig = $GLOBALS['TCA']['tt_content']['columns']['colPos']['config']; $tcaItems = $tcaConfig['items']; $tcaItems = $this->addItems($tcaItems, $tsConfig['properties']['addItems.']); if (isset($tcaConfig['itemsProcFunc']) && $tcaConfig['itemsProcFunc']) { $tcaItems = $this->addColPosListLayoutItems($id, $tcaItems); } foreach (GeneralUtility::trimExplode(',', $tsConfig['properties']['removeItems'], true) as $removeId) { foreach ($tcaItems as $key => $item) { if ($item[1] == $removeId) { unset($tcaItems[$key]); } } } return $tcaItems; }
/** * Constructor, initializing internal variables. * * @return void */ public function init() { $lang = $this->getLanguageService(); $lang->includeLLFile('EXT:lang/locallang_misc.xlf'); $LOCAL_LANG_orig = $GLOBALS['LOCAL_LANG']; $lang->includeLLFile('EXT:backend/Resources/Private/Language/locallang_db_new_content_el.xlf'); ArrayUtility::mergeRecursiveWithOverrule($LOCAL_LANG_orig, $GLOBALS['LOCAL_LANG']); $GLOBALS['LOCAL_LANG'] = $LOCAL_LANG_orig; // Setting internal vars: $this->id = (int) GeneralUtility::_GP('id'); $this->sys_language = (int) GeneralUtility::_GP('sys_language_uid'); $this->R_URI = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl')); $this->colPos = GeneralUtility::_GP('colPos') === null ? null : (int) GeneralUtility::_GP('colPos'); $this->uid_pid = (int) GeneralUtility::_GP('uid_pid'); $this->MCONF['name'] = 'xMOD_db_new_content_el'; $this->modTSconfig = BackendUtility::getModTSconfig($this->id, 'mod.wizards.newContentElement'); $config = BackendUtility::getPagesTSconfig($this->id); $this->config = $config['mod.']['wizards.']['newContentElement.']; // Starting the document template object: // We keep this here in case somebody relies on it in a hook or alike $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class); // Setting up the context sensitive menu: $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu'); // Getting the current page and receiving access information (used in main()) $perms_clause = $this->getBackendUser()->getPagePermsClause(1); $this->pageInfo = BackendUtility::readPageAccess($this->id, $perms_clause); $this->access = is_array($this->pageInfo) ? 1 : 0; }
/** * Make selector box for creating new translation in a language * Displays only languages which are not yet present for the current page and * that are not disabled with page TS. * * @param int $id Page id for which to create a new language (pages_language_overlay record) * @return string <select> HTML element (if there were items for the box anyways...) * @see getTable_tt_content() */ public function languageSelector($id) { if ($this->getBackendUser()->check('tables_modify', 'pages_language_overlay')) { // First, select all $res = $this->getPageLayoutController()->exec_languageQuery(0); $langSelItems = array(); $langSelItems[0] = ' <option value="0"></option>'; while ($row = $this->getDatabase()->sql_fetch_assoc($res)) { if ($this->getBackendUser()->checkLanguageAccess($row['uid'])) { $langSelItems[$row['uid']] = ' <option value="' . $row['uid'] . '">' . htmlspecialchars($row['title']) . '</option>'; } } // Then, subtract the languages which are already on the page: $res = $this->getPageLayoutController()->exec_languageQuery($id); while ($row = $this->getDatabase()->sql_fetch_assoc($res)) { unset($langSelItems[$row['uid']]); } // Remove disallowed languages if (count($langSelItems) > 1 && !$this->getBackendUser()->user['admin'] && $this->getBackendUser()->groupData['allowed_languages'] !== '') { $allowed_languages = array_flip(explode(',', $this->getBackendUser()->groupData['allowed_languages'])); if (!empty($allowed_languages)) { foreach ($langSelItems as $key => $value) { if (!isset($allowed_languages[$key]) && $key != 0) { unset($langSelItems[$key]); } } } } // Remove disabled languages $modSharedTSconfig = BackendUtility::getModTSconfig($id, 'mod.SHARED'); $disableLanguages = isset($modSharedTSconfig['properties']['disableLanguages']) ? GeneralUtility::trimExplode(',', $modSharedTSconfig['properties']['disableLanguages'], true) : array(); if (!empty($langSelItems) && !empty($disableLanguages)) { foreach ($disableLanguages as $language) { if ($language != 0 && isset($langSelItems[$language])) { unset($langSelItems[$language]); } } } // If any languages are left, make selector: if (count($langSelItems) > 1) { $url = BackendUtility::getModuleUrl('record_edit', array('edit[pages_language_overlay][' . $id . ']' => 'new', 'overrideVals[pages_language_overlay][doktype]' => (int) $this->pageRecord['doktype'], 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI'))); $onChangeContent = 'window.location.href=' . GeneralUtility::quoteJSvalue($url . '&overrideVals[pages_language_overlay][sys_language_uid]=') . '+this.options[this.selectedIndex].value'; return '<div class="form-inline form-inline-spaced">' . '<div class="form-group">' . '<label for="createNewLanguage">' . $this->getLanguageService()->getLL('new_language', true) . '</label>' . '<select class="form-control input-sm" name="createNewLanguage" onchange="' . htmlspecialchars($onChangeContent) . '">' . implode('', $langSelItems) . '</select></div></div>'; } } return ''; }
/** * Checks whether translated Content Elements exist in the desired language * If so, deny creating new ones via the UI * * @param array $contentElements * @param int $language * @return bool */ protected function checkIfTranslationsExistInLanguage(array $contentElements, $language) { // If in default language, you may always create new entries // Also, you may override this strict behavior via user TS Config // If you do so, you're on your own and cannot rely on any support by the TYPO3 core // We jump out here since we don't need to do the expensive loop operations $allowInconsistentLanguageHandling = BackendUtility::getModTSconfig($this->id, 'mod.web_layout.allowInconsistentLanguageHandling'); if ($language === 0 || $allowInconsistentLanguageHandling['value'] === '1') { return false; } /** * Build up caches */ if (!isset($this->languageHasTranslationsCache[$language])) { foreach ($contentElements as $columns) { foreach ($columns as $contentElement) { if ((int) $contentElement['l18n_parent'] === 0) { $this->languageHasTranslationsCache[$language]['hasStandAloneContent'] = true; } if ((int) $contentElement['l18n_parent'] > 0) { $this->languageHasTranslationsCache[$language]['hasTranslations'] = true; } } } // Check whether we have a mix of both if ($this->languageHasTranslationsCache[$language]['hasStandAloneContent'] && $this->languageHasTranslationsCache[$language]['hasTranslations']) { $message = GeneralUtility::makeInstance(FlashMessage::class, sprintf($this->getLanguageService()->getLL('staleTranslationWarning'), $this->languageIconTitles[$language]['title']), sprintf($this->getLanguageService()->getLL('staleTranslationWarningTitle'), $this->languageIconTitles[$language]['title']), FlashMessage::WARNING); $service = GeneralUtility::makeInstance(FlashMessageService::class); $queue = $service->getMessageQueueByIdentifier(); $queue->addMessage($message); } } if ($this->languageHasTranslationsCache[$language]['hasTranslations']) { return true; } return false; }
/** * Main * * @return string */ public function main() { $lang = $this->getLanguageService(); $lang->includeLLFile('EXT:tstemplate/Resources/Private/Language/locallang_ceditor.xlf'); $theOutput = ''; // Create extension template $this->pObj->createTemplate($this->pObj->id); // Checking for more than one template an if, set a menu... $manyTemplatesMenu = $this->pObj->templateMenu(); $template_uid = 0; if ($manyTemplatesMenu) { $template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage']; } // initialize $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid); if ($existTemplate) { $templateService = $this->getExtendedTemplateService(); $tplRow = $this->getTemplateRow(); $theConstants = $this->getConstants(); $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Tstemplate/ConstantEditor'); $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid']; // Update template ? if (GeneralUtility::_POST('_savedok')) { $templateService->changed = 0; $templateService->ext_procesInput(GeneralUtility::_POST(), array(), $theConstants, $tplRow); if ($templateService->changed) { // Set the data to be saved $recData = array(); $recData['sys_template'][$saveId]['constants'] = implode($templateService->raw, LF); // Create new tce-object $tce = GeneralUtility::makeInstance(DataHandler::class); $tce->stripslashes_values = false; $tce->start($recData, array()); $tce->process_datamap(); // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php) $tce->clear_cacheCmd('all'); // re-read the template ... $this->initialize_editor($this->pObj->id, $template_uid); // re-read the constants as they have changed $templateService = $this->getExtendedTemplateService(); $tplRow = $this->getTemplateRow(); $theConstants = $this->getConstants(); } } // Resetting the menu (start). I wonder if this in any way is a violation of the menu-system. Haven't checked. But need to do it here, because the menu is dependent on the categories available. $this->pObj->MOD_MENU['constant_editor_cat'] = $templateService->ext_getCategoryLabelArray(); $this->pObj->MOD_SETTINGS = BackendUtility::getModuleData($this->pObj->MOD_MENU, GeneralUtility::_GP('SET'), $this->pObj->MCONF['name']); // Resetting the menu (stop) $iconFactory = GeneralUtility::makeInstance(IconFactory::class); $content = $iconFactory->getIconForRecord('sys_template', $tplRow, Icon::SIZE_SMALL)->render() . '<strong>' . $this->pObj->linkWrapTemplateTitle($tplRow['title'], 'constants') . '</strong>' . (trim($tplRow['sitetitle']) ? htmlspecialchars(' (' . $tplRow['sitetitle'] . ')') : ''); $theOutput .= $this->pObj->doc->section($lang->getLL('editConstants', true), $content, false, true); if ($manyTemplatesMenu) { $theOutput .= $this->pObj->doc->section('', $manyTemplatesMenu); } $theOutput .= '<div style="padding-top: 10px;"></div>'; if (!empty($this->pObj->MOD_MENU['constant_editor_cat'])) { $menu = '<div class="form-inline form-inline-spaced">'; $menu .= BackendUtility::getDropdownMenu($this->pObj->id, 'SET[constant_editor_cat]', $this->pObj->MOD_SETTINGS['constant_editor_cat'], $this->pObj->MOD_MENU['constant_editor_cat']); $menu .= '</div>'; $theOutput .= $this->pObj->doc->section($lang->getLL('category', true), '<span class="text-nowrap">' . $menu . '</span>', false); } else { $theOutput .= $this->pObj->doc->section($lang->getLL('noConstants', true), $lang->getLL('noConstantsDescription', true), false, false, 1); } $theOutput .= '<div style="padding-top: 15px;"></div>'; // Category and constant editor config: $category = $this->pObj->MOD_SETTINGS['constant_editor_cat']; $templateService->ext_getTSCE_config($category); $printFields = trim($templateService->ext_printFields($theConstants, $category)); if ($printFields) { $theOutput .= $this->pObj->doc->section('', $printFields); } $BE_USER_modOptions = BackendUtility::getModTSconfig(0, 'mod.' . $this->pObj->MCONF['name']); if ($BE_USER_modOptions['properties']['constantEditor.']['example'] != 'top') { $theOutput = $this->displayExample($theOutput); } } else { $theOutput .= $this->pObj->noTemplate(1); } return $theOutput; }
/** * Basically makes sure that the workspace preview is rendered. * The preview itself consists of three frames, so there are * only the frames-urls we've to generate here * * @param integer $previewWS * @return void */ public function indexAction($previewWS = NULL) { // Get all the GET parameters to pass them on to the frames $queryParameters = GeneralUtility::_GET(); // Remove the GET parameters related to the workspaces module and the page id unset($queryParameters['tx_workspaces_web_workspacesworkspaces']); unset($queryParameters['M']); unset($queryParameters['id']); // Assemble a query string from the retrieved parameters $queryString = GeneralUtility::implodeArrayForUrl('', $queryParameters); // fetch the next and previous stage $workspaceItemsArray = $this->workspaceService->selectVersionsInWorkspace($this->stageService->getWorkspaceId(), $filter = 1, $stage = -99, $this->pageId, $recursionLevel = 0, $selectionType = 'tables_modify'); list(, $nextStage) = $this->stageService->getNextStageForElementCollection($workspaceItemsArray); list(, $previousStage) = $this->stageService->getPreviousStageForElementCollection($workspaceItemsArray); /** @var $wsService \TYPO3\CMS\Workspaces\Service\WorkspaceService */ $wsService = GeneralUtility::makeInstance('TYPO3\\CMS\\Workspaces\\Service\\WorkspaceService'); $wsList = $wsService->getAvailableWorkspaces(); $activeWorkspace = $GLOBALS['BE_USER']->workspace; if (!is_null($previewWS)) { if (in_array($previewWS, array_keys($wsList)) && $activeWorkspace != $previewWS) { $activeWorkspace = $previewWS; $GLOBALS['BE_USER']->setWorkspace($activeWorkspace); BackendUtility::setUpdateSignal('updatePageTree'); } } /** @var $uriBuilder \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder */ $uriBuilder = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder'); $wsSettingsPath = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'typo3/'; $wsSettingsUri = $uriBuilder->uriFor('singleIndex', array(), 'TYPO3\\CMS\\Workspaces\\Controller\\ReviewController', 'workspaces', 'web_workspacesworkspaces'); $wsSettingsParams = '&tx_workspaces_web_workspacesworkspaces[controller]=Review'; $wsSettingsUrl = $wsSettingsPath . $wsSettingsUri . $wsSettingsParams; $viewDomain = BackendUtility::getViewDomain($this->pageId); $wsBaseUrl = $viewDomain . '/index.php?id=' . $this->pageId . $queryString; // @todo - handle new pages here // branchpoints are not handled anymore because this feature is not supposed anymore if (\TYPO3\CMS\Workspaces\Service\WorkspaceService::isNewPage($this->pageId)) { $wsNewPageUri = $uriBuilder->uriFor('newPage', array(), 'TYPO3\\CMS\\Workspaces\\Controller\\PreviewController', 'workspaces', 'web_workspacesworkspaces'); $wsNewPageParams = '&tx_workspaces_web_workspacesworkspaces[controller]=Preview'; $this->view->assign('liveUrl', $wsSettingsPath . $wsNewPageUri . $wsNewPageParams); } else { $this->view->assign('liveUrl', $wsBaseUrl . '&ADMCMD_noBeUser=1'); } $this->view->assign('wsUrl', $wsBaseUrl . '&ADMCMD_view=1&ADMCMD_editIcons=1&ADMCMD_previewWS=' . $GLOBALS['BE_USER']->workspace); $this->view->assign('wsSettingsUrl', $wsSettingsUrl); $this->view->assign('backendDomain', GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY')); $splitPreviewTsConfig = BackendUtility::getModTSconfig($this->pageId, 'workspaces.splitPreviewModes'); $splitPreviewModes = GeneralUtility::trimExplode(',', $splitPreviewTsConfig['value']); $allPreviewModes = array('slider', 'vbox', 'hbox'); if (!array_intersect($splitPreviewModes, $allPreviewModes)) { $splitPreviewModes = $allPreviewModes; } $this->pageRenderer->addInlineSetting('Workspaces', 'SplitPreviewModes', $splitPreviewModes); $GLOBALS['BE_USER']->setAndSaveSessionData('workspaces.backend_domain', GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY')); $this->pageRenderer->addInlineSetting('Workspaces', 'disableNextStageButton', $this->isInvalidStage($nextStage)); $this->pageRenderer->addInlineSetting('Workspaces', 'disablePreviousStageButton', $this->isInvalidStage($previousStage)); $this->pageRenderer->addInlineSetting('Workspaces', 'disableDiscardStageButton', $this->isInvalidStage($nextStage) && $this->isInvalidStage($previousStage)); $resourcePath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('lang') . 'Resources/Public/JavaScript/'; $this->pageRenderer->addJsFile($resourcePath . 'Typo3Lang.js'); $this->pageRenderer->addJsInlineCode('workspaces.preview.lll', ' TYPO3.lang = { visualPreview: ' . Utility\GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:preview.visualPreview', TRUE)) . ', listView: ' . Utility\GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:preview.listView', TRUE)) . ', livePreview: ' . Utility\GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:preview.livePreview', TRUE)) . ', livePreviewDetail: ' . Utility\GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:preview.livePreviewDetail', TRUE)) . ', workspacePreview: ' . Utility\GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:preview.workspacePreview', TRUE)) . ', workspacePreviewDetail: ' . Utility\GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:preview.workspacePreviewDetail', TRUE)) . ', modeSlider: ' . Utility\GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:preview.modeSlider', TRUE)) . ', modeVbox: ' . Utility\GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:preview.modeVbox', TRUE)) . ', modeHbox: ' . Utility\GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:preview.modeHbox', TRUE)) . ', discard: ' . Utility\GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:label_doaction_discard', TRUE)) . ', nextStage: ' . Utility\GeneralUtility::quoteJSvalue($nextStage['title']) . ', previousStage: ' . Utility\GeneralUtility::quoteJSvalue($previousStage['title']) . ' };TYPO3.l10n.initialize(); '); $resourcePath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('workspaces') . 'Resources/Public/'; $this->pageRenderer->addJsFile($resourcePath . 'JavaScript/preview.js'); }
/** * Get the linkvalidator modTSconfig for a page * * @param int $page Uid of the page * @return array $modTsConfig mod.linkvalidator TSconfig array * @throws \Exception */ protected function loadModTsConfig($page) { $modTs = BackendUtility::getModTSconfig($page, 'mod.linkvalidator'); $parseObj = GeneralUtility::makeInstance(TypoScriptParser::class); $parseObj->parse($this->configuration); if (!empty($parseObj->errors)) { $parseErrorMessage = $this->getLanguageService()->sL('LLL:EXT:linkvalidator/Resources/Private/Language/locallang.xlf:tasks.error.invalidTSconfig') . '<br />'; foreach ($parseObj->errors as $errorInfo) { $parseErrorMessage .= $errorInfo[0] . '<br />'; } throw new \Exception($parseErrorMessage, '1295476989'); } $tsConfig = $parseObj->setup; $modTs = $modTs['properties']; $overrideTs = $tsConfig['mod.']['linkvalidator.']; if (is_array($overrideTs)) { ArrayUtility::mergeRecursiveWithOverrule($modTs, $overrideTs); } return $modTs; }
/** * Rendering the header row for a table * * @param string $table Table name * @param array $currentIdList Array of the currently displayed uids of the table * * @return string Header table row * @throws UnexpectedValueException If hook was of wrong interface */ public function renderListHeader($table, array $currentIdList) { $language =& $this->getLanguageService(); // Init: $theData = array(); $icon = ''; // Traverse the fields: foreach ($this->fieldArray as $fCol) { // Calculate users permissions to edit records in the table: $permsEdit = $this->calcPerms & ($table == 'tx_commerce_categories' ? 2 : 16); switch ((string) $fCol) { // Path case '_PATH_': $theData[$fCol] = '<i>[' . $language->sL('LLL:EXT:lang/locallang_core.php:labels._PATH_', 1) . ']</i>'; break; // References // References case '_REF_': $theData[$fCol] = '<i>[' . $language->sL('LLL:EXT:lang/locallang_mod_file_list.xml:c__REF_', 1) . ']</i>'; break; // Path // Path case '_LOCALIZATION_': $theData[$fCol] = '<i>[' . $language->sL('LLL:EXT:lang/locallang_core.php:labels._LOCALIZATION_', 1) . ']</i>'; break; // Path // Path case '_LOCALIZATION_b': $theData[$fCol] = $language->getLL('Localize', 1); break; // Clipboard: // Clipboard: case '_CLIPBOARD_': $cells = array(); // If there are elements on the clipboard for this table, // then display the "paste into" icon: $elFromTable = $this->clipObj->elFromTable($table); if (count($elFromTable)) { $cells['pasteAfter'] = '<a href="' . htmlspecialchars($this->clipObj->pasteUrl($table, $this->id)) . '" onclick="' . htmlspecialchars('return ' . $this->clipObj->confirmMsg('tx_commerce_categories', $this->pageRow, 'into', $elFromTable)) . '" title="' . $language->getLL('clip_paste', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-paste-after') . '</a>'; } // If the numeric clipboard pads are enabled, // display the control icons for that: if ($this->clipObj->current != 'normal') { // The "select" link: $cells['copyMarked'] = $this->linkClipboardHeaderIcon(IconUtility::getSpriteIcon('actions-edit-copy', array('title' => $language->getLL('clip_selectMarked', TRUE))), $table, 'setCB'); // The "edit marked" link: $editIdList = implode(',', $currentIdList); $editIdList = "'+editList('" . $table . "','" . $editIdList . "')+'"; $params = '&edit[' . $table . '][' . $editIdList . ']=edit&disHelp=1'; $cells['edit'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1)) . '">' . IconUtility::getSpriteIcon('actions-document-open', array('title' => $language->getLL('clip_editMarked', TRUE))) . '</a>'; // The "Delete marked" link: $cells['delete'] = $this->linkClipboardHeaderIcon(IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $language->getLL('clip_deleteMarked', TRUE))), $table, 'delete', sprintf($language->getLL('clip_deleteMarkedWarning'), $language->sL($GLOBALS['TCA'][$table]['ctrl']['title']))); // The "Select all" link: $cells['markAll'] = '<a class="cbcCheckAll" rel="" href="#" onclick="' . htmlspecialchars('checkOffCB(\'' . implode(',', $this->CBnames) . '\', this); return false;') . '" title="' . $language->getLL('clip_markRecords', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-select') . '</a>'; } else { $cells['empty'] = ''; } /** * Render list header actions hook: Allows to change the clipboard icons * @date 2007-11-20 * @request Bernhard Kraft <*****@*****.**> * @usage Above each listed table in Web>List a header row is shown. * This hook allows to modify the icons responsible for the clipboard * functions (shown above the clipboard checkboxes when a clipboard * other than "Normal" is selected), or other "Action" functions which * perform operations on the listed records. */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) { $hookObject = GeneralUtility::getUserObj($classData); if (!$hookObject instanceof \TYPO3\CMS\Recordlist\RecordList\RecordListHookInterface) { throw new UnexpectedValueException('$hookObject must implement interface \\TYPO3\\CMS\\Recordlist\\RecordList\\RecordListHookInterface', 1195567850); } $cells = $hookObject->renderListHeaderActions($table, $currentIdList, $cells, $this); } } $theData[$fCol] = implode('', $cells); break; // Control panel: // Control panel: case '_CONTROL_': if (!$GLOBALS['TCA'][$table]['ctrl']['readOnly']) { // If new records can be created on this page, add links: if ($this->calcPerms & ($table == 'tx_commerce_categories' ? 8 : 16) && $this->showNewRecLink($table) && $this->parentUid) { if ($table == 'tt_content' && $this->newWizards) { // If mod.web_list.newContentWiz.overrideWithExtension is set, // use that extension's create new content wizard instead: $tmpTyposcriptConfig = BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod.web_list'); $tmpTyposcriptConfig = $tmpTyposcriptConfig['properties']['newContentWiz.']['overrideWithExtension']; $newContentWizScriptPath = $this->backPath . ExtensionManagementUtility::isLoaded($tmpTyposcriptConfig) ? ExtensionManagementUtility::extRelPath($tmpTyposcriptConfig) . 'mod1/db_new_content_el.php' : 'sysext/cms/layout/db_new_content_el.php'; $icon = '<a href="#" onclick="' . htmlspecialchars('return jumpExt(\'' . $newContentWizScriptPath . '?id=' . $this->id . '\');') . '" title="' . $language->getLL('new', TRUE) . '">' . ($table == 'tx_commerce_categories' ? IconUtility::getSpriteIcon('actions-page-new') : IconUtility::getSpriteIcon('actions-document-new')) . '</a>'; } elseif ($table == 'tx_commerce_categories' && $this->newWizards) { $icon = '<a href="' . htmlspecialchars($this->backPath . 'db_new.php?id=' . $this->id . '&pagesOnly=1&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'))) . '" title="' . $language->getLL('new', TRUE) . '">' . ($table == 'tx_commerce_categories' ? IconUtility::getSpriteIcon('actions-page-new') : IconUtility::getSpriteIcon('actions-document-new')) . '</a>'; } else { $parameters = '&edit[' . $table . '][' . $this->id . ']=new'; if ($table == 'pages_language_overlay') { $parameters .= '&overrideVals[pages_language_overlay][doktype]=' . (int) $this->pageRow['doktype']; } switch ($table) { case 'tx_commerce_categories': $parameters .= '&defVals[tx_commerce_categories][parent_category]=' . $this->parentUid; break; case 'tx_commerce_products': $parameters .= '&defVals[tx_commerce_products][categories]=' . $this->parentUid; break; default: } $icon = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($parameters, $this->backPath, -1)) . '" title="' . $language->getLL('new', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-new') . '</a>'; } } // If the table can be edited, add link for editing // ALL SHOWN fields for all listed records: if ($permsEdit && $this->table && is_array($currentIdList)) { $editIdList = implode(',', $currentIdList); if ($this->clipNumPane()) { $editIdList = "'+editList('" . $table . "','" . $editIdList . "')+'"; } $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . implode(',', $this->fieldArray) . '&disHelp=1'; $icon .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . $language->getLL('editShownColumns', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>'; } // add an empty entry, so column count fits again after moving this into $icon $theData[$fCol] = ' '; } break; // space column // space column case '_AFTERCONTROL_': // space column // space column case '_AFTERREF_': $theData[$fCol] = ' '; break; // Regular fields header: // Regular fields header: default: $theData[$fCol] = ''; if ($this->table && is_array($currentIdList)) { // If the numeric clipboard pads are selected, show duplicate sorting link: if ($this->clipNumPane()) { $theData[$fCol] .= '<a href="' . htmlspecialchars($this->listURL('', -1) . '&duplicateField=' . $fCol) . '" title="' . $language->getLL('clip_duplicates', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-duplicates-select') . '</a>'; } // If the table can be edited, add link for editing THIS field for all records: if (!$GLOBALS['TCA'][$table]['ctrl']['readOnly'] && $permsEdit && $GLOBALS['TCA'][$table]['columns'][$fCol]) { $editIdList = implode(',', $currentIdList); if ($this->clipNumPane()) { $editIdList = "'+editList('" . $table . "','" . $editIdList . "')+'"; } $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . $fCol . '&disHelp=1'; $iTitle = sprintf($language->getLL('editThisColumn'), rtrim(trim($language->sL(BackendUtility::getItemLabel($table, $fCol))), ':')); $theData[$fCol] .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . htmlspecialchars($iTitle) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>'; } } $theData[$fCol] .= $this->addSortLink($language->sL(BackendUtility::getItemLabel($table, $fCol, '<i>[|]</i>')), $fCol, $table); } } /** * Above each listed table in Web>List a header row is shown. * Containing the labels of all shown fields and additional icons to * create new records for this table or perform special clipboard tasks * like mark and copy all listed records to clipboard, etc. */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) { $hookObject = GeneralUtility::getUserObj($classData); if (!$hookObject instanceof \TYPO3\CMS\Recordlist\RecordList\RecordListHookInterface) { throw new UnexpectedValueException('$hookObject must implement interface \\TYPO3\\CMS\\Recordlist\\RecordList\\RecordListHookInterface', 1195567855); } $theData = $hookObject->renderListHeader($table, $currentIdList, $theData, $this); } } // Create and return header table row: return $this->addelement(1, $icon, $theData, ' class="c-headLine"', ''); }
/** * Main method of modfuncreport * * @return string Module content */ public function main() { $this->getLanguageService()->includeLLFile('EXT:linkvalidator/Resources/Private/Language/Module/locallang.xlf'); $this->searchLevel = GeneralUtility::_GP('search_levels'); if (isset($this->pObj->id)) { $this->modTS = BackendUtility::getModTSconfig($this->pObj->id, 'mod.linkvalidator'); $this->modTS = $this->modTS['properties']; } $update = GeneralUtility::_GP('updateLinkList'); $prefix = ''; if (!empty($update)) { $prefix = 'check'; } $set = GeneralUtility::_GP($prefix . 'SET'); $this->pObj->handleExternalFunctionValue(); if (isset($this->searchLevel)) { $this->pObj->MOD_SETTINGS['searchlevel'] = $this->searchLevel; } else { $this->searchLevel = $this->pObj->MOD_SETTINGS['searchlevel']; } if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $linkType => $value) { // Compile list of all available types. Used for checking with button "Check Links". if (strpos($this->modTS['linktypes'], $linkType) !== FALSE) { $this->availableOptions[$linkType] = 1; } // Compile list of types currently selected by the checkboxes if ($this->pObj->MOD_SETTINGS[$linkType] && empty($set) || $set[$linkType]) { $this->checkOpt[$linkType] = 1; $this->pObj->MOD_SETTINGS[$linkType] = 1; } else { $this->pObj->MOD_SETTINGS[$linkType] = 0; unset($this->checkOpt[$linkType]); } } } $this->getBackendUser()->pushModuleData('web_info', $this->pObj->MOD_SETTINGS); $this->initialize(); // Localization $this->doc->getPageRenderer()->addInlineLanguageLabelFile(ExtensionManagementUtility::extPath('linkvalidator', 'Resources/Private/Language/Module/locallang.xlf')); if ($this->modTS['showCheckLinkTab'] == 1) { $this->updateListHtml = '<input class="btn btn-default" type="submit" name="updateLinkList" id="updateLinkList" value="' . $this->getLanguageService()->getLL('label_update') . '"/>'; } $this->refreshListHtml = '<input class="btn btn-default" type="submit" name="refreshLinkList" id="refreshLinkList" value="' . $this->getLanguageService()->getLL('label_refresh') . '"/>'; $this->linkAnalyzer = GeneralUtility::makeInstance(LinkAnalyzer::class); $this->updateBrokenLinks(); $brokenLinkOverView = $this->linkAnalyzer->getLinkCounts($this->pObj->id); $this->checkOptionsHtml = $this->getCheckOptions($brokenLinkOverView); $this->checkOptionsHtmlCheck = $this->getCheckOptions($brokenLinkOverView, 'check'); $this->render(); $pageTile = ''; if ($this->pObj->id) { $pageRecord = BackendUtility::getRecord('pages', $this->pObj->id); $pageTile = '<h1>' . htmlspecialchars(BackendUtility::getRecordTitle('pages', $pageRecord)) . '</h1>'; } return '<div id="linkvalidator-modfuncreport">' . $pageTile . $this->createTabs() . '</div>'; }
/** * Returns the list of categories with their ID. * * @param array $config Associative array of existing configurations * @param \TYPO3\CMS\Backend\Form\FormEngine|\TYPO3\CMS\Backend\Form\DataPreprocessor $tceForms TCE forms object * @param string $sitecode Unique code of the site to retrieve the categories for * @return array Associative array with existing and new entries */ public function getCategories(array $config, $tceForms = null, $sitecode = 'default') { if (isset($config['flexParentDatabaseRow']['pid'])) { // TYPO3 7+ $pid = $config['flexParentDatabaseRow']['pid']; } elseif (isset($config['row']['pid'])) { // TYPO3 6.2 $pid = $config['row']['pid']; } $pageTSConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($pid, 'tx_aimeos'); if (isset($pageTSConfig['properties']['mshop.']['locale.']['site'])) { $sitecode = $pageTSConfig['properties']['mshop.']['locale.']['site']; } try { $context = Base::getContext(Base::getConfig()); $context->setEditor('flexform'); $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); $context->setLocale($localeManager->bootstrap($sitecode, '', '', false)); $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($context); $item = $manager->getTree(null, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE); $config['items'] = array_merge($config['items'], $this->getCategoryList($item, $item->getName())); } catch (\Exception $e) { error_log($e->getMessage() . PHP_EOL . $e->getTraceAsString()); } return $config; }