本文整理汇总了PHP中TYPO3\CMS\Backend\Utility\BackendUtility::thumbCode方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUtility::thumbCode方法的具体用法?PHP BackendUtility::thumbCode怎么用?PHP BackendUtility::thumbCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Backend\Utility\BackendUtility
的用法示例。
在下文中一共展示了BackendUtility::thumbCode方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPi1Preview
/**
* Preview of a content element.
*
* @param array $row : Record row of tt_content
* @return string
*/
private function getPi1Preview($row)
{
if ($row['image']) {
$image = \TYPO3\CMS\Backend\Utility\BackendUtility::thumbCode($row, 'tt_content', 'image', $GLOBALS['BACK_PATH']);
}
$previewHtml = '<a href="#" onclick="' . \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick('&edit[tt_content][' . $row['uid'] . ']=edit') . '" />' . $text . '</a>' . $image;
return $previewHtml;
}
示例2: getUserLabelMedia
/**
* Render different label for media elements
*
* @param array $params configuration
* @return void
*/
public function getUserLabelMedia(array &$params)
{
$ll = 'LLL:EXT:news/Resources/Private/Language/locallang_db.xlf:';
$typeInfo = $additionalHtmlContent = '';
$type = $GLOBALS['LANG']->sL($ll . 'tx_news_domain_model_media.type.I.' . $params['row']['type']);
// Add additional info based on type
switch ((int) $params['row']['type']) {
// Image
case Media::MEDIA_TYPE_IMAGE:
$typeInfo .= $this->getTitleFromFields('title,alt,caption,image', $params['row']);
if (!empty($params['row']['image'])) {
$params['row']['image'] = $this->splitFileName($params['row']['image']);
try {
$additionalHtmlContent = '<br />' . BackendUtilityCore::thumbCode($params['row'], 'tx_news_domain_model_media', 'image', $GLOBALS['BACK_PATH'], '', NULL, 0, '', '', FALSE);
} catch (\TYPO3\CMS\Core\Resource\Exception\FolderDoesNotExistException $exception) {
$additionalHtmlContent = '<br />' . htmlspecialchars($params['row']['image']);
}
}
break;
// Audio & Video
// Audio & Video
case Media::MEDIA_TYPE_MULTIMEDIA:
$typeInfo .= $this->getTitleFromFields('caption,multimedia', $params['row']);
break;
// HTML
// HTML
case Media::MEDIA_TYPE_HTML:
// Don't show html value as this could get a XSS
$typeInfo .= $params['row']['caption'];
break;
default:
$typeInfo .= $params['row']['caption'];
}
$title = !empty($typeInfo) ? $type . ': ' . $typeInfo : $type;
$title = htmlspecialchars($title) . $additionalHtmlContent;
// Hook to modify the label, especially useful when using custom media relations
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['mediaLabel'])) {
$params = array('params' => $params, 'title' => $title);
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['mediaLabel'] as $reference) {
$title = GeneralUtility::callUserFunction($reference, $params, $this);
}
}
// Preview
if ($params['row']['showinpreview']) {
$label = htmlspecialchars($GLOBALS['LANG']->sL($ll . 'tx_news_domain_model_media.show'));
$icon = '../' . ExtensionManagementUtility::siteRelPath('news') . 'Resources/Public/Icons/preview.gif';
$title .= ' <img title="' . $label . '" src="' . $icon . '" />';
}
// Show the [No title] if empty
if (empty($title)) {
$title = BackendUtilityCore::getNoRecordTitle(TRUE);
}
$params['title'] = $title;
}
示例3: getThumbCodeUnlinked
/**
* Create thumbnail code for record/field but not linked
*
* @param mixed[] $row Record array
* @param string $table Table (record is from)
* @param string $field Field name for which thumbnail are to be rendered.
* @return string HTML for thumbnails, if any.
*/
public function getThumbCodeUnlinked($row, $table, $field)
{
return BackendUtility::thumbCode($row, $table, $field, '', '', null, 0, '', '', false);
}
示例4: thumbCode
/**
* Create thumbnail code for record/field
*
* @param mixed[] $row Record array
* @param string $table Table (record is from)
* @param string $field Field name for which thumbnail are to be rendered.
* @return string HTML for thumbnails, if any.
*/
public function thumbCode($row, $table, $field)
{
return BackendUtility::thumbCode($row, $table, $field);
}
示例5: previewFieldValue
/**
* Rendering preview output of a field value which is not shown as a form field but just outputted.
*
* @param string $value The value to output
* @param array $config Configuration for field.
* @param string $field Name of field.
* @return string HTML formatted output
*/
protected function previewFieldValue($value, $config, $field = '')
{
if ($config['config']['type'] === 'group' && ($config['config']['internal_type'] === 'file' || $config['config']['internal_type'] === 'file_reference')) {
// Ignore upload folder if internal_type is file_reference
if ($config['config']['internal_type'] === 'file_reference') {
$config['config']['uploadfolder'] = '';
}
$table = 'tt_content';
// Making the array of file items:
$itemArray = GeneralUtility::trimExplode(',', $value, true);
// Showing thumbnails:
$thumbnail = '';
$imgs = array();
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
foreach ($itemArray as $imgRead) {
$imgParts = explode('|', $imgRead);
$imgPath = rawurldecode($imgParts[0]);
$rowCopy = array();
$rowCopy[$field] = $imgPath;
// Icon + click menu:
$absFilePath = GeneralUtility::getFileAbsFileName($config['config']['uploadfolder'] ? $config['config']['uploadfolder'] . '/' . $imgPath : $imgPath);
$fileInformation = pathinfo($imgPath);
$title = $fileInformation['basename'] . ($absFilePath && @is_file($absFilePath)) ? ' (' . GeneralUtility::formatSize(filesize($absFilePath)) . ')' : ' - FILE NOT FOUND!';
$fileIcon = '<span title="' . htmlspecialchars($title) . '">' . $iconFactory->getIconForFileExtension($fileInformation['extension'], Icon::SIZE_SMALL)->render() . '</span>';
$imgs[] = '<span class="text-nowrap">' . BackendUtility::thumbCode($rowCopy, $table, $field, '', 'thumbs.php', $config['config']['uploadfolder'], 0, ' align="middle"') . ($absFilePath ? $this->getControllerDocumentTemplate()->wrapClickMenuOnIcon($fileIcon, $absFilePath, 0, 1, '', '+copy,info,edit,view') : $fileIcon) . $imgPath . '</span>';
}
return implode('<br />', $imgs);
} else {
return nl2br(htmlspecialchars($value));
}
}
示例6: getRowDetails
/**
* Fetch further information to current selected workspace record.
*
* @param \stdClass $parameter
* @return array $data
*/
public function getRowDetails($parameter)
{
$diffReturnArray = array();
$liveReturnArray = array();
/** @var $diffUtility \TYPO3\CMS\Core\Utility\DiffUtility */
$diffUtility = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Utility\DiffUtility::class);
/** @var $parseObj \TYPO3\CMS\Core\Html\RteHtmlParser */
$parseObj = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Html\RteHtmlParser::class);
$liveRecord = BackendUtility::getRecord($parameter->table, $parameter->t3ver_oid);
$versionRecord = BackendUtility::getRecord($parameter->table, $parameter->uid);
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$icon_Live = $iconFactory->getIconForRecord($parameter->table, $liveRecord, Icon::SIZE_SMALL)->render();
$icon_Workspace = $iconFactory->getIconForRecord($parameter->table, $versionRecord, Icon::SIZE_SMALL)->render();
$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) {
if (empty($GLOBALS['TCA'][$parameter->table]['columns'][$fieldName]['config'])) {
continue;
}
// 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;
}
// Gets the TCA configuration for the current field
$configuration = $GLOBALS['TCA'][$parameter->table]['columns'][$fieldName]['config'];
// 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 ($configuration['type'] === 'inline' && $configuration['foreign_table'] === 'sys_file_reference') {
$useThumbnails = false;
if (!empty($configuration['foreign_selector_fieldTcaOverride']['config']['appearance']['elementBrowserAllowed']) && !empty($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'])) {
$fileExtensions = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], true);
$allowedExtensions = GeneralUtility::trimExplode(',', $configuration['foreign_selector_fieldTcaOverride']['config']['appearance']['elementBrowserAllowed'], true);
$differentExtensions = array_diff($allowedExtensions, $fileExtensions);
$useThumbnails = empty($differentExtensions);
}
$liveFileReferences = BackendUtility::resolveFileReferences($parameter->table, $fieldName, $liveRecord, 0);
$versionFileReferences = BackendUtility::resolveFileReferences($parameter->table, $fieldName, $versionRecord, $this->getCurrentWorkspace());
$fileReferenceDifferences = $this->prepareFileReferenceDifferences($liveFileReferences, $versionFileReferences, $useThumbnails);
if ($fileReferenceDifferences === null) {
continue;
}
$diffReturnArray[] = array('field' => $fieldName, 'label' => $fieldTitle, 'content' => $fileReferenceDifferences['differences']);
$liveReturnArray[] = array('field' => $fieldName, 'label' => $fieldTitle, 'content' => $fileReferenceDifferences['live']);
} elseif ((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']);
if ($configuration['type'] == 'group' && $configuration['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' => $diffUtility->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);
if (method_exists($hookObject, 'modifyDifferenceArray')) {
$hookObject->modifyDifferenceArray($parameter, $diffReturnArray, $liveReturnArray, $diffUtility);
}
}
}
$commentsForRecord = $this->getCommentsForRecord($parameter->uid, $parameter->table);
return array('total' => 1, 'data' => array(array('diff' => $diffReturnArray, 'live_record' => $liveReturnArray, 'icon_Live' => $icon_Live, 'icon_Workspace' => $icon_Workspace, 'comments' => $commentsForRecord, 'path_Live' => htmlspecialchars($parameter->path_Live), 'label_Stage' => htmlspecialchars($parameter->label_Stage), 'stage_position' => (int) $stagePosition['position'], 'stage_count' => (int) $stagePosition['count'])));
}
示例7: 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)));
}
示例8: previewFieldValue
/**
* Rendering preview output of a field value which is not shown as a form field but just outputted.
*
* @param string $value The value to output
* @param array $config Configuration for field.
* @param string $field Name of field.
* @return string HTML formatted output
* @todo Define visibility
*/
public function previewFieldValue($value, $config, $field = '')
{
if ($config['config']['type'] === 'group' && ($config['config']['internal_type'] === 'file' || $config['config']['internal_type'] === 'file_reference')) {
// Ignore uploadfolder if internal_type is file_reference
if ($config['config']['internal_type'] === 'file_reference') {
$config['config']['uploadfolder'] = '';
}
$show_thumbs = TRUE;
$table = 'tt_content';
// Making the array of file items:
$itemArray = GeneralUtility::trimExplode(',', $value, TRUE);
// Showing thumbnails:
$thumbsnail = '';
if ($show_thumbs) {
$imgs = array();
foreach ($itemArray as $imgRead) {
$imgP = explode('|', $imgRead);
$imgPath = rawurldecode($imgP[0]);
$rowCopy = array();
$rowCopy[$field] = $imgPath;
// Icon + clickmenu:
$absFilePath = GeneralUtility::getFileAbsFileName($config['config']['uploadfolder'] ? $config['config']['uploadfolder'] . '/' . $imgPath : $imgPath);
$fileInformation = pathinfo($imgPath);
$fileIcon = IconUtility::getSpriteIconForFile($imgPath, array('title' => htmlspecialchars($fileInformation['basename'] . ($absFilePath && @is_file($absFilePath) ? ' (' . GeneralUtility::formatSize(filesize($absFilePath)) . 'bytes)' : ' - FILE NOT FOUND!'))));
$imgs[] = '<span class="nobr">' . BackendUtility::thumbCode($rowCopy, $table, $field, $this->backPath, 'thumbs.php', $config['config']['uploadfolder'], 0, ' align="middle"') . ($absFilePath ? $this->getClickMenu($fileIcon, $absFilePath) : $fileIcon) . $imgPath . '</span>';
}
$thumbsnail = implode('<br />', $imgs);
}
return $thumbsnail;
} else {
return nl2br(htmlspecialchars($value));
}
}
示例9: resourceListForCopy
/**
* Renders HTML table with all available template resources/files in the current rootline that could be copied
*
* @param integer $id The uid of the current page
* @param integer $template_uid The uid of the template record to be rendered (only if more than one template on the current page)
* @return string HTML table with all available template resources/files in the current rootline that could be copied
* @todo Define visibility
*/
public function resourceListForCopy($id, $template_uid)
{
global $tmpl;
$sys_page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
$rootLine = $sys_page->getRootLine($id);
// This generates the constants/config + hierarchy info for the template.
$tmpl->runThroughTemplates($rootLine, $template_uid);
$theResources = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $tmpl->resources, 1);
foreach ($theResources as $k => $v) {
$fI = pathinfo($v);
if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->pObj->textExtensions, strtolower($fI['extension']))) {
$path = PATH_site . $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['uploadfolder'] . '/' . $v;
$thumb = \TYPO3\CMS\Backend\Utility\BackendUtility::thumbCode(array('resources' => $v), 'sys_template', 'resources', $GLOBALS['BACK_PATH'], '');
$out .= '<tr><td' . $bgcol . ' nowrap="nowrap">' . $v . ' </td><td' . $bgcol . ' nowrap="nowrap"> ' . \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize(@filesize($path)) . ' </td><td' . $bgcol . '>' . trim($thumb) . '</td><td><input type="Checkbox" name="data[makecopy_resource][' . $k . ']" value="' . htmlspecialchars($v) . '"></td></tr>';
}
}
$out = $out ? '<table border="0" cellpadding="0" cellspacing="0">' . $out . '</table>' : '';
return $out;
}
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:27,代码来源:TypoScriptTemplateInformationModuleFunctionController.php
示例10: thumbCode
/**
* Create thumbnail code for record/field
*
* @param array $row Record array
* @param string $table Table (record is from)
* @param string $field Field name for which thumbsnail are to be rendered.
* @return string HTML for thumbnails, if any.
* @todo Define visibility
*/
public function thumbCode($row, $table, $field)
{
return \TYPO3\CMS\Backend\Utility\BackendUtility::thumbCode($row, $table, $field, $this->backPath);
}
示例11: getThumbCodeUnlinked
/**
* Create thumbnail code for record/field but not linked
*
* @param mixed[] $row Record array
* @param string $table Table (record is from)
* @param string $field Field name for which thumbnail are to be rendered.
* @return string HTML for thumbnails, if any.
*/
public function getThumbCodeUnlinked($row, $table, $field)
{
return BackendUtility::thumbCode($row, $table, $field, $this->backPath, '', NULL, 0, '', '', FALSE);
}
示例12: renderAttributeRows
/**
* Render attribute rows.
*
* @param \mysqli_result $result Result
*
* @return string
*/
protected function renderAttributeRows(\mysqli_result $result)
{
$language = $this->getLanguageService();
$database = $this->getDatabaseConnection();
/**
* Record list.
*
* @var \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList $recordList
*/
$recordList = GeneralUtility::makeInstance('TYPO3\\CMS\\Recordlist\\RecordList\\DatabaseRecordList');
$recordList->backPath = $this->getBackPath();
$recordList->initializeLanguages();
$output = '';
$table = 'tx_commerce_attributes';
while ($attribute = $database->sql_fetch_assoc($result)) {
$refCountMsg = BackendUtility::referenceCount($table, $attribute['uid'], ' ' . $language->sL('LLL:EXT:lang/locallang_core.xml:labels.referencesToRecord'), $this->getReferenceCount($table, $attribute['uid']));
$editParams = '&edit[' . $table . '][' . (int) $attribute['uid'] . ']=edit';
$deleteParams = '&cmd[' . $table . '][' . (int) $attribute['uid'] . '][delete]=1';
$output .= '<tr><td class="bgColor4" align="center" valign="top"> ' . BackendUtility::thumbCode($attribute, 'tx_commerce_attributes', 'icon', $this->getBackPath()) . '</td>';
if ($attribute['internal_title']) {
$output .= '<td valign="top" class="bgColor4"><strong>' . htmlspecialchars($attribute['internal_title']) . '</strong> (' . htmlspecialchars($attribute['title']) . ')';
} else {
$output .= '<td valign="top" class="bgColor4"><strong>' . htmlspecialchars($attribute['title']) . '</strong>';
}
$catCount = $this->fetchRelationCount('tx_commerce_categories_attributes_mm', $attribute['uid']);
$proCount = $this->fetchRelationCount('tx_commerce_products_attributes_mm', $attribute['uid']);
// Select language versions
$resLocalVersion = $this->fetchAttributeTranslation($attribute['uid']);
if ($database->sql_num_rows($resLocalVersion)) {
$output .= '<table >';
while ($localAttributes = $database->sql_fetch_assoc($resLocalVersion)) {
$output .= '<tr><td> ';
$output .= '</td><td>';
if ($localAttributes['internal_title']) {
$output .= htmlspecialchars($localAttributes['internal_title']) . ' (' . htmlspecialchars($localAttributes['title']) . ')';
} else {
$output .= htmlspecialchars($localAttributes['title']);
}
$output .= '</td><td>';
$output .= $recordList->languageFlag($localAttributes['sys_language_uid']);
$output .= '</td></tr>';
}
$output .= '</table>';
}
$output .= '<br />' . $language->getLL('usage');
$output .= ' <strong>' . $language->getLL('categories') . '</strong>: ' . $catCount;
$output .= ' <strong>' . $language->getLL('products') . '</strong>: ' . $proCount;
$output .= '</td>';
$onClickAction = 'onclick="' . htmlspecialchars(BackendUtility::editOnClick($editParams, $this->getBackPath(), -1)) . '"';
$output .= '<td><a href="#" ' . $onClickAction . '>' . IconUtility::getSpriteIcon('actions-document-open', array('title' => $language->getLL('edit', true))) . '</a>';
$output .= '<a href="#" onclick="' . htmlspecialchars('if (confirm(' . $language->JScharCode($language->getLL('deleteWarningManufacturer') . ' "' . $attribute['title'] . '" ' . $refCountMsg) . ')) {jumpToUrl(\'' . $this->doc->issueCommand($deleteParams, -1) . '\');} return false;') . '">' . IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $language->getLL('delete', true))) . '</a>';
$output .= '</td><td>';
if ($attribute['has_valuelist'] == 1) {
$valueRes = $database->exec_SELECTquery('*', 'tx_commerce_attribute_values', 'attributes_uid = ' . (int) $attribute['uid'] . ' AND hidden = 0 AND deleted = 0', '', 'sorting');
if ($database->sql_num_rows($valueRes)) {
$output .= '<table border="0">';
while ($value = $database->sql_fetch_assoc($valueRes)) {
$output .= '<tr><td>' . htmlspecialchars($value['value']) . '</td></tr>';
}
$output .= '</table>';
} else {
$output .= $language->getLL('no_values');
}
} else {
$output .= $language->getLL('no_valuelist');
}
$output .= '</td></tr>';
}
return $output;
}
示例13: dataFields
/**
* Adds content to all data fields in $out array
*
* @param array Array of fields to display. Each field name has a special feature which is that the field name can be specified as more field names. Eg. "field1,field2;field3". Field 2 and 3 will be shown in the same cell of the table separated by <br /> while field1 will have its own cell.
* @param string Table name
* @param array Record array
* @param array Array to which the data is added
* @param [type] $noEdit: ...
* @return array $out array returned after processing.
* @see makeOrdinaryList()
*/
function dataFields($fieldArr, $table, $row, $out = array(), $noEdit = FALSE)
{
global $TCA;
// Check table validity:
if ($TCA[$table]) {
$thumbsCol = $TCA[$table]['ctrl']['thumbnail'];
$url = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'index.php';
$thumbsize = $this->lTSprop['imageSize'];
// Traverse fields:
foreach ($fieldArr as $fieldName) {
if ($TCA[$table]['columns'][$fieldName]) {
// Each field has its own cell (if configured in TCA)
if ($fieldName == $thumbsCol) {
// If the column is a thumbnail column:
if ($this->thumbs) {
$val = \TYPO3\CMS\Backend\Utility\BackendUtility::thumbCode($row, $table, $fieldName, $this->backPath, $this->thumbScript, NULL, 0, '', $thumbsize);
} else {
$val = str_replace(',', ', ', basename($row[$fieldName]));
}
} else {
// ... otherwise just render the output:
$val = nl2br(htmlspecialchars(trim(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs(\TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValue($table, $fieldName, $row[$fieldName], 0, 0, 0, $row['uid']), 250))));
if ($this->lTSprop['clickTitleMode'] == 'view') {
if ($this->singlePid) {
$val = $this->linkSingleView($url, $val, $row['uid']);
}
} elseif ($this->lTSprop['clickTitleMode'] == 'edit') {
if (!$noEdit) {
$params = '&edit[' . $table . '][' . $row['uid'] . ']=edit';
$lTitle = ' title="' . $GLOBALS['LANG']->getLL('edit', 1) . '"';
$val = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick($params, $this->backPath, $this->returnUrl)) . '"' . $lTitle . '>' . $val . '</a>';
}
}
}
$out[$fieldName] = $val;
} else {
// Each field is separated by <br /> and shown in the same cell (If not a TCA field, then explode the field name with ";" and check each value there as a TCA configured field)
$theFields = explode(';', $fieldName);
// Traverse fields, separated by ";" (displayed in a single cell).
foreach ($theFields as $fName2) {
if ($TCA[$table]['columns'][$fName2]) {
$out[$fieldName] .= '<b>' . $GLOBALS['LANG']->sL($TCA[$table]['columns'][$fName2]['label'], 1) . '</b>' . ' ' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs(\TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValue($table, $fName2, $row[$fName2], 0, 0, 0, $row['uid']), 25)) . '<br />';
}
}
}
// If no value, add a nbsp.
if (!$out[$fieldName]) {
$out[$fieldName] = ' ';
}
// Wrap in dimmed-span tags if record is "disabled"
if ($this->isDisabled($table, $row)) {
$out[$fieldName] = $GLOBALS['TBE_TEMPLATE']->dfw($out[$fieldName]);
}
}
}
return $out;
}