ajout gestion configuration
FossilOrigin-Name: 55aa65aa3ba12a83c4f9bf2e77f37f84412765180708aa2d64e49e0620d1dded
This commit is contained in:
parent
a59923348f
commit
9bbd9de84f
40
templates/config.tpl
Normal file
40
templates/config.tpl
Normal file
@ -0,0 +1,40 @@
|
||||
<!-- nav bar -->
|
||||
{include file="%s/templates/_nav.tpl"|args:$plugin_root current_nav="config"}
|
||||
|
||||
<h2>Configuration</h2>
|
||||
|
||||
{if $ok && !$form->hasErrors()}
|
||||
<p class="block confirm">
|
||||
La configuration a bien été enregistrée.
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
{form_errors}
|
||||
|
||||
<form method="post" action="{$self_url}">
|
||||
<fieldset>
|
||||
<legend>Objet</legend>
|
||||
<dl>
|
||||
<dt><label>L'objet (but) de l'association doit tenir sur 3 lignes de 100 caractères maximum chacune.</label><b title="(Champ obligatoire)">obligatoire pour reçus fiscaux</b></dt>
|
||||
{input type="text" name="objet_0" source=$plugin.config label="Ligne 1" maxlength=95}
|
||||
{input type="text" name="objet_1" source=$plugin.config label="Ligne 2" maxlength=95}
|
||||
{input type="text" name="objet_2" source=$plugin.config label="Ligne 3" maxlength=95}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Droit à la réduction d'impôt</legend>
|
||||
<dl>
|
||||
<dt><label>Articles concernés par l'association : </label>
|
||||
<b title="(Champ obligatoire)">obligatoire pour reçus fiscaux</b>
|
||||
</dt>
|
||||
{foreach from=$plugin_config->articlesCGI key="num" item="article"}
|
||||
{input type="checkbox" name="cgi_art_%s"|args:$num value="1" source=$plugin.config label=$article}
|
||||
{/foreach}
|
||||
</dl>
|
||||
</fieldset>
|
||||
<p class="submit">
|
||||
{csrf_field key="recusfiscaux_config"}
|
||||
{button type="submit" name="save" label="Enregistrer" shape="right" class="main"}
|
||||
</p>
|
||||
</form>
|
28
www/admin/config.php
Normal file
28
www/admin/config.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Garradin;
|
||||
|
||||
$session->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');
|
Loading…
Reference in New Issue
Block a user