connectionPool = $connectionPool; } /** * Index action (default action) * Displays the customizer page on the backend */ public function indexAction() { $this->view->assign('rootPage', $this->currentRootUid); $this->view->assign('templates', TemplateRepository::templates); $templateRepository = GeneralUtility::makeInstance(ObjectManager::class)->get(TemplateRepository::class); $this->view->assign('currentTemplate', $templateRepository->getTemplate($this->currentRootUid)); $this->view->assign('preferences', $templateRepository->getTemplatePreferences($this->currentRootUid)); } /** * A template has been selected, apply the change * */ public function selectTemplateAction() { $templateKey = $this->request->getArgument('template_key'); // applies the change in the database $queryBuilder = $this->connectionPool->getQueryBuilderForTable('pages'); $queryBuilder->update('pages') ->where( $queryBuilder->expr()->eq( 'uid', $queryBuilder->createNamedParameter($this->currentRootUid, PDO::PARAM_INT) ) ) ->set('tx_opentalent_template', $templateKey) ->execute() ; // Clear the site's cache OtCacheManager::clearSiteCache($this->currentRootUid); $this->addFlashMessage('Le thème a bien été modifié'); $this->forward('index'); } /** * Update the site's preferences */ public function updatePreferencesAction() { $args = $this->request->getArguments(); $prefs = TemplateRepository::defaultPreferences; if (isset($args['themeColor'])) { $prefs['themeColor'] = $args['themeColor']; } if (isset($args['displayCarousel'])) { $prefs['displayCarousel'] = $args['displayCarousel'] ? 1 : 0; } if (isset($args['displayBreadcrumb'])) { $prefs['displayBreadcrumb'] = $args['displayBreadcrumb'] ? 1 : 0; } // applies the change in the database $queryBuilder = $this->connectionPool->getQueryBuilderForTable('pages'); $queryBuilder->update('pages') ->where( $queryBuilder->expr()->eq( 'uid', $queryBuilder->createNamedParameter($this->currentRootUid, PDO::PARAM_INT) ) ) ->set('tx_opentalent_template_preferences', json_encode($prefs)) ->execute(); // Clear the site's cache OtCacheManager::clearSiteCache($this->currentRootUid); $this->addFlashMessage('Les préférences ont bien été enregistrées'); $this->forward( 'index', 'OtCustomizer', 'OtTemplating' ); } }