本文整理汇总了PHP中TYPO3\CMS\Backend\Template\ModuleTemplate::getIconFactory方法的典型用法代码示例。如果您正苦于以下问题:PHP ModuleTemplate::getIconFactory方法的具体用法?PHP ModuleTemplate::getIconFactory怎么用?PHP ModuleTemplate::getIconFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Backend\Template\ModuleTemplate
的用法示例。
在下文中一共展示了ModuleTemplate::getIconFactory方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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->moduleTemplate->getIconFactory()->getIcon('actions-window-open', Icon::SIZE_SMALL)->render() . '</a>';
return $content;
}
示例2: renderList
/**
* Render the list
*
* @param array $pArray
* @param array $lines
* @param int $c
* @return array
*/
public function renderList($pArray, $lines = array(), $c = 0)
{
if (!is_array($pArray)) {
return $lines;
}
$statusCheckedIcon = $this->moduleTemplate->getIconFactory()->getIcon('status-status-checked', Icon::SIZE_SMALL)->render();
foreach ($pArray as $k => $v) {
if (MathUtility::canBeInterpretedAsInteger($k)) {
if (isset($pArray[$k . '_'])) {
$lines[] = '<tr>
<td nowrap><span style="width: 1px; height: 1px; display:inline-block; margin-left: ' . $c * 20 . 'px"></span>' . '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('id' => $k))) . '" title="' . htmlspecialchars('ID: ' . $k) . '">' . $this->moduleTemplate->getIconFactory()->getIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $k), Icon::SIZE_SMALL)->render() . ' ' . GeneralUtility::fixed_lgd_cs($pArray[$k], 30) . '</a></td>
<td>' . $pArray[$k . '_']['count'] . '</td>
<td>' . ($pArray[$k . '_']['root_max_val'] > 0 ? $statusCheckedIcon : '') . '</td>
<td>' . ($pArray[$k . '_']['root_min_val'] == 0 ? $statusCheckedIcon : '') . '</td>
</tr>';
} else {
$lines[] = '<tr>
<td nowrap><span style="width: 1px; height: 1px; display:inline-block; margin-left: ' . $c * 20 . 'px"></span>' . $this->moduleTemplate->getIconFactory()->getIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $k), Icon::SIZE_SMALL)->render() . GeneralUtility::fixed_lgd_cs($pArray[$k], 30) . '</td>
<td></td>
<td></td>
<td></td>
</tr>';
}
$lines = $this->renderList($pArray[$k . '.'], $lines, $c + 1);
}
}
return $lines;
}
示例3: getButtons
/**
* Register docHeader buttons
*/
protected function getButtons()
{
/** @var ButtonBar $buttonBar */
$buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
/** @var IconFactory $iconFactory */
$iconFactory = $this->moduleTemplate->getIconFactory();
// Refresh
$refreshButton = $buttonBar->makeLinkButton()->setHref(GeneralUtility::getIndpEnv('REQUEST_URI'))->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.reload'))->setIcon($iconFactory->getIcon('actions-refresh', Icon::SIZE_SMALL));
$buttonBar->addButton($refreshButton, ButtonBar::BUTTON_POSITION_RIGHT);
// CSH
$cshButton = $buttonBar->makeHelpButton()->setModuleName('xMOD_csh_corebe')->setFieldName('filetree');
$buttonBar->addButton($cshButton);
}
示例4: addToolbarButtons
/**
* Creates the toolbar buttons (TYPO3 7.6+).
*
* @return void
*/
protected function addToolbarButtons()
{
// Render SAVE type buttons:
// The action of each button is decided by its name attribute. (See doProcessData())
$buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
$saveSplitButton = $buttonBar->makeSplitButton();
// SAVE button:
$saveButton = $buttonBar->makeInputButton()->setTitle($this->languageService->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', true))->setName('_savedok')->setValue('1')->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-save', \TYPO3\CMS\Core\Imaging\Icon::SIZE_SMALL));
$saveSplitButton->addItem($saveButton, true);
// SAVE & CLOSE button:
$saveAndCloseButton = $buttonBar->makeInputButton()->setName('_saveandclosedok')->setClasses('t3js-editform-submitButton')->setValue('1')->setTitle($this->languageService->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', true))->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-save-close', \TYPO3\CMS\Core\Imaging\Icon::SIZE_SMALL));
$saveSplitButton->addItem($saveAndCloseButton);
$buttonBar->addButton($saveSplitButton, \TYPO3\CMS\Backend\Template\Components\ButtonBar::BUTTON_POSITION_LEFT, 2);
// CLOSE button:
$closeButton = $buttonBar->makeLinkButton()->setHref('#')->setClasses('t3js-editform-close')->setTitle($this->languageService->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', true))->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-view-go-back', \TYPO3\CMS\Core\Imaging\Icon::SIZE_SMALL));
$buttonBar->addButton($closeButton);
$shortcutButton = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar()->makeShortcutButton();
$shortcutButton->setModuleName($this->MCONF['name'])->setGetVariables(['returnUrl', 'edit', 'defVals', 'overrideVals', 'columnsOnly', 'returnNewPageId', 'editRegularContentFromId', 'noView']);
$this->moduleTemplate->getDocHeaderComponent()->getButtonBar()->addButton($shortcutButton);
}
示例5: getButtons
/**
* Create the panel of buttons for submitting the form or otherwise perform operations.
*/
protected function getButtons()
{
$buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
// CSH
$helpButton = $buttonBar->makeHelpButton()->setModuleName('_MOD_' . $this->moduleName)->setFieldName('');
$buttonBar->addButton($helpButton);
// Add and Reload
if (empty($this->CMD) || $this->CMD === 'list' || $this->CMD === 'delete' || $this->CMD === 'stop' || $this->CMD === 'toggleHidden') {
$reloadButton = $buttonBar->makeLinkButton()->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.reload'))->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-refresh', Icon::SIZE_SMALL))->setHref($this->moduleUri);
$buttonBar->addButton($reloadButton, ButtonBar::BUTTON_POSITION_RIGHT, 1);
if ($this->MOD_SETTINGS['function'] === 'scheduler' && !empty($this->getRegisteredClasses())) {
$addButton = $buttonBar->makeLinkButton()->setTitle($this->getLanguageService()->getLL('action.add'))->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-new', Icon::SIZE_SMALL))->setHref($this->moduleUri . '&CMD=add');
$buttonBar->addButton($addButton, ButtonBar::BUTTON_POSITION_LEFT, 2);
}
}
// Close and Save
if ($this->CMD === 'add' || $this->CMD === 'edit') {
// Close
$closeButton = $buttonBar->makeLinkButton()->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:cancel'))->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-close', Icon::SIZE_SMALL))->setOnClick('document.location=' . GeneralUtility::quoteJSvalue($this->moduleUri))->setHref('#');
$buttonBar->addButton($closeButton, ButtonBar::BUTTON_POSITION_LEFT, 2);
// Save, SaveAndClose, SaveAndNew
$saveButtonDropdown = $buttonBar->makeSplitButton();
$saveButton = $buttonBar->makeInputButton()->setName('CMD')->setValue('save')->setForm('tx_scheduler_form')->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-save', Icon::SIZE_SMALL))->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:save'));
$saveButtonDropdown->addItem($saveButton);
$saveAndNewButton = $buttonBar->makeInputButton()->setName('CMD')->setValue('savenew')->setForm('tx_scheduler_form')->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-save-new', Icon::SIZE_SMALL))->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:saveAndCreateNewDoc'));
$saveButtonDropdown->addItem($saveAndNewButton);
$saveAndCloseButton = $buttonBar->makeInputButton()->setName('CMD')->setValue('saveclose')->setForm('tx_scheduler_form')->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-save-close', Icon::SIZE_SMALL))->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:saveAndClose'));
$saveButtonDropdown->addItem($saveAndCloseButton);
$buttonBar->addButton($saveButtonDropdown, ButtonBar::BUTTON_POSITION_LEFT, 3);
}
// Edit
if ($this->CMD === 'edit') {
$deleteButton = $buttonBar->makeInputButton()->setName('CMD')->setValue('delete')->setForm('tx_scheduler_form')->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-edit-delete', Icon::SIZE_SMALL))->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:delete'));
$buttonBar->addButton($deleteButton, ButtonBar::BUTTON_POSITION_LEFT, 4);
}
// Shortcut
$shortcutButton = $buttonBar->makeShortcutButton()->setModuleName($this->moduleName)->setDisplayName($this->MOD_MENU['function'][$this->MOD_SETTINGS['function']])->setSetVariables(['function']);
$buttonBar->addButton($shortcutButton);
}
示例6: adminLinks
/**
* 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, $row)
{
// Edit link:
$editUrl = BackendUtility::getModuleUrl('record_edit', ['edit' => [$table => [$row['uid'] => 'edit']], 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]);
$adminLink = '<a class="btn btn-default" href="' . htmlspecialchars($editUrl) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.edit', true) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>';
// Delete link:
$adminLink .= '<a class="btn btn-default" href="' . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction('&cmd[' . $table . '][' . $row['uid'] . '][delete]=1')) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete', true) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</a>';
if ($table === 'pages') {
// If another page module was specified, replace the default Page module with the new one
$newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
$pageModule = BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
// Perform some access checks:
$a_wl = $GLOBALS['BE_USER']->check('modules', 'web_list');
$a_wp = $GLOBALS['BE_USER']->check('modules', $pageModule);
$adminLink .= '<a class="btn btn-default" href="#" onclick="top.loadEditId(' . $row['uid'] . ');top.goToModule(' . GeneralUtility::quoteJSvalue($pageModule) . '); return false;">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-page-open', Icon::SIZE_SMALL)->render() . '</a>';
$adminLink .= '<a class="btn btn-default" href="#" onclick="top.loadEditId(' . $row['uid'] . ');top.goToModule(\'web_list\'); return false;">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-system-list-open', Icon::SIZE_SMALL)->render() . '</a>';
// "View page" icon is added:
$adminLink .= '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($row['uid'], '', BackendUtility::BEgetRootLine($row['uid']))) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-view', Icon::SIZE_SMALL)->render() . '</a>';
} else {
if ($row['pid'] == -1) {
$getVars = '&ADMCMD_vPrev[' . rawurlencode($table . ':' . $row['t3ver_oid']) . ']=' . $row['uid'];
// "View page" icon is added:
$adminLink .= '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($row['_REAL_PID'], '', BackendUtility::BEgetRootLine($row['_REAL_PID']), '', '', $getVars)) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-view', Icon::SIZE_SMALL)->render() . '</a>';
}
}
return '<div class="btn-group btn-group-sm" role="group">' . $adminLink . '</div>';
}
示例7: init
/**
* Initializing the module
*
* @return void
*/
public function init()
{
$this->moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class);
$this->iconFactory = $this->moduleTemplate->getIconFactory();
$this->buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
$this->getLanguageService()->includeLLFile('EXT:backend/Resources/Private/Language/locallang_layout.xlf');
// Setting module configuration / page select clause
$this->MCONF['name'] = $this->moduleName;
$this->perms_clause = $this->getBackendUser()->getPagePermsClause(1);
// Get session data
$sessionData = $this->getBackendUser()->getSessionData(RecordList::class);
$this->search_field = !empty($sessionData['search_field']) ? $sessionData['search_field'] : '';
// GPvars:
$this->id = (int) GeneralUtility::_GP('id');
$this->pointer = GeneralUtility::_GP('pointer');
$this->imagemode = GeneralUtility::_GP('imagemode');
$this->clear_cache = GeneralUtility::_GP('clear_cache');
$this->popView = GeneralUtility::_GP('popView');
$this->edit_record = GeneralUtility::_GP('edit_record');
$this->new_unique_uid = GeneralUtility::_GP('new_unique_uid');
$this->search_field = GeneralUtility::_GP('search_field');
$this->search_levels = GeneralUtility::_GP('search_levels');
$this->showLimit = GeneralUtility::_GP('showLimit');
$this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
$this->externalTables = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables'];
$sessionData['search_field'] = $this->search_field;
// Store session data
$this->getBackendUser()->setAndSaveSessionData(RecordList::class, $sessionData);
// Load page info array:
$this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
// Initialize menu
$this->menuConfig();
// Setting sys language from session var:
$this->current_sys_language = (int) $this->MOD_SETTINGS['language'];
// CSH / Descriptions:
$this->descrTable = '_MOD_' . $this->moduleName;
}
示例8: getButtons
/**
* Create the panel of buttons for submitting the form or otherwise perform operations.
*
* @return array all available buttons as an associated array
*/
protected function getButtons()
{
$buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
if ($this->getBackendUser()->mayMakeShortcut()) {
$shortcutButton = $buttonBar->makeShortcutButton()->setGetVariables(['tx_impexp'])->setDisplayName($this->shortcutName)->setModuleName($this->moduleName);
$buttonBar->addButton($shortcutButton);
}
// back button
if ($this->returnUrl) {
$backButton = $buttonBar->makeLinkButton()->setHref($this->returnUrl)->setTitle($this->lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack'))->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-view-go-back', Icon::SIZE_SMALL));
$buttonBar->addButton($backButton);
}
// Input data grabbed:
$inData = GeneralUtility::_GP('tx_impexp');
if ((string) $inData['action'] == 'import') {
if ($this->id && is_array($this->pageinfo) || $this->getBackendUser()->user['admin'] && !$this->id) {
if (is_array($this->pageinfo) && $this->pageinfo['uid']) {
// View
$onClick = BackendUtility::viewOnClick($this->pageinfo['uid'], '', BackendUtility::BEgetRootLine($this->pageinfo['uid']));
$viewButton = $buttonBar->makeLinkButton()->setTitle($this->lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage'))->setHref('#')->setIcon($this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL))->setOnClick($onClick);
$buttonBar->addButton($viewButton);
}
}
}
}
示例9: renderListMenu
/**
* Render a list of items as a nicely formated definition list including a
* link, icon, title and description.
* The keys of a single item are:
* - title: Title of the item
* - link: Link to the task
* - icon: Path to the icon or Icon as HTML if it begins with <img
* - description: Description of the task, using htmlspecialchars()
* - descriptionHtml: Description allowing HTML tags which will override the
* description
*
* @param array $items List of items to be displayed in the definition list.
* @param bool $mainMenu Set it to TRUE to render the main menu
* @return string Fefinition list
*/
public function renderListMenu($items, $mainMenu = false)
{
$content = $section = '';
$count = 0;
// Change the sorting of items to the user's one
if ($mainMenu) {
$this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Taskcenter/Taskcenter');
$userSorting = unserialize($this->getBackendUser()->uc['taskcenter']['sorting']);
if (is_array($userSorting)) {
$newSorting = array();
foreach ($userSorting as $item) {
if (isset($items[$item])) {
$newSorting[] = $items[$item];
unset($items[$item]);
}
}
$items = $newSorting + $items;
}
}
if (is_array($items) && !empty($items)) {
foreach ($items as $itemKey => $item) {
$title = htmlspecialchars($item['title']);
$icon = $additionalClass = $collapsedStyle = '';
// Check for custom icon
if (!empty($item['icon'])) {
if (strpos($item['icon'], '<img ') === false) {
$absIconPath = GeneralUtility::getFileAbsFileName($item['icon']);
// If the file indeed exists, assemble relative path to it
if (file_exists($absIconPath)) {
$icon = '../' . str_replace(PATH_site, '', $absIconPath);
$icon = '<img src="' . $icon . '" title="' . $title . '" alt="' . $title . '" />';
}
if (@is_file($icon)) {
$icon = '<img src="' . PathUtility::getAbsoluteWebPath($icon) . '" width="16" height="16" title="' . $title . '" alt="' . $title . '" />';
}
} else {
$icon = $item['icon'];
}
}
$description = $item['descriptionHtml'] ?: '<p>' . nl2br(htmlspecialchars($item['description'])) . '</p>';
$id = $this->getUniqueKey($item['uid']);
$contentId = strtolower(str_replace('\\', '-', $id));
// Collapsed & expanded menu items
if (isset($this->getBackendUser()->uc['taskcenter']['states'][$id]) && $this->getBackendUser()->uc['taskcenter']['states'][$id]) {
$collapsed = true;
$collapseIcon = $this->moduleTemplate->getIconFactory()->getIcon('actions-view-list-expand', Icon::SIZE_SMALL)->render('inline');
} else {
$collapsed = false;
$collapseIcon = $this->moduleTemplate->getIconFactory()->getIcon('actions-view-list-collapse', Icon::SIZE_SMALL)->render('inline');
}
// Active menu item
$panelState = (string) $this->MOD_SETTINGS['function'] == $item['uid'] ? 'panel-active' : 'panel-default';
$content .= '<li id="el_' . $id . '">
<div id="' . $contentId . '" data-taskcenter-id="' . $id . '" class="panel ' . $panelState . '">
<div class="panel-heading">
<div class="panel-heading-right">
<a href="#task_content_' . $contentId . '" class="panel-header-collapse t3js-taskcenter-header-collapse" role="button" data-toggle="collapse" data-uid="' . $contentId . '" aria-expanded="' . ($collapsed ? 'false' : 'true') . '">
' . $collapseIcon . '
</a>
</div>
<div class="panel-heading-left">
<a href="' . $item['link'] . '" class="panel-title">
' . ($icon ? '<span class="panel-title-icon">' . $icon . '</span>' : '') . '
<span class="panel-title-name">' . $title . ' ' . $this->moduleTemplate->getIconFactory()->getIcon('actions-view-table-expand', Icon::SIZE_SMALL)->render('inline') . '</span>
</a>
</div>
</div>
<div id="task_content_' . $contentId . '" class="panel-collapse collapse t3js-taskcenter-collapse ' . ($collapsed ? '' : 'in') . '" aria-expanded="true">
<div class="panel-body">
' . $description . '
</div>
</div>
</div>
</li>';
$count++;
}
$navigationId = $mainMenu ? 'id="task-list"' : '';
$content = '<ul ' . $navigationId . ' class="list-unstyled">' . $content . '</ul>';
}
return $content;
}