本文整理汇总了PHP中TYPO3\CMS\Backend\Utility\BackendUtility::translationCount方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUtility::translationCount方法的具体用法?PHP BackendUtility::translationCount怎么用?PHP BackendUtility::translationCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Backend\Utility\BackendUtility
的用法示例。
在下文中一共展示了BackendUtility::translationCount方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tt_content_drawHeader
/**
* Draw the header for a single tt_content element
*
* @param array $row Record array
* @param int $space Amount of pixel space above the header. UNUSED
* @param bool $disableMoveAndNewButtons If set the buttons for creating new elements and moving up and down are not shown.
* @param bool $langMode If set, we are in language mode and flags will be shown for languages
* @param bool $dragDropEnabled If set the move button must be hidden
* @return string HTML table with the record header.
*/
public function tt_content_drawHeader($row, $space = 0, $disableMoveAndNewButtons = false, $langMode = false, $dragDropEnabled = false)
{
$out = '';
// If show info is set...;
if ($this->tt_contentConfig['showInfo'] && $this->getBackendUser()->recordEditAccessInternals('tt_content', $row)) {
// Render control panel for the element:
if ($this->tt_contentConfig['showCommands'] && $this->doEdit) {
// Edit content element:
$params = '&edit[tt_content][' . $this->tt_contentData['nextThree'][$row['uid']] . ']=edit';
$out .= '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, '', GeneralUtility::getIndpEnv('REQUEST_URI') . '#element-tt_content-' . $row['uid'])) . '" title="' . htmlspecialchars($this->nextThree > 1 ? sprintf($this->getLanguageService()->getLL('nextThree'), $this->nextThree) : $this->getLanguageService()->getLL('edit')) . '">' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>';
// Hide element:
$hiddenField = $GLOBALS['TCA']['tt_content']['ctrl']['enablecolumns']['disabled'];
if ($hiddenField && $GLOBALS['TCA']['tt_content']['columns'][$hiddenField] && (!$GLOBALS['TCA']['tt_content']['columns'][$hiddenField]['exclude'] || $this->getBackendUser()->check('non_exclude_fields', 'tt_content:' . $hiddenField))) {
if ($row[$hiddenField]) {
$value = 0;
$label = 'unHide';
} else {
$value = 1;
$label = 'hide';
}
$params = '&data[tt_content][' . ($row['_ORIG_uid'] ? $row['_ORIG_uid'] : $row['uid']) . '][' . $hiddenField . ']=' . $value;
$out .= '<a class="btn btn-default" href="' . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction($params)) . '" title="' . $this->getLanguageService()->getLL($label, true) . '">' . $this->iconFactory->getIcon('actions-edit-' . strtolower($label), Icon::SIZE_SMALL)->render() . '</a>';
}
// Delete
$params = '&cmd[tt_content][' . $row['uid'] . '][delete]=1';
$confirm = $this->getLanguageService()->getLL('deleteWarning') . BackendUtility::translationCount('tt_content', $row['uid'], ' ' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.translationsOfRecord'));
$out .= '<a class="btn btn-default t3js-modal-trigger" href="' . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction($params)) . '"' . ' data-severity="warning"' . ' data-title="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_alt_doc.xlf:label.confirm.delete_record.title')) . '"' . ' data-content="' . htmlspecialchars($confirm) . '" ' . ' data-button-close-text="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:cancel')) . '"' . ' title="' . $this->getLanguageService()->getLL('deleteItem', true) . '">' . $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</a>';
if ($out && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT)) {
$out = '<div class="btn-group btn-group-sm" role="group">' . $out . '</div>';
} else {
$out = '';
}
if (!$disableMoveAndNewButtons) {
$moveButtonContent = '';
$displayMoveButtons = false;
// Move element up:
if ($this->tt_contentData['prev'][$row['uid']]) {
$params = '&cmd[tt_content][' . $row['uid'] . '][move]=' . $this->tt_contentData['prev'][$row['uid']];
$moveButtonContent .= '<a class="btn btn-default" href="' . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction($params)) . '" title="' . $this->getLanguageService()->getLL('moveUp', true) . '">' . $this->iconFactory->getIcon('actions-move-up', Icon::SIZE_SMALL)->render() . '</a>';
if (!$dragDropEnabled) {
$displayMoveButtons = true;
}
} else {
$moveButtonContent .= '<span class="btn btn-default disabled">' . $this->iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
}
// Move element down:
if ($this->tt_contentData['next'][$row['uid']]) {
$params = '&cmd[tt_content][' . $row['uid'] . '][move]= ' . $this->tt_contentData['next'][$row['uid']];
$moveButtonContent .= '<a class="btn btn-default" href="' . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction($params)) . '" title="' . $this->getLanguageService()->getLL('moveDown', true) . '">' . $this->iconFactory->getIcon('actions-move-down', Icon::SIZE_SMALL)->render() . '</a>';
if (!$dragDropEnabled) {
$displayMoveButtons = true;
}
} else {
$moveButtonContent .= '<span class="btn btn-default disabled">' . $this->iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
}
if ($displayMoveButtons) {
$out .= '<div class="btn-group btn-group-sm" role="group">' . $moveButtonContent . '</div>';
}
}
}
}
$additionalIcons = array();
$additionalIcons[] = $this->getIcon('tt_content', $row) . ' ';
$additionalIcons[] = $langMode ? $this->languageFlag($row['sys_language_uid'], false) : '';
// Get record locking status:
if ($lockInfo = BackendUtility::isRecordLocked('tt_content', $row['uid'])) {
$additionalIcons[] = '<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>';
}
// Call stats information hook
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) {
$_params = array('tt_content', $row['uid'], &$row);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef) {
$additionalIcons[] = GeneralUtility::callUserFunction($_funcRef, $_params, $this);
}
}
// Wrap the whole header
// NOTE: end-tag for <div class="t3-page-ce-body"> is in getTable_tt_content()
return '<div class="t3-page-ce-header ' . ($this->isDragAndDropAllowed($row) ? 't3-page-ce-header-draggable t3js-page-ce-draghandle' : '') . '">
<div class="t3-page-ce-header-icons-left">' . implode('', $additionalIcons) . '</div>
<div class="t3-page-ce-header-icons-right">' . ($out ? '<div class="btn-toolbar">' . $out . '</div>' : '') . '</div>
</div>
<div class="t3-page-ce-body">';
}
示例2: DB_delete
/**
* Adding CM element for Delete
*
* @param string $table Table name
* @param integer $uid UID for the current record.
* @param array $elInfo Label for including in the confirmation message, EXT:lang/locallang_core.php:mess.delete
* @return array Item array, element in $menuItems
* @internal
* @todo Define visibility
*/
public function DB_delete($table, $uid, $elInfo)
{
$editOnClick = '';
$loc = 'top.content.list_frame';
if ($GLOBALS['BE_USER']->jsConfirmation(4)) {
$conf = 'confirm(' . $GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.delete'), $elInfo[0]) . \TYPO3\CMS\Backend\Utility\BackendUtility::referenceCount($table, $uid, ' (There are %s reference(s) to this record!)') . \TYPO3\CMS\Backend\Utility\BackendUtility::translationCount($table, $uid, ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.translationsOfRecord'))) . ')';
} else {
$conf = '1==1';
}
$editOnClick = 'if(' . $loc . ' && ' . $conf . ' ){' . $loc . '.location.href=top.TS.PATH_typo3+\'tce_db.php?redirect=\'+top.rawurlencode(' . $this->frameLocation($loc . '.document') . '.pathname+' . $this->frameLocation($loc . '.document') . '.search)+\'' . '&cmd[' . $table . '][' . $uid . '][delete]=1&prErr=1&vC=' . $GLOBALS['BE_USER']->veriCode() . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction') . '\';}hideCM();top.nav.refresh.defer(500, top.nav);';
return $this->linkItem($this->label('delete'), $this->excludeIcon(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-delete')), $editOnClick . 'return false;');
}
示例3: makeControl
//.........这里部分代码省略.........
$cells['moveUp'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $language->getLL('moveUp', TRUE) . '">' . IconUtility::getSpriteIcon('actions-move-up') . '</a>';
} else {
$cells['moveUp'] = $this->spaceIcon;
}
// Down
if ($this->currentTable['next'][$row['uid']]) {
$params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['next'][$row['uid']];
$cells['moveDown'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $language->getLL('moveDown', TRUE) . '">' . IconUtility::getSpriteIcon('actions-move-down') . '</a>';
} else {
$cells['moveDown'] = $this->spaceIcon;
}
} elseif (!$this->table) {
$cells['moveUp'] = $this->spaceIcon;
$cells['moveDown'] = $this->spaceIcon;
}
// "Hide/Unhide" links:
$hiddenField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];
if ($permsEdit && $hiddenField && $GLOBALS['TCA'][$table]['columns'][$hiddenField] && (!$GLOBALS['TCA'][$table]['columns'][$hiddenField]['exclude'] || $backendUser->check('non_exclude_fields', $table . ':' . $hiddenField))) {
if ($row[$hiddenField]) {
$params = '&data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=0';
$cells['hide'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $language->getLL('unHide' . ($table == 'tx_commerce_categories' ? 'Category' : ''), TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-unhide') . '</a>';
} else {
$params = '&data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=1';
$cells['hide'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $language->getLL('hide' . ($table == 'tx_commerce_categories' ? 'Category' : ''), TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-hide') . '</a>';
}
} elseif (!$this->table) {
$cells['hide'] = $this->spaceIcon;
}
// "Delete" link:
if ($table == 'tx_commerce_categories' && $localCalcPerms & 4 || $table != 'tx_commerce_categories' && $this->calcPerms & 16) {
$titleOrig = BackendUtility::getRecordTitle($table, $row, FALSE, TRUE);
$title = GeneralUtility::slashJS(GeneralUtility::fixed_lgd_cs($titleOrig, $this->fixedL), 1);
$params = '&cmd[' . $table . '][' . $row['uid'] . '][delete]=1';
$refCountMsg = BackendUtility::referenceCount($table, $row['uid'], ' ' . $language->sL('LLL:EXT:lang/locallang_core.xml:labels.referencesToRecord'), $this->getReferenceCount($table, $row['uid'])) . BackendUtility::translationCount($table, $row['uid'], ' ' . $language->sL('LLL:EXT:lang/locallang_core.xml:labels.translationsOfRecord'));
$cells['delete'] = '<a href="#" onclick="' . htmlspecialchars('if (confirm(' . $language->JScharCode($language->getLL('deleteWarning') . ' "' . $title . '" ' . $refCountMsg) . ')) {jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');} return false;') . '">' . IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $language->getLL('delete', TRUE))) . '</a>';
} elseif (!$this->table) {
$cells['delete'] = $this->spaceIcon;
}
// "Levels" links: Moving pages into new levels...
// @todo make moving left and right working with custom wizard
if ($permsEdit && $table == 'pages' && !$this->searchLevels) {
// Up (Paste as the page right after the current parent page)
if ($this->calcPerms & 8) {
$params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . -$this->id;
$cells['moveLeft'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $language->getLL('prevLevel', TRUE) . '">' . IconUtility::getSpriteIcon('actions-move-left') . '</a>';
}
// Down (Paste as subpage to the page right above)
if ($this->currentTable['prevUid'][$row['uid']]) {
$localCalcPerms = $backendUser->calcPerms(BackendUtility::getRecord('tx_commerce_categories', $this->currentTable['prevUid'][$row['uid']]));
if ($localCalcPerms & 8) {
$params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['prevUid'][$row['uid']];
$cells['moveRight'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $language->getLL('nextLevel', TRUE) . '">' . IconUtility::getSpriteIcon('actions-move-right') . '</a>';
} else {
$cells['moveRight'] = $this->spaceIcon;
}
} else {
$cells['moveRight'] = $this->spaceIcon;
}
} elseif (!$this->table) {
$cells['moveLeft'] = $this->spaceIcon;
$cells['moveRight'] = $this->spaceIcon;
}
}
}
/**
* Record stat info hooks: Allows to insert HTML
示例4: makeControl
//.........这里部分代码省略.........
$params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['next'][$row['uid']];
$moveDownAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars('return jumpToUrl(' . BackendUtility::getLinkToDataHandlerAction($params, -1) . ');') . '" title="' . $this->getLanguageService()->getLL('moveDown', true) . '">' . $this->iconFactory->getIcon('actions-move-down', Icon::SIZE_SMALL)->render() . '</a>';
} else {
$moveDownAction = $this->spaceIcon;
}
$this->addActionToCellGroup($cells, $moveDownAction, 'moveDown');
}
// "Hide/Unhide" links:
$hiddenField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];
if ($permsEdit && $hiddenField && $GLOBALS['TCA'][$table]['columns'][$hiddenField] && (!$GLOBALS['TCA'][$table]['columns'][$hiddenField]['exclude'] || $this->getBackendUserAuthentication()->check('non_exclude_fields', $table . ':' . $hiddenField))) {
if ($this->isRecordCurrentBackendUser($table, $row)) {
$hideAction = $this->spaceIcon;
} else {
$hideTitle = $this->getLanguageService()->getLL('hide' . ($table == 'pages' ? 'Page' : ''), true);
$unhideTitle = $this->getLanguageService()->getLL('unHide' . ($table == 'pages' ? 'Page' : ''), true);
if ($row[$hiddenField]) {
$params = 'data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=0';
$hideAction = '<a class="btn btn-default t3js-record-hide" data-state="hidden" href="#"' . ' data-params="' . htmlspecialchars($params) . '"' . ' title="' . $unhideTitle . '"' . ' data-toggle-title="' . $hideTitle . '">' . $this->iconFactory->getIcon('actions-edit-unhide', Icon::SIZE_SMALL)->render() . '</a>';
} else {
$params = 'data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=1';
$hideAction = '<a class="btn btn-default t3js-record-hide" data-state="visible" href="#"' . ' data-params="' . htmlspecialchars($params) . '"' . ' title="' . $hideTitle . '"' . ' data-toggle-title="' . $unhideTitle . '">' . $this->iconFactory->getIcon('actions-edit-hide', Icon::SIZE_SMALL)->render() . '</a>';
}
}
$this->addActionToCellGroup($cells, $hideAction, 'hide');
}
// "Delete" link:
if ($permsEdit && ($table === 'pages' && $localCalcPerms & Permission::PAGE_DELETE || $table !== 'pages' && $this->calcPerms & Permission::CONTENT_EDIT)) {
// Check if the record version is in "deleted" state, because that will switch the action to "restore"
if ($this->getBackendUserAuthentication()->workspace > 0 && isset($row['t3ver_state']) && (int) $row['t3ver_state'] === 2) {
$actionName = 'restore';
$refCountMsg = '';
} else {
$actionName = 'delete';
$refCountMsg = BackendUtility::referenceCount($table, $row['uid'], ' ' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.referencesToRecord'), $this->getReferenceCount($table, $row['uid'])) . BackendUtility::translationCount($table, $row['uid'], ' ' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.translationsOfRecord'));
}
if ($this->isRecordCurrentBackendUser($table, $row)) {
$deleteAction = $this->spaceIcon;
} else {
$titleOrig = BackendUtility::getRecordTitle($table, $row, false, true);
$title = GeneralUtility::slashJS(GeneralUtility::fixed_lgd_cs($titleOrig, $this->fixedL), true);
$warningText = $this->getLanguageService()->getLL($actionName . 'Warning') . ' "' . $title . '" ' . '[' . $table . ':' . $row['uid'] . ']' . $refCountMsg;
$params = 'cmd[' . $table . '][' . $row['uid'] . '][delete]=1';
$icon = $this->iconFactory->getIcon('actions-edit-' . $actionName, Icon::SIZE_SMALL)->render();
$linkTitle = $this->getLanguageService()->getLL($actionName, true);
$deleteAction = '<a class="btn btn-default t3js-record-delete" href="#" ' . ' data-l10parent="' . htmlspecialchars($row['l10n_parent']) . '"' . ' data-params="' . htmlspecialchars($params) . '" data-title="' . htmlspecialchars($titleOrig) . '"' . ' data-message="' . htmlspecialchars($warningText) . '" title="' . $linkTitle . '"' . '>' . $icon . '</a>';
}
} else {
$deleteAction = $this->spaceIcon;
}
$this->addActionToCellGroup($cells, $deleteAction, 'delete');
// "Levels" links: Moving pages into new levels...
if ($permsEdit && $table == 'pages' && !$this->searchLevels) {
// Up (Paste as the page right after the current parent page)
if ($this->calcPerms & Permission::PAGE_NEW) {
$params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . -$this->id;
$moveLeftAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars('return jumpToUrl(' . BackendUtility::getLinkToDataHandlerAction($params, -1) . ');') . '" title="' . $this->getLanguageService()->getLL('prevLevel', true) . '">' . $this->iconFactory->getIcon('actions-move-left', Icon::SIZE_SMALL)->render() . '</a>';
$this->addActionToCellGroup($cells, $moveLeftAction, 'moveLeft');
}
// Down (Paste as subpage to the page right above)
if ($this->currentTable['prevUid'][$row['uid']]) {
$localCalcPerms = $this->getBackendUserAuthentication()->calcPerms(BackendUtility::getRecord('pages', $this->currentTable['prevUid'][$row['uid']]));
if ($localCalcPerms & Permission::PAGE_NEW) {
$params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['prevUid'][$row['uid']];
$moveRightAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars('return jumpToUrl(' . BackendUtility::getLinkToDataHandlerAction($params, -1) . ');') . '" title="' . $this->getLanguageService()->getLL('nextLevel', true) . '">' . $this->iconFactory->getIcon('actions-move-right', Icon::SIZE_SMALL)->render() . '</a>';
} else {
$moveRightAction = $this->spaceIcon;
示例5: DB_delete
/**
* Adding CM element for Delete
*
* @param string $table Table name
* @param int $uid UID for the current record.
* @param array $elInfo Label for including in the confirmation message, EXT:lang/locallang_core.xlf:mess.delete
* @return array Item array, element in $menuItems
* @internal
*/
public function DB_delete($table, $uid, $elInfo)
{
$loc = 'top.content.list_frame';
if ($this->backendUser->jsConfirmation(JsConfirmation::DELETE)) {
$conf = 'confirm(' . GeneralUtility::quoteJSvalue(sprintf($this->languageService->sL('LLL:EXT:lang/locallang_core.xlf:mess.delete'), $elInfo[0]) . BackendUtility::referenceCount($table, $uid, ' ' . $this->languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.referencesToRecord')) . BackendUtility::translationCount($table, $uid, ' ' . $this->languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.translationsOfRecord'))) . ')';
} else {
$conf = '1==1';
}
$editOnClick = 'if(' . $loc . ' && ' . $conf . ' ){' . $loc . '.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('tce_db') . '&redirect=') . '+top.rawurlencode(' . $this->frameLocation($loc . '.document') . '.pathname+' . $this->frameLocation($loc . '.document') . '.search)+' . GeneralUtility::quoteJSvalue('&cmd[' . $table . '][' . $uid . '][delete]=1&prErr=1&vC=' . $this->backendUser->veriCode()) . ';};';
if ($table === 'pages') {
$editOnClick .= 'top.nav.refresh.defer(500, top.nav);';
}
return $this->linkItem($this->label('delete'), $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render(), $editOnClick . 'return false;');
}
示例6: tt_content_drawHeader
/**
* Draw the header for a single tt_content element
*
* @param array $row Record array
* @param integer $space Amount of pixel space above the header. UNUSED
* @param boolean $disableMoveAndNewButtons If set the buttons for creating new elements and moving up and down are not shown.
* @param boolean $langMode If set, we are in language mode and flags will be shown for languages
* @param boolean $dragDropEnabled If set the move button must be hidden
* @return string HTML table with the record header.
* @todo Define visibility
*/
public function tt_content_drawHeader($row, $space = 0, $disableMoveAndNewButtons = FALSE, $langMode = FALSE, $dragDropEnabled = FALSE)
{
$out = '';
// If show info is set...;
if ($this->tt_contentConfig['showInfo'] && $this->getBackendUser()->recordEditAccessInternals('tt_content', $row)) {
// Render control panel for the element:
if ($this->tt_contentConfig['showCommands'] && $this->doEdit) {
// Edit content element:
$params = '&edit[tt_content][' . $this->tt_contentData['nextThree'][$row['uid']] . ']=edit';
$out .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, GeneralUtility::getIndpEnv('REQUEST_URI') . '#element-tt_content-' . $row['uid'])) . '" title="' . htmlspecialchars($this->nextThree > 1 ? sprintf($this->getLanguageService()->getLL('nextThree'), $this->nextThree) : $this->getLanguageService()->getLL('edit')) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
// Hide element:
$hiddenField = $GLOBALS['TCA']['tt_content']['ctrl']['enablecolumns']['disabled'];
if ($hiddenField && $GLOBALS['TCA']['tt_content']['columns'][$hiddenField] && (!$GLOBALS['TCA']['tt_content']['columns'][$hiddenField]['exclude'] || $this->getBackendUser()->check('non_exclude_fields', 'tt_content:' . $hiddenField))) {
if ($row[$hiddenField]) {
$value = 0;
$label = 'unHide';
} else {
$value = 1;
$label = 'hide';
}
$params = '&data[tt_content][' . ($row['_ORIG_uid'] ? $row['_ORIG_uid'] : $row['uid']) . '][' . $hiddenField . ']=' . $value;
$out .= '<a href="' . htmlspecialchars($this->getPageLayoutController()->doc->issueCommand($params)) . '" title="' . $this->getLanguageService()->getLL($label, TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-' . strtolower($label)) . '</a>';
}
// Delete
$params = '&cmd[tt_content][' . $row['uid'] . '][delete]=1';
$confirm = GeneralUtility::quoteJSvalue($this->getLanguageService()->getLL('deleteWarning') . BackendUtility::translationCount('tt_content', $row['uid'], ' ' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.translationsOfRecord')));
$out .= '<a href="' . htmlspecialchars($this->getPageLayoutController()->doc->issueCommand($params)) . '" onclick="' . htmlspecialchars('return confirm(' . $confirm . ');') . '" title="' . $this->getLanguageService()->getLL('deleteItem', TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
if (!$disableMoveAndNewButtons) {
$moveButtonContent = '';
$displayMoveButtons = FALSE;
// Move element up:
if ($this->tt_contentData['prev'][$row['uid']]) {
$params = '&cmd[tt_content][' . $row['uid'] . '][move]=' . $this->tt_contentData['prev'][$row['uid']];
$moveButtonContent .= '<a href="' . htmlspecialchars($this->getPageLayoutController()->doc->issueCommand($params)) . '" title="' . $this->getLanguageService()->getLL('moveUp', TRUE) . '">' . IconUtility::getSpriteIcon('actions-move-up') . '</a>';
if (!$dragDropEnabled) {
$displayMoveButtons = TRUE;
}
} else {
$moveButtonContent .= IconUtility::getSpriteIcon('empty-empty');
}
// Move element down:
if ($this->tt_contentData['next'][$row['uid']]) {
$params = '&cmd[tt_content][' . $row['uid'] . '][move]= ' . $this->tt_contentData['next'][$row['uid']];
$moveButtonContent .= '<a href="' . htmlspecialchars($this->getPageLayoutController()->doc->issueCommand($params)) . '" title="' . $this->getLanguageService()->getLL('moveDown', TRUE) . '">' . IconUtility::getSpriteIcon('actions-move-down') . '</a>';
if (!$dragDropEnabled) {
$displayMoveButtons = TRUE;
}
} else {
$moveButtonContent .= IconUtility::getSpriteIcon('empty-empty');
}
if ($displayMoveButtons) {
$out .= '<span class="t3-page-ce-icons-move">' . $moveButtonContent . '</span>';
}
}
}
}
$additionalIcons = array();
$additionalIcons[] = $this->getIcon('tt_content', $row) . ' ';
$additionalIcons[] = $langMode ? $this->languageFlag($row['sys_language_uid'], FALSE) : '';
// Get record locking status:
if ($lockInfo = BackendUtility::isRecordLocked('tt_content', $row['uid'])) {
$additionalIcons[] = '<a href="#" onclick="alert(' . GeneralUtility::quoteJSvalue($lockInfo['msg']) . ');return false;" title="' . htmlspecialchars($lockInfo['msg']) . '">' . IconUtility::getSpriteIcon('status-warning-in-use') . '</a>';
}
// Call stats information hook
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) {
$_params = array('tt_content', $row['uid'], &$row);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef) {
$additionalIcons[] = GeneralUtility::callUserFunction($_funcRef, $_params, $this);
}
}
// Wrap the whole header
// NOTE: end-tag for <div class="t3-page-ce-body"> is in getTable_tt_content()
return '<h4 class="t3-page-ce-header">
<div class="t3-row-header">
<span class="ce-icons-left">' . implode('', $additionalIcons) . '</span>
<span class="ce-icons">
' . $out . '
</span></div>
</h4>
<div class="t3-page-ce-body">';
}
示例7: makeControl
//.........这里部分代码省略.........
if ($this->currentTable['next'][$row['uid']] && $this->showMoveDown === TRUE) {
// Down
$params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['next'][$row['uid']];
$this->lastMoveDownParams = $params;
$cells['moveDown'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL('moveDown', TRUE) . '">' . IconUtility::getSpriteIcon('actions-move-down') . '</a>';
} else {
$cells['moveDown'] = $this->spaceIcon;
}
} elseif (!$this->table) {
$cells['moveUp'] = $this->spaceIcon;
$cells['moveDown'] = $this->spaceIcon;
}
// "Hide/Unhide" links:
$hiddenField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];
if ($permsEdit && $hiddenField && $GLOBALS['TCA'][$table]['columns'][$hiddenField] && (!$GLOBALS['TCA'][$table]['columns'][$hiddenField]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $table . ':' . $hiddenField))) {
if ($row[$hiddenField]) {
$params = '&data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=0';
$cells['hide'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL('unHide' . ($table == 'pages' ? 'Page' : ''), TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-unhide') . '</a>';
} else {
$params = '&data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=1';
$cells['hide'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL('hide' . ($table == 'pages' ? 'Page' : ''), TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-hide') . '</a>';
}
} elseif (!$this->table) {
$cells['hide'] = $this->spaceIcon;
}
// "Delete" link:
if ($table == 'pages' && $localCalcPerms & 4 || $table != 'pages' && $this->calcPerms & 16) {
// Check if the record version is in "deleted" state, because that will switch the action to "restore"
if ($GLOBALS['BE_USER']->workspace > 0 && isset($row['t3ver_state']) && (int) $row['t3ver_state'] === 2) {
$actionName = 'restore';
$refCountMsg = '';
} else {
$actionName = 'delete';
$refCountMsg = BackendUtility::referenceCount($table, $row['uid'], ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.referencesToRecord'), $this->getReferenceCount($table, $row['uid'])) . BackendUtility::translationCount($table, $row['uid'], ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.translationsOfRecord'));
}
$titleOrig = BackendUtility::getRecordTitle($table, $row, FALSE, TRUE);
$title = GeneralUtility::slashJS(GeneralUtility::fixed_lgd_cs($titleOrig, $this->fixedL), 1);
$warningText = GeneralUtility::quoteJSvalue($GLOBALS['LANG']->getLL($actionName . 'Warning') . ' "' . $title . '" ' . $refCountMsg);
$params = '&cmd[' . $table . '][' . $row['uid'] . '][delete]=1';
$onClick = htmlspecialchars('if (confirm(' . $warningText . ')) {jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');} return false;');
$icon = IconUtility::getSpriteIcon('actions-edit-' . $actionName);
$linkTitle = $GLOBALS['LANG']->getLL($actionName, TRUE);
$cells['delete'] = '<a href="#" onclick="' . $onClick . '" title="' . $linkTitle . '">' . $icon . '</a>';
} elseif (!$this->table) {
$cells['delete'] = $this->spaceIcon;
}
// "Levels" links: Moving pages into new levels...
if ($permsEdit && $table == 'pages' && !$this->searchLevels) {
// Up (Paste as the page right after the current parent page)
if ($this->calcPerms & 8) {
$params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . -$this->id;
$cells['moveLeft'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL('prevLevel', TRUE) . '">' . IconUtility::getSpriteIcon('actions-move-left') . '</a>';
}
// Down (Paste as subpage to the page right above)
if ($this->currentTable['prevUid'][$row['uid']]) {
$localCalcPerms = $GLOBALS['BE_USER']->calcPerms(BackendUtility::getRecord('pages', $this->currentTable['prevUid'][$row['uid']]));
if ($localCalcPerms & 8) {
$params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['prevUid'][$row['uid']];
$cells['moveRight'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL('nextLevel', TRUE) . '">' . IconUtility::getSpriteIcon('actions-move-right') . '</a>';
} else {
$cells['moveRight'] = $this->spaceIcon;
}
} else {
$cells['moveRight'] = $this->spaceIcon;
}
} elseif (!$this->table) {