本文整理汇总了PHP中TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUtility::getUrlToken方法的具体用法?PHP BackendUtility::getUrlToken怎么用?PHP BackendUtility::getUrlToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Backend\Utility\BackendUtility
的用法示例。
在下文中一共展示了BackendUtility::getUrlToken方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param \TYPO3\CMS\Backend\Controller\BackendController $backendReference TYPO3 backend object reference
*/
public function __construct(\TYPO3\CMS\Backend\Controller\BackendController &$backendReference = NULL)
{
$this->backendReference = $backendReference;
$this->cacheActions = array();
$this->optionValues = array('all', 'pages');
// Clear cache for ALL tables!
if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.all')) {
$title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCacheMenu_all', TRUE);
$this->cacheActions[] = array('id' => 'all', 'title' => $title, 'href' => $this->backPath . 'tce_db.php?vC=' . $GLOBALS['BE_USER']->veriCode() . '&cacheCmd=all&ajaxCall=1' . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction'), 'icon' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-cache-clear-impact-high'));
}
// Clear cache for either ALL pages
if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.pages')) {
$title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCacheMenu_pages', TRUE);
$this->cacheActions[] = array('id' => 'pages', 'title' => $title, 'href' => $this->backPath . 'tce_db.php?vC=' . $GLOBALS['BE_USER']->veriCode() . '&cacheCmd=pages&ajaxCall=1' . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction'), 'icon' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-cache-clear-impact-medium'));
}
// Clearing of cache-files in typo3conf/ + menu
if ($GLOBALS['BE_USER']->isAdmin()) {
$title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCacheMenu_allTypo3Conf', TRUE);
$this->cacheActions[] = array('id' => 'temp_CACHED', 'title' => $title, 'href' => $this->backPath . 'tce_db.php?vC=' . $GLOBALS['BE_USER']->veriCode() . '&cacheCmd=temp_CACHED&ajaxCall=1' . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction'), 'icon' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-cache-clear-impact-low'));
}
// Hook for manipulate cacheActions
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'] as $cacheAction) {
$hookObject = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($cacheAction);
if (!$hookObject instanceof \TYPO3\CMS\Backend\Toolbar\ClearCacheActionsHookInterface) {
throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Backend\\Toolbar\\ClearCacheActionsHookInterface', 1228262000);
}
$hookObject->manipulateCacheActions($this->cacheActions, $this->optionValues);
}
}
}
示例2: manipulateCacheActions
/**
* Add an entry to the CacheMenuItems array
*
* @param array $cacheActions Array of CacheMenuItems
* @param array $optionValues Array of AccessConfigurations-identifiers (typically used by userTS with options.clearCache.identifier)
*/
public function manipulateCacheActions(&$cacheActions, &$optionValues)
{
$title = LocalizationUtility::translate('cache_action.title', 'cs_clear_images');
$icon = '<img ' . IconUtility::skinImg($GLOBALS['BACK_PATH'], ExtensionManagementUtility::extRelPath('cs_clear_images') . 'Resources/Public/Images/clear_cache_icon.png', 'width="16" height="16"') . ' alt="" title="' . $title . '"/>';
// Clearing of processed images
$cacheActions[] = array('id' => 'tx_csclearimages', 'title' => $title, 'href' => $this->backPath . 'tce_db.php?vC=' . $GLOBALS['BE_USER']->veriCode() . '&cacheCmd=tx_csclearimages&ajaxCall=1' . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction'), 'icon' => $icon);
}
示例3: manipulateCacheActions
/**
* Modifies CacheMenuItems array
*
* @param array $cacheActions Array of CacheMenuItems
* @param array $optionValues Array of AccessConfigurations-identifiers (typically used by userTS with options.clearCache.identifier)
*/
public function manipulateCacheActions(&$cacheActions, &$optionValues)
{
if ($this->getBackendUser()->getTSConfigVal('options.clearCache.system') || GeneralUtility::getApplicationContext()->isDevelopment() || (bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === TRUE && $this->getBackendUser()->isAdmin()) {
$cacheActions[] = array('id' => 'dyncss', 'title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesTitle', TRUE), 'description' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesDescription', TRUE), 'href' => BackendUtility::getModuleUrl('tce_db') . '&vC=' . $this->getBackendUser()->veriCode() . '&cacheCmd=dyncss&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-high'));
$optionValues[] = 'dyncss';
}
}
示例4: __construct
/**
* Constructor
*
* @throws \UnexpectedValueException
*/
public function __construct()
{
$backendUser = $this->getBackendUser();
$languageService = $this->getLanguageService();
$this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Toolbar/ClearCacheMenu');
// Clear all page-related caches
if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.pages')) {
$this->cacheActions[] = array('id' => 'pages', 'title' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesTitle', TRUE), 'description' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesDescription', TRUE), 'href' => BackendUtility::getModuleUrl('tce_db', ['vC' => $backendUser->veriCode(), 'cacheCmd' => 'pages', 'ajaxCall' => 1]) . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-low'));
$this->optionValues[] = 'pages';
}
// Clear cache for ALL tables!
if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.all')) {
$this->cacheActions[] = array('id' => 'all', 'title' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesTitle', TRUE), 'description' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesDescription', TRUE), 'href' => BackendUtility::getModuleUrl('tce_db', ['vC' => $backendUser->veriCode(), 'cacheCmd' => 'all', 'ajaxCall' => 1]) . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-medium'));
$this->optionValues[] = 'all';
}
// Clearing of system cache (core cache, class cache etc)
// is only shown explicitly if activated for a BE-user (not activated for admins by default)
// or if the system runs in development mode
// or if $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] is set (only for admins)
if ($backendUser->getTSConfigVal('options.clearCache.system') || GeneralUtility::getApplicationContext()->isDevelopment() || (bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === TRUE && $backendUser->isAdmin()) {
$this->cacheActions[] = array('id' => 'system', 'title' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesTitle', TRUE), 'description' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesDescription', TRUE), 'href' => BackendUtility::getModuleUrl('tce_db', ['vC' => $backendUser->veriCode(), 'cacheCmd' => 'system', 'ajaxCall' => 1]) . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-high'));
$this->optionValues[] = 'system';
}
// Hook for manipulating cacheActions
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'] as $cacheAction) {
$hookObject = GeneralUtility::getUserObj($cacheAction);
if (!$hookObject instanceof ClearCacheActionsHookInterface) {
throw new \UnexpectedValueException('$hookObject must implement interface ' . ClearCacheActionsHookInterface::class, 1228262000);
}
$hookObject->manipulateCacheActions($this->cacheActions, $this->optionValues);
}
}
}
示例5: manipulateCacheActions
/**
* Modifies CacheMenuItems array
*
* @param array $cacheActions Array of CacheMenuItems
* @param array $optionValues Array of AccessConfigurations-identifiers (typically used by userTS with options.clearCache.identifier)
*
* @return void
*/
public function manipulateCacheActions(&$cacheActions, &$optionValues)
{
if ($this->getBackendUser()->getTSConfigVal('options.clearCache.system') || GeneralUtility::getApplicationContext()->isDevelopment() || (bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === TRUE && $this->getBackendUser()->isAdmin()) {
$cacheActions[] = array('id' => 'dyncss', 'title' => $this->getLanguageService()->sL('LLL:EXT:dyncss/Resources/Private/Language/locallang.xlf:dyncss.toolbar.clearcache.title', TRUE), 'description' => $this->getLanguageService()->sL('LLL:EXT:dyncss/Resources/Private/Language/locallang.xlf:dyncss.toolbar.clearcache.description', TRUE), 'href' => BackendUtility::getModuleUrl('tce_db') . '&vC=' . $this->getBackendUser()->veriCode() . '&cacheCmd=dyncss&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('extensions-dyncss-lightning-blue'));
$optionValues[] = 'dyncss';
}
}
示例6: renderForeignRecordHeaderControl_postProcess
/**
* Post-processing to define which control items to show. Possibly own icons can be added here.
*
* @param string $parentUid The uid of the parent (embedding) record (uid or NEW...)
* @param string $foreignTable The table (foreign_table) we create control-icons for
* @param array $childRecord The current record of that foreign_table
* @param array $childConfig TCA configuration of the current field of the child record
* @param boolean $isVirtual Defines whether the current records is only virtually shown and not physically part of the parent record
* @param array $controlItems (reference) Associative array with the currently available control items
*
* @return void
*/
public function renderForeignRecordHeaderControl_postProcess($parentUid, $foreignTable, array $childRecord, array $childConfig, $isVirtual, array &$controlItems)
{
if ($foreignTable != 'sys_file_reference') {
return;
}
if (!GeneralUtility::isFirstPartOfStr($childRecord['uid_local'], 'sys_file_')) {
return;
}
$parts = BackendUtility::splitTable_Uid($childRecord['uid_local']);
if (!isset($parts[1])) {
return;
}
$table = $childRecord['tablenames'];
$uid = $parentUid;
$arguments = GeneralUtility::_GET();
if ($this->isValidRecord($table, $uid) && isset($arguments['edit'])) {
$returnUrl = ['edit' => $arguments['edit'], 'returnUrl' => $arguments['returnUrl']];
if (GeneralUtility::compat_version('7.0')) {
$returnUrlGenerated = BackendUtility::getModuleUrl('record_edit', $returnUrl);
} else {
$returnUrlGenerated = 'alt_doc.php?' . ltrim(GeneralUtility::implodeArrayForUrl('', $returnUrl, '', true, true), '&') . BackendUtility::getUrlToken('editRecord');
}
$wizardArguments = ['P' => ['referenceUid' => $childRecord['uid'], 'returnUrl' => $returnUrlGenerated]];
$wizardUri = BackendUtility::getModuleUrl('focuspoint', $wizardArguments);
} else {
$wizardUri = 'javascript:alert(\'Please save the base record first, because open this wizard will not save the changes in the current form!\');';
}
/** @var WizardService $wizardService */
$wizardService = GeneralUtility::makeInstance('HDNET\\Focuspoint\\Service\\WizardService');
$this->arrayUnshiftAssoc($controlItems, 'focuspoint', $wizardService->getWizardButton($wizardUri));
}
示例7: __construct
/**
* Constructor
*
* @param \TYPO3\CMS\Backend\Controller\BackendController $backendReference TYPO3 backend object reference
* @throws \UnexpectedValueException
*/
public function __construct(\TYPO3\CMS\Backend\Controller\BackendController &$backendReference = NULL)
{
$this->backendReference = $backendReference;
$this->cacheActions = array();
$this->optionValues = array();
$backendUser = $this->getBackendUser();
// Clear all page-related caches
if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.pages')) {
$this->cacheActions[] = array('id' => 'pages', 'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesTitle', TRUE), 'description' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesDescription', TRUE), 'href' => $this->backPath . 'tce_db.php?vC=' . $backendUser->veriCode() . '&cacheCmd=pages&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-low'));
$this->optionValues[] = 'pages';
}
// Clear cache for ALL tables!
if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.all')) {
$this->cacheActions[] = array('id' => 'all', 'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesTitle', TRUE), 'description' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesDescription', TRUE), 'href' => $this->backPath . 'tce_db.php?vC=' . $backendUser->veriCode() . '&cacheCmd=all&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-medium'));
$this->optionValues[] = 'all';
}
// Clearing of system cache (core cache, class cache etc)
// is only shown explicitly if activated for a BE-user (not activated for admins by default)
// or if the system runs in development mode
// or if $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] is set (only for admins)
if ($backendUser->getTSConfigVal('options.clearCache.system') || GeneralUtility::getApplicationContext()->isDevelopment() || (bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === TRUE && $backendUser->isAdmin()) {
$this->cacheActions[] = array('id' => 'system', 'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesTitle', TRUE), 'description' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesDescription', TRUE), 'href' => $this->backPath . 'tce_db.php?vC=' . $backendUser->veriCode() . '&cacheCmd=system&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-high'));
$this->optionValues[] = 'system';
}
// Hook for manipulating cacheActions
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'] as $cacheAction) {
$hookObject = GeneralUtility::getUserObj($cacheAction);
if (!$hookObject instanceof \TYPO3\CMS\Backend\Toolbar\ClearCacheActionsHookInterface) {
throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Backend\\Toolbar\\ClearCacheActionsHookInterface', 1228262000);
}
$hookObject->manipulateCacheActions($this->cacheActions, $this->optionValues);
}
}
}
示例8: render
/**
* Render link with sprite icon to remove user
*
* @param \TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser Target backendUser to switch active session to
* @return string
*/
public function render(\TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser)
{
if ($backendUser->getUid() == $GLOBALS['BE_USER']->user['uid']) {
return '';
}
$redirectUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI');
$parameters = 'cmd[be_users][' . $backendUser->getUid() . '][delete]=1';
$url = $GLOBALS['BACK_PATH'] . 'tce_db.php?&' . $parameters . '&redirect=' . ($redirectUrl == '' ? '\' + T3_THIS_LOCATION + \'' : rawurlencode($redirectUrl)) . '&vC=' . rawurlencode($GLOBALS['BE_USER']->veriCode()) . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction') . '&prErr=1&uPT=1';
return '<a href="' . $url . '" onclick="return confirm(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('confirm', 'beuser', array($backendUser->getUserName()))) . ')">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
}
示例9: renderStatic
/**
* @param array $arguments
* @param callable $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
*
* @return string
*/
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{
/** @var BackendUserAuthentication $beUser */
$beUser = $GLOBALS['BE_USER'];
$urlParameters = ['vC' => $beUser->veriCode(), 'prErr' => 1, 'uPT' => 1, 'redirect' => $arguments['redirectUrl'] ?: GeneralUtility::getIndpEnv('REQUEST_URI')];
if (isset($arguments['parameters'])) {
$parametersArray = GeneralUtility::explodeUrl2Array($arguments['parameters']);
$urlParameters += $parametersArray;
}
return htmlspecialchars(BackendUtility::getModuleUrl('tce_db', $urlParameters) . BackendUtility::getUrlToken('tceAction'));
}
示例10: renderStatic
/**
* @param array $arguments
* @param callable $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
*
* @return string
*/
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{
/** @var \TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser */
$backendUser = $arguments['backendUser'];
/** @var BackendUserAuthentication $beUser */
$beUser = $GLOBALS['BE_USER'];
if ($backendUser->getUid() === (int) $beUser->user['uid']) {
return '<span class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</span>';
}
$urlParameters = ['cmd[be_users][' . $backendUser->getUid() . '][delete]' => 1, 'vC' => $beUser->veriCode(), 'prErr' => 1, 'uPT' => 1, 'redirect' => GeneralUtility::getIndpEnv('REQUEST_URI')];
$url = BackendUtility::getModuleUrl('tce_db', $urlParameters) . BackendUtility::getUrlToken('tceAction');
return '<a class="btn btn-default" href="' . htmlspecialchars($url) . '" onclick="return confirm(' . GeneralUtility::quoteJSvalue(LocalizationUtility::translate('confirm', 'beuser', array($backendUser->getUserName()))) . ')">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
}
示例11: render
/**
* Returns a URL to link to quick command
*
* @param string $parameters Is a set of GET params to send to FormEngine
* @return string URL to FormEngine module + parameters
*/
public function render($parameters)
{
$parameters = GeneralUtility::explodeUrl2Array($parameters);
$parameters['vC'] = $this->getBackendUserAuthentication()->veriCode();
$parameters['prErr'] = 1;
$parameters['uPT'] = 1;
// Make sure record_edit module is available
if (GeneralUtility::compat_version('7.0')) {
$url = BackendUtility::getModuleUrl('tce_db', $parameters);
} else {
$url = 'tce_db.php?' . GeneralUtility::implodeArrayForUrl('', $parameters);
}
return $url . BackendUtility::getUrlToken('tceAction');
}
示例12: renderStatic
/**
* Renders a link to delete the file
*
* @param array $arguments
* @param Closure $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
*
* @return string
*/
public static function renderStatic(array $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{
$veriCode = '&vC=';
if ($GLOBALS['BE_USER'] instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication) {
$veriCode .= $GLOBALS['BE_USER']->veriCode() . BackendUtility::getUrlToken('tceAction');
}
if (empty($arguments['returnUrl'])) {
$arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI');
}
/** @var \TYPO3\CMS\Core\Resource\AbstractFile $file */
$file = $arguments['file'];
$params = ['file' => ['delete' => [0 => ['data' => $file->getCombinedIdentifier()]]], 'redirect' => $arguments['returnUrl']];
return BackendUtility::getModuleUrl('tce_file', $params) . $veriCode;
}
示例13: getModuleUrl
/**
* Returns the URL to a given module
* mainly used for visibility settings or deleting
* a record via AJAX
*
* @param string $moduleName Name of the module
* @param array $urlParameters URL parameters that should be added as key value pairs
* @return string Calculated URL
* @todo remove condition for TYPO3 6.2 in upcoming major version
*/
public static function getModuleUrl($moduleName, $urlParameters = [])
{
if (GeneralUtility::compat_version('7.2')) {
$uri = BackendUtilityCore::getModuleUrl($moduleName, $urlParameters);
} else {
$uri = 'tce_db.php?' . BackendUtilityCore::getUrlToken('tceAction');
}
return $uri;
}
示例14: main
/**
* Main function.
* Creates some general objects and calls other functions for the main rendering of module content.
*
* @return void
*/
public function main()
{
$lang = $this->getLanguageService();
// Access check...
// The page will show only if there is a valid page and if this page may be viewed by the user
$access = is_array($this->pageinfo) ? 1 : 0;
if ($this->id && $access) {
// Initialize permission settings:
$this->CALC_PERMS = $this->getBackendUser()->calcPerms($this->pageinfo);
$this->EDIT_CONTENT = $this->CALC_PERMS & Permission::CONTENT_EDIT ? 1 : 0;
// Start document template object:
$this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
$this->doc->backPath = $GLOBALS['BACK_PATH'];
$this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/db_layout.html');
// override the default jumpToUrl
$this->doc->JScodeArray['jumpToUrl'] = '
function jumpToUrl(URL,formEl) {
if (document.editform && TBE_EDITOR.isFormChanged) { // Check if the function exists... (works in all browsers?)
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->doc->JScode .= $this->doc->wrapScriptTags('
if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';
if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages' . (int) $this->id . '_"+top.fsMod.currentBank; ' . (int) $this->id . ';
' . ($this->popView ? BackendUtility::viewOnClick($this->id, $GLOBALS['BACK_PATH'], BackendUtility::BEgetRootLine($this->id)) : '') . '
function deleteRecord(table,id,url) { //
if (confirm(' . GeneralUtility::quoteJSvalue($lang->getLL('deleteWarning')) . ')) {
window.location.href = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('tce_db') . '&cmd[') . '+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC=' . $this->getBackendUser()->veriCode() . BackendUtility::getUrlToken('tceAction') . '&prErr=1&uPT=1";
}
return false;
}
');
$this->doc->JScode .= $this->doc->wrapScriptTags('
var DTM_array = new Array();
var DTM_origClass = new String();
// if tabs are used in a popup window the array might not exists
if(!top.DTM_currentTabs) {
top.DTM_currentTabs = new Array();
}
function DTM_activate(idBase,index,doToogle) { //
// Hiding all:
if (DTM_array[idBase]) {
for(cnt = 0; cnt < DTM_array[idBase].length ; cnt++) {
if (DTM_array[idBase][cnt] != idBase+"-"+index) {
document.getElementById(DTM_array[idBase][cnt]+"-DIV").className = "tab-pane";
document.getElementById(DTM_array[idBase][cnt]+"-MENU").attributes.getNamedItem("class").value = "tab";
}
}
}
// Showing one:
if (document.getElementById(idBase+"-"+index+"-DIV")) {
if (doToogle && document.getElementById(idBase+"-"+index+"-DIV").className === "tab-pane active") {
document.getElementById(idBase+"-"+index+"-DIV").className = "tab-pane";
if(DTM_origClass=="") {
document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").value = "tab";
} else {
DTM_origClass = "tab";
}
top.DTM_currentTabs[idBase] = -1;
} else {
document.getElementById(idBase+"-"+index+"-DIV").className = "tab-pane active";
if(DTM_origClass=="") {
document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").value = "active";
} else {
DTM_origClass = "active";
}
top.DTM_currentTabs[idBase] = index;
}
}
}
function DTM_toggle(idBase,index,isInit) { //
// Showing one:
if (document.getElementById(idBase+"-"+index+"-DIV")) {
if (document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") {
document.getElementById(idBase+"-"+index+"-DIV").className = "tab-pane";
if(isInit) {
document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").value = "tab";
} else {
DTM_origClass = "tab";
}
top.DTM_currentTabs[idBase+"-"+index] = 0;
} else {
document.getElementById(idBase+"-"+index+"-DIV").className = "tab-pane active";
//.........这里部分代码省略.........
示例15: issueCommand
/**
* Returns a URL with a command to TYPO3 Core Engine (tce_db.php)
* See description of the API elsewhere.
*
* @param string $params is a set of GET params to send to tce_db.php. Example: "&cmd[tt_content][123][move]=456" or "&data[tt_content][123][hidden]=1&data[tt_content][123][title]=Hello%20World
* @param string $redirectUrl Redirect URL if any other that \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI') is wished
* @return string URL to tce_db.php + parameters (backpath is taken from $this->backPath)
* @see \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick()
* @todo Define visibility
*/
public function issueCommand($params, $redirectUrl = '')
{
$redirectUrl = $redirectUrl ? $redirectUrl : GeneralUtility::getIndpEnv('REQUEST_URI');
$commandUrl = $this->backPath . 'tce_db.php?' . $params . '&redirect=' . ($redirectUrl == -1 ? '\'+T3_THIS_LOCATION+\'' : rawurlencode($redirectUrl)) . '&vC=' . rawurlencode($GLOBALS['BE_USER']->veriCode()) . BackendUtility::getUrlToken('tceAction') . '&prErr=1&uPT=1';
return $commandUrl;
}