本文整理匯總了PHP中TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine方法的典型用法代碼示例。如果您正苦於以下問題:PHP BackendUtility::BEgetRootLine方法的具體用法?PHP BackendUtility::BEgetRootLine怎麽用?PHP BackendUtility::BEgetRootLine使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TYPO3\CMS\Backend\Utility\BackendUtility
的用法示例。
在下文中一共展示了BackendUtility::BEgetRootLine方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: calcPerms
/**
* Returns a combined binary representation of the current users permissions for the page-record, $row.
* The perms for user, group and everybody is OR'ed together (provided that the page-owner is the user and for the groups that the user is a member of the group
* If the user is admin, 31 is returned (full permissions for all five flags)
*
* @param array Input page row with all perms_* fields available.
* @param object BE User Object
* @return integer Bitwise representation of the users permissions in relation to input page row, $row
*/
public function calcPerms($params, $that)
{
$row = $params['row'];
$beAclConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['be_acl']);
if (!$beAclConfig['disableOldPermissionSystem']) {
$out = $params['outputPermissions'];
} else {
$out = 0;
}
$rootLine = BackendUtility::BEgetRootLine($row['uid']);
$i = 0;
$takeUserIntoAccount = 1;
$groupIdsAlreadyUsed = array();
foreach ($rootLine as $level => $values) {
if ($i != 0) {
$recursive = ' AND recursive=1';
} else {
$recursive = '';
}
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_beacl_acl', 'pid=' . intval($values['uid']) . $recursive, '', 'recursive ASC');
while ($result = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
if ($result['type'] == 0 && $that->user['uid'] == $result['object_id'] && $takeUserIntoAccount) {
// user has to be taken into account
$out |= $result['permissions'];
$takeUserIntoAccount = 0;
} elseif ($result['type'] == 1 && $that->isMemberOfGroup($result['object_id']) && !in_array($result['object_id'], $groupIdsAlreadyUsed)) {
$out |= $result['permissions'];
$groupIdsAlreadyUsed[] = $result['object_id'];
}
}
$i++;
}
return $out;
}
示例2: adminLinks
/**
* Administrative links for a table / record
*
* @param string $table Table name
* @param array $row Record for which administrative links are generated.
*
* @return string HTML link tags.
*/
public function adminLinks($table, array $row)
{
if ($table !== 'tx_commerce_products') {
return parent::adminLinks($table, $row);
} else {
$language = $this->getLanguageService();
// Edit link:
$adminLink = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick('&edit[' . $table . '][' . $row['uid'] . ']=edit', $this->doc->backPath)) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open', array('title' => $language->sL('LLL:EXT:lang/locallang_core.xml:cm.edit', TRUE))) . '</a>';
// Delete link:
$adminLink .= '<a href="' . htmlspecialchars($this->doc->issueCommand('&cmd[' . $table . '][' . $row['uid'] . '][delete]=1')) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $language->sL('LLL:EXT:lang/locallang_core.php:cm.delete', TRUE))) . '</a>';
if ($row['pid'] == -1) {
// get page TSconfig
$pagesTyposcriptConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($GLOBALS['_POST']['popViewId']);
if ($pagesTyposcriptConfig['tx_commerce.']['singlePid']) {
$previewPageId = $pagesTyposcriptConfig['tx_commerce.']['singlePid'];
} else {
$previewPageId = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][COMMERCE_EXTKEY]['extConf']['previewPageID'];
}
$sysLanguageUid = (int) $row['sys_language_uid'];
/**
* Product
*
* @var $product Tx_Commerce_Domain_Model_Product
*/
$product = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Commerce_Domain_Model_Product', $row['t3ver_oid'], $sysLanguageUid);
$product->loadData();
$getVars = ($sysLanguageUid > 0 ? '&L=' . $sysLanguageUid : '') . '&ADMCMD_vPrev[' . rawurlencode($table . ':' . $row['t3ver_oid']) . ']=' . $row['uid'] . '&no_cache=1&tx_commerce_pi1[showUid]=' . $product->getUid() . '&tx_commerce_pi1[catUid]=' . current($product->getMasterparentCategory());
$adminLink .= '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($previewPageId, $this->doc->backPath, \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($row['_REAL_PID']), '', '', $getVars)) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-view') . '</a>';
}
return $adminLink;
}
}
示例3: processDatamap_preProcessFieldArray
/**
* This method is called by a hook in the TYPO3 Core Engine (TCEmain) when a record is saved.
*
* We use the tx_linkhandler for backend "save & show" button to display records on the configured detail view page
*
* @param array $fieldArray: The field names and their values to be processed (passed by reference)
* @param string $table: The table TCEmain is currently processing
* @param string $id: The records id (if any)
* @param object $pObj: Reference to the parent object (TCEmain)
* @return void
*/
public function processDatamap_preProcessFieldArray($fieldArray, $table, $id, $pObj)
{
if (isset($GLOBALS['_POST']['_savedokview_x'])) {
$settingFound = FALSE;
$currentPageId = \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($GLOBALS['_POST']['popViewId']);
$rootLineStruct = \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($currentPageId);
$defaultPageId = isset($rootLineStruct[0]) && array_key_exists('uid', $rootLineStruct[0]) ? $rootLineStruct[0]['uid'] : $currentPageId;
$pagesTsConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($currentPageId, $rootLineStruct);
$handlerConfigurationStruct = $pagesTsConfig['mod.']['tx_linkhandler.'];
// search for the current setting for given table
foreach ($pagesTsConfig['mod.']['tx_linkhandler.'] as $key => $handler) {
if (is_array($handler) && $handler['listTables'] === $table) {
$settingFound = TRUE;
$selectedConfiguration = $key;
break;
}
}
if ($settingFound) {
$l18nPointer = array_key_exists('transOrigPointerField', $GLOBALS['TCA'][$table]['ctrl']) ? $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] : '';
if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($id)) {
$id = $pObj->substNEWwithIDs[$id];
}
if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($id)) {
$recordArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($table, $id);
} else {
$recordArray = $fieldArray;
}
if (array_key_exists('previewPageId', $handlerConfigurationStruct[$selectedConfiguration]) && \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($handlerConfigurationStruct[$selectedConfiguration]['previewPageId']) > 0) {
$previewPageId = \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($handlerConfigurationStruct[$selectedConfiguration]['previewPageId']);
} else {
$previewPageId = \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($defaultPageId);
}
if ($GLOBALS['BE_USER']->workspace != 0) {
$timeToLiveHours = intval($GLOBALS['BE_USER']->getTSConfigVal('options.workspaces.previewLinkTTLHours')) ? intval($GLOBALS['BE_USER']->getTSConfigVal('options.workspaces.previewLinkTTLHours')) : 24 * 2;
$wsPreviewValue = ';' . $GLOBALS['BE_USER']->workspace . ':' . $GLOBALS['BE_USER']->user['uid'] . ':' . 60 * 60 * $timeToLiveHours;
// get record UID for
if (array_key_exists($l18nPointer, $recordArray) && $recordArray[$l18nPointer] > 0 && $recordArray['sys_language_uid'] > 0) {
$id = $recordArray[$l18nPointer];
} elseif (array_key_exists('t3ver_oid', $recordArray)) {
// this makes no sense because we already receive the UID of the WS-Placeholder which will be the real record in the LIVE-WS
$id = $recordArray['t3ver_oid'];
}
} else {
$wsPreviewValue = '';
if (array_key_exists($l18nPointer, $recordArray) && $recordArray[$l18nPointer] > 0 && $recordArray['sys_language_uid'] > 0) {
$id = $recordArray[$l18nPointer];
}
}
$linkParamValue = 'record:' . $table . ':' . $id;
$queryString = '&eID=linkhandlerPreview&linkParams=' . $linkParamValue . $wsPreviewValue;
$languageParam = '&L=' . $recordArray['sys_language_uid'];
$queryString .= $languageParam . '&authCode=' . t3lib_div::stdAuthCode($linkParamValue . $wsPreviewValue . $recordArray['sys_language_uid'], '', 32);
$GLOBALS['_POST']['viewUrl'] = '/index.php?id=' . $previewPageId . $queryString . '&y=';
}
}
}
示例4: findUsersWithPageAccess
/**
* Find users which has access to given page id
* Checks db mounts
*
* @param integer $page
* @return array
*/
public function findUsersWithPageAccess($page)
{
$rootLine = BackendUtility::BEgetRootLine($page);
$rootLineIds = array();
foreach ($rootLine as $page) {
$rootLineIds[] = (int) $page['uid'];
}
$users = $this->findAllowedUsersInRootLine($rootLineIds);
return $users;
}
示例5: getButtons
/**
* Create the panel of buttons for submitting the form or otherwise perform operations.
*/
protected function getButtons()
{
$buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
// CSH
$cshButton = $buttonBar->makeHelpButton()->setModuleName('_MOD_web_func')->setFieldName('');
$buttonBar->addButton($cshButton);
if ($this->id && is_array($this->pageinfo)) {
// View page
$viewButton = $buttonBar->makeLinkButton()->setOnClick(BackendUtility::viewOnClick($this->pageinfo['uid'], '', BackendUtility::BEgetRootLine($this->pageinfo['uid'])))->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage'))->setIcon($this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL))->setHref('#');
$buttonBar->addButton($viewButton);
// Shortcut
$shortcutButton = $buttonBar->makeShortcutButton()->setModuleName($this->moduleName)->setGetVariables(['id', 'edit_record', 'pointer', 'new_unique_uid', 'search_field', 'search_levels', 'showLimit'])->setSetVariables(array_keys($this->MOD_MENU));
$buttonBar->addButton($shortcutButton);
}
}
示例6: getDomainName
/**
* Get domain name for requested page id
*
* @param integer $pageId
* @return string|NULL Domain name from first sys_domains-Record or from TCEMAIN.previewDomain, NULL if neither is configured
*/
protected function getDomainName($pageId)
{
$previewDomainConfig = $GLOBALS['BE_USER']->getTSConfig('TCEMAIN.previewDomain', BackendUtility::getPagesTSconfig($pageId));
if ($previewDomainConfig['value']) {
$domain = $previewDomainConfig['value'];
} else {
$domain = BackendUtility::firstDomainRecord(BackendUtility::BEgetRootLine($pageId));
}
return $domain;
}
示例7: addRootlineOfNodeToStateHash
/**
* Adds the rootline of a given node to the tree expansion state and adds the node
* itself as the current selected page. This leads to the expansion and selection of
* the node in the tree after a refresh.
*
* @static
* @param string $stateId
* @param int $nodeId
* @return array
*/
public static function addRootlineOfNodeToStateHash($stateId, $nodeId)
{
$mountPoints = array_map('intval', $GLOBALS['BE_USER']->returnWebmounts());
if (empty($mountPoints)) {
$mountPoints = array(0);
}
$mountPoints[] = (int) $GLOBALS['BE_USER']->uc['pageTree_temporaryMountPoint'];
$mountPoints = array_unique($mountPoints);
/** @var $userSettingsController \TYPO3\CMS\Backend\Controller\UserSettingsController */
$userSettingsController = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\UserSettingsController::class);
$state = $userSettingsController->process('get', 'BackendComponents.States.' . $stateId);
if (empty($state)) {
$state = new \StdClass();
$state->stateHash = new \StdClass();
}
$state->stateHash = (object) $state->stateHash;
$rootline = BackendUtility::BEgetRootLine($nodeId, '', $GLOBALS['BE_USER']->workspace != 0);
$rootlineIds = array();
foreach ($rootline as $pageData) {
$rootlineIds[] = (int) $pageData['uid'];
}
foreach ($mountPoints as $mountPoint) {
if (!in_array($mountPoint, $rootlineIds, true)) {
continue;
}
$isFirstNode = true;
foreach ($rootline as $pageData) {
$node = Commands::getNewNode($pageData, $mountPoint);
if ($isFirstNode) {
$isFirstNode = false;
$state->stateHash->lastSelectedNode = $node->calculateNodeId();
} else {
$state->stateHash->{$node->calculateNodeId('')} = 1;
}
}
}
$userSettingsController->process('set', 'BackendComponents.States.' . $stateId, $state);
return (array) $state->stateHash;
}
示例8: ext_prevPageWithTemplate
/**
* [Describe function...]
*
* @param [type] $id: ...
* @param [type] $perms_clause: ...
* @return [type] ...
* @todo Define visibility
*/
public function ext_prevPageWithTemplate($id, $perms_clause)
{
$rootLine = BackendUtility::BEgetRootLine($id, $perms_clause ? ' AND ' . $perms_clause : '');
foreach ($rootLine as $p) {
if ($this->ext_getFirstTemplate($p['uid'])) {
return $p;
}
}
}
示例9: adminLinks
/**
* Administrative links for a table / record
*
* @param string $table Table name
* @param array $row Record for which administrative links are generated.
* @return string HTML link tags.
*/
public function adminLinks($table, $row)
{
// Edit link:
$editUrl = BackendUtility::getModuleUrl('record_edit', ['edit' => [$table => [$row['uid'] => 'edit']], 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]);
$adminLink = '<a class="btn btn-default" href="' . htmlspecialchars($editUrl) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.edit', true) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>';
// Delete link:
$adminLink .= '<a class="btn btn-default" href="' . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction('&cmd[' . $table . '][' . $row['uid'] . '][delete]=1')) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete', true) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</a>';
if ($table === 'pages') {
// If another page module was specified, replace the default Page module with the new one
$newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
$pageModule = BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
// Perform some access checks:
$a_wl = $GLOBALS['BE_USER']->check('modules', 'web_list');
$a_wp = $GLOBALS['BE_USER']->check('modules', $pageModule);
$adminLink .= '<a class="btn btn-default" href="#" onclick="top.loadEditId(' . $row['uid'] . ');top.goToModule(' . GeneralUtility::quoteJSvalue($pageModule) . '); return false;">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-page-open', Icon::SIZE_SMALL)->render() . '</a>';
$adminLink .= '<a class="btn btn-default" href="#" onclick="top.loadEditId(' . $row['uid'] . ');top.goToModule(\'web_list\'); return false;">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-system-list-open', Icon::SIZE_SMALL)->render() . '</a>';
// "View page" icon is added:
$adminLink .= '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($row['uid'], '', BackendUtility::BEgetRootLine($row['uid']))) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-view', Icon::SIZE_SMALL)->render() . '</a>';
} else {
if ($row['pid'] == -1) {
$getVars = '&ADMCMD_vPrev[' . rawurlencode($table . ':' . $row['t3ver_oid']) . ']=' . $row['uid'];
// "View page" icon is added:
$adminLink .= '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($row['_REAL_PID'], '', BackendUtility::BEgetRootLine($row['_REAL_PID']), '', '', $getVars)) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-view', Icon::SIZE_SMALL)->render() . '</a>';
}
}
return '<div class="btn-group btn-group-sm" role="group">' . $adminLink . '</div>';
}
示例10: getButtons
/**
* Create the panel of buttons for submitting the form or otherwise perform operations.
*
* @return array All available buttons as an assoc. array
*/
protected function getButtons()
{
$buttons = array('csh' => '', 'view' => '', 'shortcut' => '');
// CSH
$buttons['csh'] = BackendUtility::cshItem('_MOD_web_info', '', $GLOBALS['BACK_PATH'], '', TRUE);
// View page
$buttons['view'] = '<a href="#" ' . 'onclick="' . htmlspecialchars(BackendUtility::viewOnClick($this->pageinfo['uid'], $GLOBALS['BACK_PATH'], BackendUtility::BEgetRootLine($this->pageinfo['uid']))) . '" ' . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-view') . '</a>';
// Shortcut
if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
$buttons['shortcut'] = $this->doc->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
}
return $buttons;
}
示例11: makeButtons
/**
* This creates the buttons for die modules
*
* @param string $function Identifier for function of module
* @return void
*/
protected function makeButtons($function = '')
{
$lang = $this->getLanguageService();
// View page
if (!VersionState::cast($this->pageinfo['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
$viewButton = $this->buttonBar->makeLinkButton()->setOnClick(htmlspecialchars(BackendUtility::viewOnClick($this->pageinfo['uid'], '', BackendUtility::BEgetRootLine($this->pageinfo['uid']))))->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', true))->setIcon($this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL))->setHref('#');
$this->buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, 3);
}
// Shortcut
$shortcutButton = $this->buttonBar->makeShortcutButton()->setModuleName($this->moduleName)->setGetVariables(['id', 'M', 'edit_record', 'pointer', 'new_unique_uid', 'search_field', 'search_levels', 'showLimit'])->setSetVariables(array_keys($this->MOD_MENU));
$this->buttonBar->addButton($shortcutButton);
// Cache
if (!$this->modTSconfig['properties']['disableAdvanced']) {
$clearCacheButton = $this->buttonBar->makeLinkButton()->setHref(BackendUtility::getModuleUrl($this->moduleName, ['id' => $this->pageinfo['uid'], 'clear_cache' => '1']))->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.clear_cache', true))->setIcon($this->iconFactory->getIcon('actions-system-cache-clear', Icon::SIZE_SMALL));
$this->buttonBar->addButton($clearCacheButton, ButtonBar::BUTTON_POSITION_RIGHT, 1);
}
if (!$this->modTSconfig['properties']['disableIconToolbar']) {
// Move record
if (MathUtility::canBeInterpretedAsInteger($this->eRParts[1])) {
$urlParameters = ['table' => $this->eRParts[0], 'uid' => $this->eRParts[1], 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')];
$moveButton = $this->buttonBar->makeLinkButton()->setHref(BackendUtility::getModuleUrl('move_element', $urlParameters))->setTitle($lang->getLL('move_' . ($this->eRParts[0] == 'tt_content' ? 'record' : 'page'), true))->setIcon($this->iconFactory->getIcon('actions-' . ($this->eRParts[0] == 'tt_content' ? 'document' : 'page') . '-move', Icon::SIZE_SMALL));
$this->buttonBar->addButton($moveButton, ButtonBar::BUTTON_POSITION_LEFT, 2);
}
// Edit page properties and page language overlay icons
if ($this->pageIsNotLockedForEditors() && $this->getBackendUser()->checkLanguageAccess(0)) {
// Edit localized page_language_overlay only when one specific language is selected
if ($this->MOD_SETTINGS['function'] == 1 && $this->current_sys_language > 0) {
$overlayRecord = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('uid', 'pages_language_overlay', 'pid = ' . (int) $this->id . ' ' . 'AND sys_language_uid = ' . (int) $this->current_sys_language . BackendUtility::deleteClause('pages_language_overlay') . BackendUtility::versioningPlaceholderClause('pages_language_overlay'), '', '', '');
$editLanguageButton = $this->buttonBar->makeLinkButton()->setHref('#')->setTitle($lang->getLL('editPageLanguageOverlayProperties', true))->setOnClick(htmlspecialchars(BackendUtility::editOnClick('&edit[pages_language_overlay][' . $overlayRecord['uid'] . ']=edit')))->setIcon($this->iconFactory->getIcon('mimetypes-x-content-page-language-overlay', Icon::SIZE_SMALL));
$this->buttonBar->addButton($editLanguageButton, ButtonBar::BUTTON_POSITION_LEFT, 3);
}
$editPageButton = $this->buttonBar->makeLinkButton()->setHref('#')->setTitle($lang->getLL('editPageProperties', true))->setOnClick(htmlspecialchars(BackendUtility::editOnClick('&edit[pages][' . $this->id . ']=edit')))->setIcon($this->iconFactory->getIcon('actions-page-open', Icon::SIZE_SMALL));
$this->buttonBar->addButton($editPageButton, ButtonBar::BUTTON_POSITION_LEFT, 3);
}
// Add CSH (Context Sensitive Help) icon to tool bar
$contextSensitiveHelpButton = $this->buttonBar->makeHelpButton()->setModuleName($this->descrTable)->setFieldName($function === 'quickEdit' ? 'quickEdit' : 'columns_' . $this->MOD_SETTINGS['function']);
$this->buttonBar->addButton($contextSensitiveHelpButton);
// QuickEdit
if ($function == 'quickEdit') {
// Close Record
$closeButton = $this->buttonBar->makeLinkButton()->setHref('#')->setOnClick(htmlspecialchars('jumpToUrl(' . GeneralUtility::quoteJSvalue($this->closeUrl) . '); return false;'))->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', true))->setIcon($this->iconFactory->getIcon('actions-document-close', Icon::SIZE_SMALL));
$this->buttonBar->addButton($closeButton, ButtonBar::BUTTON_POSITION_LEFT, 0);
// Save Record
$saveButtonDropdown = $this->buttonBar->makeSplitButton();
$saveButton = $this->buttonBar->makeInputButton()->setName('_savedok')->setValue('1')->setForm('PageLayoutController')->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', true))->setIcon($this->iconFactory->getIcon('actions-document-save', Icon::SIZE_SMALL));
$saveButtonDropdown->addItem($saveButton);
$saveAndCloseButton = $this->buttonBar->makeInputButton()->setName('_saveandclosedok')->setValue('1')->setForm('PageLayoutController')->setOnClick('document.editform.redirect.value=\'' . $this->closeUrl . '\';')->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', true))->setIcon($this->iconFactory->getIcon('actions-document-save-close', Icon::SIZE_SMALL));
$saveButtonDropdown->addItem($saveAndCloseButton);
$saveAndShowPageButton = $this->buttonBar->makeInputButton()->setName('_savedokview')->setValue('1')->setForm('PageLayoutController')->setOnClick('document.editform.redirect.value+=\'&popView=1\';')->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDocShow', true))->setIcon($this->iconFactory->getIcon('actions-document-save-view', Icon::SIZE_SMALL));
$saveButtonDropdown->addItem($saveAndShowPageButton);
$this->buttonBar->addButton($saveButtonDropdown, ButtonBar::BUTTON_POSITION_LEFT, 1);
// Delete record
if ($this->deleteButton) {
$deleteButton = $this->buttonBar->makeLinkButton()->setHref('#')->setOnClick(htmlspecialchars('return deleteRecord(' . GeneralUtility::quoteJSvalue($this->eRParts[0]) . ',' . GeneralUtility::quoteJSvalue($this->eRParts[1]) . ',' . GeneralUtility::quoteJSvalue(GeneralUtility::getIndpEnv('SCRIPT_NAME') . '?id=' . $this->id) . ');'))->setTitle($lang->getLL('deleteItem', true))->setIcon($this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL));
$this->buttonBar->addButton($deleteButton, ButtonBar::BUTTON_POSITION_LEFT, 4);
}
// History
if ($this->undoButton) {
$undoButton = $this->buttonBar->makeLinkButton()->setHref('#')->setOnClick(htmlspecialchars('window.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('record_history', array('element' => $this->eRParts[0] . ':' . $this->eRParts[1], 'revert' => 'ALL_FIELDS', 'sumUp' => -1, 'returnUrl' => $this->R_URI))) . '; return false;'))->setTitle(htmlspecialchars(sprintf($lang->getLL('undoLastChange'), BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $this->undoButtonR['tstamp'], $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')))))->setIcon($this->iconFactory->getIcon('actions-edit-undo', Icon::SIZE_SMALL));
$this->buttonBar->addButton($undoButton, ButtonBar::BUTTON_POSITION_LEFT, 5);
$historyButton = $this->buttonBar->makeLinkButton()->setHref('#')->setOnClick(htmlspecialchars('jumpToUrl(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('record_history', array('element' => $this->eRParts[0] . ':' . $this->eRParts[1], 'returnUrl' => $this->R_URI)) . '#latest') . ');return false;'))->setTitle($lang->getLL('recordHistory', true))->setIcon($this->iconFactory->getIcon('actions-document-history-open', Icon::SIZE_SMALL));
$this->buttonBar->addButton($historyButton, ButtonBar::BUTTON_POSITION_LEFT, 3);
}
}
}
}
示例12: clearCacheForAllParents
/**
* Clears the treelist cache for all parents of a changed page.
* gets called after creating a new page and after moving a page
*
* @param integer $affectedParentPage Parent page id of the changed page, the page to start clearing from
* @return void
*/
protected function clearCacheForAllParents($affectedParentPage)
{
$rootline = BackendUtility::BEgetRootLine($affectedParentPage);
$rootlineIds = array();
foreach ($rootline as $page) {
if ($page['uid'] != 0) {
$rootlineIds[] = $page['uid'];
}
}
if (!empty($rootlineIds)) {
$rootlineIdsImploded = implode(',', $rootlineIds);
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_treelist', 'pid IN(' . $rootlineIdsImploded . ')');
}
}
示例13: main
/**
* Main function, rendering the document with the iframe with the RTE in.
*
* @return void
* @todo Define visibility
*/
public function main()
{
// Translate id to the workspace version:
if ($versionRec = \TYPO3\CMS\Backend\Utility\BackendUtility::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $this->P['table'], $this->P['uid'], 'uid')) {
$this->P['uid'] = $versionRec['uid'];
}
// If all parameters are available:
if ($this->P['table'] && $this->P['field'] && $this->P['uid'] && $this->checkEditAccess($this->P['table'], $this->P['uid'])) {
// Getting the raw record (we need only the pid-value from here...)
$rawRec = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($this->P['table'], $this->P['uid']);
\TYPO3\CMS\Backend\Utility\BackendUtility::fixVersioningPid($this->P['table'], $rawRec);
// Setting JavaScript, including the pid value for viewing:
$this->doc->JScode = $this->doc->wrapScriptTags('
function jumpToUrl(URL,formEl) { //
if (document.editform) {
if (!TBE_EDITOR.isFormChanged()) {
window.location.href = URL;
} else if (formEl) {
if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
}
} else window.location.href = URL;
}
' . ($this->popView ? \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($rawRec['pid'], '', \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($rawRec['pid'])) : '') . '
');
// Initialize TCeforms - for rendering the field:
$tceforms = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\FormEngine');
// Init...
$tceforms->initDefaultBEMode();
// SPECIAL: Disables all wizards - we are NOT going to need them.
$tceforms->disableWizards = 1;
// SPECIAL: Setting background color of the RTE to ordinary background
$tceforms->colorScheme[0] = $this->doc->bgColor;
// Initialize style for RTE object:
// Getting reference to the RTE object used to render the field!
$RTEobj = \TYPO3\CMS\Backend\Utility\BackendUtility::RTEgetObj();
if ($RTEobj->ID == 'rte') {
$RTEobj->RTEdivStyle = 'position:relative; left:0px; top:0px; height:100%; width:100%; border:solid 0px;';
}
// Fetching content of record:
$trData = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\DataPreprocessor');
$trData->lockRecords = 1;
$trData->fetchRecord($this->P['table'], $this->P['uid'], '');
// Getting the processed record content out:
$rec = reset($trData->regTableItems_data);
$rec['uid'] = $this->P['uid'];
$rec['pid'] = $rawRec['pid'];
// TSconfig, setting width:
$fieldTSConfig = $tceforms->setTSconfig($this->P['table'], $rec, $this->P['field']);
if (strcmp($fieldTSConfig['RTEfullScreenWidth'], '')) {
$width = $fieldTSConfig['RTEfullScreenWidth'];
} else {
$width = '100%';
}
// Get the form field and wrap it in the table with the buttons:
$formContent = $tceforms->getSoloField($this->P['table'], $rec, $this->P['field']);
$formContent = '
<!--
RTE wizard:
-->
<table border="0" cellpadding="0" cellspacing="0" width="' . $width . '" id="typo3-rtewizard">
<tr>
<td width="' . $width . '" colspan="2" id="c-formContent">' . $formContent . '</td>
<td></td>
</tr>
</table>';
// Adding hidden fields:
$formContent .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($this->R_URI) . '" />
<input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" />' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction');
// Finally, add the whole setup:
$this->content .= $tceforms->printNeededJSFunctions_top() . $formContent . $tceforms->printNeededJSFunctions();
} else {
// ERROR:
$this->content .= $this->doc->section($GLOBALS['LANG']->getLL('forms_title'), '<span class="typo3-red">' . $GLOBALS['LANG']->getLL('table_noData', 1) . '</span>', 0, 1);
}
// Setting up the buttons and markers for docheader
$docHeaderButtons = $this->getButtons();
$markers['CONTENT'] = $this->content;
// Build the <body> for the module
$this->content = $this->doc->startPage('');
$this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
$this->content .= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
}
示例14: main
/**
* Main function, rendering the document with the iFrame with the RTE in.
*
* @return void
*/
public function main()
{
$this->content .= '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_db')) . '" method="post" enctype="multipart/form-data" id="RteController" name="editform" ' . ' onsubmit="return TBE_EDITOR.checkSubmit(1);">';
// Translate id to the workspace version:
if ($versionedRecord = BackendUtility::getWorkspaceVersionOfRecord($this->getBackendUserAuthentication()->workspace, $this->P['table'], $this->P['uid'], 'uid')) {
$this->P['uid'] = $versionedRecord['uid'];
}
// If all parameters are available:
if ($this->P['table'] && $this->P['field'] && $this->P['uid'] && $this->checkEditAccess($this->P['table'], $this->P['uid'])) {
/** @var TcaDatabaseRecord $formDataGroup */
$formDataGroup = GeneralUtility::makeInstance(TcaDatabaseRecord::class);
/** @var FormDataCompiler $formDataCompiler */
$formDataCompiler = GeneralUtility::makeInstance(FormDataCompiler::class, $formDataGroup);
/** @var NodeFactory $nodeFactory */
$nodeFactory = GeneralUtility::makeInstance(NodeFactory::class);
$formDataCompilerInput = ['vanillaUid' => (int) $this->P['uid'], 'tableName' => $this->P['table'], 'command' => 'edit', 'disabledWizards' => true];
$formData = $formDataCompiler->compile($formDataCompilerInput);
$formData['fieldListToRender'] = $this->P['field'];
$formData['renderType'] = 'outerWrapContainer';
$formResult = $nodeFactory->create($formData)->render();
/** @var FormResultCompiler $formResultCompiler */
$formResultCompiler = GeneralUtility::makeInstance(FormResultCompiler::class);
$formResultCompiler->mergeResult($formResult);
// override the default jumpToUrl
$this->moduleTemplate->addJavaScriptCode('RteWizardInlineCode', 'function jumpToUrl(URL,formEl) {
if (document.editform) {
if (!TBE_EDITOR.isFormChanged()) {
window.location.href = URL;
} else if (formEl) {
if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
}
} else {
window.location.href = URL;
}
}
');
// Setting JavaScript of the pid value for viewing:
if ($this->popView) {
$this->moduleTemplate->addJavaScriptCode('PopupViewInlineJS', BackendUtility::viewOnClick($formData['databaseRow']['pid'], '', BackendUtility::BEgetRootLine($formData['databaseRow']['pid'])));
}
$pageTsConfigMerged = $formData['pageTsConfigMerged'];
if ((string) $pageTsConfigMerged['TCEFORM.'][$this->P['table'] . '.'][$this->P['field'] . '.']['RTEfullScreenWidth'] !== '') {
$width = (string) $pageTsConfigMerged['TCEFORM.'][$this->P['table'] . '.'][$this->P['field'] . '.']['RTEfullScreenWidth'];
} else {
$width = '100%';
}
// Get the form field and wrap it in the table with the buttons:
$formContent = $formResult['html'];
$formContent = '
<table border="0" cellpadding="0" cellspacing="0" width="' . $width . '" id="typo3-rtewizard">
<tr>
<td width="' . $width . '" colspan="2" id="c-formContent">' . $formContent . '</td>
<td></td>
</tr>
</table>';
// Adding hidden fields:
$formContent .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($this->R_URI) . '" />
<input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" />';
// Finally, add the whole setup:
$this->content .= $formResultCompiler->JStop() . $formContent . $formResultCompiler->printNeededJSFunctions();
} else {
// ERROR:
$this->content .= '<h2>' . $this->getLanguageService()->getLL('forms_title', true) . '</h2>' . '<div><span class="text-danger">' . $this->getLanguageService()->getLL('table_noData', true) . '</span></div>';
}
// Setting up the buttons and markers for docHeader
$this->getButtons();
// Build the <body> for the module
$this->content .= '</form>';
$this->moduleTemplate->setContent($this->content);
}
示例15: DB_view
/**
* Adding CM element for View Page
*
* @param integer $id Page uid (PID)
* @param string $anchor Anchor, if any
* @return array Item array, element in $menuItems
* @internal
* @todo Define visibility
*/
public function DB_view($id, $anchor = '')
{
return $this->linkItem($this->label('view'), $this->excludeIcon(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-view')), \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($id, $this->PH_backPath, \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($id), $anchor) . 'return hideCM();');
}