From 97cf0a727bc02c9d80455f273b3491a6c775ca6f Mon Sep 17 00:00:00 2001 From: afornerot Date: Wed, 3 Mar 2021 16:34:28 +0100 Subject: [PATCH] pouvoir forcer l'utilisation d'un theme (fixes #31090) --- dicos/91_ninegate.xml | 12 +++++++++++ .../CoreBundle/Command/InitDataCommand.php | 21 +++++++++++++++++++ tmpl/ninegate-template.yml | 9 ++++++++ 3 files changed, 42 insertions(+) diff --git a/dicos/91_ninegate.xml b/dicos/91_ninegate.xml index 0f6a4e92..6b698e41 100644 --- a/dicos/91_ninegate.xml +++ b/dicos/91_ninegate.xml @@ -127,6 +127,9 @@ 8 8 + non + + @@ -494,6 +497,8 @@ ninegate_moderegistration ninegate_keyterm ninegate_minpassword + ninegate_forcetheme + ninegate_forcethemename ninegate_activate_portal ninegate_activate_page @@ -699,6 +704,13 @@ ninegate_addomaineprofil + + + non + + ninegate_forcethemename + + non diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/InitDataCommand.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/InitDataCommand.php index 92e04e50..77f28f1d 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/InitDataCommand.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/InitDataCommand.php @@ -237,6 +237,27 @@ class InitDataCommand extends ContainerAwareCommand $this->addModeration($profil,'cadoles_cron_config_log',0); } + // Forcer le theme + $force_theme=$this->getContainer()->getParameter('force_theme'); + if($force_theme) { + + // On force la configuration du theme + $force_themename=$this->getContainer()->getParameter('force_themename'); + $config = $em->getRepository('CadolesCoreBundle:Config')->find("theme"); + if($config) { + $config->setValue($force_themename); + $em->persist($config); + $em->flush(); + } + + // On enlève l'accès de la sidebar + $sidebar = $em->getRepository('CadolesCoreBundle:Sidebar')->findOneBy(["path"=>"cadoles_core_config_theme"]); + if($sidebar) { + $em->remove($sidebar); + $em->flush(); + } + } + $output->writeln(''); } diff --git a/tmpl/ninegate-template.yml b/tmpl/ninegate-template.yml index 0bf95e68..9abe2541 100644 --- a/tmpl/ninegate-template.yml +++ b/tmpl/ninegate-template.yml @@ -30,6 +30,15 @@ parameters: %end if initpwdadmin: %%getVar("ninegate_pwdadmin", '') + # Force theme +%if %%getVar("ninegate_forcetheme", 'non') == "oui" + force_theme: true + force_themename: %%ninegate_forcethemename +%else + force_theme: false + force_themename: +%end if + # Activation module %if %%getVar("ninegate_activate_cron", 'non') == "oui" cron_activate: true