TYPO3 CMS  TYPO3_6-2
BackendUtilityHook.php
Go to the documentation of this file.
1 <?php
3 
22 
28  static public function getInstance() {
29  return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(__CLASS__);
30  }
31 
45  public function preProcess(&$pageUid, $backPath, $rootLine, $anchorSection, &$viewScript, $additionalGetVars, $switchFocus) {
46  if ($GLOBALS['BE_USER']->workspace !== 0) {
47  $viewScript = $this->getWorkspaceService()->generateWorkspaceSplittedPreviewLink($pageUid);
48  }
49  }
50 
56  protected function getWorkspaceService() {
57  return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Workspaces\\Service\\WorkspaceService');
58  }
59 
68  public function makeEditForm_accessCheck($params, &$form) {
69  if ($GLOBALS['BE_USER']->workspace !== 0 && $GLOBALS['TCA'][$params['table']]['ctrl']['versioningWS']) {
70  $record = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL($params['table'], $params['uid']);
71  if (abs($record['t3ver_stage']) > \TYPO3\CMS\Workspaces\Service\StagesService::STAGE_EDIT_ID) {
72  $stages = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Workspaces\\Service\\StagesService');
73  $stageName = $stages->getStageTitle($record['t3ver_stage']);
74  $editingName = $stages->getStageTitle(\TYPO3\CMS\Workspaces\Service\StagesService::STAGE_EDIT_ID);
75  $message = $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:info.elementAlreadyModified');
76  $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', sprintf($message, $stageName, $editingName), '', \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, TRUE);
78  $flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
80  $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
81  $defaultFlashMessageQueue->enqueue($flashMessage);
82  }
83  }
84  return $params['hasAccess'];
85  }
86 
87 }
static getRecordWSOL($table, $uid, $fields=' *', $where='', $useDeleteClause=TRUE, $unsetMovePointers=FALSE)
preProcess(&$pageUid, $backPath, $rootLine, $anchorSection, &$viewScript, $additionalGetVars, $switchFocus)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]