本文整理匯總了PHP中TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses方法的典型用法代碼示例。如果您正苦於以下問題:PHP IconUtility::getSpriteIconClasses方法的具體用法?PHP IconUtility::getSpriteIconClasses怎麽用?PHP IconUtility::getSpriteIconClasses使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TYPO3\CMS\Backend\Utility\IconUtility
的用法示例。
在下文中一共展示了IconUtility::getSpriteIconClasses方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: renderStatic
/**
* 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>';
}
示例2: initializeAction
/**
* Initializes the controller before invoking an action method.
*
* @return void
*/
protected function initializeAction()
{
// @todo Evaluate how the intval() call can be used with Extbase validators/filters
$this->pageId = (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id');
$icons = array('language' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses('flags-multiple'), 'integrity' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses('status-dialog-information'), 'success' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses('status-dialog-ok'), 'info' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses('status-dialog-information'), 'warning' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses('status-dialog-warning'), 'error' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses('status-dialog-error'));
$this->pageRenderer->addInlineSetting('Workspaces', 'icons', $icons);
$this->pageRenderer->addInlineSetting('Workspaces', 'id', $this->pageId);
$this->pageRenderer->addInlineSetting('Workspaces', 'depth', $this->pageId === 0 ? 999 : 1);
$this->pageRenderer->addInlineSetting('Workspaces', 'language', $this->getLanguageSelection());
$this->pageRenderer->addCssFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('workspaces') . 'Resources/Public/StyleSheet/module.css');
$this->pageRenderer->addInlineLanguageLabelArray(array('title' => $GLOBALS['LANG']->getLL('title'), 'path' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.path'), 'table' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.table'), 'depth' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_perm.xlf:Depth'), 'depth_0' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_0'), 'depth_1' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_1'), 'depth_2' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_2'), 'depth_3' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_3'), 'depth_4' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_4'), 'depth_infi' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_infi')));
$this->pageRenderer->addInlineLanguageLabelFile('EXT:workspaces/Resources/Private/Language/locallang.xlf');
$this->assignExtensionSettings();
}
示例3: getNextContextMenuLevel
/**
* Returns the next context menu level
*
* @param array $actions
* @param \TYPO3\CMS\Backend\Tree\TreeNode $node
* @param integer $level
* @return \TYPO3\CMS\Backend\ContextMenu\ContextMenuActionCollection
*/
protected function getNextContextMenuLevel(array $actions, \TYPO3\CMS\Backend\Tree\TreeNode $node, $level = 0)
{
/** @var $actionCollection \TYPO3\CMS\Backend\ContextMenu\ContextMenuActionCollection */
$actionCollection = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\ContextMenu\\ContextMenuActionCollection');
if ($level > 5) {
return $actionCollection;
}
$type = '';
foreach ($actions as $index => $actionConfiguration) {
if (substr($index, -1) !== '.') {
$type = $actionConfiguration;
if ($type !== 'DIVIDER') {
continue;
}
}
if (!in_array($type, array('DIVIDER', 'SUBMENU', 'ITEM'))) {
continue;
}
/** @var $action \TYPO3\CMS\Backend\ContextMenu\ContextMenuAction */
$action = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\ContextMenu\\ContextMenuAction');
$action->setId($index);
if ($type === 'DIVIDER') {
$action->setType('divider');
} else {
if (in_array($actionConfiguration['name'], $this->disableItems) || isset($actionConfiguration['displayCondition']) && trim($actionConfiguration['displayCondition']) !== '' && !$this->evaluateDisplayCondition($node, $actionConfiguration['displayCondition'])) {
unset($action);
continue;
}
$label = $GLOBALS['LANG']->sL($actionConfiguration['label'], TRUE);
if ($type === 'SUBMENU') {
$action->setType('submenu');
$action->setChildActions($this->getNextContextMenuLevel($actionConfiguration, $node, $level + 1));
} else {
$action->setType('action');
$action->setCallbackAction($actionConfiguration['callbackAction']);
if (is_array($actionConfiguration['customAttributes.'])) {
$action->setCustomAttributes($actionConfiguration['customAttributes.']);
}
}
$action->setLabel($label);
if (isset($actionConfiguration['icon']) && trim($actionConfiguration['icon']) !== '') {
$action->setIcon($actionConfiguration['icon']);
} elseif (isset($actionConfiguration['spriteIcon'])) {
$action->setClass(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses($actionConfiguration['spriteIcon']));
}
}
$actionCollection->offsetSet($level . intval($index), $action);
$actionCollection->ksort();
}
return $actionCollection;
}
示例4: init
/**
* Constructor function for script class.
*
* @return void
* @todo Define visibility
*/
public function init()
{
// Setting GPvars:
$this->backPath = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('backPath');
$this->item = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('item');
$this->reloadListFrame = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('reloadListFrame');
// Setting pseudo module name
$this->MCONF['name'] = 'xMOD_alt_clickmenu.php';
// Takes the backPath as a parameter BUT since we are worried about someone forging a backPath (XSS security hole) we will check with sent md5 hash:
$inputBP = explode('|', $this->backPath);
if (count($inputBP) == 2 && $inputBP[1] == \TYPO3\CMS\Core\Utility\GeneralUtility::shortMD5($inputBP[0] . '|' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
$this->backPath = $inputBP[0];
} else {
$this->backPath = $GLOBALS['BACK_PATH'];
}
// Setting internal array of classes for extending the clickmenu:
$this->extClassArray = $GLOBALS['TBE_MODULES_EXT']['xMOD_alt_clickmenu']['extendCMclasses'];
// Traversing that array and setting files for inclusion:
if (is_array($this->extClassArray)) {
foreach ($this->extClassArray as $extClassConf) {
if ($extClassConf['path']) {
$this->include_once[] = $extClassConf['path'];
}
}
}
// Initialize template object
if (!$this->ajax) {
$this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
$this->doc->backPath = $GLOBALS['BACK_PATH'];
}
// Setting mode for display and background image in the top frame
$this->dontDisplayTopFrameCM = $this->doc->isCMlayers() && !$GLOBALS['BE_USER']->getTSConfigVal('options.contextMenu.options.alwaysShowClickMenuInTopFrame');
if ($this->dontDisplayTopFrameCM) {
$this->doc->bodyTagId .= '-notop';
}
// Setting clickmenu timeout
$secs = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($GLOBALS['BE_USER']->getTSConfigVal('options.contextMenu.options.clickMenuTimeOut'), 1, 100, 5);
// default is 5
// Setting the JavaScript controlling the timer on the page
$listFrameDoc = $this->reloadListFrame != 2 ? 'top.content.list_frame' : 'top.content';
$this->doc->JScode .= $this->doc->wrapScriptTags('
var date = new Date();
var mo_timeout = Math.floor(date.getTime()/1000);
roImg = "' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses('status-status-current') . '";
routImg = "t3-icon-empty";
function mo(c) { //
var name="roimg_"+c;
document.getElementById(name).className = roImg;
updateTime();
}
function mout(c) { //
var name="roimg_"+c;
document[name].src = routImg;
updateTime();
}
function updateTime() { //
date = new Date();
mo_timeout = Math.floor(date.getTime()/1000);
}
function timeout_func() { //
date = new Date();
if (Math.floor(date.getTime()/1000)-mo_timeout > ' . $secs . ') {
hideCM();
return false;
} else {
window.setTimeout("timeout_func();",1*1000);
}
}
function hideCM() { //
window.location.href="alt_topmenu_dummy.php";
return false;
}
// Start timer
timeout_func();
' . ($this->reloadListFrame ? '
// Reload list frame:
if(' . $listFrameDoc . '){' . $listFrameDoc . '.location.href=' . $listFrameDoc . '.location.href;}' : '') . '
');
}
示例5: generateDataArray
/**
* Generates grid list array from given versions.
*
* @param array $versions All available version records
* @param string $filterTxt Text to be used to filter record result
* @return void
*/
protected function generateDataArray(array $versions, $filterTxt)
{
$workspaceAccess = $GLOBALS['BE_USER']->checkWorkspace($GLOBALS['BE_USER']->workspace);
$swapStage = $workspaceAccess['publish_access'] & 1 ? \TYPO3\CMS\Workspaces\Service\StagesService::STAGE_PUBLISH_ID : 0;
$swapAccess = $GLOBALS['BE_USER']->workspacePublishAccess($GLOBALS['BE_USER']->workspace) && $GLOBALS['BE_USER']->workspaceSwapAccess();
$this->initializeWorkspacesCachingFramework();
// check for dataArray in cache
if ($this->getDataArrayFromCache($versions, $filterTxt) === FALSE) {
/** @var $stagesObj \TYPO3\CMS\Workspaces\Service\StagesService */
$stagesObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Workspaces\\Service\\StagesService');
$defaultGridColumns = array(self::GridColumn_Collection => 0, self::GridColumn_CollectionLevel => 0, self::GridColumn_CollectionParent => '', self::GridColumn_CollectionCurrent => '', self::GridColumn_CollectionChildren => 0);
foreach ($versions as $table => $records) {
$hiddenField = $this->getTcaEnableColumnsFieldName($table, 'disabled');
$isRecordTypeAllowedToModify = $GLOBALS['BE_USER']->check('tables_modify', $table);
foreach ($records as $record) {
$origRecord = BackendUtility::getRecord($table, $record['t3ver_oid']);
$versionRecord = BackendUtility::getRecord($table, $record['uid']);
$combinedRecord = \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord::createFromArrays($table, $origRecord, $versionRecord);
$this->getIntegrityService()->checkElement($combinedRecord);
if ($hiddenField !== NULL) {
$recordState = $this->workspaceState($versionRecord['t3ver_state'], $origRecord[$hiddenField], $versionRecord[$hiddenField]);
} else {
$recordState = $this->workspaceState($versionRecord['t3ver_state']);
}
$isDeletedPage = $table == 'pages' && $recordState == 'deleted';
$viewUrl = \TYPO3\CMS\Workspaces\Service\WorkspaceService::viewSingleRecord($table, $record['uid'], $origRecord, $versionRecord);
$versionArray = array();
$versionArray['table'] = $table;
$versionArray['id'] = $table . ':' . $record['uid'];
$versionArray['uid'] = $record['uid'];
$versionArray['workspace'] = $versionRecord['t3ver_id'];
$versionArray = array_merge($versionArray, $defaultGridColumns);
$versionArray['label_Workspace'] = htmlspecialchars(BackendUtility::getRecordTitle($table, $versionRecord));
$versionArray['label_Live'] = htmlspecialchars(BackendUtility::getRecordTitle($table, $origRecord));
$versionArray['label_Stage'] = htmlspecialchars($stagesObj->getStageTitle($versionRecord['t3ver_stage']));
$tempStage = $stagesObj->getNextStage($versionRecord['t3ver_stage']);
$versionArray['label_nextStage'] = htmlspecialchars($stagesObj->getStageTitle($tempStage['uid']));
$tempStage = $stagesObj->getPrevStage($versionRecord['t3ver_stage']);
$versionArray['label_prevStage'] = htmlspecialchars($stagesObj->getStageTitle($tempStage['uid']));
$versionArray['path_Live'] = htmlspecialchars(BackendUtility::getRecordPath($record['livepid'], '', 999));
$versionArray['path_Workspace'] = htmlspecialchars(BackendUtility::getRecordPath($record['wspid'], '', 999));
$versionArray['workspace_Title'] = htmlspecialchars(\TYPO3\CMS\Workspaces\Service\WorkspaceService::getWorkspaceTitle($versionRecord['t3ver_wsid']));
$versionArray['workspace_Tstamp'] = $versionRecord['tstamp'];
$versionArray['workspace_Formated_Tstamp'] = BackendUtility::datetime($versionRecord['tstamp']);
$versionArray['t3ver_wsid'] = $versionRecord['t3ver_wsid'];
$versionArray['t3ver_oid'] = $record['t3ver_oid'];
$versionArray['livepid'] = $record['livepid'];
$versionArray['stage'] = $versionRecord['t3ver_stage'];
$versionArray['icon_Live'] = \TYPO3\CMS\Backend\Utility\IconUtility::mapRecordTypeToSpriteIconClass($table, $origRecord);
$versionArray['icon_Workspace'] = \TYPO3\CMS\Backend\Utility\IconUtility::mapRecordTypeToSpriteIconClass($table, $versionRecord);
$languageValue = $this->getLanguageValue($table, $versionRecord);
$versionArray['languageValue'] = $languageValue;
$versionArray['language'] = array('cls' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses($this->getSystemLanguageValue($languageValue, 'flagIcon')), 'title' => htmlspecialchars($this->getSystemLanguageValue($languageValue, 'title')));
$versionArray['allowedAction_nextStage'] = $isRecordTypeAllowedToModify && $stagesObj->isNextStageAllowedForUser($versionRecord['t3ver_stage']);
$versionArray['allowedAction_prevStage'] = $isRecordTypeAllowedToModify && $stagesObj->isPrevStageAllowedForUser($versionRecord['t3ver_stage']);
if ($swapAccess && $swapStage != 0 && $versionRecord['t3ver_stage'] == $swapStage) {
$versionArray['allowedAction_swap'] = $isRecordTypeAllowedToModify && $stagesObj->isNextStageAllowedForUser($swapStage);
} elseif ($swapAccess && $swapStage == 0) {
$versionArray['allowedAction_swap'] = $isRecordTypeAllowedToModify;
} else {
$versionArray['allowedAction_swap'] = FALSE;
}
$versionArray['allowedAction_delete'] = $isRecordTypeAllowedToModify;
// preview and editing of a deleted page won't work ;)
$versionArray['allowedAction_view'] = !$isDeletedPage && $viewUrl;
$versionArray['allowedAction_edit'] = $isRecordTypeAllowedToModify && !$isDeletedPage;
$versionArray['allowedAction_editVersionedPage'] = $isRecordTypeAllowedToModify && !$isDeletedPage;
$versionArray['state_Workspace'] = $recordState;
$versionArray = array_merge($versionArray, $this->getAdditionalColumnService()->getData($combinedRecord));
if ($filterTxt == '' || $this->isFilterTextInVisibleColumns($filterTxt, $versionArray)) {
$versionIdentifier = $versionArray['id'];
$this->dataArray[$versionIdentifier] = $versionArray;
}
}
}
// Suggested slot method:
// methodName(\TYPO3\CMS\Workspaces\Service\GridDataService $gridData, array &$dataArray, array $versions)
$this->emitSignal(self::SIGNAL_GenerateDataArray_BeforeCaching, $this->dataArray, $versions);
// Enrich elements after everything has been processed:
foreach ($this->dataArray as &$element) {
$identifier = $element['table'] . ':' . $element['t3ver_oid'];
$element['integrity'] = array('status' => $this->getIntegrityService()->getStatusRepresentation($identifier), 'messages' => htmlspecialchars($this->getIntegrityService()->getIssueMessages($identifier, TRUE)));
}
$this->setDataArrayIntoCache($versions, $filterTxt);
}
// Suggested slot method:
// methodName(\TYPO3\CMS\Workspaces\Service\GridDataService $gridData, array &$dataArray, array $versions)
$this->emitSignal(self::SIGNAL_GenerateDataArray_PostProcesss, $this->dataArray, $versions);
$this->sortDataArray();
$this->resolveDataArrayDependencies();
}
示例6: addJS
//.........這裏部分代碼省略.........
* @return void
*/
protected function addJS($parameters, &$pageRenderer)
{
$formprotection = FormProtectionFactory::get();
if (count($parameters['jsFiles'])) {
if (method_exists($GLOBALS['SOBE']->doc, 'issueCommand')) {
/** @var \TYPO3\CMS\Backend\Clipboard\Clipboard $clipObj */
$clipObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Clipboard\\Clipboard');
// Start clipboard
$clipObj->initializeClipboard();
$clipBoardHasContent = FALSE;
if (isset($clipObj->clipData['normal']['el']) && strpos(key($clipObj->clipData['normal']['el']), 'tt_content') !== FALSE) {
$pasteURL = str_replace('&', '&', $clipObj->pasteUrl('tt_content', 'DD_PASTE_UID', 0));
if (isset($clipObj->clipData['normal']['mode'])) {
$clipBoardHasContent = 'copy';
} else {
$clipBoardHasContent = 'move';
}
}
$moveParams = '&cmd[tt_content][DD_DRAG_UID][move]=DD_DROP_UID';
$moveURL = str_replace('&', '&', htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($moveParams, 1)));
$copyParams = '&cmd[tt_content][DD_DRAG_UID][copy]=DD_DROP_UID&DDcopy=1';
$copyURL = str_replace('&', '&', htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($copyParams, 1)));
// add JavaScript library
$pageRenderer->addJsFile($GLOBALS['BACK_PATH'] . ExtensionManagementUtility::extRelPath('gridelements') . 'Resources/Public/Backend/JavaScript/dbNewContentElWizardFixDTM.js', $type = 'text/javascript', $compress = TRUE, $forceOnTop = FALSE, $allWrap = '');
// add JavaScript library
$pageRenderer->addJsFile($GLOBALS['BACK_PATH'] . ExtensionManagementUtility::extRelPath('gridelements') . 'Resources/Public/Backend/JavaScript/GridElementsDD.js', $type = 'text/javascript', $compress = TRUE, $forceOnTop = FALSE, $allWrap = '');
// add JavaScript library
$pageRenderer->addJsFile($GLOBALS['BACK_PATH'] . ExtensionManagementUtility::extRelPath('gridelements') . 'Resources/Public/Backend/JavaScript/GridElementsListView.js', $type = 'text/javascript', $compress = TRUE, $forceOnTop = FALSE, $allWrap = '');
if (!$pageRenderer->getCharSet()) {
$pageRenderer->setCharSet($GLOBALS['LANG']->charSet ? $GLOBALS['LANG']->charSet : 'utf-8');
}
if (is_array($clipObj->clipData['normal']['el'])) {
$arrCBKeys = array_keys($clipObj->clipData['normal']['el']);
$intFirstCBEl = str_replace('tt_content|', '', $arrCBKeys[0]);
}
// pull locallang_db.xml to JS side - only the tx_gridelements_js-prefixed keys
$pageRenderer->addInlineLanguageLabelFile('EXT:gridelements/Resources/Private/Language/locallang_db.xml', 'tx_gridelements_js');
$pRaddExtOnReadyCode = '
TYPO3.l10n = {
localize: function(langKey){
return TYPO3.lang[langKey];
}
}
';
$allowedCTypesAndGridTypesClassesByColPos = array();
$layoutSetup = GeneralUtility::callUserFunction('TYPO3\\CMS\\Backend\\View\\BackendLayoutView->getSelectedBackendLayout', intval(GeneralUtility::_GP('id')), $this);
if (is_array($layoutSetup) && !empty($layoutSetup['__config']['backend_layout.']['rows.'])) {
foreach ($layoutSetup['__config']['backend_layout.']['rows.'] as $rows) {
foreach ($rows as $row) {
if (!empty($layoutSetup['__config']['backend_layout.']['rows.'])) {
foreach ($row as $col) {
$classes = '';
if ($col['allowed']) {
$allowed = explode(',', $col['allowed']);
foreach ($allowed as $ctypes) {
$ctypes = trim($ctypes);
if ($ctypes === '*') {
$classes = 't3-allow-all';
break;
} else {
$ctypes = explode(',', $ctypes);
foreach ($ctypes as $ctype) {
$classes .= 't3-allow-' . $ctype . ' ';
}
}
}
} else {
$classes = 't3-allow-all';
}
if ($col['allowedGridTypes']) {
$allowedGridTypes = explode(',', $col['allowedGridTypes']);
$classes .= 't3-allow-gridelements_pi1 ';
foreach ($allowedGridTypes as $gridTypes) {
$gridTypes = trim($gridTypes);
if ($gridTypes !== '*') {
$gridTypes = explode(',', $gridTypes);
foreach ($gridTypes as $gridType) {
$classes .= 't3-allow-gridtype-' . $gridType . ' ';
}
}
}
} else {
if ($classes !== 't3-allow-all') {
$classes .= 't3-allow-gridelements_pi1 ';
}
}
$allowedCTypesAndGridTypesClassesByColPos[] = $col['colPos'] . ':' . trim($classes);
}
}
}
}
}
// add Ext.onReady() code from file
$modTSconfig = BackendUtility::getModTSconfig((int) GeneralUtility::_GP('id'), 'mod.web_layout');
$pageRenderer->addExtOnReadyCode($pRaddExtOnReadyCode . "\n\t\t\t\t\t\ttop.pageColumnsAllowedCTypes = '" . join('|', $allowedCTypesAndGridTypesClassesByColPos) . "';\n\t\t\t\t\t\ttop.pasteURL = '" . $pasteURL . "';\n\t\t\t\t\t\ttop.moveURL = '" . $moveURL . "';\n\t\t\t\t\t\ttop.copyURL = '" . $copyURL . "';\n\t\t\t\t\t\ttop.pasteTpl = '" . str_replace('&redirect=1', '', str_replace('DDcopy=1', 'DDcopy=1&reference=DD_REFYN', $copyURL)) . "';\n\t\t\t\t\t\ttop.DDtceActionToken = '" . $formprotection->generateToken('tceAction') . "';\n\t\t\t\t\t\ttop.DDtoken = '" . $formprotection->generateToken('editRecord') . "';\n\t\t\t\t\t\ttop.DDpid = '" . (int) GeneralUtility::_GP('id') . "';\n\t\t\t\t\t\ttop.DDclipboardfilled = '" . ($clipBoardHasContent ? $clipBoardHasContent : 'false') . "';\n\t\t\t\t\t\ttop.pasteReferenceAllowed = '" . ($GLOBALS['BE_USER']->checkAuthMode('tt_content', 'CType', 11, 'explicitAllow') ? 'true' : 'false') . "';\n\t\t\t\t\t\ttop.newElementWizard = '" . ($modTSconfig['properties']['disableNewContentElementWizard'] ? 'false' : 'true') . "';\n\t\t\t\t\t\ttop.DDclipboardElId = '" . $intFirstCBEl . "';\n\t\t\t\t\t" . str_replace(array('top.skipDraggableDetails = 0;', 'insert_ext_baseurl_here', 'insert_server_time_here', 'top.geSprites = {};', "top.backPath = '';"), array($GLOBALS['BE_USER']->uc['dragAndDropHideNewElementWizardInfoOverlay'] ? 'top.skipDraggableDetails = true;' : 'top.skipDraggableDetails = false;', GeneralUtility::locationHeaderUrl('/' . ExtensionManagementUtility::siteRelPath('gridelements')), time() . '000', "top.geSprites = {\n\t\t\t\t\t\t\tcopyfrompage: '" . IconUtility::getSpriteIconClasses('extensions-gridelements-copyfrompage') . "',\n\t\t\t\t\t\t\t\tpastecopy: '" . IconUtility::getSpriteIconClasses('extensions-gridelements-pastecopy') . "',\n\t\t\t\t\t\t\t\tpasteref: '" . IconUtility::getSpriteIconClasses('extensions-gridelements-pasteref') . "'\n\t\t\t\t\t\t\t};", "top.backPath = '" . $GLOBALS['BACK_PATH'] . "';"), file_get_contents(ExtensionManagementUtility::extPath('gridelements') . 'Resources/Public/Backend/JavaScript/GridElementsDD_onReady.js')), TRUE);
}
}
}
示例7: loadResources
/**
* Returns the language labels, sprites and configuration options for the pagetree
*
* @return void
*/
public function loadResources()
{
$file = 'LLL:EXT:lang/locallang_core.xlf:';
$indicators = $this->getIndicators();
$configuration = array('LLL' => array('copyHint' => $GLOBALS['LANG']->sL($file . 'tree.copyHint', TRUE), 'fakeNodeHint' => $GLOBALS['LANG']->sL($file . 'mess.please_wait', TRUE), 'activeFilterMode' => $GLOBALS['LANG']->sL($file . 'tree.activeFilterMode', TRUE), 'dropToRemove' => $GLOBALS['LANG']->sL($file . 'tree.dropToRemove', TRUE), 'buttonRefresh' => $GLOBALS['LANG']->sL($file . 'labels.refresh', TRUE), 'buttonNewNode' => $GLOBALS['LANG']->sL($file . 'tree.buttonNewNode', TRUE), 'buttonFilter' => $GLOBALS['LANG']->sL($file . 'tree.buttonFilter', TRUE), 'dropZoneElementRemoved' => $GLOBALS['LANG']->sL($file . 'tree.dropZoneElementRemoved', TRUE), 'dropZoneElementRestored' => $GLOBALS['LANG']->sL($file . 'tree.dropZoneElementRestored', TRUE), 'searchTermInfo' => $GLOBALS['LANG']->sL($file . 'tree.searchTermInfo', TRUE), 'temporaryMountPointIndicatorInfo' => $GLOBALS['LANG']->sl($file . 'labels.temporaryDBmount', TRUE), 'deleteDialogTitle' => $GLOBALS['LANG']->sL('LLL:EXT:cms/layout/locallang.xlf:deleteItem', TRUE), 'deleteDialogMessage' => $GLOBALS['LANG']->sL('LLL:EXT:cms/layout/locallang.xlf:deleteWarning', TRUE), 'recursiveDeleteDialogMessage' => $GLOBALS['LANG']->sL('LLL:EXT:cms/layout/locallang.xlf:recursiveDeleteWarning', TRUE)), 'Configuration' => array('hideFilter' => $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.hideFilter'), 'displayDeleteConfirmation' => $GLOBALS['BE_USER']->jsConfirmation(4), 'canDeleteRecursivly' => $GLOBALS['BE_USER']->uc['recursiveDelete'] == TRUE, 'disableIconLinkToContextmenu' => $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.disableIconLinkToContextmenu'), 'indicator' => $indicators['html'], 'temporaryMountPoint' => Commands::getMountPointPath()), 'Sprites' => array('Filter' => IconUtility::getSpriteIconClasses('actions-system-tree-search-open'), 'NewNode' => IconUtility::getSpriteIconClasses('actions-page-new'), 'Refresh' => IconUtility::getSpriteIconClasses('actions-system-refresh'), 'InputClear' => IconUtility::getSpriteIconClasses('actions-input-clear'), 'TrashCan' => IconUtility::getSpriteIconClasses('actions-edit-delete'), 'TrashCanRestore' => IconUtility::getSpriteIconClasses('actions-edit-restore'), 'Info' => IconUtility::getSpriteIconClasses('actions-document-info')));
return $configuration;
}
示例8: getSystemLanguages
/**
* Gets all available system languages.
*
* @return array
*/
public function getSystemLanguages()
{
$systemLanguages = array(array('uid' => 'all', 'title' => \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('language.allLanguages', 'workspaces'), 'cls' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses('empty-empty')));
foreach ($this->getGridDataService()->getSystemLanguages() as $id => $systemLanguage) {
if ($id < 0) {
continue;
}
$systemLanguages[] = array('uid' => $id, 'title' => htmlspecialchars($systemLanguage['title']), 'cls' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses($systemLanguage['flagIcon']));
}
$result = array('total' => count($systemLanguages), 'data' => $systemLanguages);
return $result;
}
示例9: renderField
/**
* renders the tree as replacement for the selector
*
* @param string $table The table name of the record
* @param string $field The field name which this element is supposed to edit
* @param array $row The record data array where the value(s) for the field can be found
* @param array $PA An array with additional configuration options.
* @param array $config (Redundant) content of $PA['fieldConf']['config'] (for convenience)
* @param array $possibleSelectboxItems Items available for selection
* @param string $noMatchLabel Label for no-matching-value
* @return string The HTML code for the TCEform field
*/
public function renderField($table, $field, $row, &$PA, $config, $possibleSelectboxItems, $noMatchLabel)
{
$valueArray = array();
$selectedNodes = array();
if (!empty($PA['itemFormElValue'])) {
$valueArray = explode(',', $PA['itemFormElValue']);
}
if (count($valueArray)) {
foreach ($valueArray as $selectedValue) {
$temp = explode('|', $selectedValue);
$selectedNodes[] = $temp[0];
}
}
$allowedUids = array();
foreach ($possibleSelectboxItems as $item) {
if ((int) $item[1] > 0) {
$allowedUids[] = $item[1];
}
}
$treeDataProvider = \TYPO3\CMS\Core\Tree\TableConfiguration\TreeDataProviderFactory::getDataProvider($config, $table, $field, $row);
$treeDataProvider->setSelectedList(implode(',', $selectedNodes));
$treeDataProvider->setItemWhiteList($allowedUids);
$treeDataProvider->initializeTreeData();
$treeRenderer = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Tree\\TableConfiguration\\ExtJsArrayTreeRenderer');
$tree = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Tree\\TableConfiguration\\TableConfigurationTree');
$tree->setDataProvider($treeDataProvider);
$tree->setNodeRenderer($treeRenderer);
$treeData = $tree->render();
$itemArray = array();
if (is_array($PA['fieldConf']['config']['items'])) {
foreach ($PA['fieldConf']['config']['items'] as $additionalItem) {
if ($additionalItem[1] !== '--div--') {
$item = new \stdClass();
$item->uid = $additionalItem[1];
$item->text = $GLOBALS['LANG']->sL($additionalItem[0]);
$item->selectable = TRUE;
$item->leaf = TRUE;
$item->checked = in_array($additionalItem[1], $selectedNodes);
if (file_exists(PATH_typo3 . $additionalItem[3])) {
$item->icon = $additionalItem[3];
} elseif (strlen(trim($additionalItem[3]))) {
$item->iconCls = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses($additionalItem[3]);
}
$itemArray[] = $item;
}
}
}
$itemArray[] = $treeData;
$treeData = json_encode($itemArray);
$id = md5($PA['itemFormElName']);
if (isset($PA['fieldConf']['config']['size']) && (int) $PA['fieldConf']['config']['size'] > 0) {
$height = (int) $PA['fieldConf']['config']['size'] * 20;
} else {
$height = 280;
}
if (isset($PA['fieldConf']['config']['autoSizeMax']) && (int) $PA['fieldConf']['config']['autoSizeMax'] > 0) {
$autoSizeMax = (int) $PA['fieldConf']['config']['autoSizeMax'] * 20;
}
$header = FALSE;
$expanded = FALSE;
$width = 280;
$appearance = $PA['fieldConf']['config']['treeConfig']['appearance'];
if (is_array($appearance)) {
$header = $appearance['showHeader'] ? TRUE : FALSE;
$expanded = $appearance['expandAll'] === TRUE;
if (isset($appearance['width'])) {
$width = (int) $appearance['width'];
}
}
$onChange = '';
if ($PA['fieldChangeFunc']['TBE_EDITOR_fieldChanged']) {
$onChange = $PA['fieldChangeFunc']['TBE_EDITOR_fieldChanged'];
}
// Create a JavaScript code line which will ask the user to save/update the form due to changing the element.
// This is used for eg. "type" fields and others configured with "requestUpdate"
if (!empty($GLOBALS['TCA'][$table]['ctrl']['type']) && $field === $GLOBALS['TCA'][$table]['ctrl']['type'] || !empty($GLOBALS['TCA'][$table]['ctrl']['requestUpdate']) && GeneralUtility::inList(str_replace(' ', '', $GLOBALS['TCA'][$table]['ctrl']['requestUpdate']), $field)) {
if ($GLOBALS['BE_USER']->jsConfirmation(1)) {
$onChange .= 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && ' . 'TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
} else {
$onChange .= 'if (TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
}
}
/** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
$pageRenderer = $GLOBALS['SOBE']->doc->getPageRenderer();
$pageRenderer->loadExtJs();
$pageRenderer->addJsFile('sysext/backend/Resources/Public/JavaScript/tree.js');
$pageRenderer->addInlineLanguageLabelFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('lang') . 'locallang_csh_corebe.xlf', 'tcatree');
$pageRenderer->addExtOnReadyCode('
//.........這裏部分代碼省略.........
示例10: getSpriteIconClassesWithFourPartsReturnsT3IconAndCombinedParts
/**
* Tests the return of four parts
*
* @test
*/
public function getSpriteIconClassesWithFourPartsReturnsT3IconAndCombinedParts()
{
$result = explode(' ', IconUtility::getSpriteIconClasses('actions-juggle-speed-game'));
sort($result);
$this->assertEquals(array('t3-icon', 't3-icon-actions', 't3-icon-actions-juggle', 't3-icon-juggle-speed-game'), $result);
}