本文整理匯總了PHP中TYPO3\CMS\Backend\Utility\IconUtility::mapRecordTypeToSpriteIconClass方法的典型用法代碼示例。如果您正苦於以下問題:PHP IconUtility::mapRecordTypeToSpriteIconClass方法的具體用法?PHP IconUtility::mapRecordTypeToSpriteIconClass怎麽用?PHP IconUtility::mapRecordTypeToSpriteIconClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TYPO3\CMS\Backend\Utility\IconUtility
的用法示例。
在下文中一共展示了IconUtility::mapRecordTypeToSpriteIconClass方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: buildRepresentationForNode
/**
* Builds a complete node including children
*
* @param \TYPO3\CMS\Backend\Tree\TreeNode|\TYPO3\CMS\Backend\Tree\TreeNode $basicNode
* @param NULL|\TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeNode $parent
* @param integer $level
* @param bool $restriction
* @return \TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeNode node
*/
protected function buildRepresentationForNode(\TYPO3\CMS\Backend\Tree\TreeNode $basicNode, \TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeNode $parent = NULL, $level = 0, $restriction = FALSE)
{
/**@param $node \TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeNode */
$node = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Tree\\TableConfiguration\\DatabaseTreeNode');
$row = array();
if ($basicNode->getId() == 0) {
$node->setSelected(FALSE);
$node->setExpanded(TRUE);
$node->setLabel($GLOBALS['LANG']->sL($GLOBALS['TCA'][$this->tableName]['ctrl']['title']));
} else {
$row = BackendUtility::getRecordWSOL($this->tableName, $basicNode->getId(), '*', '', FALSE);
if ($this->getLabelField() !== '') {
$label = CategoryService::translateCategoryRecord($row[$this->getLabelField()], $row);
$node->setLabel($label);
} else {
$node->setLabel($basicNode->getId());
}
$node->setSelected(GeneralUtility::inList($this->getSelectedList(), $basicNode->getId()));
$node->setExpanded($this->isExpanded($basicNode));
$node->setLabel($node->getLabel());
}
$node->setId($basicNode->getId());
// Break to force single category activation
if ($parent != NULL && $level != 0 && $this->isSingleCategoryAclActivated() && !$this->isCategoryAllowed($node)) {
return NULL;
}
$node->setSelectable(!GeneralUtility::inList($this->getNonSelectableLevelList(), $level) && !in_array($basicNode->getId(), $this->getItemUnselectableList()));
$node->setSortValue($this->nodeSortValues[$basicNode->getId()]);
$node->setIcon(IconUtility::mapRecordTypeToSpriteIconClass($this->tableName, $row));
$node->setParentNode($parent);
if ($basicNode->hasChildNodes()) {
$node->setHasChildren(TRUE);
/** @var \TYPO3\CMS\Backend\Tree\SortedTreeNodeCollection $childNodes */
$childNodes = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\SortedTreeNodeCollection');
$foundSomeChild = FALSE;
foreach ($basicNode->getChildNodes() as $child) {
// Change in custom TreeDataProvider by adding the if clause
if ($restriction || $this->isCategoryAllowed($child)) {
$returnedChild = $this->buildRepresentationForNode($child, $node, $level + 1, TRUE);
if (!is_null($returnedChild)) {
$foundSomeChild = TRUE;
$childNodes->append($returnedChild);
} else {
$node->setParentNode(NULL);
$node->setHasChildren(FALSE);
}
}
// Change in custom TreeDataProvider end
}
if ($foundSomeChild) {
$node->setChildNodes($childNodes);
}
}
return $node;
}
示例2: 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();
}
示例3: buildRepresentationForNode
/**
* Builds a complete node including childs
*
* @param \TYPO3\CMS\Backend\Tree\TreeNode $basicNode
* @param NULL|\TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeNode $parent
* @param int $level
* @return \TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeNode Node object
*/
protected function buildRepresentationForNode(\TYPO3\CMS\Backend\Tree\TreeNode $basicNode, DatabaseTreeNode $parent = NULL, $level = 0)
{
/** @var $node \TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeNode */
$node = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeNode::class);
$row = array();
if ($basicNode->getId() == 0) {
$node->setSelected(FALSE);
$node->setExpanded(TRUE);
$node->setLabel($GLOBALS['LANG']->sL($GLOBALS['TCA'][$this->tableName]['ctrl']['title']));
} else {
$row = BackendUtility::getRecordWSOL($this->tableName, $basicNode->getId(), '*', '', FALSE);
$node->setLabel(BackendUtility::getRecordTitle($this->tableName, $row) ?: $basicNode->getId());
$node->setSelected(GeneralUtility::inList($this->getSelectedList(), $basicNode->getId()));
$node->setExpanded($this->isExpanded($basicNode));
}
$node->setId($basicNode->getId());
$node->setSelectable(!GeneralUtility::inList($this->getNonSelectableLevelList(), $level) && !in_array($basicNode->getId(), $this->getItemUnselectableList()));
$node->setSortValue($this->nodeSortValues[$basicNode->getId()]);
$node->setIcon(\TYPO3\CMS\Backend\Utility\IconUtility::mapRecordTypeToSpriteIconClass($this->tableName, $row));
$node->setParentNode($parent);
if ($basicNode->hasChildNodes()) {
$node->setHasChildren(TRUE);
/** @var $childNodes \TYPO3\CMS\Backend\Tree\SortedTreeNodeCollection */
$childNodes = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\SortedTreeNodeCollection::class);
foreach ($basicNode->getChildNodes() as $child) {
$childNodes->append($this->buildRepresentationForNode($child, $node, $level + 1));
}
$node->setChildNodes($childNodes);
}
return $node;
}
示例4: getRowDetails
/**
* Fetch futher information to current selected worspace record.
*
* @param object $parameter
* @return array $data
*/
public function getRowDetails($parameter)
{
$diffReturnArray = array();
$liveReturnArray = array();
/** @var $t3lib_diff \TYPO3\CMS\Core\Utility\DiffUtility */
$t3lib_diff = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\DiffUtility');
/** @var $parseObj \TYPO3\CMS\Core\Html\RteHtmlParser */
$parseObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Html\\RteHtmlParser');
$liveRecord = BackendUtility::getRecord($parameter->table, $parameter->t3ver_oid);
$versionRecord = BackendUtility::getRecord($parameter->table, $parameter->uid);
$icon_Live = \TYPO3\CMS\Backend\Utility\IconUtility::mapRecordTypeToSpriteIconClass($parameter->table, $liveRecord);
$icon_Workspace = \TYPO3\CMS\Backend\Utility\IconUtility::mapRecordTypeToSpriteIconClass($parameter->table, $versionRecord);
$stagePosition = $this->getStagesService()->getPositionOfCurrentStage($parameter->stage);
$fieldsOfRecords = array_keys($liveRecord);
if ($GLOBALS['TCA'][$parameter->table]) {
if ($GLOBALS['TCA'][$parameter->table]['interface']['showRecordFieldList']) {
$fieldsOfRecords = $GLOBALS['TCA'][$parameter->table]['interface']['showRecordFieldList'];
$fieldsOfRecords = GeneralUtility::trimExplode(',', $fieldsOfRecords, TRUE);
}
}
foreach ($fieldsOfRecords as $fieldName) {
// check for exclude fields
if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['TCA'][$parameter->table]['columns'][$fieldName]['exclude'] == 0 || GeneralUtility::inList($GLOBALS['BE_USER']->groupData['non_exclude_fields'], $parameter->table . ':' . $fieldName)) {
// call diff class only if there is a difference
if ((string) $liveRecord[$fieldName] !== (string) $versionRecord[$fieldName]) {
// Select the human readable values before diff
$liveRecord[$fieldName] = BackendUtility::getProcessedValue($parameter->table, $fieldName, $liveRecord[$fieldName], 0, 1, FALSE, $liveRecord['uid']);
$versionRecord[$fieldName] = BackendUtility::getProcessedValue($parameter->table, $fieldName, $versionRecord[$fieldName], 0, 1, FALSE, $versionRecord['uid']);
// Get the field's label. If not available, use the field name
$fieldTitle = $GLOBALS['LANG']->sL(BackendUtility::getItemLabel($parameter->table, $fieldName));
if (empty($fieldTitle)) {
$fieldTitle = $fieldName;
}
if ($GLOBALS['TCA'][$parameter->table]['columns'][$fieldName]['config']['type'] == 'group' && $GLOBALS['TCA'][$parameter->table]['columns'][$fieldName]['config']['internal_type'] == 'file') {
$versionThumb = BackendUtility::thumbCode($versionRecord, $parameter->table, $fieldName, '');
$liveThumb = BackendUtility::thumbCode($liveRecord, $parameter->table, $fieldName, '');
$diffReturnArray[] = array('field' => $fieldName, 'label' => $fieldTitle, 'content' => $versionThumb);
$liveReturnArray[] = array('field' => $fieldName, 'label' => $fieldTitle, 'content' => $liveThumb);
} else {
$diffReturnArray[] = array('field' => $fieldName, 'label' => $fieldTitle, 'content' => $t3lib_diff->makeDiffDisplay($liveRecord[$fieldName], $versionRecord[$fieldName]));
$liveReturnArray[] = array('field' => $fieldName, 'label' => $fieldTitle, 'content' => $parseObj->TS_images_rte($liveRecord[$fieldName]));
}
}
}
}
// Hook for modifying the difference and live arrays
// (this may be used by custom or dynamically-defined fields)
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['workspaces']['modifyDifferenceArray'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['workspaces']['modifyDifferenceArray'] as $className) {
$hookObject =& GeneralUtility::getUserObj($className);
$hookObject->modifyDifferenceArray($parameter, $diffReturnArray, $liveReturnArray, $t3lib_diff);
}
}
$commentsForRecord = $this->getCommentsForRecord($parameter->uid, $parameter->table);
return array('total' => 1, 'data' => array(array('diff' => $diffReturnArray, 'live_record' => $liveReturnArray, 'path_Live' => $parameter->path_Live, 'label_Stage' => $parameter->label_Stage, 'stage_position' => $stagePosition['position'], 'stage_count' => $stagePosition['count'], 'comments' => $commentsForRecord, 'icon_Live' => $icon_Live, 'icon_Workspace' => $icon_Workspace)));
}
示例5: buildRepresentationForNode
/**
* Builds a complete node including childs
*
* @param \TYPO3\CMS\Backend\Tree\TreeNode $basicNode
* @param NULL|t3lib_tree_tca_DatabaseNode $parent
* @param integer $level
* @return An object
*/
protected function buildRepresentationForNode(\TYPO3\CMS\Backend\Tree\TreeNode $basicNode, \t3lib_tree_tca_DatabaseNode $parent = NULL, $level = 0)
{
$node = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_tree_tca_DatabaseNode');
$row = array();
if ($basicNode->getId() == 0) {
$node->setSelected(FALSE);
$node->setExpanded(TRUE);
$node->setLabel($GLOBALS['LANG']->sL($GLOBALS['TCA'][$this->tableName]['ctrl']['title']));
} else {
$row = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL($this->tableName, $basicNode->getId(), '*', '', FALSE);
if ($this->getLabelField() !== '') {
$node->setLabel($row[$this->getLabelField()]);
} else {
$node->setLabel($basicNode->getId());
}
$node->setSelected(\TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->getSelectedList(), $basicNode->getId()));
$node->setExpanded($this->isExpanded($basicNode));
}
$node->setId($basicNode->getId());
$node->setSelectable(!\TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->getNonSelectableLevelList(), $level) && !in_array($basicNode->getId(), $this->getItemUnselectableList()));
$node->setSortValue($this->nodeSortValues[$basicNode->getId()]);
$node->setIcon(\TYPO3\CMS\Backend\Utility\IconUtility::mapRecordTypeToSpriteIconClass($this->tableName, $row));
$node->setParentNode($parent);
if ($basicNode->hasChildNodes()) {
$node->setHasChildren(TRUE);
$childNodes = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\SortedTreeNodeCollection');
foreach ($basicNode->getChildNodes() as $child) {
$childNodes->append($this->buildRepresentationForNode($child, $node, $level + 1));
}
$node->setChildNodes($childNodes);
}
return $node;
}