TYPO3 CMS  TYPO3_7-6
AbstractController.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
22 
27 {
31  protected $defaultViewObjectName = BackendTemplateView::class;
32 
36  protected $view;
37 
41  protected $extensionName = 'Workspaces';
42 
46  protected $pageRenderer;
47 
51  protected $pageId;
52 
58  protected function initializeAction()
59  {
60  $this->pageRenderer = $this->getPageRenderer();
61  // @todo Evaluate how the intval() call can be used with Extbase validators/filters
62  $this->pageId = (int)GeneralUtility::_GP('id');
63  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
64  $icons = [
65  'language' => $iconFactory->getIcon('flags-multiple', Icon::SIZE_SMALL)->render(),
66  'integrity' => $iconFactory->getIcon('status-dialog-information', Icon::SIZE_SMALL)->render(),
67  'success' => $iconFactory->getIcon('status-dialog-ok', Icon::SIZE_SMALL)->render(),
68  'info' => $iconFactory->getIcon('status-dialog-information', Icon::SIZE_SMALL)->render(),
69  'warning' => $iconFactory->getIcon('status-dialog-warning', Icon::SIZE_SMALL)->render(),
70  'error' => $iconFactory->getIcon('status-dialog-error', Icon::SIZE_SMALL)->render()
71  ];
72  $this->pageRenderer->addInlineSetting('Workspaces', 'icons', $icons);
73  $this->pageRenderer->addInlineSetting('Workspaces', 'id', $this->pageId);
74  $this->pageRenderer->addInlineSetting('Workspaces', 'depth', $this->pageId === 0 ? 999 : 1);
75  $this->pageRenderer->addInlineSetting('Workspaces', 'language', $this->getLanguageSelection());
76  $this->pageRenderer->addCssFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('workspaces') . 'Resources/Public/Css/module.css');
77  $this->pageRenderer->addInlineLanguageLabelArray([
78  'title' => $GLOBALS['LANG']->getLL('title'),
79  'path' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.path'),
80  'table' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.table'),
81  'depth' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_perm.xlf:Depth'),
82  'depth_0' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_0'),
83  'depth_1' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_1'),
84  'depth_2' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_2'),
85  'depth_3' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_3'),
86  'depth_4' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_4'),
87  'depth_infi' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_infi')
88  ]);
89  $this->pageRenderer->addInlineLanguageLabelFile('EXT:workspaces/Resources/Private/Language/locallang.xlf');
90  $this->assignExtensionSettings();
91  }
92 
98  protected function assignExtensionSettings()
99  {
100  $extension = [
101  'AdditionalColumn' => [
102  'Definition' => [],
103  'Handler' => [],
104  ],
105  ];
106 
107  $extension['AdditionalColumn']['Definition'] = $this->getAdditionalColumnService()->getDefinition();
108  $extension['AdditionalColumn']['Handler'] = $this->getAdditionalColumnService()->getHandler();
109  $this->pageRenderer->addInlineSetting('Workspaces', 'extension', $extension);
110  }
111 
117  protected function getLanguageSelection()
118  {
119  $language = 'all';
120  $backendUser = $this->getBackendUser();
121  if (isset($backendUser->uc['moduleData']['Workspaces'][$backendUser->workspace]['language'])) {
122  $language = $backendUser->uc['moduleData']['Workspaces'][$backendUser->workspace]['language'];
123  }
124  return $language;
125  }
126 
130  protected function getAdditionalColumnService()
131  {
132  return $this->objectManager->get(\TYPO3\CMS\Workspaces\Service\AdditionalColumnService::class);
133  }
134 
138  protected function getAdditionalResourceService()
139  {
140  return $this->objectManager->get(\TYPO3\CMS\Workspaces\Service\AdditionalResourceService::class);
141  }
142 
146  protected function getBackendUser()
147  {
148  return $GLOBALS['BE_USER'];
149  }
150 
154  protected function getPageRenderer()
155  {
156  return GeneralUtility::makeInstance(PageRenderer::class);
157  }
158 }
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']