| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- namespace Opentalent\OtTemplating\Controller;
- use Opentalent\OtTemplating\Utilities\OtPageRepository;
- use TYPO3\CMS\Core\Page\PageRenderer;
- use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
- use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
- use TYPO3\CMS\Core\Utility\GeneralUtility;
- /**
- * Controller for the OtCustomizer backend submodule
- *
- * @author olivier.massot
- */
- class OtCustomizerController extends ActionController {
- CONST themes = [
- 'classic' => [
- 'name' => 'Classique',
- 'description' => 'Le thème classique',
- 'picture' => 'EXT:ot_templating/Resources/Public/media/theme_classic.png'
- ],
- 'modern' => [
- 'name' => 'Moderne',
- 'description' => 'Le thème 2020 pour votre site',
- 'picture' => 'EXT:ot_templating/Resources/Public/media/theme_modern.png'
- ]
- ];
- /**
- *
- * @var int
- */
- protected $pageRootId;
- public function __construct() {
- $this->pageRootId = (int) GeneralUtility::_GP('id');
- }
- /**
- * Index action
- */
- public function indexAction() {
- // Get the current page
- $pageRepository = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
- $pageId = (int) GeneralUtility::_GP('id');
- $page = $pageRepository->getPage($pageId);
- // Get the root page of the site
- $pageRepository = new OtPageRepository();
- $rootPage = $pageRepository->getRootPageFor($pageId);
- // If the current page is not a root page or a subpage of one, abort
- $pageSelected = ($rootPage['uid'] > 0);
- $this->view->assign('pageSelected', (int)$pageSelected);
- if (!$pageSelected) {
- return;
- }
- $this->view->assign('rootPage', $rootPage);
- $this->view->assign('themes', self::themes);
- }
- /**
- * Gets the backend user
- *
- * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
- */
- protected function getBackendUser() {
- return $GLOBALS['BE_USER'];
- }
- }
|