|
|
@@ -16,19 +16,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
|
|
|
*/
|
|
|
class OtCustomizerController extends ActionController {
|
|
|
|
|
|
- CONST templates = [
|
|
|
- 'Classic' => [
|
|
|
- 'name' => 'Classique',
|
|
|
- 'description' => 'Le thème classique, simple et complet.',
|
|
|
- 'picture' => 'EXT:ot_templating/Resources/Public/media/theme_classic.png'
|
|
|
- ],
|
|
|
- 'Modern' => [
|
|
|
- 'name' => 'Moderne',
|
|
|
- 'description' => '[Nouveau] Un thème moderne et intuitif.',
|
|
|
- 'picture' => 'EXT:ot_templating/Resources/Public/media/theme_modern.png'
|
|
|
- ]
|
|
|
- ];
|
|
|
-
|
|
|
/**
|
|
|
* Index action (default action)
|
|
|
* Displays the customize page on the backend
|
|
|
@@ -46,7 +33,15 @@ class OtCustomizerController extends ActionController {
|
|
|
}
|
|
|
|
|
|
$this->view->assign('rootPage', $rootPageUid);
|
|
|
- $this->view->assign('templates', self::templates);
|
|
|
+ $this->view->assign('templates', OtPageRepository::templates);
|
|
|
+
|
|
|
+ $pageRepository = new OtPageRepository();
|
|
|
+ $this->view->assign('currentTemplate', $pageRepository->getCurrentTemplate($rootPageUid));
|
|
|
+ $this->view->assign('preferences', $pageRepository->getTemplatePreferences($rootPageUid));
|
|
|
+
|
|
|
+ $args = $this->request->getArguments();
|
|
|
+ $this->view->assign('preferencesUpdated', $args['preferencesUpdated']);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -74,7 +69,49 @@ class OtCustomizerController extends ActionController {
|
|
|
// Clear the page cache
|
|
|
$this->cleanCache();
|
|
|
|
|
|
- $this->redirect('index');
|
|
|
+ $this->forward('index');
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Update the site's preferences
|
|
|
+ */
|
|
|
+ public function updatePreferencesAction() {
|
|
|
+ $args = $this->request->getArguments();
|
|
|
+
|
|
|
+ $prefs = OtPageRepository::defaultPreferences;
|
|
|
+
|
|
|
+ if (isset($args['themeColor'])) {
|
|
|
+ $prefs['themeColor'] = $args['themeColor'];
|
|
|
+ }
|
|
|
+ if (isset($args['displayCarousel'])) {
|
|
|
+ $prefs['displayCarousel'] = $args['displayCarousel'];
|
|
|
+ }
|
|
|
+
|
|
|
+ // Get the current root page's uid
|
|
|
+ $rootPageUid = $this->getCurrentRootPageUid();
|
|
|
+
|
|
|
+ // applies the change in the database
|
|
|
+ $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
|
|
|
+ $queryBuilder->update('pages')
|
|
|
+ ->where(
|
|
|
+ $queryBuilder->expr()->eq(
|
|
|
+ 'uid',
|
|
|
+ $queryBuilder->createNamedParameter($rootPageUid, PDO::PARAM_INT)
|
|
|
+ )
|
|
|
+ )
|
|
|
+ ->set('tx_opentalent_template_preferences', json_encode($prefs))
|
|
|
+ ->execute()
|
|
|
+ ;
|
|
|
+
|
|
|
+ // Clear the page cache
|
|
|
+ $this->cleanCache();
|
|
|
+
|
|
|
+ $this->forward(
|
|
|
+ 'index',
|
|
|
+ 'OtCustomizer',
|
|
|
+ 'OtTemplating',
|
|
|
+ ['preferencesUpdated'=>'1']
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
|