/** * @param string $icon * @return string */ public static function getIcon($icon) { if (NULL === static::$iconFactory) { static::$iconFactory = GeneralUtility::makeInstance(IconFactory::class); } return static::$iconFactory->getIcon($icon, Icon::SIZE_SMALL); }
/** * Get drop down * * @return string */ public function getDropDown() { $backendUser = $this->getBackendUser(); $languageService = $this->getLanguageService(); $index = 0; $activeWorkspace = (int) $backendUser->workspace; $stateCheckedIcon = $this->iconFactory->getIcon('status-status-checked', Icon::SIZE_SMALL)->render(); $stateUncheckedIcon = '<span title="' . $languageService->getLL('bookmark_inactive', true) . '">' . $this->iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>'; $workspaceSections = array('top' => array(), 'items' => array()); foreach ($this->availableWorkspaces as $workspaceId => $label) { $workspaceId = (int) $workspaceId; $iconState = $workspaceId === $activeWorkspace ? $stateCheckedIcon : $stateUncheckedIcon; $classValue = $workspaceId === $activeWorkspace ? ' class="selected"' : ''; $sectionName = $index++ === 0 ? 'top' : 'items'; $workspaceSections[$sectionName][] = '<li' . $classValue . '>' . '<a href="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('main', array('changeWorkspace' => $workspaceId))) . '" data-workspaceid="' . $workspaceId . '" class="dropdown-list-link tx-workspaces-switchlink">' . $iconState . ' ' . htmlspecialchars($label) . '</a></li>'; } if (!empty($workspaceSections['top'])) { // Add the "Go to workspace module" link // if there is at least one icon on top and if the access rights are there if ($backendUser->check('modules', 'web_WorkspacesWorkspaces')) { $workspaceSections['top'][] = '<li><a target="content" data-module="web_WorkspacesWorkspaces" class="dropdown-list-link tx-workspaces-modulelink">' . $stateUncheckedIcon . ' ' . $languageService->getLL('bookmark_workspace', true) . '</a></li>'; } } else { // no items on top (= no workspace to work in) $workspaceSections['top'][] = '<li>' . $stateUncheckedIcon . ' ' . $languageService->getLL('bookmark_noWSfound', true) . '</li>'; } $workspaceMenu = array('<ul class="dropdown-list">', implode(LF, $workspaceSections['top']), !empty($workspaceSections['items']) ? '<li class="divider"></li>' : '', implode(LF, $workspaceSections['items']), '</ul>'); return implode(LF, $workspaceMenu); }
/** * Get drop down * * @return string */ public function getDropDown() { $backendUser = $this->getBackendUser(); $languageService = $this->getLanguageService(); $index = 0; $activeWorkspace = (int) $backendUser->workspace; $stateCheckedIcon = $this->iconFactory->getIcon('status-status-checked', Icon::SIZE_SMALL)->render(); $stateUncheckedIcon = '<span title="' . htmlspecialchars($languageService->getLL('bookmark_inactive')) . '">' . $this->iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>'; $workspaceSections = ['top' => [], 'items' => []]; foreach ($this->availableWorkspaces as $workspaceId => $label) { $workspaceId = (int) $workspaceId; $iconState = $workspaceId === $activeWorkspace ? $stateCheckedIcon : $stateUncheckedIcon; $classValue = $workspaceId === $activeWorkspace ? 'selected' : ''; $sectionName = $index++ === 0 ? 'top' : 'items'; $workspaceSections[$sectionName][] = ' <div class="dropdown-table-row t3js-workspace-item ' . $classValue . '"> <div class="dropdown-table-column dropdown-table-icon"> ' . $iconState . ' </div> <div class="dropdown-table-column"> <a href="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('main', ['changeWorkspace' => $workspaceId])) . '" data-workspaceid="' . $workspaceId . '" class="t3js-workspaces-switchlink"> ' . htmlspecialchars($label) . ' </a> </div> </div> '; } if (!empty($workspaceSections['top'])) { // Add the "Go to workspace module" link // if there is at least one icon on top and if the access rights are there if ($backendUser->check('modules', 'web_WorkspacesWorkspaces')) { $workspaceSections['top'][] = ' <div class="dropdown-table-row"> <div class="dropdown-table-column dropdown-table-icon"> ' . $stateUncheckedIcon . ' </div> <div class="dropdown-table-column"> <a href="#" target="list_frame" data-module="web_WorkspacesWorkspaces" class="t3js-workspaces-modulelink"> ' . htmlspecialchars($languageService->getLL('bookmark_workspace')) . ' </a> </div> </div> '; } } else { // no items on top (= no workspace to work in) $workspaceSections['top'][] = ' <div class="dropdown-table-row"> <div class="dropdown-table-column dropdown-table-icon"> ' . $stateUncheckedIcon . ' </div> <div class="dropdown-table-column"> ' . htmlspecialchars($languageService->getLL('bookmark_noWSfound')) . ' </div> </div> '; } $workspaceMenu = ['<h3 class="dropdown-headline">' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:toolbarItems.workspace')) . '</h3>', '<hr>', '<div class="dropdown-table">' . implode(LF, $workspaceSections['top']) . '</div>', !empty($workspaceSections['items']) ? '<hr>' : '', '<div class="dropdown-table">' . implode(LF, $workspaceSections['items']) . '</div>']; return implode(LF, $workspaceMenu); }
/** * Processing of clickmenu items * * @param \TYPO3\CMS\Backend\ClickMenu\ClickMenu $backRef parent * @param array $menuItems Menu items array to modify * @param string $table Table name * @param int $uid Uid of the record * @return array Menu item array, returned after modification * @todo Skinning for icons... */ public function main(&$backRef, $menuItems, $table, $uid) { $localItems = []; // Show import/export on second level menu OR root level. if ($backRef->cmLevel && GeneralUtility::_GP('subname') == 'moreoptions' || $table === 'pages' && $uid == 0) { $LL = $this->includeLL(); $urlParameters = ['tx_impexp' => ['action' => 'export'], 'id' => $table == 'pages' ? $uid : $backRef->rec['pid']]; if ($table == 'pages') { $urlParameters['tx_impexp']['pagetree']['id'] = $uid; $urlParameters['tx_impexp']['pagetree']['levels'] = 0; $urlParameters['tx_impexp']['pagetree']['tables'][] = '_ALL'; } else { $urlParameters['tx_impexp']['record'][] = $table . ':' . $uid; $urlParameters['tx_impexp']['external_ref']['tables'][] = '_ALL'; } $url = BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters); $localItems[] = $backRef->linkItem(htmlspecialchars($this->getLanguageService()->getLLL('export', $LL)), $this->iconFactory->getIcon('actions-document-export-t3d', Icon::SIZE_SMALL), $backRef->urlRefForCM($url), 1); if ($table === 'pages') { $backendUser = $this->getBackendUser(); $isEnabledForNonAdmin = $backendUser->getTSConfig('options.impexp.enableImportForNonAdminUser'); if ($backendUser->isAdmin() || !empty($isEnabledForNonAdmin['value'])) { $urlParameters = ['id' => $uid, 'table' => $table, 'tx_impexp' => ['action' => 'import']]; $url = BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters); $localItems[] = $backRef->linkItem(htmlspecialchars($this->getLanguageService()->getLLL('import', $LL)), $this->iconFactory->getIcon('actions-document-import-t3d', Icon::SIZE_SMALL), $backRef->urlRefForCM($url), 1); } } } return array_merge($menuItems, $localItems); }
/** * Processing of clickmenu items * * @param \TYPO3\CMS\Backend\ClickMenu\ClickMenu $backRef parent * @param array $menuItems Menu items array to modify * @param string $table Table name * @param int $uid Uid of the record * @return array Menu item array, returned after modification * @todo Skinning for icons... */ public function main(&$backRef, $menuItems, $table, $uid) { $localItems = array(); // Show import/export on second level menu OR root level. if ($backRef->cmLevel && \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('subname') == 'moreoptions' || $table === 'pages' && $uid == 0) { $LL = $this->includeLL(); $urlParameters = array('tx_impexp' => array('action' => 'export'), 'id' => $table == 'pages' ? $uid : $backRef->rec['pid']); if ($table == 'pages') { $urlParameters['tx_impexp']['pagetree']['id'] = $uid; $urlParameters['tx_impexp']['pagetree']['levels'] = 0; $urlParameters['tx_impexp']['pagetree']['tables'][] = '_ALL'; } else { $urlParameters['tx_impexp']['record'][] = $table . ':' . $uid; $urlParameters['tx_impexp']['external_ref']['tables'][] = '_ALL'; } $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters); $localItems[] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('export', $LL)), $backRef->excludeIcon($this->iconFactory->getIcon('actions-document-export-t3d', Icon::SIZE_SMALL)), $backRef->urlRefForCM($url), 1); if ($table == 'pages') { $urlParameters = array('id' => $uid, 'table' => $table, 'tx_impexp' => array('action' => 'import')); $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters); $localItems[] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('import', $LL)), $backRef->excludeIcon($this->iconFactory->getIcon('actions-document-import-t3d', Icon::SIZE_SMALL)), $backRef->urlRefForCM($url), 1); } } return array_merge($menuItems, $localItems); }
/** * Render help icon * * @return string Help */ public function getItem() { $icon = $this->iconFactory->getIcon('apps-toolbar-menu-help', Icon::SIZE_SMALL)->render('inline'); $view = $this->getFluidTemplateObject('HelpToolbarItem.html'); $view->assignMultiple(['title' => 'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:toolbarItems.help', 'icon' => $icon]); return $view->render(); }
/** * Main function, adding the item to input menuItems array * * @param ClickMenu $backRef References to parent clickmenu objects. * @param array $menuItems Array of existing menu items accumulated. New element added to this. * @param string $table Table name of the element * @param int $uid Record UID of the element * @return array Modified menuItems array */ public function main(&$backRef, $menuItems, $table, $uid) { $localItems = array(); if (!$backRef->cmLevel && $uid > 0 && $GLOBALS['BE_USER']->check('modules', 'web_txversionM1')) { // Returns directly, because the clicked item was not from the pages table if (in_array('versioning', $backRef->disabledItems) || !$GLOBALS['TCA'][$table] || !$GLOBALS['TCA'][$table]['ctrl']['versioningWS']) { return $menuItems; } // Adds the regular item $LL = $this->includeLL(); // "Versioning" element added: $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_txversionM1', array('table' => $table, 'uid' => $uid)); $localItems[] = $backRef->linkItem($GLOBALS['LANG']->getLLL('title', $LL), $backRef->excludeIcon($this->iconFactory->getIcon('actions-version-open', Icon::SIZE_SMALL)->render()), $backRef->urlRefForCM($url), true); // Find position of "delete" element: $c = 0; foreach ($menuItems as $k => $value) { $c++; if ($k === 'delete') { break; } } // .. subtract two (delete item + divider line) $c -= 2; // ... and insert the items just before the delete element. array_splice($menuItems, $c, 0, $localItems); } return $menuItems; }
/** * Returns the recent documents list as an array * * @param array $document * @param string $md5sum * @param bool $isRecentDoc * @param bool $isFirstDoc * @return array All recent documents as list-items */ protected function renderMenuEntry($document, $md5sum, $isRecentDoc = false, $isFirstDoc = false) { $table = $document[3]['table']; $uid = $document[3]['uid']; $record = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL($table, $uid); if (!is_array($record)) { // Record seems to be deleted return ''; } $label = htmlspecialchars(strip_tags(htmlspecialchars_decode($document[0]))); $icon = $this->iconFactory->getIconForRecord($table, $record, Icon::SIZE_SMALL)->render(); $link = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('record_edit') . '&' . $document[2]; $pageId = (int) $document[3]['uid']; if ($document[3]['table'] !== 'pages') { $pageId = (int) $document[3]['pid']; } $onClickCode = 'jump(' . GeneralUtility::quoteJSvalue($link) . ', \'web_list\', \'web\', ' . $pageId . '); TYPO3.OpendocsMenu.toggleMenu(); return false;'; if (!$isRecentDoc) { $title = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', true); // Open document $closeIcon = $this->iconFactory->getIcon('actions-close', Icon::SIZE_SMALL)->render('inline'); $entry = ' <li class="opendoc"> <a href="#" class="dropdown-list-link dropdown-link-list-add-close" onclick="' . htmlspecialchars($onClickCode) . '" target="content">' . $icon . ' ' . $label . '</a> <a href="#" class="dropdown-list-link-close" data-opendocsidentifier="' . $md5sum . '" title="' . $title . '">' . $closeIcon . '</a> </li>'; } else { // Recently used document $entry = ' <li> <a href="#" class="dropdown-list-link" onclick="' . htmlspecialchars($onClickCode) . '" target="content">' . $icon . ' ' . $label . '</a> </li>'; } return $entry; }
/** * This method prepares the link for opening the devlog in a new window * * @return string Hyperlink with icon and appropriate JavaScript */ protected function openInNewWindow() { $url = GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'); $onClick = 'devlogWin=window.open(' . GeneralUtility::quoteJSvalue($url) . ',\'taskcenter\',\'width=790,status=0,menubar=1,resizable=1,location=0,scrollbars=1,toolbar=0\');return false;'; $content = '<a href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.openInNewWindow', true) . '">' . $this->iconFactory->getIcon('actions-window-open', Icon::SIZE_SMALL)->render() . '</a>'; return $content; }
/** * Render drop down * * @return string HTML */ public function getDropDown() { $backendUser = $this->getBackendUser(); $languageService = $this->getLanguageService(); $dropdown = array(); $dropdown[] = '<ul class="dropdown-list">'; /** @var BackendModuleRepository $backendModuleRepository */ $backendModuleRepository = GeneralUtility::makeInstance(BackendModuleRepository::class); /** @var \TYPO3\CMS\Backend\Domain\Model\Module\BackendModule $userModuleMenu */ $userModuleMenu = $backendModuleRepository->findByModuleName('user'); if ($userModuleMenu != false && $userModuleMenu->getChildren()->count() > 0) { foreach ($userModuleMenu->getChildren() as $module) { /** @var BackendModule $module */ $dropdown[] = '<li' . ' id="' . htmlspecialchars($module->getName()) . '"' . ' class="typo3-module-menu-item submodule mod-' . htmlspecialchars($module->getName()) . '" ' . ' data-modulename="' . htmlspecialchars($module->getName()) . '"' . ' data-navigationcomponentid="' . htmlspecialchars($module->getNavigationComponentId()) . '"' . ' data-navigationframescript="' . htmlspecialchars($module->getNavigationFrameScript()) . '"' . ' data-navigationframescriptparameters="' . htmlspecialchars($module->getNavigationFrameScriptParameters()) . '"' . '>'; $dropdown[] = '<a title="' . htmlspecialchars($module->getDescription()) . '" href="' . htmlspecialchars($module->getLink()) . '" class="dropdown-list-link modlink">'; $dropdown[] = '<span class="submodule-icon typo3-app-icon"><span><span>' . $module->getIcon() . '</span></span></span>'; $dropdown[] = '<span class="submodule-label">' . htmlspecialchars($module->getTitle()) . '</span>'; $dropdown[] = '</a>'; $dropdown[] = '</li>'; } $dropdown[] = '<li class="divider"></li>'; } // Logout button $buttonLabel = 'LLL:EXT:lang/locallang_core.xlf:' . ($backendUser->user['ses_backuserid'] ? 'buttons.exit' : 'buttons.logout'); $dropdown[] = '<li class="reset-dropdown">'; $dropdown[] = '<a href="' . htmlspecialchars(BackendUtility::getModuleUrl('logout')) . '" class="btn btn-danger pull-right" target="_top">'; $dropdown[] = $this->iconFactory->getIcon('actions-logout', Icon::SIZE_SMALL)->render('inline') . ' '; $dropdown[] = $languageService->sL($buttonLabel, true); $dropdown[] = '</a>'; $dropdown[] = '</li>'; $dropdown[] = '</ul>'; return implode(LF, $dropdown); }
/** * Returns the language labels and configuration options for the pagetree * * @return array */ public function loadResources() { $file = 'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:'; $indicators = $this->getIndicators(); $configuration = ['LLL' => ['copyHint' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'tree.copyHint')), 'fakeNodeHint' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'mess.please_wait')), 'activeFilterMode' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'tree.activeFilterMode')), 'dropToRemove' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'tree.dropToRemove')), 'buttonRefresh' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'labels.refresh')), 'buttonNewNode' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'tree.buttonNewNode')), 'buttonFilter' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'tree.buttonFilter')), 'dropZoneElementRemoved' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'tree.dropZoneElementRemoved')), 'dropZoneElementRestored' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'tree.dropZoneElementRestored')), 'searchTermInfo' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'tree.searchTermInfo')), 'temporaryMountPointIndicatorInfo' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'labels.temporaryDBmount')), 'deleteDialogTitle' => htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:deleteItem')), 'deleteDialogMessage' => htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:deleteWarning')), 'recursiveDeleteDialogMessage' => htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:recursiveDeleteWarning'))], 'Configuration' => ['hideFilter' => $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.hideFilter'), 'displayDeleteConfirmation' => $GLOBALS['BE_USER']->jsConfirmation(JsConfirmation::DELETE), 'canDeleteRecursivly' => $GLOBALS['BE_USER']->uc['recursiveDelete'] == true, 'disableIconLinkToContextmenu' => $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.disableIconLinkToContextmenu'), 'indicator' => $indicators['html'], 'temporaryMountPoint' => Commands::getMountPointPath()], 'Icons' => ['InputClear' => $this->iconFactory->getIcon('actions-input-clear', Icon::SIZE_SMALL)->render(), 'Close' => $this->iconFactory->getIcon('actions-close', Icon::SIZE_SMALL)->render('inline'), 'TrashCan' => $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render('inline'), 'TrashCanRestore' => $this->iconFactory->getIcon('actions-edit-restore', Icon::SIZE_SMALL)->render('inline'), 'Info' => $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render('inline'), 'NewNode' => $this->iconFactory->getIcon('actions-page-new', Icon::SIZE_SMALL)->render(), 'Filter' => $this->iconFactory->getIcon('actions-filter', Icon::SIZE_SMALL)->render(), 'Refresh' => $this->iconFactory->getIcon('actions-refresh', Icon::SIZE_SMALL)->render()]]; return $configuration; }
/** * Draw header for a content element column: * * @param string $colName Column name * @param string $editParams Edit params (Syntax: &edit[...] for FormEngine) * @param \TYPO3\CMS\Backend\View\PageLayoutView $parentObject * @param boolean $expanded * * @return string HTML table */ public function tt_content_drawColHeader($colName, $editParams, PageLayoutView $parentObject, $expanded = true) { $iconsArr = array(); // Create command links: if ($parentObject->tt_contentConfig['showCommands']) { // Edit whole of column: if ($editParams) { $iconsArr['edit'] = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($editParams)) . '" title="' . $this->getLanguageService()->getLL('editColumn', true) . '">' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>'; } } if ($expanded) { $state = 'expanded'; $title = $this->languageService->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xml:tx_gridelements_collapsecontent'); $toggleTitle = $this->languageService->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xml:tx_gridelements_expandcontent'); } else { $state = 'collapsed'; $title = $this->languageService->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xml:tx_gridelements_expandcontent'); $toggleTitle = $this->languageService->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xml:tx_gridelements_collapsecontent'); } $iconsArr['toggleContent'] = '<a href="#" class="btn btn-default t3js-toggle-gridelements-column toggle-content" title="' . $title . '" data-toggle-title="' . $toggleTitle . '" data-state="' . $state . '">' . $this->iconFactory->getIcon('actions-view-list-collapse', 'small') . $this->iconFactory->getIcon('actions-view-list-expand', 'small') . '</a>'; $icons = '<div class="t3-page-column-header-icons btn-group btn-group-sm">' . implode('', $iconsArr) . '</div>'; // Create header row: $out = '<div class="t3-page-column-header"> ' . $icons . ' <div class="t3-page-column-header-label">' . htmlspecialchars($colName) . '</div> </div>'; return $out; }
/** * Render search field * * @return string Live search form HTML */ public function getItem() { return ' <form class="t3js-topbar-navigation-search toolbar-item-search-form live-search-wrapper" role="search"> <div class="form-group"> <div class="form-control-holder"> <div class="form-control-icon"> ' . $this->iconFactory->getIcon('apps-toolbar-menu-search', Icon::SIZE_SMALL)->render('inline') . ' </div> <input type="text" class="form-control toolbar-item-search-field t3js-topbar-navigation-search-field" placeholder="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:toolbarItems.search')) . '" id="live-search-box" autocomplete="off"> </div> </div> </form> <a href="#" class="dropdown-toggle t3js-toolbar-search-dropdowntoggle" data-toggle="dropdown" aria-expanded="false"></a> <div class="dropdown-menu" role="menu"></div> '; }
/** * Action to view the result of a SQL query * * @param array $record sys_action record * @return string Result of the query */ protected function viewSqlQuery($record) { $content = ''; if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('lowlevel')) { $sql_query = unserialize($record['t2_data']); if (!is_array($sql_query) || is_array($sql_query) && strtoupper(substr(trim($sql_query['qSelect']), 0, 6)) === 'SELECT') { $actionContent = ''; $fullsearch = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\QueryView::class); $fullsearch->formW = 40; $fullsearch->noDownloadB = 1; $type = $sql_query['qC']['search_query_makeQuery']; if ($sql_query['qC']['labels_noprefix'] === 'on') { $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] = 'on'; } $sqlQuery = $sql_query['qSelect']; $queryIsEmpty = false; if ($sqlQuery) { $res = $this->getDatabaseConnection()->sql_query($sqlQuery); if (!$this->getDatabaseConnection()->sql_error()) { $fullsearch->formW = 48; // Additional configuration $GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels'] = 1; $GLOBALS['SOBE']->MOD_SETTINGS['queryFields'] = $sql_query['qC']['queryFields']; $cP = $fullsearch->getQueryResultCode($type, $res, $sql_query['qC']['queryTable']); $actionContent = $cP['content']; // If the result is rendered as csv or xml, show a download link if ($type === 'csv' || $type === 'xml') { $actionContent .= '<a href="' . GeneralUtility::getIndpEnv('REQUEST_URI') . '&download_file=1"><strong>' . $this->getLanguageService()->getLL('action_download_file') . '</strong></a>'; } } else { $actionContent .= $this->getDatabaseConnection()->sql_error(); } } else { // Query is empty (not built) $queryIsEmpty = true; $this->addMessage($this->getLanguageService()->getLL('action_emptyQuery'), $this->getLanguageService()->getLL('action_error'), FlashMessage::ERROR); $content .= $this->renderFlashMessages(); } // Admin users are allowed to see and edit the query if ($this->getBackendUser()->isAdmin()) { if (!$queryIsEmpty) { $actionContent .= '<div class="panel panel-default"><div class="panel-body">' . $fullsearch->tableWrap($sql_query['qSelect']) . '</div></div>'; } $actionContent .= '<a title="' . $this->getLanguageService()->getLL('action_editQuery') . '" class="btn btn-default" href="' . htmlspecialchars(BackendUtility::getModuleUrl('system_dbint') . '&id=' . '&SET[function]=search' . '&SET[search]=query' . '&storeControl[STORE]=-' . $record['uid'] . '&storeControl[LOAD]=1') . '">' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render() . ' ' . $this->getLanguageService()->getLL($queryIsEmpty ? 'action_createQuery' : 'action_editQuery') . '</a>'; } $content .= '<h2>' . $this->getLanguageService()->getLL('action_t2_result', true) . '</h2>' . $actionContent; } else { // Query is not configured $this->addMessage($this->getLanguageService()->getLL('action_notReady'), $this->getLanguageService()->getLL('action_error'), FlashMessage::ERROR); $content .= $this->renderFlashMessages(); } } else { // Required sysext lowlevel is not installed $this->addMessage($this->getLanguageService()->getLL('action_lowlevelMissing'), $this->getLanguageService()->getLL('action_error'), FlashMessage::ERROR); $content .= $this->renderFlashMessages(); } return $content; }
/** * Create delete link with trash icon * * @param int $uid Uid of the record * * @return string Link with the trash icon */ function deleteLink($uid) { $icon = $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL); $dmail = BackendUtility::getRecord('sys_dmail', $uid); if (!$dmail['scheduled_begin']) { return '<a href="' . BackendUtility::getModuleUrl('txdirectmailM1_txdirectmailM5') . '&id=' . $this->id . '&cmd=delete&uid=' . $uid . '">' . $icon . '</a>'; } return ""; }
/** * The icon for the source tab * * @param bool $expand State of the tab * * @return string */ protected function getNewsletterTabIcon($expand = false) { if ($expand) { // opened return $this->iconFactory->getIcon('apps-pagetree-expand', Icon::SIZE_SMALL); } // closes return $this->iconFactory->getIcon('apps-pagetree-collapse', Icon::SIZE_SMALL); }
/** * Render system information dropdown * * @return string Icon HTML */ public function getItem() { $title = htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:toolbarItems.sysinfo')); $icon = $this->iconFactory->getIcon('actions-system-list-open', Icon::SIZE_SMALL)->render('inline'); return ' <span class="toolbar-item-icon" title="' . $title . '">' . $icon . '</span> <span class="toolbar-item-title">' . $title . '</span> <span class="toolbar-item-badge t3js-systeminformation-counter badge"></span> '; }
/** * Create the workspace information * * @return string HTML containing workspace info */ protected function getWorkspaceInfo() { if (ExtensionManagementUtility::isLoaded('workspaces') && ($this->getBackendUser()->workspace !== 0 || $this->getBackendUser()->getTSConfigVal('options.pageTree.onlineWorkspaceInfo'))) { $wsTitle = htmlspecialchars(WorkspaceService::getWorkspaceTitle($this->getBackendUser()->workspace)); $workspaceInfo = '<div class="bgColor4 workspace-info"><span title="' . $wsTitle . '" onclick="top.goToModule(\'web_WorkspacesWorkspaces\');" style="cursor:pointer;">' . $this->iconFactory->getIcon('apps-toolbar-menu-workspace', Icon::SIZE_SMALL)->render() . '</span>' . $wsTitle . '</div>'; } else { $workspaceInfo = ''; } return $workspaceInfo; }
/** * Print the string with the new edit lock state of a page record * * @param int $page The TYPO3 page id * @param string $editLockState The state of the TYPO3 page (locked, unlocked) * @return string The new edit lock string wrapped in HTML */ protected function renderToggleEditLock($page, $editLockState) { $page = (int) $page; if ($editLockState === 1) { $ret = '<span id="el_' . $page . '"><a class="editlock btn btn-default" data-page="' . $page . '" data-lockstate="1" title="The page and all content is locked for editing by all non-Admin users.">' . $this->iconFactory->getIcon('actions-lock', Icon::SIZE_SMALL)->render() . '</a></span>'; } else { $ret = '<span id="el_' . $page . '"><a class="editlock btn btn-default" data-page="' . $page . '" data-lockstate="0" title="Enable the »Admin-only« edit lock for this page">' . $this->iconFactory->getIcon('actions-unlock', Icon::SIZE_SMALL)->render() . '</a></span>'; } return $ret; }
/** * Creates the tool bar links for the "edit" section of the Admin Panel. * * @return string A string containing images wrapped in <a>-tags linking them to proper functions. */ public function ext_makeToolBar() { $tsfe = $this->getTypoScriptFrontendController(); // If mod.newContentElementWizard.override is set, use that extension's create new content wizard instead: $tsConfig = BackendUtility::getModTSconfig($tsfe->page['uid'], 'mod'); $moduleName = isset($tsConfig['properties']['newContentElementWizard.']['override']) ? $tsConfig['properties']['newContentElementWizard.']['override'] : 'new_content_element'; $newContentWizScriptPath = BackendUtility::getModuleUrl($moduleName); $perms = $this->getBackendUser()->calcPerms($tsfe->page); $langAllowed = $this->getBackendUser()->checkLanguageAccess($tsfe->sys_language_uid); $id = $tsfe->id; $returnUrl = GeneralUtility::getIndpEnv('REQUEST_URI'); $icon = $this->iconFactory->getIcon('actions-document-history-open', Icon::SIZE_SMALL)->render(); $link = BackendUtility::getModuleUrl('record_history', ['element' => 'pages:' . $id, 'returnUrl' => $returnUrl]); $toolBar = '<a class="t3-icon btn btn-default" href="' . htmlspecialchars($link) . '#latest" title="' . $this->extGetLL('edit_recordHistory') . '">' . $icon . '</a>'; if ($perms & Permission::CONTENT_EDIT && $langAllowed) { $params = ''; if ($tsfe->sys_language_uid) { $params = '&sys_language_uid=' . $tsfe->sys_language_uid; } $icon = $this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)->render(); $link = $newContentWizScriptPath . 'id=' . $id . $params . '&returnUrl=' . rawurlencode($returnUrl); $toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars($link) . '" title="' . $this->extGetLL('edit_newContentElement') . '"">' . $icon . '</a>'; } if ($perms & Permission::PAGE_EDIT) { $icon = $this->iconFactory->getIcon('actions-document-move', Icon::SIZE_SMALL)->render(); $link = BackendUtility::getModuleUrl('move_element', ['table' => 'pages', 'uid' => $id, 'returnUrl' => $returnUrl]); $toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars($link) . '" title="' . $this->extGetLL('edit_move_page') . '">' . $icon . '</a>'; } if ($perms & Permission::PAGE_NEW) { $toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars(BackendUtility::getModuleUrl('db_new', ['id' => $id, 'pagesOnly' => 1, 'returnUrl' => $returnUrl])) . '" title="' . $this->extGetLL('edit_newPage') . '">' . $this->iconFactory->getIcon('actions-page-new', Icon::SIZE_SMALL)->render() . '</a>'; } if ($perms & Permission::PAGE_EDIT) { $icon = $this->iconFactory->getIcon('actions-page-open', Icon::SIZE_SMALL)->render(); $url = BackendUtility::getModuleUrl('record_edit', ['edit[pages][' . $id . ']' => 'edit', 'noView' => 1, 'returnUrl' => $returnUrl]); $toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars($url) . '">' . $icon . '</a>'; if ($tsfe->sys_language_uid && $langAllowed) { $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages_language_overlay'); $queryBuilder->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class)); $row = $queryBuilder->select('uid', 'pid', 't3ver_state')->from('pages_language_overlay')->where($queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($id, \PDO::PARAM_INT)), $queryBuilder->expr()->eq('sys_language_uid', $queryBuilder->createNamedParameter($tsfe->sys_language_uid, \PDO::PARAM_INT)))->setMaxResults(1)->execute()->fetch(); $tsfe->sys_page->versionOL('pages_language_overlay', $row); if (is_array($row)) { $icon = '<span title="' . $this->extGetLL('edit_editPageOverlay', true) . '">' . $this->iconFactory->getIcon('mimetypes-x-content-page-language-overlay', Icon::SIZE_SMALL)->render() . '</span>'; $url = BackendUtility::getModuleUrl('record_edit', ['edit[pages_language_overlay][' . $row['uid'] . ']' => 'edit', 'noView' => 1, 'returnUrl' => $returnUrl]); $toolBar .= '<a href="' . htmlspecialchars($url) . '">' . $icon . '</a>'; } } } if ($this->getBackendUser()->check('modules', 'web_list')) { $urlParams = ['id' => $id, 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]; $icon = '<span title="' . $this->extGetLL('edit_db_list', false) . '">' . $this->iconFactory->getIcon('actions-system-list-open', Icon::SIZE_SMALL)->render() . '</span>'; $toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars(BackendUtility::getModuleUrl('web_list', $urlParams)) . '">' . $icon . '</a>'; } $toolBar = '<div class="toolbar btn-group" role="group">' . $toolBar . '</div>'; return $toolBar; }
/** * Get a selector as used for the select type, to select from all available * records and to create a relation to the embedding record (e.g. like MM). * * @param array $selItems Array of all possible records * @param array $conf TCA configuration of the parent(!) field * @param array $PA An array with additional configuration options * @param array $uniqueIds The uids that have already been used and should be unique * @return string A HTML <select> box with all possible records */ protected function renderPossibleRecordsSelectorTypeSelect($selItems, $conf, &$PA, $uniqueIds = array()) { $foreign_table = $conf['foreign_table']; $foreign_selector = $conf['foreign_selector']; $PA = array(); $PA['fieldConf'] = $GLOBALS['TCA'][$foreign_table]['columns'][$foreign_selector]; $PA['fieldTSConfig'] = FormEngineUtility::getTSconfigForTableRow($foreign_table, array(), $foreign_selector); $config = $PA['fieldConf']['config']; $item = ''; // @todo $disabled is not present - should be read from config? $disabled = false; if (!$disabled) { $nameObject = $this->inlineStackProcessor->getCurrentStructureDomObjectIdPrefix($this->data['inlineFirstPid']); // Create option tags: $opt = array(); foreach ($selItems as $p) { if (!in_array($p[1], $uniqueIds)) { $opt[] = '<option value="' . htmlspecialchars($p[1]) . '">' . htmlspecialchars($p[0]) . '</option>'; } } // Put together the selector box: $itemListStyle = isset($config['itemListStyle']) ? ' style="' . htmlspecialchars($config['itemListStyle']) . '"' : ''; $size = (int) $conf['size']; $size = $conf['autoSizeMax'] ? MathUtility::forceIntegerInRange(count($selItems) + 1, MathUtility::forceIntegerInRange($size, 1), $conf['autoSizeMax']) : $size; $onChange = 'return inline.importNewRecord(' . GeneralUtility::quoteJSvalue($nameObject . '-' . $conf['foreign_table']) . ')'; $item = ' <select id="' . $nameObject . '-' . $conf['foreign_table'] . '_selector" class="form-control"' . ($size ? ' size="' . $size . '"' : '') . ' onchange="' . htmlspecialchars($onChange) . '"' . $PA['onFocus'] . $itemListStyle . ($conf['foreign_unique'] ? ' isunique="isunique"' : '') . '> ' . implode('', $opt) . ' </select>'; if ($size <= 1) { // Add a "Create new relation" link for adding new relations // This is necessary, if the size of the selector is "1" or if // there is only one record item in the select-box, that is selected by default // The selector-box creates a new relation on using an onChange event (see some line above) if (!empty($conf['appearance']['createNewRelationLinkTitle'])) { $createNewRelationText = $this->getLanguageService()->sL($conf['appearance']['createNewRelationLinkTitle'], true); } else { $createNewRelationText = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.createNewRelation', true); } $item .= ' <span class="input-group-btn"> <a href="#" class="btn btn-default" onclick="' . htmlspecialchars($onChange) . '" title="' . $createNewRelationText . '"> ' . $this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)->render() . $createNewRelationText . ' </a> </span>'; } else { $item .= ' <span class="input-group-btn btn"></span>'; } // Wrap the selector and add a spacer to the bottom $item = '<div class="input-group form-group t3js-formengine-validation-marker ' . $this->inlineData['config'][$nameObject]['md5'] . '">' . $item . '</div>'; } return $item; }
/** * Creates the tool bar links for the "edit" section of the Admin Panel. * * @return string A string containing images wrapped in <a>-tags linking them to proper functions. */ public function ext_makeToolBar() { $tsfe = $this->getTypoScriptFrontendController(); // If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead: $tsConfig = BackendUtility::getModTSconfig($tsfe->page['uid'], 'mod.web_list'); $tsConfig = $tsConfig['properties']['newContentWiz.']['overrideWithExtension']; $newContentWizScriptPath = ExtensionManagementUtility::isLoaded($tsConfig) ? ExtensionManagementUtility::extRelPath($tsConfig) . 'mod1/db_new_content_el.php?' : BackendUtility::getModuleUrl('new_content_element') . '&'; $perms = $this->getBackendUser()->calcPerms($tsfe->page); $langAllowed = $this->getBackendUser()->checkLanguageAccess($tsfe->sys_language_uid); $id = $tsfe->id; $returnUrl = GeneralUtility::getIndpEnv('REQUEST_URI'); $icon = $this->iconFactory->getIcon('actions-document-history-open', Icon::SIZE_SMALL)->render(); $link = BackendUtility::getModuleUrl('record_history', array('element' => 'pages:' . $id, 'returnUrl' => $returnUrl)); $toolBar = '<a class="t3-icon btn btn-default" href="' . htmlspecialchars($link) . '#latest" title="' . $this->extGetLL('edit_recordHistory') . '">' . $icon . '</a>'; if ($perms & Permission::CONTENT_EDIT && $langAllowed) { $params = ''; if ($tsfe->sys_language_uid) { $params = '&sys_language_uid=' . $tsfe->sys_language_uid; } $icon = $this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)->render(); $link = $newContentWizScriptPath . 'id=' . $id . $params . '&returnUrl=' . rawurlencode($returnUrl); $toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars($link) . '" title="' . $this->extGetLL('edit_newContentElement') . '"">' . $icon . '</a>'; } if ($perms & Permission::PAGE_EDIT) { $icon = $this->iconFactory->getIcon('actions-document-move', Icon::SIZE_SMALL)->render(); $link = BackendUtility::getModuleUrl('move_element', ['table' => 'pages', 'uid' => $id, 'returnUrl' => $returnUrl]); $toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars($link) . '" title="' . $this->extGetLL('edit_move_page') . '">' . $icon . '</a>'; } if ($perms & Permission::PAGE_NEW) { $toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars(BackendUtility::getModuleUrl('db_new', ['id' => $id, 'pagesOnly' => 1, 'returnUrl' => $returnUrl])) . '" title="' . $this->extGetLL('edit_newPage') . '">' . $this->iconFactory->getIcon('actions-page-new', Icon::SIZE_SMALL)->render() . '</a>'; } if ($perms & Permission::PAGE_EDIT) { $icon = $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render(); $url = BackendUtility::getModuleUrl('record_edit', array('edit[pages][' . $id . ']' => 'edit', 'noView' => 1, 'returnUrl' => $returnUrl)); $toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars($url) . '">' . $icon . '</a>'; if ($tsfe->sys_language_uid && $langAllowed) { $row = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('uid,pid,t3ver_state', 'pages_language_overlay', 'pid=' . (int) $id . ' AND sys_language_uid=' . $tsfe->sys_language_uid . $tsfe->sys_page->enableFields('pages_language_overlay')); $tsfe->sys_page->versionOL('pages_language_overlay', $row); if (is_array($row)) { $icon = '<span title="' . $this->extGetLL('edit_editPageOverlay', true) . '">' . $this->iconFactory->getIcon('mimetypes-x-content-page-language-overlay', Icon::SIZE_SMALL)->render() . '</span>'; $url = BackendUtility::getModuleUrl('record_edit', array('edit[pages_language_overlay][' . $row['uid'] . ']' => 'edit', 'noView' => 1, 'returnUrl' => $returnUrl)); $toolBar .= '<a href="' . htmlspecialchars($url) . '">' . $icon . '</a>'; } } } if ($this->getBackendUser()->check('modules', 'web_list')) { $urlParams = array('id' => $id, 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')); $icon = '<span title="' . $this->extGetLL('edit_db_list', false) . '">' . $this->iconFactory->getIcon('actions-system-list-open', Icon::SIZE_SMALL)->render() . '</span>'; $toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars(BackendUtility::getModuleUrl('web_list', $urlParams)) . '">' . $icon . '</a>'; } $toolBar = '<div class="toolbar btn-group" role="group">' . $toolBar . '</div>'; return $toolBar; }
/** * Adding CM element for Clipboard "paste into"/"paste after" * NOTICE: $table and $uid should follow the special syntax for paste, see clipboard-class :: pasteUrl(); * * @param CLickMenu $backRef * @param string $table Table name * @param int $uid UID for the current record. NOTICE: Special syntax! * @param string $type Type: "into" or "after * @param array $elInfo Contains instructions about whether to copy or cut an element. * @param array $targetItem * @param bool $reference * * @return array Item array, element in $menuItems */ public function DB_paste(&$backRef, $table, $uid, $type, $elInfo, $targetItem, $reference) { $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); $updateArray = array('colPos' => $targetItem['colPos'], 'tx_gridelements_container' => $targetItem['tx_gridelements_container'], 'tx_gridelements_columns' => $targetItem['tx_gridelements_columns']); $loc = 'top.content.list_frame'; if ($this->getBackendUser()->jsConfirmation(JsConfirmation::COPY_MOVE_PASTE)) { $conf = $loc . ' && confirm(' . GeneralUtility::quoteJSvalue(sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:mess.' . ($elInfo[2] === 'copy' ? 'copy' : 'move') . '_' . $type), $elInfo[0], $elInfo[1])) . ')'; } else { $conf = $loc; } $editOnClick = 'if(' . $conf . '){' . $loc . '.location.href=' . GeneralUtility::quoteJSvalue($backRef->clipObj->pasteUrl($table, $uid, 0, $updateArray) . ($reference ? '&reference=1' : '') . '&redirect=') . '+top.rawurlencode(' . $backRef->frameLocation($loc . '.document') . '.pathname+' . $backRef->frameLocation($loc . '.document') . '.search);}'; return $backRef->linkItem($reference ? $this->getLanguageService()->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xml:tx_gridelements_clickmenu_pastereference') : $backRef->label('paste' . $type), $this->iconFactory->getIcon('actions-document-paste-' . $type, Icon::SIZE_SMALL)->render(), $editOnClick . 'return false;'); }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. */ protected function getButtons() { $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar(); // CSH $cshButton = $buttonBar->makeHelpButton()->setModuleName('_MOD_web_info')->setFieldName(''); $buttonBar->addButton($cshButton, ButtonBar::BUTTON_POSITION_LEFT, 0); // View page $viewButton = $buttonBar->makeLinkButton()->setHref('#')->setOnClick(BackendUtility::viewOnClick($this->pageinfo['uid'], '', BackendUtility::BEgetRootLine($this->pageinfo['uid'])))->setTitle($this->languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', true))->setIcon($this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL)); $buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, 1); // Shortcut $shortCutButton = $buttonBar->makeShortcutButton()->setModuleName($this->moduleName)->setGetVariables(['M', 'id', 'edit_record', 'pointer', 'new_unique_uid', 'search_field', 'search_levels', 'showLimit'])->setSetVariables(array_keys($this->MOD_MENU)); $buttonBar->addButton($shortCutButton, ButtonBar::BUTTON_POSITION_RIGHT); }
/** * Create configuration form * * @param array $inData Form configuration data * @return void */ public function makeConfigurationForm($inData) { $nameSuggestion = ''; // Page tree export options: if (isset($inData['pagetree']['id'])) { $this->standaloneView->assign('treeHTML', $this->treeHTML); $opt = array('-2' => $this->lang->getLL('makeconfig_tablesOnThisPage'), '-1' => $this->lang->getLL('makeconfig_expandedTree'), '0' => $this->lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_0'), '1' => $this->lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_1'), '2' => $this->lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_2'), '3' => $this->lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_3'), '4' => $this->lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_4'), '999' => $this->lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_infi')); $this->standaloneView->assign('levelSelectOptions', $opt); $this->standaloneView->assign('tableSelectOptions', $this->getTableSelectOptions('pages')); $nameSuggestion .= 'tree_PID' . $inData['pagetree']['id'] . '_L' . $inData['pagetree']['levels']; } // Single record export: if (is_array($inData['record'])) { $records = array(); foreach ($inData['record'] as $ref) { $rParts = explode(':', $ref); $tName = $rParts[0]; $rUid = $rParts[1]; $nameSuggestion .= $tName . '_' . $rUid; $rec = BackendUtility::getRecordWSOL($tName, $rUid); if (!empty($rec)) { $records[] = array('icon' => $this->iconFactory->getIconForRecord($tName, $rec, Icon::SIZE_SMALL)->render(), 'title' => BackendUtility::getRecordTitle($tName, $rec, true), 'tableName' => $tName, 'recordUid' => $rUid); } } $this->standaloneView->assign('records', $records); } // Single tables/pids: if (is_array($inData['list'])) { // Display information about pages from which the export takes place $tableList = array(); foreach ($inData['list'] as $reference) { $referenceParts = explode(':', $reference); $tableName = $referenceParts[0]; if ($this->getBackendUser()->check('tables_select', $tableName)) { // If the page is actually the root, handle it differently // NOTE: we don't compare integers, because the number actually comes from the split string above if ($referenceParts[1] === '0') { $iconAndTitle = $this->iconFactory->getIcon('apps-pagetree-root', Icon::SIZE_SMALL)->render() . $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']; } else { $record = BackendUtility::getRecordWSOL('pages', $referenceParts[1]); $iconAndTitle = $this->iconFactory->getIconForRecord('pages', $record, Icon::SIZE_SMALL)->render() . BackendUtility::getRecordTitle('pages', $record, true); } $tableList[] = array('tableName' => $tableName, 'iconAndTitle' => $iconAndTitle, 'reference' => $reference); } } $this->standaloneView->assign('tableList', $tableList); } $this->standaloneView->assign('externalReferenceTableSelectOptions', $this->getTableSelectOptions()); $this->standaloneView->assign('externalStaticTableSelectOptions', $this->getTableSelectOptions()); $this->standaloneView->assign('nameSuggestion', $nameSuggestion); }
/** * Get used languages in a colPos of a page * * @param ServerRequestInterface $request * @param ResponseInterface $response * @return ResponseInterface */ public function getUsedLanguagesInPageAndColumn(ServerRequestInterface $request, ResponseInterface $response) { $params = $request->getQueryParams(); if (!isset($params['pageId'], $params['colPos'], $params['languageId'])) { $response = $response->withStatus(500); return $response; } $pageId = (int) $params['pageId']; $colPos = (int) $params['colPos']; $languageId = (int) $params['languageId']; $databaseConnection = $this->getDatabaseConnection(); $backendUser = $this->getBackendUser(); /** @var TranslationConfigurationProvider $translationProvider */ $translationProvider = GeneralUtility::makeInstance(TranslationConfigurationProvider::class); $systemLanguages = $translationProvider->getSystemLanguages($pageId); $availableLanguages = []; $availableLanguages[0] = $systemLanguages[0]; $excludeQueryPart = BackendUtility::deleteClause('tt_content') . BackendUtility::versioningPlaceholderClause('tt_content'); // First check whether column is empty and then load additional languages $elementsInColumnCount = $databaseConnection->exec_SELECTcountRows('uid', 'tt_content', 'tt_content.sys_language_uid=' . (int) $languageId . ' AND tt_content.colPos = ' . (int) $colPos . ' AND tt_content.pid=' . (int) $pageId . $excludeQueryPart); $additionalWhere = ''; if (!$backendUser->isAdmin()) { $additionalWhere .= ' AND sys_language.hidden=0'; if (!empty($backendUser->user['allowed_languages'])) { $additionalWhere .= ' AND sys_language.uid IN(' . $databaseConnection->cleanIntList($backendUser->user['allowed_languages']) . ')'; } } if ($elementsInColumnCount === 0) { $res = $databaseConnection->exec_SELECTquery('sys_language.uid', 'tt_content,sys_language', 'tt_content.sys_language_uid=sys_language.uid' . ' AND tt_content.colPos = ' . (int) $colPos . ' AND tt_content.pid=' . (int) $pageId . ' AND sys_language.uid <> ' . (int) $languageId . $additionalWhere . $excludeQueryPart, 'tt_content.sys_language_uid', 'sys_language.title'); while ($row = $databaseConnection->sql_fetch_assoc($res)) { if (isset($systemLanguages[$row['uid']])) { $availableLanguages[] = $systemLanguages[$row['uid']]; } } $databaseConnection->sql_free_result($res); } // Pre-render all flag icons foreach ($availableLanguages as &$language) { if ($language['flagIcon'] === 'empty-empty') { $language['flagIcon'] = ''; } else { $language['flagIcon'] = $this->iconFactory->getIcon($language['flagIcon'], Icon::SIZE_SMALL)->render(); } } $response->getBody()->write(json_encode($availableLanguages)); return $response; }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. */ protected function getButtons() { $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar(); // CSH $cshButton = $buttonBar->makeFullyRenderedButton()->setHtmlSource(BackendUtility::cshItem('_MOD_web_func', '')); $buttonBar->addButton($cshButton); if ($this->id && is_array($this->pageinfo)) { // View page $viewButton = $buttonBar->makeLinkButton()->setOnClick(BackendUtility::viewOnClick($this->pageinfo['uid'], '', BackendUtility::BEgetRootLine($this->pageinfo['uid'])))->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', true))->setIcon($this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL))->setHref('#'); $buttonBar->addButton($viewButton); // Shortcut if ($this->getBackendUser()->mayMakeShortcut()) { $shortCutButton = $buttonBar->makeFullyRenderedButton()->setHtmlSource($this->moduleTemplate->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->moduleName)); $buttonBar->addButton($shortCutButton, ButtonBar::BUTTON_POSITION_RIGHT); } } }
/** * Builds the buttons for the docheader and returns them as an array * * @return array */ public function getButtons() { $lang = $this->getLanguageService(); $buttons = array(); // CSH button $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'file_edit'); // Save button $theIcon = $this->iconFactory->getIcon('actions-document-save', Icon::SIZE_SMALL)->render(); $buttons['SAVE'] = '<a href="#" class="t3js-fileedit-save" onclick="document.editform.submit();" title="' . $lang->makeEntities($lang->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.submit', true)) . '">' . $theIcon . '</a>'; // Save and Close button $theIcon = $this->iconFactory->getIcon('actions-document-save-close', Icon::SIZE_SMALL)->render(); $buttons['SAVE_CLOSE'] = '<a href="#" class="t3js-fileedit-save-close" onclick="document.editform.redirect.value=' . htmlspecialchars(GeneralUtility::quoteJSvalue($this->returnUrl)) . '; document.editform.submit();" title="' . $lang->makeEntities($lang->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.saveAndClose', true)) . '">' . $theIcon . '</a>'; // Cancel button $theIcon = $this->iconFactory->getIcon('actions-document-close', Icon::SIZE_SMALL)->render(); $buttons['CANCEL'] = '<a href="#" onclick="backToList(); return false;" title="' . $lang->makeEntities($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.cancel', true)) . '">' . $theIcon . '</a>'; return $buttons; }
/** * Main function, rendering the upload file form fields * * @return void */ public function main() { // Make page header: $this->content = $this->doc->startPage($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_upload.php.pagetitle')); $form = $this->renderUploadForm(); $pageContent = $this->doc->header($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_upload.php.pagetitle')) . $this->doc->section('', $form); // Header Buttons $docHeaderButtons = array('csh' => BackendUtility::cshItem('xMOD_csh_corebe', 'file_upload'), 'back' => ''); $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => '', 'CONTENT' => $pageContent, 'PATH' => $this->title); // Back if ($this->returnUrl) { $docHeaderButtons['back'] = '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisUrl($this->returnUrl)) . '" class="typo3-goBack" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', true) . '">' . $this->iconFactory->getIcon('actions-view-go-back', Icon::SIZE_SMALL)->render() . '</a>'; } $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Get a selector as used for the select type, to select from all available * records and to create a relation to the embedding record (e.g. like MM). * * @param array $config TCA inline configuration of the parent(!) field * @param array $uniqueIds The uids that have already been used and should be unique * @return string A HTML <select> box with all possible records */ protected function renderPossibleRecordsSelectorTypeSelect(array $config, array $uniqueIds) { $possibleRecords = $config['selectorOrUniquePossibleRecords']; $nameObject = $this->inlineStackProcessor->getCurrentStructureDomObjectIdPrefix($this->data['inlineFirstPid']); // Create option tags: $opt = []; foreach ($possibleRecords as $p) { if (!in_array($p[1], $uniqueIds)) { $opt[] = '<option value="' . htmlspecialchars($p[1]) . '">' . htmlspecialchars($p[0]) . '</option>'; } } // Put together the selector box: $size = (int) $config['size']; $size = $config['autoSizeMax'] ? MathUtility::forceIntegerInRange(count($possibleRecords) + 1, MathUtility::forceIntegerInRange($size, 1), $config['autoSizeMax']) : $size; $onChange = 'return inline.importNewRecord(' . GeneralUtility::quoteJSvalue($nameObject . '-' . $config['foreign_table']) . ')'; $item = ' <select id="' . $nameObject . '-' . $config['foreign_table'] . '_selector" class="form-control"' . ($size ? ' size="' . $size . '"' : '') . ' onchange="' . htmlspecialchars($onChange) . '"' . ($config['foreign_unique'] ? ' isunique="isunique"' : '') . '> ' . implode('', $opt) . ' </select>'; if ($size <= 1) { // Add a "Create new relation" link for adding new relations // This is necessary, if the size of the selector is "1" or if // there is only one record item in the select-box, that is selected by default // The selector-box creates a new relation on using an onChange event (see some line above) if (!empty($config['appearance']['createNewRelationLinkTitle'])) { $createNewRelationText = htmlspecialchars($this->getLanguageService()->sL($config['appearance']['createNewRelationLinkTitle'])); } else { $createNewRelationText = htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.createNewRelation')); } $item .= ' <span class="input-group-btn"> <a href="#" class="btn btn-default" onclick="' . htmlspecialchars($onChange) . '" title="' . $createNewRelationText . '"> ' . $this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)->render() . $createNewRelationText . ' </a> </span>'; } else { $item .= ' <span class="input-group-btn btn"></span>'; } // Wrap the selector and add a spacer to the bottom $item = '<div class="input-group form-group t3js-formengine-validation-marker ' . $this->inlineData['config'][$nameObject]['md5'] . '">' . $item . '</div>'; return $item; }