cc6c46f59d
FossilOrigin-Name: 2134225b5757bee55253c1af81ba9f3dab5ea2f948c93ae42d76d3af6164f370
53 lines
1.7 KiB
PHP
53 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Garradin;
|
|
use Garradin\Files\Files;
|
|
use Garradin\Entities\Files\File;
|
|
|
|
$session->requireAccess($session::SECTION_CONFIG, $session::ACCESS_ADMIN);
|
|
$art_sel=f('articlesCGI') ? : [];
|
|
|
|
$path = qg('path') ?: File::CONTEXT_CONFIG;
|
|
$context = Files::getContext($path);
|
|
$context_ref = Files::getContextRef($path);
|
|
|
|
if (f('save') && $form->check('recusfiscaux_config'))
|
|
{
|
|
try {
|
|
// objet de l'association
|
|
$plugin->setConfig('objet_asso', trim(f('objet_asso')));
|
|
|
|
// articles du CGI
|
|
$confArticles = $plugin->getConfig('articlesCGI');
|
|
// effacer l'ancienne configuration
|
|
for ($i = 0; $i < count($confArticles); ++$i) {
|
|
$confArticles[$i]->valeur = 0;
|
|
}
|
|
// et copier la nouvelle
|
|
foreach ($art_sel as $article) {
|
|
$confArticles[$article]->valeur = 1;
|
|
}
|
|
$plugin->setConfig("articlesCGI", $confArticles);
|
|
|
|
// nom, fonction et signature du responsable
|
|
$plugin->setConfig('nom_responsable', trim(f('nom_responsable')));
|
|
$plugin->setConfig('fonction_responsable', trim(f('fonction_responsable')));
|
|
if (isset($_SESSION['sig_file']) && count($_SESSION['sig_file']) > 0) {
|
|
$plugin->setConfig('signature', $_SESSION['sig_file'][0]->path);
|
|
}
|
|
|
|
\Garradin\Utils::redirect(PLUGIN_URL . 'config.php?ok');
|
|
}
|
|
catch (UserException $e)
|
|
{
|
|
$form->addError($e->getMessage());
|
|
}
|
|
}
|
|
|
|
$tpl->assign('ok', qg('ok') !== null);
|
|
$tpl->assign('path', $path);
|
|
$tpl->assign('default_signature', \Garradin\WWW_URL . "plugin/recusfiscaux/default_signature.png");
|
|
$tpl->assign('plugin_config', $plugin->getConfig());
|
|
$tpl->assign('plugin_css', ['style.css']);
|
|
$tpl->display(PLUGIN_ROOT . '/templates/config.tpl');
|