From 9bbd9de84f8772b857c1d798266bb1bc95767587 Mon Sep 17 00:00:00 2001 From: engel <> Date: Sat, 29 Jan 2022 14:00:04 +0000 Subject: [PATCH] ajout gestion configuration FossilOrigin-Name: 55aa65aa3ba12a83c4f9bf2e77f37f84412765180708aa2d64e49e0620d1dded --- templates/config.tpl | 40 ++++++++++++++++++++++++++++++++++++++++ www/admin/config.php | 28 ++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 templates/config.tpl create mode 100644 www/admin/config.php diff --git a/templates/config.tpl b/templates/config.tpl new file mode 100644 index 0000000..3728eea --- /dev/null +++ b/templates/config.tpl @@ -0,0 +1,40 @@ + +{include file="%s/templates/_nav.tpl"|args:$plugin_root current_nav="config"} + +
+ La configuration a bien été enregistrée. +
+{/if} + +{form_errors} + + diff --git a/www/admin/config.php b/www/admin/config.php new file mode 100644 index 0000000..494046c --- /dev/null +++ b/www/admin/config.php @@ -0,0 +1,28 @@ +requireAccess($session::SECTION_CONFIG, $session::ACCESS_ADMIN); + +if (f('save') && $form->check('recusfiscaux_config')) +{ + try { + $plugin->setConfig('objet_0', trim(f('objet_0'))); + $plugin->setConfig('objet_1', trim(f('objet_1'))); + $plugin->setConfig('objet_2', trim(f('objet_2')));; + $plugin->setConfig('cgi_art1', (bool)f('cgi_art_1')); + $plugin->setConfig('cgi_art2', (bool)f('cgi_art_2')); + $plugin->setConfig('cgi_art3', (bool)f('cgi_art_3')); + \Garradin\Utils::redirect(PLUGIN_URL . 'config.php?ok'); + } + catch (UserException $e) + { + $form->addError($e->getMessage()); + } +} + +$tpl->assign('ok', qg('ok') !== null); +$tpl->assign('plugin_config', $plugin->getConfig()); +$tpl->assign('plugin_css', ['style.css']); + +$tpl->display(PLUGIN_ROOT . '/templates/config.tpl');