/** * @param array $arguments * @param callable $renderChildrenClosure * @param RenderingContextInterface $renderingContext * * @return string */ public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { $documentTranslation = $arguments['documentTranslation']; $icons = array('html' => '<a class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</a>', 'pdf' => '<a class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</a>', 'sxw' => '<a class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</a>'); $formats = $documentTranslation->getFormats(); foreach ($formats as $format) { $output = ''; /** @var \TYPO3\CMS\Documentation\Domain\Model\DocumentFormat $format */ $output .= '<a '; $uri = '../' . $format->getPath(); $extension = substr($uri, strrpos($uri, '.') + 1); if (strlen($extension) < 5) { // This is direct link to a file $output .= 'href="' . $uri . '" class="btn btn-default"'; } else { $extension = $format->getFormat(); if ($extension === 'json') { $extension = 'js'; } $output .= 'href="#" onclick="top.TYPO3.Backend.ContentContainer.setUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($uri) . ')" class="btn btn-default"'; } $xliff = 'LLL:EXT:documentation/Resources/Private/Language/locallang.xlf'; $title = sprintf($GLOBALS['LANG']->sL($xliff . ':tx_documentation_domain_model_documentformat.format.title'), $format->getFormat()); $output .= ' title="' . htmlspecialchars($title) . '">'; $spriteIconHtml = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForFile($extension); $output .= $spriteIconHtml . '</a>' . LF; $keyFormat = $format->getFormat(); if ($keyFormat === 'json') { // It should take over the place of sxw which will then never be used $keyFormat = 'sxw'; } $icons[$keyFormat] = $output; } return implode('', array_values($icons)); }
/** * Modifies CacheMenuItems array * * @param array $cacheActions Array of CacheMenuItems * @param array $optionValues Array of AccessConfigurations-identifiers (typically used by userTS with options.clearCache.identifier) */ public function manipulateCacheActions(&$cacheActions, &$optionValues) { if ($this->getBackendUser()->getTSConfigVal('options.clearCache.system') || GeneralUtility::getApplicationContext()->isDevelopment() || (bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === TRUE && $this->getBackendUser()->isAdmin()) { $cacheActions[] = array('id' => 'dyncss', 'title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesTitle', TRUE), 'description' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesDescription', TRUE), 'href' => BackendUtility::getModuleUrl('tce_db') . '&vC=' . $this->getBackendUser()->veriCode() . '&cacheCmd=dyncss&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-high')); $optionValues[] = 'dyncss'; } }
/** * Wrapping icon in browse tree * * @param string $thePageIcon Icon IMG code * @param array $row Data row for element. * @return string Page icon */ public function wrapIcon($thePageIcon, &$row) { // If the record is locked, present a warning sign. if ($lockInfo = \TYPO3\CMS\Backend\Utility\BackendUtility::isRecordLocked('pages', $row['uid'])) { $aOnClick = 'alert(' . GeneralUtility::quoteJSvalue($lockInfo['msg']) . ');return false;'; $lockIcon = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . IconUtility::getSpriteIcon('status-warning-in-use', array('title' => $lockInfo['msg'])) . '</a>'; } else { $lockIcon = ''; } // Wrap icon in click-menu link. if (!$this->ext_IconMode) { $thePageIcon = $GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon($thePageIcon, 'pages', $row['uid'], 0, '&bank=' . $this->bank); } elseif ($this->ext_IconMode === 'titlelink') { $aOnClick = 'return jumpTo(' . GeneralUtility::quoteJSvalue($this->getJumpToParam($row)) . ',this,' . GeneralUtility::quoteJSvalue($this->treeName) . ');'; $thePageIcon = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $thePageIcon . '</a>'; } // Wrap icon in a drag/drop span. $dragDropIcon = '<span class="dragIcon" id="dragIconID_' . $row['uid'] . '">' . $thePageIcon . '</span>'; // Add Page ID: $pageIdStr = ''; if ($this->ext_showPageId) { $pageIdStr = '<span class="dragId">[' . $row['uid'] . ']</span> '; } // Call stats information hook $stat = ''; if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) { $_params = array('pages', $row['uid']); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef) { $stat .= GeneralUtility::callUserFunction($_funcRef, $_params, $this); } } return $dragDropIcon . $lockIcon . $pageIdStr . $stat; }
/** * Generate the plus/minus icon for the browsable tree. * In this case, there is no plus-minus icon displayed. * * @param array $row Record for the entry * @param integer $a The current entry number * @param integer $c The total number of entries. If equal to $a, a 'bottom' element is returned. * @param integer $nextCount The number of sub-elements to the current element. * @param boolean $exp The element was expanded to render subelements if this flag is set. * @return string Image tag with the plus/minus icon. * @access private * @see AbstarctTreeView::PMicon() * @todo Define visibility */ public function PMicon($row, $a, $c, $nextCount, $exp) { $PM = 'join'; $BTM = $a == $c ? 'bottom' : ''; $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('treeline-' . $PM . $BTM); return $icon; }
/** * Processing of clickmenu items * * @param object $backRef Reference to parent * @param array $menuItems Menu items array to modify * @param string $table Table name * @param integer $uid Uid of the record * @return array Menu item array, returned after modification * @todo Skinning for icons... * @todo Define visibility */ 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(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-export-t3d')), $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(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-import-t3d')), $backRef->urlRefForCM($url), 1); } } return array_merge($menuItems, $localItems); }
/** * Generate album add/edit buttons for click menu or toolbar * * @param string $combinedIdentifier * @return array */ protected function generateButtons($combinedIdentifier) { $buttons = array(); // In some folder copy/move actions in file list a invalid id is passed try { /** @var $file \TYPO3\CMS\Core\Resource\Folder */ $folder = ResourceFactory::getInstance()->retrieveFileOrFolderObject($combinedIdentifier); } catch (ResourceDoesNotExistException $exception) { $folder = NULL; } catch (InsufficientFolderAccessPermissionsException $exception) { $folder = NULL; } if ($folder && $folder instanceof Folder && !$folder->getStorage()->isPublic() && in_array($folder->getRole(), array(Folder::ROLE_DEFAULT, Folder::ROLE_USERUPLOAD))) { /** @var \BeechIt\FalSecuredownload\Service\Utility $utility */ $utility = GeneralUtility::makeInstance('BeechIt\\FalSecuredownload\\Service\\Utility'); $folderRecord = $utility->getFolderRecord($folder); $menuItems[] = 'spacer'; if ($folderRecord) { $buttons[] = $this->createLink($this->sL('clickmenu.folderpermissions'), $this->sL('clickmenu.folderpermissions'), IconUtility::getSpriteIcon('extensions-fal_securedownload-folder', array(), array('status-overlay-access-restricted' => '')), "alt_doc.php?edit[tx_falsecuredownload_folder][" . $folderRecord['uid'] . "]=edit"); } else { $buttons[] = $this->createLink($this->sL('clickmenu.folderpermissions'), $this->sL('clickmenu.folderpermissions'), IconUtility::getSpriteIcon('extensions-fal_securedownload-folder', array(), array('extensions-fal_securedownload-overlay-permissions' => '')), "alt_doc.php?edit[tx_falsecuredownload_folder][0]=new&defVals[tx_falsecuredownload_folder][folder_hash]=" . $folder->getHashedIdentifier() . "&defVals[tx_falsecuredownload_folder][storage]=" . $folder->getStorage()->getUid() . "&defVals[tx_falsecuredownload_folder][folder]=" . $folder->getIdentifier()); } } return $buttons; }
/** * Get drop down * * @return string */ public function getDropDown() { $backendUser = $this->getBackendUser(); $languageService = $this->getLanguageService(); $index = 0; $activeWorkspace = (int) $backendUser->workspace; $stateCheckedIcon = IconUtility::getSpriteIcon('status-status-checked'); $stateUncheckedIcon = IconUtility::getSpriteIcon('empty-empty', array('title' => $languageService->getLL('bookmark_inactive'))); $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="backend.php?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); }
/** * Wrapping icon in browse tree * * @param string $icon IMG code * @param array $row Data row for element. * * @return string Page icon */ public function wrapIcon($icon, array &$row) { $language = $this->getLanguageService(); // If the record is locked, present a warning sign. if ($lockInfo = \TYPO3\CMS\Backend\Utility\BackendUtility::isRecordLocked('pages', $row['uid'])) { $aOnClick = 'alert(' . $language->JScharCode($lockInfo['msg']) . ');return false;'; $lockIcon = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-warning-in-use', array('title' => htmlspecialchars($lockInfo['msg']))) . '</a>'; } else { $lockIcon = ''; } // Add title attribute to input icon tag $thePageIcon = $this->addTagAttributes($icon, $this->titleAttrib . '="' . $this->getTitleAttrib($row) . '"'); // Wrap icon in click-menu link. if (!$this->ext_IconMode) { /** * Template * * @var \TYPO3\CMS\Backend\Template\DocumentTemplate $tbeTemplate */ $tbeTemplate = $GLOBALS['TBE_TEMPLATE']; $thePageIcon = $tbeTemplate->wrapClickMenuOnIcon($thePageIcon, 'pages', $row['uid'], 0, '&bank=' . $this->bank); } elseif (!strcmp($this->ext_IconMode, 'titlelink')) { $aOnClick = 'return jumpTo(\'' . $this->getJumpToParam($row) . '\',this,\'' . $this->treeName . '\');'; $thePageIcon = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $thePageIcon . '</a>'; } // Add Page ID: if ($this->ext_showPageId) { $pageIdStr = '[' . $row['uid'] . '] '; } else { $pageIdStr = ''; } return $thePageIcon . $lockIcon . $pageIdStr; }
/** * Administrative links for a table / record * * @param string $table Table name * @param array $row Record for which administrative links are generated. * * @return string HTML link tags. */ public function adminLinks($table, array $row) { if ($table !== 'tx_commerce_products') { return parent::adminLinks($table, $row); } else { $language = $this->getLanguageService(); // Edit link: $adminLink = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick('&edit[' . $table . '][' . $row['uid'] . ']=edit', $this->doc->backPath)) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open', array('title' => $language->sL('LLL:EXT:lang/locallang_core.xml:cm.edit', TRUE))) . '</a>'; // Delete link: $adminLink .= '<a href="' . htmlspecialchars($this->doc->issueCommand('&cmd[' . $table . '][' . $row['uid'] . '][delete]=1')) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $language->sL('LLL:EXT:lang/locallang_core.php:cm.delete', TRUE))) . '</a>'; if ($row['pid'] == -1) { // get page TSconfig $pagesTyposcriptConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($GLOBALS['_POST']['popViewId']); if ($pagesTyposcriptConfig['tx_commerce.']['singlePid']) { $previewPageId = $pagesTyposcriptConfig['tx_commerce.']['singlePid']; } else { $previewPageId = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][COMMERCE_EXTKEY]['extConf']['previewPageID']; } $sysLanguageUid = (int) $row['sys_language_uid']; /** * Product * * @var $product Tx_Commerce_Domain_Model_Product */ $product = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Commerce_Domain_Model_Product', $row['t3ver_oid'], $sysLanguageUid); $product->loadData(); $getVars = ($sysLanguageUid > 0 ? '&L=' . $sysLanguageUid : '') . '&ADMCMD_vPrev[' . rawurlencode($table . ':' . $row['t3ver_oid']) . ']=' . $row['uid'] . '&no_cache=1&tx_commerce_pi1[showUid]=' . $product->getUid() . '&tx_commerce_pi1[catUid]=' . current($product->getMasterparentCategory()); $adminLink .= '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($previewPageId, $this->doc->backPath, \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($row['_REAL_PID']), '', '', $getVars)) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-view') . '</a>'; } return $adminLink; } }
/** * Processes the list of actions for a given extension and adds * a link to the manual(s), if available. * * @param array $extension * @param array $actions * @return void */ public function processActions(array $extension, array &$actions) { if (static::$documents === NULL) { /** @var \TYPO3\CMS\Documentation\Controller\DocumentController $documentController */ $documentController = $this->objectManager->get(\TYPO3\CMS\Documentation\Controller\DocumentController::class); static::$documents = $documentController->getDocuments(); } $extensionKey = $extension['key']; $documentKey = 'typo3cms.extensions.' . $extensionKey; if (isset(static::$documents[$documentKey])) { $document = static::$documents[$documentKey]; foreach ($document->getTranslations() as $documentTranslation) { $actions[] = FormatsViewHelper::renderStatic( array( 'documentTranslation' => $documentTranslation, ), function() {}, new RenderingContext() ); } } else { $actions[] = '<span class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</span>'; $actions[] = '<span class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</span>'; $actions[] = '<span class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</span>'; } }
/** * Prints sprite icon html for $iconName key. * * @param string $iconName * @param array $options * @param int $uid * @return string */ public function render($iconName, $options = array(), $uid = 0) { if (!isset($options['title']) && $uid > 0) { $options['title'] = 'id=' . $uid; } return \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon($iconName, $options); }
/** * Constructor for initializing the class * * @return void * @todo Define visibility */ public function init() { // Initialize GPvars: $this->target = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('target'); $this->returnUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('returnUrl')); if (!$this->returnUrl) { $this->returnUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('file_list') . '&id=' . rawurlencode($this->target); } // Create the folder object if ($this->target) { $this->folderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($this->target); } // Cleaning and checking target directory if (!$this->folderObject) { $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', TRUE); $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', TRUE); throw new \RuntimeException($title . ': ' . $message, 1294586843); } // Setting the title and the icon $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-filetree-root'); $this->title = $icon . htmlspecialchars($this->folderObject->getStorage()->getName()) . ': ' . htmlspecialchars($this->folderObject->getIdentifier()); // Setting template object $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->setModuleTemplate('templates/file_upload.html'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->form = '<form action="tce_file.php" method="post" name="editform" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">'; }
/** * Fetch the context help for the given table * * @param string $table Table identifier * @return array Complete help information */ public function getTableContextHelp($table) { $output = array(); if (!isset($GLOBALS['TCA_DESCR'][$table]['columns'])) { $GLOBALS['LANG']->loadSingleTableDescription($table); } if (is_array($GLOBALS['TCA_DESCR'][$table]) && is_array($GLOBALS['TCA_DESCR'][$table]['columns'])) { $arrow = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-forward'); foreach ($GLOBALS['TCA_DESCR'][$table]['columns'] as $field => $data) { $output[$field] = array('description' => NULL, 'title' => NULL, 'moreInfo' => FALSE, 'id' => $table . '.' . $field); // Add alternative title, if defined if ($data['alttitle']) { $output[$field]['title'] = $data['alttitle']; } // If we have more information to show if ($data['image_descr'] || $data['seeAlso'] || $data['details'] || $data['syntax']) { $output[$field]['moreInfo'] = TRUE; } // Add description if ($data['description']) { $output[$field]['description'] = $data['description'] . ($output[$field]['moreInfo'] ? $arrow : ''); } } } return $output; }
/** * Modifies CacheMenuItems array * * @param array $cacheActions Array of CacheMenuItems * @param array $optionValues Array of AccessConfigurations-identifiers (typically used by userTS with options.clearCache.identifier) * * @return void */ public function manipulateCacheActions(&$cacheActions, &$optionValues) { if ($this->getBackendUser()->getTSConfigVal('options.clearCache.system') || GeneralUtility::getApplicationContext()->isDevelopment() || (bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === TRUE && $this->getBackendUser()->isAdmin()) { $cacheActions[] = array('id' => 'dyncss', 'title' => $this->getLanguageService()->sL('LLL:EXT:dyncss/Resources/Private/Language/locallang.xlf:dyncss.toolbar.clearcache.title', TRUE), 'description' => $this->getLanguageService()->sL('LLL:EXT:dyncss/Resources/Private/Language/locallang.xlf:dyncss.toolbar.clearcache.description', TRUE), 'href' => BackendUtility::getModuleUrl('tce_db') . '&vC=' . $this->getBackendUser()->veriCode() . '&cacheCmd=dyncss&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('extensions-dyncss-lightning-blue')); $optionValues[] = 'dyncss'; } }
/** * Wrapping the record header (from getRecordHeader()) * * @param string $str HTML content * @param array $row Record array. * @return string HTML content */ public function wrapRecordHeader($str, $row) { if ($row['uid'] == $this->moveUid) { return \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-status-current') . $str; } else { return $str; } }
/** * Render confirm link with sprite icon * * @param string $link * @param string $message * @param string $title * @param string $class * @param string $icon * @return string */ public function render($link, $message = '', $title = '', $class = '', $icon = 'actions-edit-delete') { if (!empty($link)) { $attributes = array('href' => $link, 'onclick' => 'return confirm(' . GeneralUtility::quoteJSvalue($message) . ')', 'title' => $title, 'class' => $class); return '<a ' . GeneralUtility::implodeAttributes($attributes, false, true) . '>' . IconUtility::getSpriteIcon($icon) . '</a>'; } return ''; }
/** * Renders an icon link as known from the TYPO3 backend * * @param string $uri the target URI for the link. If you want to execute JavaScript here, prefix the URI with "javascript:" * @param string $icon Icon to be used. * @param string $title Title attribte of the resulting link * @return string the rendered icon link */ public function render($uri, $icon = 'actions-document-close', $title = '') { if ($this->arguments['onclick']) { $onclick = ' onclick="' . $this->arguments['onclick'] . '" '; } $ret = '<a href="' . $uri . '"' . $onclick . '>' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon($icon, array('title' => $title)) . '</a>'; return $ret; }
/** * @param \TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser Target backendUser to switch active session to * @param boolean $emulate Return to current session or logout after target session termination? * @return string */ public function render(\TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser, $emulate = FALSE) { if ($backendUser->getIsAdministrator()) { return ''; } $title = $GLOBALS['LANG']->getLL('switchUserTo', TRUE) . ' ' . $backendUser->getUserName() . ' ' . $GLOBALS['LANG']->getLL('switchBackMode', TRUE); return '<a href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('SwitchUser' => $backendUser->getUid(), 'switchBackUser' => $emulate)) . '" target="_top" title="' . htmlspecialchars($title) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-backend-user-' . ($emulate ? 'emulate' : 'switch')) . '</a>'; }
/** * @param \TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser Target backendUser to switch active session to * @param boolean $emulate Return to current session or logout after target session termination? * @return string */ public function render(\TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser, $emulate = FALSE) { if ($backendUser->getUid() == $GLOBALS['BE_USER']->user['uid']) { return ''; } $title = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($emulate ? 'switchBackMode' : 'changeToMode', 'beuser'); return '<a href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('SwitchUser' => $backendUser->getUid(), 'switchBackUser' => $emulate)) . '" target="_top" title="' . htmlspecialchars($title) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-backend-user-' . ($emulate ? 'emulate' : 'switch')) . '</a>'; }
/** * @param array $arguments * @param callable $renderChildrenClosure * @param RenderingContextInterface $renderingContext * * @return string */ public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { $backendUser = $arguments['backendUser']; if ($backendUser->getUid() == $GLOBALS['BE_USER']->user['uid'] || !$backendUser->isActive()) { return '<span class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</span>'; } $title = LocalizationUtility::translate('switchBackMode', 'beuser'); return '<a class="btn btn-default" href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('SwitchUser' => $backendUser->getUid()))) . '" target="_top" title="' . htmlspecialchars($title) . '">' . IconUtility::getSpriteIcon('actions-system-backend-user-switch') . '</a>'; }
/** * 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); } }
/** * Creates the version selector for the page id inputted. * Moved out of the core file \TYPO3\CMS\Backend\Template\DocumentTemplate * * @param int $id Page id to create selector for. * @param bool $noAction If set, there will be no button for swapping page. * @return void * @see \TYPO3\CMS\Backend\Template\DocumentTemplate */ public function getVersionSelector($id, $noAction = FALSE) { if ($id <= 0) { return; } if ($GLOBALS['BE_USER']->workspace == 0) { // Get Current page record: $curPage = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $id); // If the selected page is not online, find the right ID $onlineId = $curPage['pid'] == -1 ? $curPage['t3ver_oid'] : $id; // Select all versions of online version: $versions = \TYPO3\CMS\Backend\Utility\BackendUtility::selectVersionsOfRecord('pages', $onlineId, 'uid,pid,t3ver_label,t3ver_oid,t3ver_wsid,t3ver_id'); // If more than one was found...: if (count($versions) > 1) { $selectorLabel = '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xlf:versionSelect.label', TRUE) . '</strong>'; // Create selector box entries: $opt = array(); foreach ($versions as $vRow) { if ($vRow['uid'] == $onlineId) { // Live version $label = '[' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xlf:versionSelect.live', TRUE) . ']'; } else { $label = $vRow['t3ver_label'] . ' (' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xlf:versionId', TRUE) . ' ' . $vRow['t3ver_id'] . ($vRow['t3ver_wsid'] != 0 ? ' ' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xlf:workspaceId', TRUE) . ' ' . $vRow['t3ver_wsid'] : '') . ')'; } $opt[] = '<option value="' . htmlspecialchars(GeneralUtility::linkThisScript(array('id' => $vRow['uid']))) . '"' . ($id == $vRow['uid'] ? ' selected="selected"' : '') . '>' . htmlspecialchars($label) . '</option>'; } // Add management link: $management = '<input type="button" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ver.mgm', TRUE) . '" onclick="window.location.href=\'' . htmlspecialchars($GLOBALS['BACK_PATH'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_txversionM1', array('table' => 'pages', 'uid' => $onlineId))) . '\';" />'; // Create onchange handler: $onChange = 'window.location.href=this.options[this.selectedIndex].value;'; // Controls: if ($id == $onlineId) { $controls = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/blinkarrow_left.gif', 'width="5" height="9"') . ' class="absmiddle" alt="" /> <strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ver.online', TRUE) . '</strong>'; } elseif (!$noAction) { $href = $GLOBALS['TBE_TEMPLATE']->issueCommand('&cmd[pages][' . $onlineId . '][version][swapWith]=' . $id . '&cmd[pages][' . $onlineId . '][version][action]=swap', GeneralUtility::linkThisScript(array('id' => $onlineId))); $controls = '<a href="' . htmlspecialchars($href) . '" class="text-nowrap">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-version-swap-version', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ver.swapPage', TRUE), 'style' => 'margin-left:5px;vertical-align:bottom;')) . '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ver.swap', TRUE) . '</strong></a>'; } // Write out HTML code: return ' <!-- Version selector: --> <table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector"> <tr> <td>' . $selectorLabel . '</td> <td> <select onchange="' . htmlspecialchars($onChange) . '"> ' . implode('', $opt) . ' </select></td> <td>' . $controls . '</td> <td>' . $management . '</td> </tr> </table> '; } } }
/** * Render link with sprite icon to remove user * * @param \TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser Target backendUser to switch active session to * @return string */ public function render(\TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser) { if ($backendUser->getUid() == $GLOBALS['BE_USER']->user['uid']) { return ''; } $redirectUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI'); $parameters = 'cmd[be_users][' . $backendUser->getUid() . '][delete]=1'; $url = $GLOBALS['BACK_PATH'] . 'tce_db.php?&' . $parameters . '&redirect=' . ($redirectUrl == '' ? '\' + T3_THIS_LOCATION + \'' : rawurlencode($redirectUrl)) . '&vC=' . rawurlencode($GLOBALS['BE_USER']->veriCode()) . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction') . '&prErr=1&uPT=1'; return '<a href="' . $url . '" onclick="return confirm(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('confirm', 'beuser', array($backendUser->getUserName()))) . ')">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-delete') . '</a>'; }
/** * Renders an icon link as known from the TYPO3 backend * * @param string $icon Icon to be used * @param string $uri the target URI for the link * @param string $title Title attribute of the resulting link * @param string $onclick onclick setting * @return string the rendered icon link */ public function render($icon = 'closedok', $uri = '', $title = '', $onclick = '') { $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon($icon, array('title' => $title)); if (empty($uri) && empty($onclick)) { $content = $icon; } else { $content = '<a onclick="' . htmlspecialchars($onclick) . '" href="' . htmlspecialchars($uri) . '">' . $icon . '</a>'; } return $content; }
/** * Get the wizard icon * * @return string */ protected function getWizardIcon() { if (GeneralUtility::compat_version('7.6')) { /** @var \TYPO3\CMS\Core\Imaging\IconFactory $iconFactory */ $iconFactory = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Imaging\\IconFactory'); $icon = $iconFactory->getIcon('tcarecords-tx_focuspoint_domain_model_filestandalone-default', Icon::SIZE_SMALL, null); return $icon->render(); } return IconUtility::getSpriteIcon('extensions-focuspoint-focuspoint'); }
/** * Prints sprite icon html for $iconName key * * @todo Find a way to process $option['title'] for TYPO 7.x * Probably move the title attribute to parent element * * @param string $iconName * @param array $options * * @return string */ public function render($iconName, $options = array()) { // @todo Remove this when 6.2 is no longer relevant if (version_compare(TYPO3_branch, '7.0', '<')) { $icon = IconUtility::getSpriteIcon($iconName, $options); } else { /* @var $iconFactory \TYPO3\CMS\Core\Imaging\IconFactory */ $iconFactory = GeneralUtility::makeInstance(IconFactory::class); $icon = $iconFactory->getIcon($iconName, Icon::SIZE_SMALL)->render(); } return $icon; }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. * * @return array All available buttons as an assoc. array */ protected function getButtons() { $buttons = array('csh' => '', 'back' => ''); // CSH $buttons['csh'] = \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_csh_corebe', 'history_log', $GLOBALS['BACK_PATH'], '', TRUE); // Start history object $historyObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\History\\RecordHistory'); if ($historyObj->returnUrl) { $buttons['back'] = '<a href="' . htmlspecialchars($historyObj->returnUrl) . '" class="typo3-goBack">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-back') . '</a>'; } return $buttons; }
/** * @param array $arguments * @param callable $renderChildrenClosure * @param RenderingContextInterface $renderingContext * * @return string */ public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { /** @var \TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser */ $backendUser = $arguments['backendUser']; /** @var BackendUserAuthentication $beUser */ $beUser = $GLOBALS['BE_USER']; if ($backendUser->getUid() === (int) $beUser->user['uid']) { return '<span class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</span>'; } $urlParameters = ['cmd[be_users][' . $backendUser->getUid() . '][delete]' => 1, 'vC' => $beUser->veriCode(), 'prErr' => 1, 'uPT' => 1, 'redirect' => GeneralUtility::getIndpEnv('REQUEST_URI')]; $url = BackendUtility::getModuleUrl('tce_db', $urlParameters) . BackendUtility::getUrlToken('tceAction'); return '<a class="btn btn-default" href="' . htmlspecialchars($url) . '" onclick="return confirm(' . GeneralUtility::quoteJSvalue(LocalizationUtility::translate('confirm', 'beuser', array($backendUser->getUserName()))) . ')">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>'; }
/** * Get system history record * * @param integer $uid Uid of the log entry * @return string Formatted history entry if one exists, else empty string */ public function render($uid) { /** @var $historyEntry \TYPO3\CMS\Belog\Domain\Model\HistoryEntry */ $historyEntry = $this->historyEntryRepository->findOneBySysLogUid($uid); if (!$historyEntry instanceof \TYPO3\CMS\Belog\Domain\Model\HistoryEntry) { return ''; } $historyLabel = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('changesInFields', $this->controllerContext->getRequest()->getControllerExtensionName(), array($historyEntry->getFieldlist())); $historyIcon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-history-open', array('title' => \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('showHistory', $this->controllerContext->getRequest()->getControllerExtensionName()))); $historyHref = 'show_rechis.php?sh_uid=' . $historyEntry->getUid() . '&returnUrl=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI')); $historyLink = '<a href="' . htmlspecialchars($historyHref) . '">' . $historyIcon . '</a>'; return $historyLabel . ' ' . $historyLink; }
/** * Renders a configure extension link if the extension has configuration options * * @param array $extension * @return string the rendered a tag */ public function render($extension) { $tag = ''; if ($extension['installed'] && file_exists(PATH_site . $extension['siteRelPath'] . '/ext_conf_template.txt')) { $uriBuilder = $this->controllerContext->getUriBuilder(); $action = 'showConfigurationForm'; $uri = $uriBuilder->reset()->uriFor($action, array('extension' => array('key' => $extension['key'])), 'Configuration'); $this->tag->addAttribute('href', $uri); $this->tag->addAttribute('title', \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('extensionList.configure', 'extensionmanager')); $this->tag->setContent(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-extension-configure')); $tag = $this->tag->render(); } return $tag; }