本文整理匯總了PHP中TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle方法的典型用法代碼示例。如果您正苦於以下問題:PHP BackendUtility::getRecordTitle方法的具體用法?PHP BackendUtility::getRecordTitle怎麽用?PHP BackendUtility::getRecordTitle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TYPO3\CMS\Backend\Utility\BackendUtility
的用法示例。
在下文中一共展示了BackendUtility::getRecordTitle方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: main
function main(&$backRef, $menuItems, $tableID, $srcId)
{
$this->backRef = $backRef;
$this->beUser = $GLOBALS['BE_USER'];
$this->LANG = $GLOBALS['LANG'];
$this->includeLocalLang();
if (($tableID == 'dragDrop_tt_news_cat' || $tableID == 'tt_news_cat_CM') && $srcId) {
$table = 'tt_news_cat';
$rec = BackendUtility::getRecordWSOL($table, $srcId);
// fetch page record to get editing permissions
$lCP = $this->beUser->calcPerms(BackendUtility::getRecord('pages', $rec['pid']));
$doEdit = $lCP & 16;
// if ($doEdit && $tableID == 'dragDrop_tt_news_cat') {
// $dstId = intval(GeneralUtility::_GP('dstId'));
// $menuItems['moveinto'] = $this->dragDrop_moveCategory($srcId,$dstId);
// $menuItems['copyinto'] = $this->dragDrop_copyCategory($srcId,$dstId);
// }
if ($tableID == 'tt_news_cat_CM') {
$menuItems = array();
if ($doEdit) {
$menuItems['edit'] = $this->DB_edit($table, $srcId);
$menuItems['new'] = $this->DB_new($table, $rec);
$menuItems['newsub'] = $this->DB_new($table, $rec, true);
}
$menuItems['info'] = $this->backRef->DB_info($table, $srcId);
if ($doEdit) {
$menuItems['hide'] = $this->DB_hideUnhide($table, $rec, 'hidden');
$elInfo = array(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle('tt_news_cat', $rec), $this->beUser->uc['titleLen']));
$menuItems['spacer2'] = 'spacer';
$menuItems['delete'] = $this->DB_delete($table, $srcId, $elInfo);
}
}
}
return $menuItems;
}
示例2: indexAction
/**
* Renders the review module user dependent with all workspaces.
* The module will show all records of one workspace.
*
* @return void
*/
public function indexAction()
{
/** @var WorkspaceService $wsService */
$wsService = GeneralUtility::makeInstance(WorkspaceService::class);
$this->view->assign('showGrid', !($GLOBALS['BE_USER']->workspace === 0 && !$GLOBALS['BE_USER']->isAdmin()));
$this->view->assign('showAllWorkspaceTab', true);
$this->view->assign('pageUid', GeneralUtility::_GP('id'));
if (GeneralUtility::_GP('id')) {
$pageRecord = BackendUtility::getRecord('pages', GeneralUtility::_GP('id'));
$this->view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation($pageRecord);
$this->view->assign('pageTitle', BackendUtility::getRecordTitle('pages', $pageRecord));
}
$this->view->assign('showLegend', !($GLOBALS['BE_USER']->workspace === 0 && !$GLOBALS['BE_USER']->isAdmin()));
$wsList = $wsService->getAvailableWorkspaces();
$activeWorkspace = $GLOBALS['BE_USER']->workspace;
$performWorkspaceSwitch = false;
// Only admins see multiple tabs, we decided to use it this
// way for usability reasons. Regular users might be confused
// by switching workspaces with the tabs in a module.
if (!$GLOBALS['BE_USER']->isAdmin()) {
$wsCur = array($activeWorkspace => true);
$wsList = array_intersect_key($wsList, $wsCur);
} else {
if ((string) GeneralUtility::_GP('workspace') !== '') {
$switchWs = (int) GeneralUtility::_GP('workspace');
if (in_array($switchWs, array_keys($wsList)) && $activeWorkspace != $switchWs) {
$activeWorkspace = $switchWs;
$GLOBALS['BE_USER']->setWorkspace($activeWorkspace);
$performWorkspaceSwitch = true;
BackendUtility::setUpdateSignal('updatePageTree');
} elseif ($switchWs == WorkspaceService::SELECT_ALL_WORKSPACES) {
$this->redirect('fullIndex');
}
}
}
$this->pageRenderer->addInlineSetting('Workspaces', 'isLiveWorkspace', (int) $GLOBALS['BE_USER']->workspace === 0);
$this->pageRenderer->addInlineSetting('Workspaces', 'workspaceTabs', $this->prepareWorkspaceTabs($wsList, $activeWorkspace));
$this->pageRenderer->addInlineSetting('Workspaces', 'activeWorkspaceId', $activeWorkspace);
$this->pageRenderer->addInlineSetting('FormEngine', 'moduleUrl', BackendUtility::getModuleUrl('record_edit'));
$this->view->assign('performWorkspaceSwitch', $performWorkspaceSwitch);
$this->view->assign('workspaceList', $wsList);
$this->view->assign('activeWorkspaceUid', $activeWorkspace);
$this->view->assign('activeWorkspaceTitle', WorkspaceService::getWorkspaceTitle($activeWorkspace));
if ($wsService->canCreatePreviewLink(GeneralUtility::_GP('id'), $activeWorkspace)) {
$buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
$iconFactory = $this->view->getModuleTemplate()->getIconFactory();
$showButton = $buttonBar->makeLinkButton()->setHref('#')->setOnClick('TYPO3.Workspaces.Actions.generateWorkspacePreviewLinksForAllLanguages();return false;')->setTitle($this->getLanguageService()->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:tooltip.generatePagePreview'))->setIcon($iconFactory->getIcon('module-workspaces-action-preview-link', Icon::SIZE_SMALL));
$buttonBar->addButton($showButton);
}
$this->view->assign('showPreviewLink', $wsService->canCreatePreviewLink(GeneralUtility::_GP('id'), $activeWorkspace));
$GLOBALS['BE_USER']->setAndSaveSessionData('tx_workspace_activeWorkspace', $activeWorkspace);
}
示例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: transform
/**
* Transforms the rows for the deleted Records into the Array View necessary for ExtJS Ext.data.ArrayReader
*
* @param array $rows Array with table as key and array with all deleted rows
* @param integer $totalDeleted: Number of deleted records in total, for PagingToolbar
* @return string JSON Array
*/
public function transform($deletedRowsArray, $totalDeleted)
{
$total = 0;
$jsonArray = array('rows' => array());
// iterate
if (is_array($deletedRowsArray) && count($deletedRowsArray) > 0) {
foreach ($deletedRowsArray as $table => $rows) {
$total += count($deletedRowsArray[$table]);
foreach ($rows as $row) {
$backendUser = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('be_users', $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'username', '', FALSE);
$jsonArray['rows'][] = array('uid' => $row['uid'], 'pid' => $row['pid'], 'table' => $table, 'crdate' => \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['crdate']]), 'tstamp' => \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['tstamp']]), 'owner' => htmlspecialchars($backendUser['username']), 'owner_uid' => $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'tableTitle' => \TYPO3\CMS\Recycler\Utility\RecyclerUtility::getUtf8String($GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['ctrl']['title'])), 'title' => htmlspecialchars(\TYPO3\CMS\Recycler\Utility\RecyclerUtility::getUtf8String(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($table, $row))), 'path' => \TYPO3\CMS\Recycler\Utility\RecyclerUtility::getRecordPath($row['pid']));
}
}
}
$jsonArray['total'] = $totalDeleted;
return json_encode($jsonArray);
}
示例5: users
/**
* Prepares the list of frontend users.
*
* @param array $params
* @param object $pObj
*/
public function users(array &$params, $pObj)
{
if (GeneralUtility::inList('be_groups,fe_groups', $params['table'])) {
$databaseConnection = $this->getDatabaseConnection();
$userTable = $params['table'] === 'be_groups' ? 'be_users' : 'fe_users';
/** @var \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRecordList $recordList */
$recordList = GeneralUtility::makeInstance('TYPO3\\CMS\\Recordlist\\RecordList\\AbstractDatabaseRecordList');
$recordList->start(0, $userTable, 0);
$queryParts = $recordList->makeQueryArray($userTable, 0);
$queryParts['WHERE'] = '1=1' . BackendUtility::deleteClause($userTable);
$result = $databaseConnection->exec_SELECT_queryArray($queryParts);
while (($row = $databaseConnection->sql_fetch_assoc($result)) !== FALSE) {
$label = BackendUtility::getRecordTitle($userTable, $row);
$params['items'][] = array($label, $row['uid']);
}
$databaseConnection->sql_free_result($result);
}
}
示例6: indexAction
/**
* Renders the review module user dependent with all workspaces.
* The module will show all records of one workspace.
*
* @return void
*/
public function indexAction()
{
$wsService = GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Service\WorkspaceService::class);
$this->view->assign('showGrid', !($GLOBALS['BE_USER']->workspace === 0 && !$GLOBALS['BE_USER']->isAdmin()));
$this->view->assign('showAllWorkspaceTab', TRUE);
$this->view->assign('pageUid', GeneralUtility::_GP('id'));
if (GeneralUtility::_GP('id')) {
$pageRecord = BackendUtility::getRecord('pages', GeneralUtility::_GP('id'));
$this->view->assign('pageTitle', BackendUtility::getRecordTitle('pages', $pageRecord));
}
$this->view->assign('showLegend', !($GLOBALS['BE_USER']->workspace === 0 && !$GLOBALS['BE_USER']->isAdmin()));
$wsList = $wsService->getAvailableWorkspaces();
$activeWorkspace = $GLOBALS['BE_USER']->workspace;
$performWorkspaceSwitch = FALSE;
// Only admins see multiple tabs, we decided to use it this
// way for usability reasons. Regular users might be confused
// by switching workspaces with the tabs in a module.
if (!$GLOBALS['BE_USER']->isAdmin()) {
$wsCur = array($activeWorkspace => TRUE);
$wsList = array_intersect_key($wsList, $wsCur);
} else {
if ((string) GeneralUtility::_GP('workspace') !== '') {
$switchWs = (int) GeneralUtility::_GP('workspace');
if (in_array($switchWs, array_keys($wsList)) && $activeWorkspace != $switchWs) {
$activeWorkspace = $switchWs;
$GLOBALS['BE_USER']->setWorkspace($activeWorkspace);
$performWorkspaceSwitch = TRUE;
BackendUtility::setUpdateSignal('updatePageTree');
} elseif ($switchWs == WorkspaceService::SELECT_ALL_WORKSPACES) {
$this->redirect('fullIndex');
}
}
}
$this->pageRenderer->addInlineSetting('Workspaces', 'isLiveWorkspace', (int) $GLOBALS['BE_USER']->workspace === 0 ? TRUE : FALSE);
$this->pageRenderer->addInlineSetting('Workspaces', 'workspaceTabs', $this->prepareWorkspaceTabs($wsList, $activeWorkspace));
$this->pageRenderer->addInlineSetting('Workspaces', 'activeWorkspaceId', $activeWorkspace);
$this->pageRenderer->addInlineSetting('FormEngine', 'moduleUrl', BackendUtility::getModuleUrl('record_edit'));
$this->view->assign('performWorkspaceSwitch', $performWorkspaceSwitch);
$this->view->assign('workspaceList', $wsList);
$this->view->assign('activeWorkspaceUid', $activeWorkspace);
$this->view->assign('activeWorkspaceTitle', WorkspaceService::getWorkspaceTitle($activeWorkspace));
$this->view->assign('showPreviewLink', $wsService->canCreatePreviewLink(GeneralUtility::_GP('id'), $activeWorkspace));
$GLOBALS['BE_USER']->setAndSaveSessionData('tx_workspace_activeWorkspace', $activeWorkspace);
}
示例7: transform
/**
* Transforms the rows for the deleted records
*
* @param array $deletedRowsArray Array with table as key and array with all deleted rows
* @param int $totalDeleted Number of deleted records in total
* @return string JSON array
*/
public function transform($deletedRowsArray, $totalDeleted)
{
$total = 0;
$jsonArray = array('rows' => array());
if (is_array($deletedRowsArray)) {
$lang = $this->getLanguageService();
$backendUser = $this->getBackendUser();
foreach ($deletedRowsArray as $table => $rows) {
$total += count($deletedRowsArray[$table]);
foreach ($rows as $row) {
$pageTitle = $this->getPageTitle((int) $row['pid']);
$backendUser = BackendUtility::getRecord('be_users', $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'username', '', FALSE);
$jsonArray['rows'][] = array('uid' => $row['uid'], 'pid' => $row['pid'], 'icon' => IconUtility::getSpriteIconForRecord($table, $row), 'pageTitle' => RecyclerUtility::getUtf8String($pageTitle), 'table' => $table, 'crdate' => BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['crdate']]), 'tstamp' => BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['tstamp']]), 'owner' => htmlspecialchars($backendUser['username']), 'owner_uid' => $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'tableTitle' => RecyclerUtility::getUtf8String($lang->sL($GLOBALS['TCA'][$table]['ctrl']['title'])), 'title' => htmlspecialchars(RecyclerUtility::getUtf8String(BackendUtility::getRecordTitle($table, $row))), 'path' => RecyclerUtility::getRecordPath($row['pid']));
}
}
}
$jsonArray['total'] = $totalDeleted;
return $jsonArray;
}
示例8: transform
/**
* Transforms the rows for the deleted records
*
* @param array $deletedRowsArray Array with table as key and array with all deleted rows
* @param int $totalDeleted Number of deleted records in total
* @return string JSON array
*/
public function transform($deletedRowsArray, $totalDeleted)
{
$total = 0;
$jsonArray = array('rows' => array());
if (is_array($deletedRowsArray)) {
$lang = $this->getLanguageService();
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
foreach ($deletedRowsArray as $table => $rows) {
$total += count($deletedRowsArray[$table]);
foreach ($rows as $row) {
$pageTitle = $this->getPageTitle((int) $row['pid']);
$backendUser = BackendUtility::getRecord('be_users', $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'username', '', false);
$jsonArray['rows'][] = array('uid' => $row['uid'], 'pid' => $row['pid'], 'icon' => $iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render(), 'pageTitle' => $pageTitle, 'table' => $table, 'crdate' => BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['crdate']]), 'tstamp' => BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['tstamp']]), 'owner' => htmlspecialchars($backendUser['username']), 'owner_uid' => $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'tableTitle' => $lang->sL($GLOBALS['TCA'][$table]['ctrl']['title']), 'title' => htmlspecialchars(BackendUtility::getRecordTitle($table, $row)), 'path' => RecyclerUtility::getRecordPath($row['pid']));
}
}
}
$jsonArray['total'] = $totalDeleted;
return $jsonArray;
}
示例9: main
/**
* Main method
*
* @param CLickMenu $backRef
* @param array $menuItems
* @param string $table
* @param int $uid
*
* @return array
*/
public function main($backRef, array $menuItems, $table = '', $uid = 0)
{
if ($table === 'tt_content') {
$this->setLanguageService($GLOBALS['LANG']);
// add "paste reference after" if user is allowed to use CType shortcut
if ($this->getBackendUser()->checkAuthMode('tt_content', 'CType', 'shortcut', 'explicitAllow')) {
if ($menuItems['pasteafter']) {
unset($menuItems['pasteafter']);
$selItem = $backRef->clipObj->getSelectedRecord();
$targetItem = BackendUtility::getRecordRaw('tt_content', 'uid = ' . $uid, 'colPos,tx_gridelements_container,tx_gridelements_columns');
$elInfo = array(GeneralUtility::fixed_lgd_cs($selItem['_RECORD_TITLE'], $this->getBackendUser()->uc['titleLen']), $backRef->root ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] : GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $backRef->rec), $this->getBackendUser()->uc['titleLen']), $backRef->clipObj->currentMode());
$menuItems['pasteafter'] = $this->DB_paste($backRef, $table, -$uid, 'after', $elInfo, $targetItem, false);
if ($backRef->clipObj->currentMode() === 'copy') {
$menuItems['pastereference'] = $this->DB_paste($backRef, $table, -$uid, 'after', $elInfo, $targetItem, true);
}
}
}
}
return $menuItems;
}
示例10: linkWrapItems
/**
* Returns the title of a record (from table $table) with the proper link around (that is for "pages"-records a link to the level of that record)
*
* @param string $table Table name
* @param integer $uid UID
* @param string $title Title string
* @param array $row Records array (from table name)
* @return string
*/
public function linkWrapItems($table, $uid, $title, $row)
{
// if we handle translation records, make sure that we refer to the localisation parent with their uid
if (is_array($GLOBALS['TCA'][$table]['ctrl']) && array_key_exists('transOrigPointerField', $GLOBALS['TCA'][$table]['ctrl'])) {
$transOrigPointerField = $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'];
if (\TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($row[$transOrigPointerField]) > 0) {
$uid = $row[$transOrigPointerField];
}
}
$currentImage = '';
if ($this->browselistObj->curUrlInfo['recordTable'] === $table && $this->browselistObj->curUrlInfo['recordUid'] === $uid) {
$currentImage = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/blinkarrow_right.gif', 'width="5" height="9"') . ' class="c-blinkArrowL" alt="" />';
}
$title = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($table, $row, FALSE, TRUE);
if (@$this->browselistObj->mode === 'rte') {
//used in RTE mode:
$aOnClick = 'return link_spec(\'' . $this->linkHandler . ':' . $table . ':' . $uid . '\');';
} else {
//used in wizard mode
$aOnClick = 'return link_folder(\'' . $this->linkHandler . ':' . $table . ':' . $uid . '\');';
}
return '<a href="#" onclick="' . $aOnClick . '">' . $title . $currentImage . '</a>';
}
示例11: renderModule
/**
* Rendering the information
*
* @param BrowseTreeView $tree The Page tree data
*
* @return string HTML for the information table.
*/
protected function renderModule(BrowseTreeView $tree)
{
$rows = [];
$cache = CacheUtility::getCache();
foreach ($tree->tree as $row) {
$cacheEntries = $cache->getByTag('sfc_pageId_' . $row['row']['uid']);
if ($cacheEntries) {
$isFirst = true;
foreach ($cacheEntries as $identifier => $info) {
$cell = ['uid' => $row['row']['uid'], 'title' => $isFirst ? $row['HTML'] . BackendUtility::getRecordTitle('pages', $row['row'], true) : $row['HTML_depthData'], 'identifier' => $identifier, 'info' => $info, 'depthData' => $row['depthData']];
$isFirst = false;
$rows[] = $cell;
}
} else {
$cell = ['uid' => $row['row']['uid'], 'title' => $row['HTML'] . BackendUtility::getRecordTitle('pages', $row['row'], true), 'depthData' => $row['depthData']];
$rows[] = $cell;
}
}
/** @var StandaloneView $renderer */
$renderer = GeneralUtility::makeInstance(StandaloneView::class);
$renderer->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:nc_staticfilecache/Resources/Private/Templates/Module.html'));
$renderer->assignMultiple(['requestUri' => GeneralUtility::getIndpEnv('REQUEST_URI'), 'rows' => $rows, 'pageId' => $this->pageId]);
return $renderer->render();
}
示例12: notifyStageChange
//.........這裏部分代碼省略.........
foreach ($rows as $dat) {
$data = unserialize($dat['log_data']);
$emails = $this->getEmailsForStageChangeNotification($dat['userid'], TRUE) + $emails;
if ($data['stage'] == 1) {
break;
}
}
}
break;
case 0:
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['members']);
break;
default:
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers'], TRUE);
}
break;
case 10:
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers'], TRUE);
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['reviewers']) + $emails;
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['members']) + $emails;
break;
default:
// Do nothing
}
} else {
$emails = $notificationAlternativeRecipients;
}
// prepare and then send the emails
if (count($emails)) {
// Path to record is found:
list($elementTable, $elementUid) = explode(':', $elementName);
$elementUid = (int) $elementUid;
$elementRecord = BackendUtility::getRecord($elementTable, $elementUid);
$recordTitle = BackendUtility::getRecordTitle($elementTable, $elementRecord);
if ($elementTable == 'pages') {
$pageUid = $elementUid;
} else {
BackendUtility::fixVersioningPid($elementTable, $elementRecord);
$pageUid = $elementUid = $elementRecord['pid'];
}
// fetch the TSconfig settings for the email
// old way, options are TCEMAIN.notificationEmail_body/subject
$TCEmainTSConfig = $tcemainObj->getTCEMAIN_TSconfig($pageUid);
// new way, options are
// pageTSconfig: tx_version.workspaces.stageNotificationEmail.subject
// userTSconfig: page.tx_version.workspaces.stageNotificationEmail.subject
$pageTsConfig = BackendUtility::getPagesTSconfig($pageUid);
$emailConfig = $pageTsConfig['tx_version.']['workspaces.']['stageNotificationEmail.'];
$markers = array('###RECORD_TITLE###' => $recordTitle, '###RECORD_PATH###' => BackendUtility::getRecordPath($elementUid, '', 20), '###SITE_NAME###' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'], '###SITE_URL###' => GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir, '###WORKSPACE_TITLE###' => $workspaceRec['title'], '###WORKSPACE_UID###' => $workspaceRec['uid'], '###ELEMENT_NAME###' => $elementName, '###NEXT_STAGE###' => $newStage, '###COMMENT###' => $comment, '###USER_REALNAME###' => $tcemainObj->BE_USER->user['realName'], '###USER_FULLNAME###' => $tcemainObj->BE_USER->user['realName'], '###USER_USERNAME###' => $tcemainObj->BE_USER->user['username']);
// add marker for preview links if workspace extension is loaded
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('workspaces')) {
$this->workspaceService = GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Service\WorkspaceService::class);
// only generate the link if the marker is in the template - prevents database from getting to much entries
if (GeneralUtility::isFirstPartOfStr($emailConfig['message'], 'LLL:')) {
$tempEmailMessage = $GLOBALS['LANG']->sL($emailConfig['message']);
} else {
$tempEmailMessage = $emailConfig['message'];
}
if (strpos($tempEmailMessage, '###PREVIEW_LINK###') !== FALSE) {
$markers['###PREVIEW_LINK###'] = $this->workspaceService->generateWorkspacePreviewLink($elementUid);
}
unset($tempEmailMessage);
$markers['###SPLITTED_PREVIEW_LINK###'] = $this->workspaceService->generateWorkspaceSplittedPreviewLink($elementUid, TRUE);
}
// Hook for preprocessing of the content for formmails:
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/version/class.tx_version_tcemain.php']['notifyStageChange-postModifyMarkers'])) {
示例13: linkWrapItems
/**
* Returns the title (based on $code) of a record (from table $table) with
* the proper link around (that is for 'tx_commerce_categories'-records
* a link to the level of that record...)
*
* @param string $table Table name
* @param int $uid Item uid
* @param string $code Item title (not htmlspecialchars()'ed yet)
* @param array $row Item row
*
* @return string The item title. Ready for HTML output
*/
public function linkWrapItems($table, $uid, $code, array $row)
{
$language = $this->getLanguageService();
$backendUser = $this->getBackendUser();
// If the title is blank, make a "no title" label:
if (!strcmp($code, '')) {
$code = '<i>[' . $language->sL('LLL:EXT:lang/locallang_core.php:labels.no_title', 1) . ']</i> - ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $row), $backendUser->uc['titleLen']));
} else {
$code = htmlspecialchars(GeneralUtility::fixed_lgd_cs($code, $this->fixedL));
}
switch ((string) $this->clickTitleMode) {
case 'edit':
// If the listed table is 'tx_commerce_categories' we have to
// request the permission settings for each page:
if ($table == 'tx_commerce_categories') {
$localCalcPerms = $backendUser->calcPerms(BackendUtility::getRecord('tx_commerce_categories', $row['uid']));
$permsEdit = $localCalcPerms & 2;
} else {
$permsEdit = $this->calcPerms & 16;
}
// "Edit" link: ( Only if permissions to edit the page-record
// of the content of the parent page ($this->id)
if ($permsEdit) {
$params = '&edit[' . $table . '][' . $row['uid'] . ']=edit';
$code = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . $language->getLL('edit', 1) . '">' . $code . '</a>';
}
break;
case 'show':
// "Show" link (only tx_commerce_categories and tx_commerce_products elements)
if ($table == 'tx_commerce_categories' || $table == 'tx_commerce_products') {
$code = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($table == 'tx_commerce_products' ? $this->id . '#' . $row['uid'] : $row['uid'])) . '" title="' . $language->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '">' . $code . '</a>';
}
break;
case 'info':
// "Info": (All records)
$code = '<a href="#" onclick="' . htmlspecialchars('top.launchView(\'' . $table . '\', \'' . $row['uid'] . '\'); return false;') . '" title="' . $language->getLL('showInfo', 1) . '">' . $code . '</a>';
break;
default:
// Output the label now:
if ($table == 'tx_commerce_categories') {
$code = '<a href="' . htmlspecialchars($this->listURL($uid, '')) . '">' . $code . '</a>';
}
}
return $code;
}
示例14: main
/**
* Creating the module output.
*
* @return void
*/
public function main()
{
$lang = $this->getLanguageService();
if ($this->page_id) {
$backendUser = $this->getBackendUser();
$this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Tooltip');
// Get record for element:
$elRow = BackendUtility::getRecordWSOL($this->table, $this->moveUid);
// Headerline: Icon, record title:
$headerLine = '<span ' . BackendUtility::getRecordToolTip($elRow, $this->table) . '>' . $this->moduleTemplate->getIconFactory()->getIconForRecord($this->table, $elRow, Icon::SIZE_SMALL)->render() . '</span>';
$headerLine .= BackendUtility::getRecordTitle($this->table, $elRow, true);
// Make-copy checkbox (clicking this will reload the page with the GET var makeCopy set differently):
$onClick = 'window.location.href=' . GeneralUtility::quoteJSvalue(GeneralUtility::linkThisScript(array('makeCopy' => !$this->makeCopy))) . ';';
$headerLine .= '<div><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">' . $lang->getLL('makeCopy', 1) . '</label></div>';
// Add the header-content to the module content:
$this->content .= '<div>' . $headerLine . '</div>';
// 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 = BackendUtility::readPageAccess($this->page_id, $this->perms_clause);
if (is_array($pageInfo) && $backendUser->isInWebMount($pageInfo['pid'], $this->perms_clause)) {
// Initialize the position map:
$posMap = GeneralUtility::makeInstance(PageMovingPagePositionMap::class);
$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 = BackendUtility::readPageAccess($pageInfo['pid'], $this->perms_clause);
if (is_array($pidPageInfo)) {
if ($backendUser->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) {
$code .= '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('uid' => (int) $pageInfo['pid'], 'moveUid' => $this->moveUid))) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-view-go-up', Icon::SIZE_SMALL)->render() . BackendUtility::getRecordTitle('pages', $pidPageInfo, true) . '</a><br />';
} else {
$code .= $this->moduleTemplate->getIconFactory()->getIconForRecord('pages', $pidPageInfo, Icon::SIZE_SMALL)->render() . 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 = 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 = BackendUtility::readPageAccess($this->page_id, $this->perms_clause);
if (is_array($pageInfo) && $backendUser->isInWebMount($pageInfo['pid'], $this->perms_clause)) {
// Initialize the position map:
$posMap = GeneralUtility::makeInstance(ContentMovingPagePositionMap::class);
$posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move';
$posMap->cur_sys_language = $this->sys_language;
// Headerline for the parent page: Icon, record title:
$headerLine = '<span ' . BackendUtility::getRecordToolTip($pageInfo, 'pages') . '>' . $this->moduleTemplate->getIconFactory()->getIconForRecord('pages', $pageInfo, Icon::SIZE_SMALL)->render() . '</span>';
$headerLine .= BackendUtility::getRecordTitle('pages', $pageInfo, true);
// Load SHARED page-TSconfig settings and retrieve column list from there, if applicable:
// SHARED page-TSconfig settings.
// $modTSconfig_SHARED = BackendUtility::getModTSconfig($this->pageId, 'mod.SHARED');
$colPosArray = GeneralUtility::callUserFunction(\TYPO3\CMS\Backend\View\BackendLayoutView::class . '->getColPosListItemsParsed', $this->page_id, $this);
$colPosIds = array();
foreach ($colPosArray as $colPos) {
$colPosIds[] = $colPos[1];
}
// Removing duplicates, if any
$colPosList = implode(',', array_unique($colPosIds));
// Adding parent page-header and the content element columns from position-map:
$code = $headerLine . '<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 /><br />';
if ($pageInfo['pid']) {
$pidPageInfo = BackendUtility::readPageAccess($pageInfo['pid'], $this->perms_clause);
if (is_array($pidPageInfo)) {
if ($backendUser->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) {
$code .= '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('uid' => (int) $pageInfo['pid'], 'moveUid' => $this->moveUid))) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-view-go-up', Icon::SIZE_SMALL)->render() . BackendUtility::getRecordTitle('pages', $pidPageInfo, true) . '</a><br />';
} else {
$code .= $this->moduleTemplate->getIconFactory()->getIconForRecord('pages', $pidPageInfo, Icon::SIZE_SMALL)->render() . 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 .= '<h2>' . $lang->getLL('selectPositionOfElement') . '</h2>';
$this->content .= '<div>' . $code . '</div>';
}
// Setting up the buttons and markers for docheader
$this->getButtons();
// Build the <body> for the module
//.........這裏部分代碼省略.........
示例15: generateDataArray
/**
* Generates grid list array from given versions.
*
* @param array $versions All available version records
* @param string $filterTxt Text to be used to filter record result
* @return void
*/
protected function generateDataArray(array $versions, $filterTxt)
{
$workspaceAccess = $GLOBALS['BE_USER']->checkWorkspace($GLOBALS['BE_USER']->workspace);
$swapStage = $workspaceAccess['publish_access'] & 1 ? \TYPO3\CMS\Workspaces\Service\StagesService::STAGE_PUBLISH_ID : 0;
$swapAccess = $GLOBALS['BE_USER']->workspacePublishAccess($GLOBALS['BE_USER']->workspace) && $GLOBALS['BE_USER']->workspaceSwapAccess();
$this->initializeWorkspacesCachingFramework();
// check for dataArray in cache
if ($this->getDataArrayFromCache($versions, $filterTxt) === FALSE) {
/** @var $stagesObj \TYPO3\CMS\Workspaces\Service\StagesService */
$stagesObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Workspaces\\Service\\StagesService');
$defaultGridColumns = array(self::GridColumn_Collection => 0, self::GridColumn_CollectionLevel => 0, self::GridColumn_CollectionParent => '', self::GridColumn_CollectionCurrent => '', self::GridColumn_CollectionChildren => 0);
foreach ($versions as $table => $records) {
$hiddenField = $this->getTcaEnableColumnsFieldName($table, 'disabled');
$isRecordTypeAllowedToModify = $GLOBALS['BE_USER']->check('tables_modify', $table);
foreach ($records as $record) {
$origRecord = BackendUtility::getRecord($table, $record['t3ver_oid']);
$versionRecord = BackendUtility::getRecord($table, $record['uid']);
$combinedRecord = \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord::createFromArrays($table, $origRecord, $versionRecord);
$this->getIntegrityService()->checkElement($combinedRecord);
if ($hiddenField !== NULL) {
$recordState = $this->workspaceState($versionRecord['t3ver_state'], $origRecord[$hiddenField], $versionRecord[$hiddenField]);
} else {
$recordState = $this->workspaceState($versionRecord['t3ver_state']);
}
$isDeletedPage = $table == 'pages' && $recordState == 'deleted';
$viewUrl = \TYPO3\CMS\Workspaces\Service\WorkspaceService::viewSingleRecord($table, $record['uid'], $origRecord, $versionRecord);
$versionArray = array();
$versionArray['table'] = $table;
$versionArray['id'] = $table . ':' . $record['uid'];
$versionArray['uid'] = $record['uid'];
$versionArray['workspace'] = $versionRecord['t3ver_id'];
$versionArray = array_merge($versionArray, $defaultGridColumns);
$versionArray['label_Workspace'] = htmlspecialchars(BackendUtility::getRecordTitle($table, $versionRecord));
$versionArray['label_Live'] = htmlspecialchars(BackendUtility::getRecordTitle($table, $origRecord));
$versionArray['label_Stage'] = htmlspecialchars($stagesObj->getStageTitle($versionRecord['t3ver_stage']));
$tempStage = $stagesObj->getNextStage($versionRecord['t3ver_stage']);
$versionArray['label_nextStage'] = htmlspecialchars($stagesObj->getStageTitle($tempStage['uid']));
$tempStage = $stagesObj->getPrevStage($versionRecord['t3ver_stage']);
$versionArray['label_prevStage'] = htmlspecialchars($stagesObj->getStageTitle($tempStage['uid']));
$versionArray['path_Live'] = htmlspecialchars(BackendUtility::getRecordPath($record['livepid'], '', 999));
$versionArray['path_Workspace'] = htmlspecialchars(BackendUtility::getRecordPath($record['wspid'], '', 999));
$versionArray['workspace_Title'] = htmlspecialchars(\TYPO3\CMS\Workspaces\Service\WorkspaceService::getWorkspaceTitle($versionRecord['t3ver_wsid']));
$versionArray['workspace_Tstamp'] = $versionRecord['tstamp'];
$versionArray['workspace_Formated_Tstamp'] = BackendUtility::datetime($versionRecord['tstamp']);
$versionArray['t3ver_wsid'] = $versionRecord['t3ver_wsid'];
$versionArray['t3ver_oid'] = $record['t3ver_oid'];
$versionArray['livepid'] = $record['livepid'];
$versionArray['stage'] = $versionRecord['t3ver_stage'];
$versionArray['icon_Live'] = \TYPO3\CMS\Backend\Utility\IconUtility::mapRecordTypeToSpriteIconClass($table, $origRecord);
$versionArray['icon_Workspace'] = \TYPO3\CMS\Backend\Utility\IconUtility::mapRecordTypeToSpriteIconClass($table, $versionRecord);
$languageValue = $this->getLanguageValue($table, $versionRecord);
$versionArray['languageValue'] = $languageValue;
$versionArray['language'] = array('cls' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses($this->getSystemLanguageValue($languageValue, 'flagIcon')), 'title' => htmlspecialchars($this->getSystemLanguageValue($languageValue, 'title')));
$versionArray['allowedAction_nextStage'] = $isRecordTypeAllowedToModify && $stagesObj->isNextStageAllowedForUser($versionRecord['t3ver_stage']);
$versionArray['allowedAction_prevStage'] = $isRecordTypeAllowedToModify && $stagesObj->isPrevStageAllowedForUser($versionRecord['t3ver_stage']);
if ($swapAccess && $swapStage != 0 && $versionRecord['t3ver_stage'] == $swapStage) {
$versionArray['allowedAction_swap'] = $isRecordTypeAllowedToModify && $stagesObj->isNextStageAllowedForUser($swapStage);
} elseif ($swapAccess && $swapStage == 0) {
$versionArray['allowedAction_swap'] = $isRecordTypeAllowedToModify;
} else {
$versionArray['allowedAction_swap'] = FALSE;
}
$versionArray['allowedAction_delete'] = $isRecordTypeAllowedToModify;
// preview and editing of a deleted page won't work ;)
$versionArray['allowedAction_view'] = !$isDeletedPage && $viewUrl;
$versionArray['allowedAction_edit'] = $isRecordTypeAllowedToModify && !$isDeletedPage;
$versionArray['allowedAction_editVersionedPage'] = $isRecordTypeAllowedToModify && !$isDeletedPage;
$versionArray['state_Workspace'] = $recordState;
$versionArray = array_merge($versionArray, $this->getAdditionalColumnService()->getData($combinedRecord));
if ($filterTxt == '' || $this->isFilterTextInVisibleColumns($filterTxt, $versionArray)) {
$versionIdentifier = $versionArray['id'];
$this->dataArray[$versionIdentifier] = $versionArray;
}
}
}
// Suggested slot method:
// methodName(\TYPO3\CMS\Workspaces\Service\GridDataService $gridData, array &$dataArray, array $versions)
$this->emitSignal(self::SIGNAL_GenerateDataArray_BeforeCaching, $this->dataArray, $versions);
// Enrich elements after everything has been processed:
foreach ($this->dataArray as &$element) {
$identifier = $element['table'] . ':' . $element['t3ver_oid'];
$element['integrity'] = array('status' => $this->getIntegrityService()->getStatusRepresentation($identifier), 'messages' => htmlspecialchars($this->getIntegrityService()->getIssueMessages($identifier, TRUE)));
}
$this->setDataArrayIntoCache($versions, $filterTxt);
}
// Suggested slot method:
// methodName(\TYPO3\CMS\Workspaces\Service\GridDataService $gridData, array &$dataArray, array $versions)
$this->emitSignal(self::SIGNAL_GenerateDataArray_PostProcesss, $this->dataArray, $versions);
$this->sortDataArray();
$this->resolveDataArrayDependencies();
}