/** * @param array $arguments * @param callable $renderChildrenClosure * @param RenderingContextInterface $renderingContext * * @return string * @throws Exception */ public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { $object = $arguments['object']; $table = $arguments['table']; if (!is_object($object) || !method_exists($object, 'getUid')) { return ''; } $row = array('uid' => $object->getUid(), 'startTime' => FALSE, 'endTime' => FALSE); if (method_exists($object, 'getIsDisabled')) { $row['disable'] = $object->getIsDisabled(); } if (method_exists($object, 'getHidden')) { $row['hidden'] = $object->getHidden(); } if ($table === 'be_users' && $object instanceof BackendUser) { $row['admin'] = $object->getIsAdministrator(); } if (method_exists($object, 'getStartDateAndTime')) { $row['startTime'] = $object->getStartDateAndTime(); } if (method_exists($object, 'getEndDateAndTime')) { $row['endTime'] = $object->getEndDateAndTime(); } return IconUtility::getSpriteIconForRecord($table, $row); }
public function init($PA, $fobj) { $GLOBALS['LANG']->includeLLFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('cal') . 'Resources/Private/Language/locallang_db.xml'); $this->frequency = $PA['row']['freq']; if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 7005000) { $this->frequency = $PA['row']['freq'][0]; } $this->uid = $PA['row']['uid']; $this->row = $PA['row']; $this->table = $PA['table']; $this->rdateType = $this->row['rdate_type']; $this->rdate = $this->row['rdate']; $this->rdateValues = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->row['rdate'], 1); if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 7004000) { $this->garbageIcon = '<span class="t3-icon fa t3-icon fa fa-trash"> </span>'; $this->newIcon = '<span title="' . $GLOBALS['LANG']->getLL('tx_cal_event.add_recurrence') . '" class="t3-icon fa t3-icon fa fa-plus-square"> </span>'; } else { $this->garbageIcon = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/garbage.gif') . ' title="' . $GLOBALS['LANG']->getLL('tx_cal_event.remove_recurrence') . '" alt="' . $GLOBALS['LANG']->getLL('tx_cal_event.delete_recurrence') . '" />'; $this->newIcon = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/new_el.gif') . ' title="' . $GLOBALS['LANG']->getLL('tx_cal_event.add_recurrence') . '" alt="' . $GLOBALS['LANG']->getLL('tx_cal_event.add_recurrence') . '" />'; } $this->commonJS = ''; if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 7004000) { $this->commonJS .= '<script src="' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('cal') . 'Resources/Public/js/recurui2.js" type="text/javascript"></script>' . chr(10) . '<script src="' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('cal') . 'Resources/Public/js/url2.js" type="text/javascript"></script>'; } else { $this->commonJS .= '<script src="' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('cal') . 'Resources/Public/js/recurui.js" type="text/javascript"></script>' . chr(10) . '<script src="' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('cal') . 'Resources/Public/js/url.js" type="text/javascript"></script>'; } $this->everyMonthText = $GLOBALS['LANG']->getLL('tx_cal_event.recurs_every_month'); $this->selectedMonthText = $GLOBALS['LANG']->getLL('tx_cal_event.recurs_selected_months'); $this->counts = $this->getCountsArray(); $startDay = $this->getWeekStartDay($PA); $this->weekdays = $this->getWeekDaysArray($startDay); $this->months = $this->getMonthsArray(); }
/** * 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; }
/** * Render javascript in header * * @return string the rendered page info icon * @see template::getPageInfo() Note: can't call this method as it's protected! */ public function render() { $doc = $this->getDocInstance(); $id = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id'); $pageRecord = BackendUtility::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1)); // Add icon with clickmenu, etc: if ($pageRecord['uid']) { // If there IS a real page $alttext = BackendUtility::getRecordIconAltText($pageRecord, 'pages'); $iconImg = IconUtility::getSpriteIconForRecord('pages', $pageRecord, array('title' => htmlspecialchars($alttext))); // Make Icon: $theIcon = $doc->wrapClickMenuOnIcon($iconImg, 'pages', $pageRecord['uid']); } else { // On root-level of page tree // Make Icon $iconImg = '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/i/_icon_website.gif') . ' alt="' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '" />'; if ($GLOBALS['BE_USER']->user['admin']) { $theIcon = $doc->wrapClickMenuOnIcon($iconImg, 'pages', 0); } else { $theIcon = $iconImg; } } // Setting icon with clickmenu + uid $pageInfo = $theIcon . '<em>[pid: ' . $pageRecord['uid'] . ']</em>'; return $pageInfo; }
/** * 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'; } }
/** * 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; }
/** * 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); }
/** * @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)); }
/** * 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'] . '">'; }
/** * Renders all format download links. * * @param \TYPO3\CMS\Documentation\Domain\Model\DocumentTranslation $documentTranslation * @return string */ public function render(\TYPO3\CMS\Documentation\Domain\Model\DocumentTranslation $documentTranslation) { $output = ''; foreach ($documentTranslation->getFormats() as $format) { /** @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 . '"'; } else { $extension = $format->getFormat(); if ($extension === 'json') { $extension = 'js'; } $output .= 'href="#" onclick="top.TYPO3.Backend.ContentContainer.setUrl(\'' . $uri . '\')"'; } $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; } return $output; }
/** * 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; } }
/** * Create the page navigation tree in HTML * * @param array Tree array * @return string HTML output. * @todo Define visibility */ public function printTree($treeArr = '') { $titleLen = (int) $GLOBALS['BE_USER']->uc['titleLen']; if (!is_array($treeArr)) { $treeArr = $this->tree; } $out = ''; $c = 0; foreach ($treeArr as $k => $v) { $c++; $bgColorClass = ($c + 1) % 2 ? 'bgColor' : 'bgColor-10'; if ($GLOBALS['SOBE']->browser->curUrlInfo['act'] == 'page' && $GLOBALS['SOBE']->browser->curUrlInfo['pageid'] == $v['row']['uid'] && $GLOBALS['SOBE']->browser->curUrlInfo['pageid']) { $arrCol = '<td><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/blinkarrow_right.gif', 'width="5" height="9"') . ' class="c-blinkArrowR" alt="" /></td>'; $bgColorClass = 'bgColor4'; } else { $arrCol = '<td></td>'; } $aOnClick = 'return jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&editorNo=' . $GLOBALS['SOBE']->browser->editorNo . '&contentTypo3Language=' . $GLOBALS['SOBE']->browser->contentTypo3Language . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandPage=' . $v['row']['uid']) . ');'; $cEbullet = $this->ext_isLinkable($v['row']['doktype'], $v['row']['uid']) ? '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/arrowbullet.gif', 'width="18" height="16"') . ' alt="" /></a>' : ''; $out .= ' <tr class="' . $bgColorClass . '"> <td nowrap="nowrap"' . ($v['row']['_CSSCLASS'] ? ' class="' . $v['row']['_CSSCLASS'] . '"' : '') . '>' . $v['HTML'] . $this->wrapTitle($this->getTitleStr($v['row'], $titleLen), $v['row'], $this->ext_pArrPages) . '</td>' . $arrCol . '<td>' . $cEbullet . '</td> </tr>'; } $out = ' <!-- Navigation Page Tree: --> <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree"> ' . $out . ' </table>'; return $out; }
/** * 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); }
/** * 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); }
/** * 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; }
/** * 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>'; } }
/** * 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; }
/** * Displays spriteIcon for database table and object * * @param string $table * @param object $object * * @return string * @see t3lib_iconWorks::getSpriteIconForRecord($table, $row) */ public function render($table, $object) { if (!is_object($object) || !method_exists($object, 'getUid')) { return ''; } $row = array('uid' => $object->getUid(), 'startTime' => FALSE, 'endTime' => FALSE); if (method_exists($object, 'getIsDisabled')) { $row['disable'] = $object->getIsDisabled(); } if ($table === 'be_users' && $object instanceof BackendUser) { $row['admin'] = $object->getIsAdministrator(); } if (method_exists($object, 'getStartDateAndTime')) { $row['startTime'] = $object->getStartDateAndTime(); } if (method_exists($object, 'getEndDateAndTime')) { $row['endTime'] = $object->getEndDateAndTime(); } // @todo Remove this when 6.2 is no longer relevant if (version_compare(TYPO3_branch, '7.0', '<')) { $icon = IconUtility::getSpriteIconForRecord($table, $row); } else { /* @var $iconFactory \TYPO3\CMS\Core\Imaging\IconFactory */ $iconFactory = GeneralUtility::makeInstance(IconFactory::class); $icon = $iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render(); } return $icon; }
/** * Add an entry to the 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) { $title = LocalizationUtility::translate('cache_action.title', 'cs_clear_images'); $icon = '<img ' . IconUtility::skinImg($GLOBALS['BACK_PATH'], ExtensionManagementUtility::extRelPath('cs_clear_images') . 'Resources/Public/Images/clear_cache_icon.png', 'width="16" height="16"') . ' alt="" title="' . $title . '"/>'; // Clearing of processed images $cacheActions[] = array('id' => 'tx_csclearimages', 'title' => $title, 'href' => $this->backPath . 'tce_db.php?vC=' . $GLOBALS['BE_USER']->veriCode() . '&cacheCmd=tx_csclearimages&ajaxCall=1' . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction'), 'icon' => $icon); }
/** * Implementing CompilableInterface suppresses object instantiation of this view helper * * @param array $arguments * @param \Closure $renderChildrenClosure * @param RenderingContextInterface $renderingContext * @return string * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception */ public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { // The two main icon classes are static during one call. They trigger relatively expensive // calculation with a signal and object creation and thus make sense to have them cached. if (!static::$grantedCssClasses) { static::$grantedCssClasses = IconUtility::getSpriteIconClasses('status-status-permission-granted'); } if (!static::$deniedCssClasses) { static::$deniedCssClasses = IconUtility::getSpriteIconClasses('status-status-permission-denied'); } $masks = array(1, 16, 2, 4, 8); if (empty(static::$permissionLabels)) { foreach ($masks as $mask) { static::$permissionLabels[$mask] = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:' . $mask, 'be_user'); } } $icon = ''; foreach ($masks as $mask) { if ($arguments['permission'] & $mask) { $icon .= '<span' . ' title="' . static::$permissionLabels[$mask] . '"' . ' class="' . static::$grantedCssClasses . ' change-permission text-success"' . ' data-page="' . $arguments['pageId'] . '"' . ' data-permissions="' . $arguments['permission'] . '"' . ' data-mode="delete"' . ' data-who="' . $arguments['scope'] . '"' . ' data-bits="' . $mask . '"' . ' style="cursor:pointer"' . '></span>'; } else { $icon .= '<span' . ' title="' . static::$permissionLabels[$mask] . '"' . ' class="' . static::$deniedCssClasses . ' change-permission text-danger"' . ' data-page="' . $arguments['pageId'] . '"' . ' data-permissions="' . $arguments['permission'] . '"' . ' data-mode="add"' . ' data-who="' . $arguments['scope'] . '"' . ' data-bits="' . $mask . '"' . ' style="cursor:pointer"' . '></span>'; } } return '<span id="' . $arguments['pageId'] . '_' . $arguments['scope'] . '">' . $icon . '</span>'; }
/** * @param array|NULL $backendUser * @param int $size * @param bool $showIcon * @return string */ public function render(array $backendUser = NULL, $size = 32, $showIcon = FALSE) { $size = (int) $size; if (!is_array($backendUser)) { $backendUser = $this->getBackendUser()->user; } $image = parent::render($backendUser, $size, $showIcon); if (!StringUtility::beginsWith($image, '<span class="avatar"><span class="avatar-image"></span>') || empty($backendUser['email'])) { return $image; } $cachedFilePath = PATH_site . 'typo3temp/t3gravatar/'; $cachedFileName = sha1($backendUser['email'] . $size) . '.jpg'; if (!file_exists($cachedFilePath . $cachedFileName)) { $gravatar = 'https://www.gravatar.com/avatar/' . md5(strtolower($backendUser['email'])) . '?s=' . $size . '&d=404'; $gravatarImage = GeneralUtility::getUrl($gravatar); if (empty($gravatarImage)) { return $image; } GeneralUtility::writeFileToTypo3tempDir($cachedFileName, $gravatarImage); } // Icon $icon = ''; if ($showIcon) { $icon = '<span class="avatar-icon">' . IconUtility::getSpriteIconForRecord('be_users', $backendUser) . '</span>'; } $relativeFilePath = PathUtility::getRelativePath(PATH_typo3, $cachedFilePath); return '<span class="avatar"><span class="avatar-image">' . '<img src="' . $relativeFilePath . $cachedFileName . '" width="' . $size . '" height="' . $size . '" /></span>' . $icon . '</span>'; }
/** * 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'; } }
/** * Returns array of system languages * * Since TYPO3 4.5 the flagIcon is not returned as a filename in "gfx/flags/*" anymore, * but as a string <flags-xx>. The calling party should call * t3lib_iconWorks::getSpriteIcon(<flags-xx>) to get an HTML which will represent * the flag of this language. * * @param integer $page_id Page id (only used to get TSconfig configuration setting flag and label for default language) * @param string $backPath Backpath for flags * @return array Array with languages (title, uid, flagIcon) * @todo Define visibility */ public function getSystemLanguages($page_id = 0, $backPath = '') { $modSharedTSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($page_id, 'mod.SHARED'); $languageIconTitles = array(); // fallback "old iconstyles" if (preg_match('/\\.gif$/', $modSharedTSconfig['properties']['defaultLanguageFlag'])) { $modSharedTSconfig['properties']['defaultLanguageFlag'] = str_replace('.gif', '', $modSharedTSconfig['properties']['defaultLanguageFlag']); } $languageIconTitles[0] = array('uid' => 0, 'title' => strlen($modSharedTSconfig['properties']['defaultLanguageLabel']) ? $modSharedTSconfig['properties']['defaultLanguageLabel'] . ' (' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xml:defaultLanguage') . ')' : $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xml:defaultLanguage'), 'ISOcode' => 'DEF', 'flagIcon' => strlen($modSharedTSconfig['properties']['defaultLanguageFlag']) ? 'flags-' . $modSharedTSconfig['properties']['defaultLanguageFlag'] : 'empty-empty'); // Set "All" language: $languageIconTitles[-1] = array('uid' => -1, 'title' => $GLOBALS['LANG']->getLL('multipleLanguages'), 'ISOcode' => 'DEF', 'flagIcon' => 'flags-multiple'); // Find all system languages: $sys_languages = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_language', ''); foreach ($sys_languages as $row) { $languageIconTitles[$row['uid']] = $row; if ($row['static_lang_isocode'] && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('static_info_tables')) { $staticLangRow = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('static_languages', $row['static_lang_isocode'], 'lg_iso_2'); if ($staticLangRow['lg_iso_2']) { $languageIconTitles[$row['uid']]['ISOcode'] = $staticLangRow['lg_iso_2']; } } if (strlen($row['flag'])) { $languageIconTitles[$row['uid']]['flagIcon'] = \TYPO3\CMS\Backend\Utility\IconUtility::mapRecordTypeToSpriteIconName('sys_language', $row); } } return $languageIconTitles; }
/** * @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>'; }
/** * 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>'; }
/** * 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 '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/content_client.gif', 'width="7" height="10"') . ' alt="" />' . $str; } else { return $str; } }
/** * 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 the sprite icon * * @param string $table table name * @param integer $uid uid of record * @param string $title title * @return string sprite icon */ public function render($table, $uid, $title) { $icon = ''; $row = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($table, $uid); if (is_array($row)) { $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($table, $row, array('title' => htmlspecialchars($title))); } return $icon; }