本文整理汇总了PHP中TYPO3\CMS\Backend\Utility\BackendUtility::referenceCount方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUtility::referenceCount方法的具体用法?PHP BackendUtility::referenceCount怎么用?PHP BackendUtility::referenceCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Backend\Utility\BackendUtility
的用法示例。
在下文中一共展示了BackendUtility::referenceCount方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: makeEdit
/**
* Creates the edit control section
*
* @param File|Folder $fileOrFolderObject Array with information about the file/directory for which to make the edit control section for the listing.
* @return string HTML-table
*/
public function makeEdit($fileOrFolderObject)
{
$cells = array();
$fullIdentifier = $fileOrFolderObject->getCombinedIdentifier();
// Edit file content (if editable)
if ($fileOrFolderObject instanceof File && $fileOrFolderObject->checkActionPermission('write') && GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], $fileOrFolderObject->getExtension())) {
$url = BackendUtility::getModuleUrl('file_edit', array('target' => $fullIdentifier));
$editOnClick = 'top.content.list_frame.location.href=' . GeneralUtility::quoteJSvalue($url) . '+\'&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;';
$cells['edit'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($editOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.editcontent') . '">' . IconUtility::getSpriteIcon('actions-page-open') . '</a>';
} else {
$cells['edit'] = $this->spaceIcon;
}
if ($fileOrFolderObject instanceof File) {
$fileUrl = $fileOrFolderObject->getPublicUrl(TRUE);
if ($fileUrl) {
$aOnClick = 'return top.openUrlInWindow(' . GeneralUtility::quoteJSvalue($fileUrl) . ', \'WebFile\');';
$cells['view'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($aOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.view') . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
} else {
$cells['view'] = $this->spaceIcon;
}
} else {
$cells['view'] = $this->spaceIcon;
}
// rename the file
if ($fileOrFolderObject->checkActionPermission('rename')) {
$url = BackendUtility::getModuleUrl('file_rename', array('target' => $fullIdentifier));
$renameOnClick = 'top.content.list_frame.location.href = ' . GeneralUtility::quoteJSvalue($url) . '+\'&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;';
$cells['rename'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($renameOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.rename') . '">' . IconUtility::getSpriteIcon('actions-edit-rename') . '</a>';
} else {
$cells['rename'] = $this->spaceIcon;
}
if ($fileOrFolderObject->checkActionPermission('read')) {
$infoOnClick = '';
if ($fileOrFolderObject instanceof Folder) {
$infoOnClick = 'top.launchView( \'_FOLDER\', ' . GeneralUtility::quoteJSvalue($fullIdentifier) . ');return false;';
} elseif ($fileOrFolderObject instanceof File) {
$infoOnClick = 'top.launchView( \'_FILE\', ' . GeneralUtility::quoteJSvalue($fullIdentifier) . ');return false;';
}
$cells['info'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($infoOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.info') . '">' . IconUtility::getSpriteIcon('status-dialog-information') . '</a>';
} else {
$cells['info'] = $this->spaceIcon;
}
// delete the file
if ($fileOrFolderObject->checkActionPermission('delete')) {
$identifier = $fileOrFolderObject->getIdentifier();
if ($fileOrFolderObject instanceof Folder) {
$referenceCountText = BackendUtility::referenceCount('_FILE', $identifier, ' (There are %s reference(s) to this folder!)');
} else {
$referenceCountText = BackendUtility::referenceCount('sys_file', $fileOrFolderObject->getUid(), ' (There are %s reference(s) to this file!)');
}
if ($this->getBackendUser()->jsConfirmation(JsConfirmation::DELETE)) {
$confirmationCheck = 'confirm(' . GeneralUtility::quoteJSvalue(sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:mess.delete'), $fileOrFolderObject->getName()) . $referenceCountText) . ')';
} else {
$confirmationCheck = '1 == 1';
}
$removeOnClick = 'if (' . $confirmationCheck . ') { top.content.list_frame.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('tce_file') . '&file[delete][0][data]=' . rawurlencode($fileOrFolderObject->getCombinedIdentifier()) . '&vC=' . $this->getBackendUser()->veriCode() . BackendUtility::getUrlToken('tceAction') . '&redirect=') . '+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);};';
$cells['delete'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($removeOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete') . '">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
} else {
$cells['delete'] = $this->spaceIcon;
}
// Hook for manipulating edit icons.
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'] as $classData) {
$hookObject = GeneralUtility::getUserObj($classData);
if (!$hookObject instanceof FileListEditIconHookInterface) {
throw new \UnexpectedValueException('$hookObject must implement interface \\TYPO3\\CMS\\Filelist\\FileListEditIconHookInterface', 1235225797);
}
$hookObject->manipulateEditIcons($cells, $this);
}
}
// Compile items into a DIV-element:
return '<div class="btn-group">' . implode('', $cells) . '</div>';
}
示例3: 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;
示例4: FILE_delete
/**
* Creates element for deleting of target
*
* @param string $path Path to the file/directory (target)
* @return array Item array, element in $menuItems
* @internal
* @todo Define visibility
*/
public function FILE_delete($path)
{
$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'), basename($path)) . \TYPO3\CMS\Backend\Utility\BackendUtility::referenceCount('_FILE', $path, ' (There are %s reference(s) to this file!)')) . ')';
} else {
$conf = '1==1';
}
$editOnClick = 'if(' . $loc . ' && ' . $conf . ' ){' . $loc . '.location.href=top.TS.PATH_typo3+\'tce_file.php?redirect=\'+top.rawurlencode(' . $this->frameLocation($loc . '.document') . '.pathname+' . $this->frameLocation($loc . '.document') . '.search)+\'' . '&file[delete][0][data]=' . rawurlencode($path) . '&vC=' . $GLOBALS['BE_USER']->veriCode() . '\';}hideCM();';
return $this->linkItem($this->label('delete'), $this->excludeIcon(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-delete')), $editOnClick . 'return false;');
}
示例5: reference
/**
* 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
*/
function DB_delete($table, $uid, $elInfo)
{
$loc = 'top.content.list_frame';
if ($this->beUser->jsConfirmation(4)) {
$conf = "confirm(" . GeneralUtility::quoteJSvalue(sprintf($this->LANG->sL('LLL:EXT:lang/locallang_core.php:mess.delete'), $elInfo[0]) . BackendUtility::referenceCount($table, $uid, ' (There are %s reference(s) to this record!)')) . ")";
} else {
$conf = '1==1';
}
$editOnClick = 'if(' . $loc . " && " . $conf . " ){" . $loc . ".location.href=top.TS.PATH_typo3+'tce_db.php?redirect='+top.rawurlencode(" . $this->backRef->frameLocation($loc . '.document') . ")+'" . "&cmd[" . $table . '][' . $uid . '][DDdelete]=1&prErr=1&vC=' . $this->beUser->veriCode() . BackendUtility::getUrlToken('tceAction') . "';hideCM();}";
return $this->backRef->linkItem($this->LANG->getLLL('delete', $this->LL), $this->backRef->excludeIcon(IconUtility::getSpriteIcon('actions-edit-delete')), $editOnClick . 'return false;');
}
示例6: FILE_delete
/**
* Creates element for deleting of target
*
* @param string $path Path to the file/directory (target)
* @return array Item array, element in $menuItems
* @internal
*/
public function FILE_delete($path)
{
$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'), basename($path)) . BackendUtility::referenceCount('_FILE', $path, ' ' . $this->languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.referencesToFile'))) . ')';
} else {
$conf = '1==1';
}
$editOnClick = 'if(' . $loc . ' && ' . $conf . ' ){' . $loc . '.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('tce_file') . '&redirect=') . '+top.rawurlencode(' . $this->frameLocation($loc . '.document') . '.pathname+' . $this->frameLocation($loc . '.document') . '.search)+' . GeneralUtility::quoteJSvalue('&file[delete][0][data]=' . rawurlencode($path) . '&vC=' . $this->backendUser->veriCode()) . ';};';
return $this->linkItem($this->label('delete'), $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render(), $editOnClick . 'return false;');
}
示例7: makeEdit
/**
* Creates the edit control section
*
* @param \TYPO3\CMS\Core\Resource\File|\TYPO3\CMS\Core\Resource\Folder $fileOrFolderObject Array with information about the file/directory for which to make the edit control section for the listing.
* @return string HTML-table
* @todo Define visibility
*/
public function makeEdit($fileOrFolderObject)
{
$cells = array();
$fullIdentifier = $fileOrFolderObject->getCombinedIdentifier();
// Edit metadata of file
try {
if (is_a($fileOrFolderObject, 'TYPO3\\CMS\\Core\\Resource\\File') && $fileOrFolderObject->isIndexed() && $fileOrFolderObject->checkActionPermission('write')) {
$metaData = $fileOrFolderObject->_getMetaData();
$data = array('sys_file_metadata' => array($metaData['uid'] => 'edit'));
$editOnClick = BackendUtility::editOnClick(GeneralUtility::implodeArrayForUrl('edit', $data), $GLOBALS['BACK_PATH'], $this->listUrl());
$title = htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.editMetadata'));
$cells['editmetadata'] = '<a href="#" onclick="' . $editOnClick . '" title="' . $title . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
} else {
$cells['editmetadata'] = IconUtility::getSpriteIcon('empty-empty');
}
} catch (\Exception $e) {
$cells['editmetadata'] = IconUtility::getSpriteIcon('empty-empty');
}
// Edit file content (if editable)
if (is_a($fileOrFolderObject, 'TYPO3\\CMS\\Core\\Resource\\File') && $fileOrFolderObject->checkActionPermission('write') && GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], $fileOrFolderObject->getExtension())) {
$editOnClick = 'top.content.list_frame.location.href=top.TS.PATH_typo3+\'file_edit.php?target=' . rawurlencode($fullIdentifier) . '&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;';
$cells['edit'] = '<a href="#" onclick="' . $editOnClick . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.editcontent') . '">' . IconUtility::getSpriteIcon('actions-page-open') . '</a>';
} else {
$cells['edit'] = IconUtility::getSpriteIcon('empty-empty');
}
// rename the file
if ($fileOrFolderObject->checkActionPermission('rename')) {
$renameOnClick = 'top.content.list_frame.location.href = top.TS.PATH_typo3+\'file_rename.php?target=' . rawurlencode($fullIdentifier) . '&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;';
$cells['rename'] = '<a href="#" onclick="' . $renameOnClick . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.rename') . '">' . IconUtility::getSpriteIcon('actions-edit-rename') . '</a>';
} else {
$cells['rename'] = IconUtility::getSpriteIcon('empty-empty');
}
if ($fileOrFolderObject->checkActionPermission('read')) {
if (is_a($fileOrFolderObject, 'TYPO3\\CMS\\Core\\Resource\\Folder')) {
$infoOnClick = 'top.launchView( \'_FOLDER\', \'' . $fullIdentifier . '\');return false;';
} elseif (is_a($fileOrFolderObject, 'TYPO3\\CMS\\Core\\Resource\\File')) {
$infoOnClick = 'top.launchView( \'_FILE\', \'' . $fullIdentifier . '\');return false;';
}
$cells['info'] = '<a href="#" onclick="' . $infoOnClick . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.info') . '">' . IconUtility::getSpriteIcon('status-dialog-information') . '</a>';
} else {
$cells['info'] = IconUtility::getSpriteIcon('empty-empty');
}
// delete the file
if ($fileOrFolderObject->checkActionPermission('delete')) {
$identifier = $fileOrFolderObject->getIdentifier();
if ($fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) {
$referenceCountText = BackendUtility::referenceCount('_FILE', $identifier, ' (There are %s reference(s) to this folder!)');
} else {
$referenceCountText = BackendUtility::referenceCount('sys_file', $fileOrFolderObject->getUid(), ' (There are %s reference(s) to this file!)');
}
if ($GLOBALS['BE_USER']->jsConfirmation(4)) {
$confirmationCheck = 'confirm(' . GeneralUtility::quoteJSvalue(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.delete'), $fileOrFolderObject->getName()) . $referenceCountText) . ')';
} else {
$confirmationCheck = '1 == 1';
}
$removeOnClick = 'if (' . $confirmationCheck . ') { top.content.list_frame.location.href=top.TS.PATH_typo3+\'tce_file.php?file[delete][0][data]=' . rawurlencode($fileOrFolderObject->getCombinedIdentifier()) . '&vC=' . $GLOBALS['BE_USER']->veriCode() . BackendUtility::getUrlToken('tceAction') . '&redirect=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);};';
$cells['delete'] = '<a href="#" onclick="' . htmlspecialchars($removeOnClick) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete') . '">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
} else {
$cells['delete'] = IconUtility::getSpriteIcon('empty-empty');
}
// Hook for manipulating edit icons.
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'])) {
$cells['__fileOrFolderObject'] = $fileOrFolderObject;
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'] as $classData) {
$hookObject = GeneralUtility::getUserObj($classData);
if (!$hookObject instanceof \TYPO3\CMS\Filelist\FileListEditIconHookInterface) {
throw new \UnexpectedValueException('$hookObject must implement interface \\TYPO3\\CMS\\Filelist\\FileListEditIconHookInterface', 1235225797);
}
$hookObject->manipulateEditIcons($cells, $this);
}
unset($cells['__fileOrFolderObject']);
}
// Compile items into a DIV-element:
return ' <!-- EDIT CONTROLS: -->
<div class="typo3-editCtrl">
' . implode('
', $cells) . '
</div>';
}
示例8: 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) {
示例9: renderSupplierRows
/**
* Render supplier row.
*
* @param \mysqli_result $result Result
* @param array $fields Fields
*
* @return string
*/
protected function renderSupplierRows(\mysqli_result $result, array $fields)
{
$language = $this->getLanguageService();
$output = '';
$table = 'tx_commerce_supplier';
while ($row = $this->getDatabaseConnection()->sql_fetch_assoc($result)) {
$refCountMsg = BackendUtility::referenceCount($table, $row['uid'], ' ' . $language->sL('LLL:EXT:lang/locallang_core.xml:labels.referencesToRecord'), $this->getReferenceCount($table, $row['uid']));
$editParams = '&edit[' . $table . '][' . (int) $row['uid'] . ']=edit';
$deleteParams = '&cmd[' . $table . '][' . (int) $row['uid'] . '][delete]=1';
$onClickAction = 'onclick="' . htmlspecialchars(BackendUtility::editOnClick($editParams, $this->getBackPath(), -1)) . '"';
$output .= '<tr><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('deleteWarningSupplier') . ' "' . htmlspecialchars($row['title']) . '" ' . $refCountMsg) . ')) {jumpToUrl(\'' . $this->doc->issueCommand($deleteParams, -1) . '\');} return false;') . '">' . IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $language->getLL('delete', true))) . '</a>';
$output .= '</td>';
foreach ($fields as $field) {
$output .= '<td valign="top" class="bgColor4"><strong>' . htmlspecialchars($row[$field]) . '</strong>';
}
$output .= '</td></tr>';
}
return $output;
}