本文整理汇总了PHP中TYPO3\CMS\Backend\Utility\BackendUtility::getRecordIconAltText方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUtility::getRecordIconAltText方法的具体用法?PHP BackendUtility::getRecordIconAltText怎么用?PHP BackendUtility::getRecordIconAltText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Backend\Utility\BackendUtility
的用法示例。
在下文中一共展示了BackendUtility::getRecordIconAltText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Render javascript in header
*
* @return string the rendered page info icon
* @see template::getPageInfo() Note: can't call this method as it's protected!
*/
public function render()
{
$doc = $this->getDocInstance();
$id = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id');
$pageRecord = BackendUtility::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1));
// Add icon with clickmenu, etc:
if ($pageRecord['uid']) {
// If there IS a real page
$alttext = BackendUtility::getRecordIconAltText($pageRecord, 'pages');
$iconImg = IconUtility::getSpriteIconForRecord('pages', $pageRecord, array('title' => htmlspecialchars($alttext)));
// Make Icon:
$theIcon = $doc->wrapClickMenuOnIcon($iconImg, 'pages', $pageRecord['uid']);
} else {
// On root-level of page tree
// Make Icon
$iconImg = '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/i/_icon_website.gif') . ' alt="' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '" />';
if ($GLOBALS['BE_USER']->user['admin']) {
$theIcon = $doc->wrapClickMenuOnIcon($iconImg, 'pages', 0);
} else {
$theIcon = $iconImg;
}
}
// Setting icon with clickmenu + uid
$pageInfo = $theIcon . '<em>[pid: ' . $pageRecord['uid'] . ']</em>';
return $pageInfo;
}
示例2: renderStatic
/**
* @param array $arguments
* @param callable $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
*
* @return string
*/
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{
$id = GeneralUtility::_GP('id');
$pageRecord = BackendUtility::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1));
// Add icon with clickmenu, etc:
/** @var IconFactory $iconFactory */
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
if ($pageRecord['uid']) {
// If there IS a real page
$altText = BackendUtility::getRecordIconAltText($pageRecord, 'pages');
$theIcon = '<span title="' . $altText . '">' . $iconFactory->getIconForRecord('pages', $pageRecord, Icon::SIZE_SMALL)->render() . '</span>';
// Make Icon:
$theIcon = BackendUtility::wrapClickMenuOnIcon($theIcon, 'pages', $pageRecord['uid']);
// Setting icon with clickmenu + uid
$theIcon .= ' <em>[PID: ' . $pageRecord['uid'] . ']</em>';
} else {
// On root-level of page tree
// Make Icon
$theIcon = '<span title="' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '">' . $iconFactory->getIcon('apps-pagetree-page-domain', Icon::SIZE_SMALL)->render() . '</span>';
if ($GLOBALS['BE_USER']->user['admin']) {
$theIcon = BackendUtility::wrapClickMenuOnIcon($theIcon, 'pages', 0);
}
}
return $theIcon;
}
示例3: render
/**
* Iterates through elements of $each and renders child nodes
*
* @param array $record The tt_content record
* @param boolean $oncludeTitle If title should be included in output,
* @return string
*/
public function render($record)
{
$shortcutContent = '';
$tableName = 'tt_content';
if (is_array($record)) {
$altText = BackendUtility::getRecordIconAltText($record, $tableName);
$iconImg = IconUtility::getSpriteIconForRecord($tableName, $record, array('title' => $altText));
if ($this->getBackendUser()->recordEditAccessInternals($tableName, $record)) {
$iconImg = BackendUtility::wrapClickMenuOnIcon($iconImg, $tableName, $record['uid'], 1, '', '+copy,info,edit,view');
}
$link = $this->linkEditContent(htmlspecialchars(BackendUtility::getRecordTitle($tableName, $record)), $record);
$shortcutContent = $iconImg . $link;
}
return $shortcutContent;
}
示例4: renderStatic
/**
* @param array $arguments
* @param callable $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
*
* @return string
*/
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{
$doc = GeneralUtility::makeInstance(DocumentTemplate::class);
$id = GeneralUtility::_GP('id');
$pageRecord = BackendUtility::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1));
// Add icon with clickmenu, etc:
if ($pageRecord['uid']) {
// If there IS a real page
$alttext = BackendUtility::getRecordIconAltText($pageRecord, 'pages');
$theIcon = IconUtility::getSpriteIconForRecord('pages', $pageRecord, array('title' => htmlspecialchars($alttext)));
// Make Icon:
$theIcon = $doc->wrapClickMenuOnIcon($theIcon, 'pages', $pageRecord['uid']);
// Setting icon with clickmenu + uid
$theIcon .= ' <em>[PID: ' . $pageRecord['uid'] . ']</em>';
} else {
// On root-level of page tree
// Make Icon
$theIcon = IconUtility::getSpriteIcon('apps-pagetree-page-domain', array('title' => htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'])));
if ($GLOBALS['BE_USER']->user['admin']) {
$theIcon = $doc->wrapClickMenuOnIcon($theIcon, 'pages', 0);
}
}
return $theIcon;
}
示例5: renderListRow
/**
* Rendering a single row for the list
*
* @param string $table Table name
* @param array $row Current record
* @param int $cc Counter, counting for each time an element
* is rendered (used for alternating colors)
* @param string $titleCol Table field (column) where header value is found
* @param string $thumbsCol Table field (column) where (possible)
* thumbnails can be found
* @param int $indent Indent from left.
*
* @return string Table row for the element
* @see getTable()
*/
public function renderListRow($table, array $row, $cc, $titleCol, $thumbsCol, $indent = 0)
{
$backendUser = $this->getBackendUser();
$iOut = '';
$extConf = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][COMMERCE_EXTKEY]['extConf'];
if (substr(TYPO3_version, 0, 3) >= '4.0') {
// In offline workspace, look for alternative record:
BackendUtility::workspaceOL($table, $row, $GLOBALS['BE_USER']->workspace);
}
$rowBackgroundColor = '';
if ($this->alternateBgColors) {
$rowBackgroundColor = $cc % 2 ? '' : ' bgcolor="' . GeneralUtility::modifyHTMLColor($GLOBALS['SOBE']->doc->bgColor4, 10, 10, 10) . '"';
}
if ($backendUser->getModuleData('commerce_orders/index.php/userid', 'ses') == $row['uid']) {
$rowBackgroundColor = ' bgcolor="' . GeneralUtility::modifyHTMLColor($GLOBALS['SOBE']->doc->bgColor4, 30, 30, 30) . '"';
}
// Overriding with versions background color if any:
$rowBackgroundColor = $row['_CSSCLASS'] ? ' class="' . $row['_CSSCLASS'] . '"' : $rowBackgroundColor;
// Initialization
$alttext = BackendUtility::getRecordIconAltText($row, $table);
// Incr. counter.
$this->counter++;
// The icon with link
$iconImg = IconUtility::skinImg($this->backPath, IconUtility::getIcon($table, $row), 'title="' . htmlspecialchars($alttext) . '"' . ($indent ? ' style="margin-left: ' . $indent . 'px;"' : ''));
$theIcon = $this->clickMenuEnabled ? $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, $table, $row['uid']) : $iconImg;
// Preparing and getting the data-array
$theData = array();
foreach ($this->fieldArray as $fCol) {
if ($fCol == 'pid') {
$theData[$fCol] = $row[$fCol];
}
if ($fCol == 'username') {
$theData[$fCol] = $row[$fCol];
} elseif ($fCol == 'crdate') {
$theData[$fCol] = BackendUtility::date($row[$fCol]);
} elseif ($fCol == '_PATH_') {
$theData[$fCol] = $this->recPath($row['pid']);
} elseif ($fCol == '_CONTROL_') {
$theData[$fCol] = $this->makeControl($table, $row);
} elseif ($fCol == '_CLIPBOARD_') {
$theData[$fCol] = $this->makeClip($table, $row);
} elseif ($fCol == '_LOCALIZATION_') {
list($lC1, $lC2) = $this->makeLocalizationPanel($table, $row);
$theData[$fCol] = $lC1;
$theData[$fCol . 'b'] = $lC2;
} elseif ($fCol == '_LOCALIZATION_b') {
// Do nothing, has been done above.
$theData[$fCol] .= '';
} else {
/**
* Use own method, if typo3 4.0.0 is not installed
*/
if (substr(TYPO3_version, 0, 3) >= '4.0') {
$theData[$fCol] = $this->linkUrlMail(htmlspecialchars(BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid'])), $row[$fCol]);
} else {
$theData[$fCol] = $this->myLinkUrlMail(htmlspecialchars(BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid'])), $row[$fCol]);
}
}
}
// Add row to CSV list:
if ($this->csvOutput) {
// Charset Conversion
/**
* Charset converter
*
* @var \TYPO3\CMS\Core\Charset\CharsetConverter $csObj
*/
$csObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Charset\\CharsetConverter');
$csObj->initCharset($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset']);
if (!$extConf['BECSVCharset']) {
$extConf['BECSVCharset'] = 'iso-8859-1';
}
$csObj->initCharset($extConf['BECSVCharset']);
$csObj->convArray($row, $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'], $extConf['BECSVCharset']);
$this->addToCSV($row);
}
// Create element in table cells:
$iOut .= $this->addelement(1, $theIcon, $theData, $rowBackgroundColor);
// Render thumbsnails if a thumbnail column exists and there is content in it:
if ($this->thumbs && trim($row[$thumbsCol])) {
$iOut .= $this->addelement(4, '', array($titleCol => $this->thumbCode($row, $table, $thumbsCol)), $rowBackgroundColor);
}
// Finally, return table row element:
return $iOut;
}
示例6: getIcon
/**
* Creates the icon image tag for record from table and wraps it in a link which will trigger the click menu.
*
* @param string $table Table name
* @param array $row Record array
* @return string HTML for the icon
*/
public function getIcon($table, $row)
{
// Initialization
$altText = BackendUtility::getRecordIconAltText($row, $table);
$icon = '<span title="' . $altText . '">' . $this->iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render() . '</span>';
$this->counter++;
// The icon with link
if ($this->getBackendUser()->recordEditAccessInternals($table, $row)) {
$icon = $this->getPageLayoutController()->getModuleTemplate()->wrapClickMenuOnIcon($icon, $table, $row['uid']);
}
return $icon;
}
示例7: renderListRow
/**
* Rendering a single row for the list
*
* @param string $table Table name
* @param mixed[] $row Current record
* @param int $cc Counter, counting for each time an element is rendered (used for alternating colors)
* @param string $titleCol Table field (column) where header value is found
* @param string $thumbsCol Table field (column) where (possible) thumbnails can be found
* @param int $indent Indent from left.
* @return string Table row for the element
* @access private
* @see getTable()
*/
public function renderListRow($table, $row, $cc, $titleCol, $thumbsCol, $indent = 0)
{
if (!is_array($row)) {
return '';
}
$rowOutput = '';
$id_orig = null;
// If in search mode, make sure the preview will show the correct page
if ((string) $this->searchString !== '') {
$id_orig = $this->id;
$this->id = $row['pid'];
}
// Add special classes for first and last row
$rowSpecial = '';
if ($cc == 1 && $indent == 0) {
$rowSpecial .= ' firstcol';
}
if ($cc == $this->totalRowCount || $cc == $this->iLimit) {
$rowSpecial .= ' lastcol';
}
$row_bgColor = ' class="' . $rowSpecial . '"';
// Overriding with versions background color if any:
$row_bgColor = $row['_CSSCLASS'] ? ' class="' . $row['_CSSCLASS'] . '"' : $row_bgColor;
// Incr. counter.
$this->counter++;
// The icon with link
$altText = BackendUtility::getRecordIconAltText($row, $table);
$additionalStyle = $indent ? ' style="margin-left: ' . $indent . 'px;"' : '';
$iconImg = '<span title="' . $altText . '" ' . $additionalStyle . '>' . $this->iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render() . '</span>';
$theIcon = $this->clickMenuEnabled ? $this->getModule()->doc->wrapClickMenuOnIcon($iconImg, $table, $row['uid']) : $iconImg;
// Preparing and getting the data-array
$theData = array();
$localizationMarkerClass = '';
foreach ($this->fieldArray as $fCol) {
if ($fCol == $titleCol) {
$recTitle = BackendUtility::getRecordTitle($table, $row, false, true);
$warning = '';
// If the record is edit-locked by another user, we will show a little warning sign:
$lockInfo = BackendUtility::isRecordLocked($table, $row['uid']);
if ($lockInfo) {
$warning = '<a href="#" onclick="alert(' . GeneralUtility::quoteJSvalue($lockInfo['msg']) . '); return false;" title="' . htmlspecialchars($lockInfo['msg']) . '">' . $this->iconFactory->getIcon('status-warning-in-use', Icon::SIZE_SMALL)->render() . '</a>';
}
$theData[$fCol] = $theData['__label'] = $warning . $this->linkWrapItems($table, $row['uid'], $recTitle, $row);
// Render thumbnails, if:
// - a thumbnail column exists
// - there is content in it
// - the thumbnail column is visible for the current type
$type = 0;
if (isset($GLOBALS['TCA'][$table]['ctrl']['type'])) {
$typeColumn = $GLOBALS['TCA'][$table]['ctrl']['type'];
$type = $row[$typeColumn];
}
// If current type doesn't exist, set it to 0 (or to 1 for historical reasons,
// if 0 doesn't exist)
if (!isset($GLOBALS['TCA'][$table]['types'][$type])) {
$type = isset($GLOBALS['TCA'][$table]['types'][0]) ? 0 : 1;
}
$visibleColumns = $GLOBALS['TCA'][$table]['types'][$type]['showitem'];
if ($this->thumbs && trim($row[$thumbsCol]) && preg_match('/(^|(.*(;|,)?))' . $thumbsCol . '(((;|,).*)|$)/', $visibleColumns) === 1) {
$theData[$fCol] .= '<br />' . $this->thumbCode($row, $table, $thumbsCol);
}
if (isset($GLOBALS['TCA'][$table]['ctrl']['languageField']) && $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] != 0 && $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] != 0) {
// It's a translated record with a language parent
$localizationMarkerClass = ' localization';
}
} elseif ($fCol == 'pid') {
$theData[$fCol] = $row[$fCol];
} elseif ($fCol == '_PATH_') {
$theData[$fCol] = $this->recPath($row['pid']);
} elseif ($fCol == '_REF_') {
$theData[$fCol] = $this->createReferenceHtml($table, $row['uid']);
} elseif ($fCol == '_CONTROL_') {
$theData[$fCol] = $this->makeControl($table, $row);
} elseif ($fCol == '_CLIPBOARD_') {
$theData[$fCol] = $this->makeClip($table, $row);
} elseif ($fCol == '_LOCALIZATION_') {
list($lC1, $lC2) = $this->makeLocalizationPanel($table, $row);
$theData[$fCol] = $lC1;
$theData[$fCol . 'b'] = $lC2;
} elseif ($fCol == '_LOCALIZATION_b') {
// deliberately empty
} else {
$pageId = $table === 'pages' ? $row['uid'] : $row['pid'];
$tmpProc = BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid'], true, $pageId);
$theData[$fCol] = $this->linkUrlMail(htmlspecialchars($tmpProc), $row[$fCol]);
if ($this->csvOutput) {
$row[$fCol] = BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 0, $row['uid']);
//.........这里部分代码省略.........
示例8: getRecordHeader
/**
* Create record header (includes teh record icon, record title etc.)
*
* @param array $row Record row.
* @return string HTML
*/
public function getRecordHeader($row)
{
$line = IconUtility::getSpriteIconForRecord('tt_content', $row, array('title' => htmlspecialchars(BackendUtility::getRecordIconAltText($row, 'tt_content'))));
$line .= BackendUtility::getRecordTitle('tt_content', $row, TRUE);
return $this->wrapRecordTitle($line, $row);
}
示例9: printNewDBLevel
/**
* Make 2nd level clickmenu (only for DBmenus)
*
* @param string $table Table name
* @param integer $uid UID for the current record.
* @return string HTML content
* @todo Define visibility
*/
public function printNewDBLevel($table, $uid)
{
// Setting internal record to the table/uid :
$this->rec = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL($table, $uid);
$menuItems = array();
$root = 0;
// Rootlevel
if ($table == 'pages' && !strcmp($uid, '0')) {
$root = 1;
}
// If record was found, check permissions and get menu items.
if (is_array($this->rec) || $root) {
$lCP = $GLOBALS['BE_USER']->calcPerms(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $table == 'pages' ? $this->rec['uid'] : $this->rec['pid']));
// Edit:
if (!$root && ($GLOBALS['BE_USER']->isPSet($lCP, $table, 'edit') || $GLOBALS['BE_USER']->isPSet($lCP, $table, 'editcontent'))) {
$this->editOK = 1;
}
$menuItems = $this->processingByExtClassArray($menuItems, $table, $uid);
}
// Return the printed elements:
if (!is_array($menuItems)) {
$menuItems = array();
}
return $this->printItems($menuItems, $root ? \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-pagetree-root') . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) : \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($table, $this->rec, array('title' => htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordIconAltText($this->rec, $table)))) . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($table, $this->rec, TRUE));
}
示例10: getPageInfo
/**
* Setting page icon with clickmenu + uid for docheader
*
* @param array $pageRecord Current page
* @return string Page info
*/
protected function getPageInfo($pageRecord)
{
// Add icon with clickmenu, etc:
// If there IS a real page
if (is_array($pageRecord) && $pageRecord['uid']) {
$alttext = BackendUtility::getRecordIconAltText($pageRecord, 'pages');
$iconImg = '<span title="' . htmlspecialchars($alttext) . '">' . $this->iconFactory->getIconForRecord('pages', $pageRecord, Icon::SIZE_SMALL)->render() . '</span>';
// Make Icon:
$theIcon = BackendUtility::wrapClickMenuOnIcon($iconImg, 'pages', $pageRecord['uid']);
$uid = $pageRecord['uid'];
$title = BackendUtility::getRecordTitle('pages', $pageRecord);
} else {
// On root-level of page tree
// Make Icon
$iconImg = '<span title="' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '">' . $this->iconFactory->getIcon('apps-pagetree-root', Icon::SIZE_SMALL)->render() . '</span>';
if ($GLOBALS['BE_USER']->user['admin']) {
$theIcon = BackendUtility::wrapClickMenuOnIcon($iconImg, 'pages', 0);
} else {
$theIcon = $iconImg;
}
$uid = '0';
$title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
}
// Setting icon with clickmenu + uid
$pageInfo = $theIcon . '<strong>' . htmlspecialchars($title) . ' [' . $uid . ']</strong>';
return $pageInfo;
}
示例11: renderForeignRecordHeader
/**
* Renders the HTML header for a foreign record, such as the title, toggle-function, drag'n'drop, etc.
* Later on the command-icons are inserted here.
*
* @param array $data Current data
* @return string The HTML code of the header
*/
protected function renderForeignRecordHeader(array $data)
{
$languageService = $this->getLanguageService();
$inlineConfig = $data['inlineParentConfig'];
$foreignTable = $inlineConfig['foreign_table'];
$rec = $data['databaseRow'];
// Init:
$domObjectId = $this->inlineStackProcessor->getCurrentStructureDomObjectIdPrefix($data['inlineFirstPid']);
$objectId = $domObjectId . '-' . $foreignTable . '-' . $rec['uid'];
$recordTitle = $data['recordTitle'];
if (empty($recordTitle)) {
$recordTitle = '<em>[' . $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.no_title', true) . ']</em>';
}
$altText = BackendUtility::getRecordIconAltText($rec, $foreignTable);
$iconImg = '<span title="' . $altText . '" id="' . htmlspecialchars($objectId) . '_icon' . '">' . $this->iconFactory->getIconForRecord($foreignTable, $rec, Icon::SIZE_SMALL)->render() . '</span>';
$label = '<span id="' . $objectId . '_label">' . $recordTitle . '</span>';
$ctrl = $this->renderForeignRecordHeaderControl($data);
$thumbnail = false;
// Renders a thumbnail for the header
if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] && !empty($inlineConfig['appearance']['headerThumbnail']['field'])) {
$fieldValue = $rec[$inlineConfig['appearance']['headerThumbnail']['field']];
$firstElement = array_shift(GeneralUtility::trimExplode('|', array_shift(GeneralUtility::trimExplode(',', $fieldValue))));
$fileUid = array_pop(BackendUtility::splitTable_Uid($firstElement));
if (!empty($fileUid)) {
try {
$fileObject = ResourceFactory::getInstance()->getFileObject($fileUid);
} catch (\InvalidArgumentException $e) {
$fileObject = null;
}
if ($fileObject && $fileObject->isMissing()) {
$thumbnail .= '<span class="label label-danger">' . htmlspecialchars(static::getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:warning.file_missing')) . '</span> ' . htmlspecialchars($fileObject->getName()) . '<br />';
} elseif ($fileObject) {
$imageSetup = $inlineConfig['appearance']['headerThumbnail'];
unset($imageSetup['field']);
if (!empty($rec['crop'])) {
$imageSetup['crop'] = $rec['crop'];
}
$imageSetup = array_merge(array('width' => '45', 'height' => '45c'), $imageSetup);
$processedImage = $fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, $imageSetup);
// Only use a thumbnail if the processing process was successful by checking if image width is set
if ($processedImage->getProperty('width')) {
$imageUrl = $processedImage->getPublicUrl(true);
$thumbnail = '<img src="' . $imageUrl . '" ' . 'width="' . $processedImage->getProperty('width') . '" ' . 'height="' . $processedImage->getProperty('height') . '" ' . 'alt="' . htmlspecialchars($altText) . '" ' . 'title="' . htmlspecialchars($altText) . '">';
}
}
}
}
if (!empty($inlineConfig['appearance']['headerThumbnail']['field']) && $thumbnail) {
$mediaContainer = '<div class="form-irre-header-cell form-irre-header-thumbnail" id="' . $objectId . '_thumbnailcontainer">' . $thumbnail . '</div>';
} else {
$mediaContainer = '<div class="form-irre-header-cell form-irre-header-icon" id="' . $objectId . '_iconcontainer">' . $iconImg . '</div>';
}
$header = $mediaContainer . '
<div class="form-irre-header-cell form-irre-header-body">' . $label . '</div>
<div class="form-irre-header-cell form-irre-header-control t3js-formengine-irre-control">' . $ctrl . '</div>';
return $header;
}
示例12: renderForeignRecordHeader
/**
* Renders the HTML header for a foreign record, such as the title, toggle-function, drag'n'drop, etc.
* Later on the command-icons are inserted here.
*
* @param string $parentUid The uid of the parent (embedding) record (uid or NEW...)
* @param string $foreign_table The foreign_table we create a header for
* @param array $data Current data
* @param array $config content of $PA['fieldConf']['config']
* @param bool $isVirtualRecord
* @return string The HTML code of the header
*/
protected function renderForeignRecordHeader($parentUid, $foreign_table, $data, $config, $isVirtualRecord = false)
{
$rec = $data['databaseRow'];
// Init:
$domObjectId = $this->inlineStackProcessor->getCurrentStructureDomObjectIdPrefix($this->data['inlineFirstPid']);
$objectId = $domObjectId . '-' . $foreign_table . '-' . $rec['uid'];
// We need the returnUrl of the main script when loading the fields via AJAX-call (to correct wizard code, so include it as 3rd parameter)
// Pre-Processing:
$isOnSymmetricSide = RelationHandler::isOnSymmetricSide($parentUid, $config, $rec);
$hasForeignLabel = (bool) (!$isOnSymmetricSide && $config['foreign_label']);
$hasSymmetricLabel = (bool) $isOnSymmetricSide && $config['symmetric_label'];
// Get the record title/label for a record:
// Try using a self-defined user function only for formatted labels
if (isset($GLOBALS['TCA'][$foreign_table]['ctrl']['formattedLabel_userFunc'])) {
$params = array('table' => $foreign_table, 'row' => $rec, 'title' => '', 'isOnSymmetricSide' => $isOnSymmetricSide, 'options' => isset($GLOBALS['TCA'][$foreign_table]['ctrl']['formattedLabel_userFunc_options']) ? $GLOBALS['TCA'][$foreign_table]['ctrl']['formattedLabel_userFunc_options'] : array(), 'parent' => array('uid' => $parentUid, 'config' => $config));
// callUserFunction requires a third parameter, but we don't want to give $this as reference!
$null = null;
GeneralUtility::callUserFunction($GLOBALS['TCA'][$foreign_table]['ctrl']['formattedLabel_userFunc'], $params, $null);
$recTitle = $params['title'];
// Try using a normal self-defined user function
} elseif (isset($GLOBALS['TCA'][$foreign_table]['ctrl']['label_userFunc'])) {
$recTitle = $data['recordTitle'];
} elseif ($hasForeignLabel || $hasSymmetricLabel) {
$titleCol = $hasForeignLabel ? $config['foreign_label'] : $config['symmetric_label'];
// Render title for everything else than group/db:
if (isset($this->data['processedTca']['columns'][$titleCol]['config']['type']) && $this->data['processedTca']['columns'][$titleCol]['config']['type'] === 'group' && isset($this->data['processedTca']['columns'][$titleCol]['config']['internal_type']) && $this->data['processedTca']['columns'][$titleCol]['config']['internal_type'] === 'db') {
$recTitle = BackendUtility::getProcessedValueExtra($foreign_table, $titleCol, $rec[$titleCol], 0, 0, false);
} else {
// $recTitle could be something like: "tx_table_123|...",
$valueParts = GeneralUtility::trimExplode('|', $rec[$titleCol]);
$itemParts = GeneralUtility::revExplode('_', $valueParts[0], 2);
$recTemp = BackendUtility::getRecordWSOL($itemParts[0], $itemParts[1]);
$recTitle = BackendUtility::getRecordTitle($itemParts[0], $recTemp, false);
}
$recTitle = BackendUtility::getRecordTitlePrep($recTitle);
if (trim($recTitle) === '') {
$recTitle = BackendUtility::getNoRecordTitle(true);
}
} else {
$recTitle = BackendUtility::getRecordTitle($foreign_table, FormEngineUtility::databaseRowCompatibility($rec), true);
}
$altText = BackendUtility::getRecordIconAltText($rec, $foreign_table);
$iconImg = '<span title="' . $altText . '" id="' . htmlspecialchars($objectId) . '_icon' . '">' . $this->iconFactory->getIconForRecord($foreign_table, $rec, Icon::SIZE_SMALL)->render() . '</span>';
$label = '<span id="' . $objectId . '_label">' . $recTitle . '</span>';
$ctrl = $this->renderForeignRecordHeaderControl($parentUid, $foreign_table, $data, $config, $isVirtualRecord);
$thumbnail = false;
// Renders a thumbnail for the header
if (!empty($config['appearance']['headerThumbnail']['field'])) {
$fieldValue = $rec[$config['appearance']['headerThumbnail']['field']];
$firstElement = array_shift(GeneralUtility::trimExplode('|', array_shift(GeneralUtility::trimExplode(',', $fieldValue))));
$fileUid = array_pop(BackendUtility::splitTable_Uid($firstElement));
if (!empty($fileUid)) {
$fileObject = ResourceFactory::getInstance()->getFileObject($fileUid);
if ($fileObject && $fileObject->isMissing()) {
$flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($fileObject);
$thumbnail = $flashMessage->render();
} elseif ($fileObject) {
$imageSetup = $config['appearance']['headerThumbnail'];
unset($imageSetup['field']);
if (!empty($rec['crop'])) {
$imageSetup['crop'] = $rec['crop'];
}
$imageSetup = array_merge(array('width' => '45', 'height' => '45c'), $imageSetup);
$processedImage = $fileObject->process(ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, $imageSetup);
// Only use a thumbnail if the processing process was successful by checking if image width is set
if ($processedImage->getProperty('width')) {
$imageUrl = $processedImage->getPublicUrl(true);
$thumbnail = '<img src="' . $imageUrl . '" ' . 'width="' . $processedImage->getProperty('width') . '" ' . 'height="' . $processedImage->getProperty('height') . '" ' . 'alt="' . htmlspecialchars($altText) . '" ' . 'title="' . htmlspecialchars($altText) . '">';
}
}
}
}
if (!empty($config['appearance']['headerThumbnail']['field']) && $thumbnail) {
$mediaContainer = '<div class="form-irre-header-cell form-irre-header-thumbnail" id="' . $objectId . '_thumbnailcontainer">' . $thumbnail . '</div>';
} else {
$mediaContainer = '<div class="form-irre-header-cell form-irre-header-icon" id="' . $objectId . '_iconcontainer">' . $iconImg . '</div>';
}
$header = $mediaContainer . '
<div class="form-irre-header-cell form-irre-header-body">' . $label . '</div>
<div class="form-irre-header-cell form-irre-header-control t3js-formengine-irre-control">' . $ctrl . '</div>';
return $header;
}
示例13: getIcon
/**
* Creates the icon image tag for record from table and wraps it in a link which will trigger the click menu.
*
* @param string $table Table name
* @param array $row Record array
* @return string HTML for the icon
* @todo Define visibility
*/
public function getIcon($table, $row)
{
// Initialization
$altText = BackendUtility::getRecordIconAltText($row, $table);
$icon = IconUtility::getSpriteIconForRecord($table, $row, array('title' => $altText));
$this->counter++;
// The icon with link
if ($this->getBackendUser()->recordEditAccessInternals($table, $row)) {
$icon = $this->getPageLayoutController()->doc->wrapClickMenuOnIcon($icon, $table, $row['uid']);
}
return $icon;
}
示例14: main
/**
* Creating the module output.
*
* @return void
* @todo Define visibility
*/
public function main()
{
if ($this->page_id) {
// Get record for element:
$elRow = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL($this->table, $this->moveUid);
// Headerline: Icon, record title:
$hline = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($this->table, $elRow, array('id' => 'c-recIcon', 'title' => htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordIconAltText($elRow, $this->table))));
$hline .= \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($this->table, $elRow, TRUE);
// Make-copy checkbox (clicking this will reload the page with the GET var makeCopy set differently):
$hline .= $this->doc->spacer(5);
$onClick = 'window.location.href=\'' . \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('makeCopy' => !$this->makeCopy)) . '\';';
$hline .= $this->doc->spacer(5);
$hline .= '<input type="hidden" name="makeCopy" value="0" />' . '<input type="checkbox" name="makeCopy" id="makeCopy" value="1"' . ($this->makeCopy ? ' checked="checked"' : '') . ' onclick="' . htmlspecialchars($onClick) . '" /> <label for="makeCopy" class="t3-label-valign-top">' . $GLOBALS['LANG']->getLL('makeCopy', 1) . '</label>';
// Add the header-content to the module content:
$this->content .= $this->doc->section('', $hline, FALSE, TRUE);
$this->content .= $this->doc->spacer(20);
// Reset variable to pick up the module content in:
$code = '';
// IF the table is "pages":
if ((string) $this->table == 'pages') {
// Get page record (if accessible):
$pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->page_id, $this->perms_clause);
if (is_array($pageinfo) && $GLOBALS['BE_USER']->isInWebMount($pageinfo['pid'], $this->perms_clause)) {
// Initialize the position map:
$posMap = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('ext_posMap_pages');
$posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move';
// Print a "go-up" link IF there is a real parent page (and if the user has read-access to that page).
if ($pageinfo['pid']) {
$pidPageInfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($pageinfo['pid'], $this->perms_clause);
if (is_array($pidPageInfo)) {
if ($GLOBALS['BE_USER']->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) {
$code .= '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => intval($pageinfo['pid']), 'moveUid' => $this->moveUid))) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-up') . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />';
} else {
$code .= \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $pidPageInfo) . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />';
}
}
}
// Create the position tree:
$code .= $posMap->positionTree($this->page_id, $pageinfo, $this->perms_clause, $this->R_URI);
}
}
// IF the table is "tt_content":
if ((string) $this->table == 'tt_content') {
// First, get the record:
$tt_content_rec = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('tt_content', $this->moveUid);
// ?
if (!$this->input_moveUid) {
$this->page_id = $tt_content_rec['pid'];
}
// Checking if the parent page is readable:
$pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->page_id, $this->perms_clause);
if (is_array($pageinfo) && $GLOBALS['BE_USER']->isInWebMount($pageinfo['pid'], $this->perms_clause)) {
// Initialize the position map:
$posMap = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('ext_posMap_tt_content');
$posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move';
$posMap->cur_sys_language = $this->sys_language;
// Headerline for the parent page: Icon, record title:
$hline = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $pageinfo, array('title' => htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordIconAltText($pageinfo, 'pages'))));
$hline .= \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $pageinfo, TRUE);
// Load SHARED page-TSconfig settings and retrieve column list from there, if applicable:
// SHARED page-TSconfig settings.
$modTSconfig_SHARED = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($this->page_id, 'mod.SHARED');
$colPosArray = \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction('EXT:cms/classes/class.tx_cms_backendlayout.php:TYPO3\\CMS\\Backend\\View\\BackendLayoutView->getColPosListItemsParsed', $this->page_id, $this);
foreach ($colPosArray as $colPos) {
$colPosList .= $colPosList != '' ? ',' . $colPos[1] : $colPos[1];
}
// Removing duplicates, if any
$colPosList = implode(',', array_unique(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $colPosList)));
// Adding parent page-header and the content element columns from position-map:
$code = $hline . '<br />';
$code .= $posMap->printContentElementColumns($this->page_id, $this->moveUid, $colPosList, 1, $this->R_URI);
// Print a "go-up" link IF there is a real parent page (and if the user has read-access to that page).
$code .= '<br />';
$code .= '<br />';
if ($pageinfo['pid']) {
$pidPageInfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($pageinfo['pid'], $this->perms_clause);
if (is_array($pidPageInfo)) {
if ($GLOBALS['BE_USER']->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) {
$code .= '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => intval($pageinfo['pid']), 'moveUid' => $this->moveUid))) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-up') . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />';
} else {
$code .= \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $pidPageInfo) . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />';
}
}
}
// Create the position tree (for pages):
$code .= $posMap->positionTree($this->page_id, $pageinfo, $this->perms_clause, $this->R_URI);
}
}
// Add the $code content as a new section to the module:
$this->content .= $this->doc->section($GLOBALS['LANG']->getLL('selectPositionOfElement'), $code, FALSE, TRUE);
}
// Setting up the buttons and markers for docheader
$docHeaderButtons = $this->getButtons();
$markers['CSH'] = $docHeaderButtons['csh'];
//.........这里部分代码省略.........
示例15: renderForeignRecordHeader
/**
* Renders the HTML header for a foreign record, such as the title, toggle-function, drag'n'drop, etc.
* Later on the command-icons are inserted here.
*
* @param string $parentUid The uid of the parent (embedding) record (uid or NEW...)
* @param string $foreign_table The foreign_table we create a header for
* @param array $rec The current record of that foreign_table
* @param array $config content of $PA['fieldConf']['config']
* @param boolean $isVirtualRecord
* @return string The HTML code of the header
* @todo Define visibility
*/
public function renderForeignRecordHeader($parentUid, $foreign_table, $rec, $config, $isVirtualRecord = FALSE)
{
// Init:
$objectId = $this->inlineNames['object'] . self::Structure_Separator . $foreign_table . self::Structure_Separator . $rec['uid'];
// We need the returnUrl of the main script when loading the fields via AJAX-call (to correct wizard code, so include it as 3rd parameter)
// Pre-Processing:
$isOnSymmetricSide = \TYPO3\CMS\Core\Database\RelationHandler::isOnSymmetricSide($parentUid, $config, $rec);
$hasForeignLabel = !$isOnSymmetricSide && $config['foreign_label'] ? TRUE : FALSE;
$hasSymmetricLabel = $isOnSymmetricSide && $config['symmetric_label'] ? TRUE : FALSE;
// Get the record title/label for a record:
// render using a self-defined user function
if ($GLOBALS['TCA'][$foreign_table]['ctrl']['label_userFunc']) {
$params = array('table' => $foreign_table, 'row' => $rec, 'title' => '', 'isOnSymmetricSide' => $isOnSymmetricSide, 'parent' => array('uid' => $parentUid, 'config' => $config));
// callUserFunction requires a third parameter, but we don't want to give $this as reference!
$null = NULL;
\TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($GLOBALS['TCA'][$foreign_table]['ctrl']['label_userFunc'], $params, $null);
$recTitle = $params['title'];
} elseif ($hasForeignLabel || $hasSymmetricLabel) {
$titleCol = $hasForeignLabel ? $config['foreign_label'] : $config['symmetric_label'];
$foreignConfig = $this->getPossibleRecordsSelectorConfig($config, $titleCol);
// Render title for everything else than group/db:
if ($foreignConfig['type'] != 'groupdb') {
$recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValueExtra($foreign_table, $titleCol, $rec[$titleCol], 0, 0, FALSE);
} else {
// $recTitle could be something like: "tx_table_123|...",
$valueParts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('|', $rec[$titleCol]);
$itemParts = \TYPO3\CMS\Core\Utility\GeneralUtility::revExplode('_', $valueParts[0], 2);
$recTemp = \t3lib_befunc::getRecordWSOL($itemParts[0], $itemParts[1]);
$recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($itemParts[0], $recTemp, FALSE);
}
$recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitlePrep($recTitle);
if (!strcmp(trim($recTitle), '')) {
$recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getNoRecordTitle(TRUE);
}
} else {
$recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($foreign_table, $rec, TRUE);
}
// Renders a thumbnail for the header
if (!empty($config['appearance']['headerThumbnail']['field'])) {
$fieldValue = $rec[$config['appearance']['headerThumbnail']['field']];
$firstElement = array_shift(\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $fieldValue));
$fileUid = array_pop(\TYPO3\CMS\Backend\Utility\BackendUtility::splitTable_Uid($firstElement));
if (!empty($fileUid)) {
$fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFileObject($fileUid);
if ($fileObject) {
$imageSetup = $config['appearance']['headerThumbnail'];
unset($imageSetup['field']);
$imageSetup = array_merge(array('width' => 64, 'height' => 64), $imageSetup);
$imageUrl = $fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, $imageSetup)->getPublicUrl(TRUE);
$thumbnail = '<img src="' . $imageUrl . '" alt="' . htmlspecialchars($recTitle) . '">';
} else {
$thumbnail = FALSE;
}
}
}
$altText = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordIconAltText($rec, $foreign_table);
$iconImg = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($foreign_table, $rec, array('title' => htmlspecialchars($altText), 'id' => $objectId . '_icon'));
$label = '<span id="' . $objectId . '_label">' . $recTitle . '</span>';
$ctrl = $this->renderForeignRecordHeaderControl($parentUid, $foreign_table, $rec, $config, $isVirtualRecord);
$header = '<table>' . '<tr>' . (!empty($config['appearance']['headerThumbnail']['field']) && $thumbnail ? '<td class="t3-form-field-header-inline-thumbnail" id="' . $objectId . '_thumbnailcontainer">' . $thumbnail . '</td>' : '<td class="t3-form-field-header-inline-icon" id="' . $objectId . '_iconcontainer">' . $iconImg . '</td>') . '<td class="t3-form-field-header-inline-summary">' . $label . '</td>' . '<td clasS="t3-form-field-header-inline-ctrl">' . $ctrl . '</td>' . '</tr>' . '</table>';
return $header;
}