本文整理汇总了PHP中TYPO3\CMS\Core\Imaging\IconFactory类的典型用法代码示例。如果您正苦于以下问题:PHP IconFactory类的具体用法?PHP IconFactory怎么用?PHP IconFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IconFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIcon
/**
* @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);
}
示例2: getDropDown
/**
* 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);
}
示例3: main
/**
* 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);
}
示例4: main
/**
* 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;
}
示例5: renderMenuEntry
/**
* 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;
}
示例6: getLocalizations
/**
* Gets all localizations of the current record.
*
* @param string $table The table
* @param array $parentRec The current record
* @param string $bgColClass Class for the background color of a column
* @param string $pad Pad reference
* @return string HTML table rows
*/
public function getLocalizations($table, $parentRec, $bgColClass, $pad)
{
$lines = array();
$tcaCtrl = $GLOBALS['TCA'][$table]['ctrl'];
if ($table != 'pages' && BackendUtility::isTableLocalizable($table) && !$tcaCtrl['transOrigPointerTable']) {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
$queryBuilder->getQueryContext()->setContext(QueryContextType::UNRESTRICTED);
$queryBuilder->select('*')->from($table)->where($queryBuilder->expr()->eq($tcaCtrl['transOrigPointerField'], (int) $parentRec['uid']))->andWhere($queryBuilder->expr()->neq($tcaCtrl['languageField'], 0));
if (isset($tcaCtrl['delete']) && $tcaCtrl['delete']) {
$queryBuilder->andWhere($queryBuilder->expr()->eq($tcaCtrl['delete'], 0));
}
if (isset($tcaCtrl['versioningWS']) && $tcaCtrl['versioningWS']) {
$queryBuilder->andWhere($queryBuilder->expr()->eq('t3ver_wsid', $parentRec['t3ver_wsid']));
}
$rows = $queryBuilder->execute()->fetchAll();
if (is_array($rows)) {
$modeData = '';
if ($pad == 'normal') {
$mode = $this->clipData['normal']['mode'] == 'copy' ? 'copy' : 'cut';
$modeData = ' <strong>(' . $this->clLabel($mode, 'cm') . ')</strong>';
}
foreach ($rows as $rec) {
$lines[] = '
<tr>
<td nowrap="nowrap" class="col-icon">' . $this->iconFactory->getIconForRecord($table, $rec, Icon::SIZE_SMALL)->render() . '</td>
<td nowrap="nowrap" width="95%">' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $rec), $this->getBackendUser()->uc['titleLen'])) . $modeData . '</td>
<td nowrap="nowrap" class="col-control"></td>
</tr>';
}
}
}
return implode('', $lines);
}
示例7: openInNewWindow
/**
* 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;
}
示例8: tt_content_drawColHeader
/**
* 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;
}
示例9: getLocalizations
/**
* Gets all localizations of the current record.
*
* @param string $table The table
* @param array $parentRec The current record
* @param string $bgColClass Class for the background color of a column
* @param string $pad Pad reference
* @return string HTML table rows
*/
public function getLocalizations($table, $parentRec, $bgColClass, $pad)
{
$lines = array();
$tcaCtrl = $GLOBALS['TCA'][$table]['ctrl'];
if ($table != 'pages' && BackendUtility::isTableLocalizable($table) && !$tcaCtrl['transOrigPointerTable']) {
$where = array();
$where[] = $tcaCtrl['transOrigPointerField'] . '=' . (int) $parentRec['uid'];
$where[] = $tcaCtrl['languageField'] . '<>0';
if (isset($tcaCtrl['delete']) && $tcaCtrl['delete']) {
$where[] = $tcaCtrl['delete'] . '=0';
}
if (isset($tcaCtrl['versioningWS']) && $tcaCtrl['versioningWS']) {
$where[] = 't3ver_wsid=' . $parentRec['t3ver_wsid'];
}
$rows = $this->getDatabaseConnection()->exec_SELECTgetRows('*', $table, implode(' AND ', $where));
if (is_array($rows)) {
$modeData = '';
if ($pad == 'normal') {
$mode = $this->clipData['normal']['mode'] == 'copy' ? 'copy' : 'cut';
$modeData = ' <strong>(' . $this->clLabel($mode, 'cm') . ')</strong>';
}
foreach ($rows as $rec) {
$lines[] = '
<tr>
<td nowrap="nowrap" class="col-icon">' . $this->iconFactory->getIconForRecord($table, $rec, Icon::SIZE_SMALL)->render() . '</td>
<td nowrap="nowrap" width="95%">' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $rec), $this->getBackendUser()->uc['titleLen'])) . $modeData . '</td>
<td nowrap="nowrap" class="col-control"></td>
</tr>';
}
}
}
return implode('', $lines);
}
示例10: getDropDown
/**
* 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);
}
示例11: renderList
/**
* Render the list of pages to show.
* This function is called recursively
*
* @param array $pageArray The Page Array
* @param array $lines Lines that have been processed up to this point
* @param int $pageDepth The level of the current $pageArray being processed
* @return array
*/
protected function renderList($pageArray, $lines = array(), $pageDepth = 0)
{
$cellStyle = 'padding-left: ' . $pageDepth * 20 . 'px';
if (!is_array($pageArray)) {
return $lines;
}
foreach ($pageArray as $identifier => $_) {
if (!MathUtility::canBeInterpretedAsInteger($identifier)) {
continue;
}
if (isset($pageArray[$identifier . '_'])) {
$lines[] = '
<tr>
<td nowrap style="' . $cellStyle . '">
<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('id' => $identifier))) . '" title="' . htmlspecialchars('ID: ' . $identifier) . '">' . $this->iconFactory->getIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $identifier), Icon::SIZE_SMALL)->render() . GeneralUtility::fixed_lgd_cs($pageArray[$identifier], 30) . '</a></td>
<td>' . ($pageArray[$identifier . '_']['includeLines'] === 0 ? '' : $pageArray[$identifier . '_']['includeLines']) . '</td>
<td>' . ($pageArray[$identifier . '_']['writtenLines'] === 0 ? '' : $pageArray[$identifier . '_']['writtenLines']) . '</td>
</tr>';
} else {
$lines[] = '<tr>
<td nowrap style="' . $cellStyle . '">' . $this->iconFactory->getIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $identifier), Icon::SIZE_SMALL)->render() . GeneralUtility::fixed_lgd_cs($pageArray[$identifier], 30) . '</td>
<td></td>
<td></td>
</tr>';
}
$lines = $this->renderList($pageArray[$identifier . '.'], $lines, $pageDepth + 1);
}
return $lines;
}
示例12: getList
/**
* Get the list of pages to show.
* This function is called recursively
*
* @param array $pageArray The Page Array
* @param array $lines Lines that have been processed up to this point
* @param int $pageDepth The level of the current $pageArray being processed
* @return array
*/
protected function getList($pageArray, $lines = array(), $pageDepth = 0)
{
if (!is_array($pageArray)) {
return $lines;
}
foreach ($pageArray as $identifier => $_) {
if (!MathUtility::canBeInterpretedAsInteger($identifier)) {
continue;
}
$line = array();
$line['padding'] = $pageDepth * 20;
if (isset($pageArray[$identifier . '_'])) {
$line['link'] = htmlspecialchars(GeneralUtility::linkThisScript(array('id' => $identifier)));
$line['icon'] = $this->iconFactory->getIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $identifier), Icon::SIZE_SMALL)->render();
$line['title'] = htmlspecialchars('ID: ' . $identifier);
$line['pageTitle'] = GeneralUtility::fixed_lgd_cs($pageArray[$identifier], 30);
$line['includedFiles'] = $pageArray[$identifier . '_']['includeLines'] === 0 ? '' : $pageArray[$identifier . '_']['includeLines'];
$line['lines'] = $pageArray[$identifier . '_']['writtenLines'] === 0 ? '' : $pageArray[$identifier . '_']['writtenLines'];
} else {
$line['link'] = '';
$line['icon'] = $this->iconFactory->getIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $identifier), Icon::SIZE_SMALL)->render();
$line['title'] = '';
$line['pageTitle'] = GeneralUtility::fixed_lgd_cs($pageArray[$identifier], 30);
$line['includedFiles'] = '';
$line['lines'] = '';
}
$lines[] = $line;
$lines = $this->getList($pageArray[$identifier . '.'], $lines, $pageDepth + 1);
}
return $lines;
}
示例13: viewSqlQuery
/**
* 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;
}
示例14: getNewsletterTabIcon
/**
* 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);
}
示例15: getFolderTree
/**
* Fetches the data for the tree
*
* @param \TYPO3\CMS\Core\Resource\Folder $folderObject the folderobject
* @param int $depth Max depth (recursivity limit)
* @param string $type HTML-code prefix for recursive calls.
* @return int The count of items on the level
* @see getBrowsableTree()
*/
public function getFolderTree(\TYPO3\CMS\Core\Resource\Folder $folderObject, $depth = 999, $type = '')
{
$depth = (int) $depth;
// This generates the directory tree
/* array of \TYPO3\CMS\Core\Resource\Folder */
if ($folderObject instanceof InaccessibleFolder) {
$subFolders = array();
} else {
$subFolders = $folderObject->getSubfolders();
$subFolders = \TYPO3\CMS\Core\Resource\Utility\ListUtility::resolveSpecialFolderNames($subFolders);
uksort($subFolders, 'strnatcasecmp');
}
$totalSubFolders = count($subFolders);
$HTML = '';
$subFolderCounter = 0;
$treeKey = '';
/** @var Folder $subFolder */
foreach ($subFolders as $subFolderName => $subFolder) {
$subFolderCounter++;
// Reserve space.
$this->tree[] = array();
// Get the key for this space
end($this->tree);
$isLocked = $subFolder instanceof InaccessibleFolder;
$treeKey = key($this->tree);
$specUID = GeneralUtility::md5int($subFolder->getCombinedIdentifier());
$this->specUIDmap[$specUID] = $subFolder->getCombinedIdentifier();
$row = array('uid' => $specUID, 'path' => $subFolder->getCombinedIdentifier(), 'title' => $subFolderName, 'folder' => $subFolder);
// Make a recursive call to the next level
if (!$isLocked && $depth > 1 && $this->expandNext($specUID)) {
$nextCount = $this->getFolderTree($subFolder, $depth - 1, $type);
// Set "did expand" flag
$isOpen = 1;
} else {
$nextCount = $isLocked ? 0 : $this->getNumberOfSubfolders($subFolder);
// Clear "did expand" flag
$isOpen = 0;
}
// Set HTML-icons, if any:
if ($this->makeHTML) {
$HTML = $this->PMicon($subFolder, $subFolderCounter, $totalSubFolders, $nextCount, $isOpen);
$type = '';
$role = $subFolder->getRole();
if ($role !== FolderInterface::ROLE_DEFAULT) {
$row['_title'] = '<strong>' . $subFolderName . '</strong>';
}
$icon = '<span title="' . htmlspecialchars($subFolderName) . '">' . $this->iconFactory->getIconForResource($subFolder, Icon::SIZE_SMALL, null, array('folder-open' => (bool) $isOpen)) . '</span>';
$HTML .= $this->wrapIcon($icon, $subFolder);
}
// Finally, add the row/HTML content to the ->tree array in the reserved key.
$this->tree[$treeKey] = array('row' => $row, 'HTML' => $HTML, 'hasSub' => $nextCount && $this->expandNext($specUID), 'isFirst' => $subFolderCounter == 1, 'isLast' => false, 'invertedDepth' => $depth, 'bank' => $this->bank);
}
if ($subFolderCounter > 0) {
$this->tree[$treeKey]['isLast'] = true;
}
return $totalSubFolders;
}