Overview
Comment: | Édition et suppression de recherche enregistrée |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
a4991057b30fc05cc5e5f80ab3d652ba |
User & Date: | bohwaz on 2018-10-01 17:14:37 |
Other Links: | branch diff | manifest | tags |
Context
2018-10-01
| ||
17:36 | Ajout recherche sur catégorie de membre check-in: b648e8d1ff user: bohwaz tags: dev | |
17:14 | Édition et suppression de recherche enregistrée check-in: a4991057b3 user: bohwaz tags: dev | |
2018-09-27
| ||
14:52 | Enregistrement / modification / liste de recherches enregistrées check-in: 769382af32 user: bohwaz tags: dev | |
Changes
Modified src/include/lib/Garradin/Recherche.php from [ae6601ff1c] to [1c1828c11f].
︙ | ︙ | |||
36 37 38 39 40 41 42 43 44 45 46 47 48 49 | throw new \InvalidArgumentException('Type de recherche inconnu.'); } if (array_key_exists('cible', $data) && !in_array($data['cible'], self::TARGETS, true)) { throw new \InvalidArgumentException('Cible de recherche invalide.'); } if (array_key_exists('type', $data)) { if (empty($data['contenu'])) { throw new UserException('Le contenu ne peut être vide.'); } | > > | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | throw new \InvalidArgumentException('Type de recherche inconnu.'); } if (array_key_exists('cible', $data) && !in_array($data['cible'], self::TARGETS, true)) { throw new \InvalidArgumentException('Cible de recherche invalide.'); } $query = null; if (array_key_exists('type', $data)) { if (empty($data['contenu'])) { throw new UserException('Le contenu ne peut être vide.'); } |
︙ | ︙ |
Modified src/templates/admin/membres/cotisations/supprimer.tpl from [27473236e0] to [979b1b65a7].
︙ | ︙ | |||
24 25 26 27 28 29 30 | Celles-ci ne seront pas supprimées lors de la suppression de la cotisation membre. </p> {else} <p class="help"> Aucune écriture comptable n'est liée à cette cotisation. </p> {/if} | < | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | Celles-ci ne seront pas supprimées lors de la suppression de la cotisation membre. </p> {else} <p class="help"> Aucune écriture comptable n'est liée à cette cotisation. </p> {/if} </fieldset> <p class="submit"> {csrf_field key="del_cotisation_%s"|args:$cotisation.id} <input type="submit" name="delete" value="Supprimer →" /> </p> </form> {include file="admin/_foot.tpl"} |
Modified src/templates/admin/membres/recherches.tpl from [b6b05b2ed5] to [3685bb7adf].
1 2 3 4 | {include file="admin/_head.tpl" title="Recherches enregistrées" current="membres"} {include file="admin/membres/_nav.tpl" current="recherches"} | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | {include file="admin/_head.tpl" title="Recherches enregistrées" current="membres"} {include file="admin/membres/_nav.tpl" current="recherches"} {form_errors} {if $mode == 'edit'} <form method="post" action="{$self_url}"> <fieldset> <legend>Modifier une recherche enregistrée</legend> <dl> <dt><label for="f_intitule">Intitulé</label> <b title="(Champ obligatoire)">obligatoire</b></dt> <dd><input type="text" name="intitule" id="f_intitule" value="{form_field name="intitule" data=$recherche}" size="80" required="required" /></dd> <dt>Statut</dt> <dd><label><input type="radio" name="prive" value="1" {if $recherche.id_membre}checked="checked"{/if} /> Recherche privée</label> — Visible seulement par moi-même</dd> <dd><label><input type="radio" name="prive" value="0" {if !$recherche.id_membre}checked="checked"{/if} /> Recherche publique</label> — Visible et exécutable par tous les membres ayant accès à la gestion des membres</dd> <dt>Type</dt> <dd>{if $recherche.type == Recherche::TYPE_JSON}Avancée{else}SQL{/if}</dd> <dt>Cible</dt> <dd>{$recherche.cible}</dd> </dl> </fieldset> <p class="submit"> {csrf_field key="edit_recherche_%s"|args:$recherche.id} <input type="submit" name="save" value="Enregistrer →" /> </p> </form> {elseif $mode == 'delete'} <form method="post" action="{$self_url}"> <fieldset> <legend>Supprimer une recherche enregistrée</legend> <h3 class="warning"> Êtes-vous sûr de vouloir supprimer la recherche enregistrée {$recherche.intitule} ? </h3> </fieldset> <p class="submit"> {csrf_field key="del_recherche_%s"|args:$recherche.id} <input type="submit" name="delete" value="Supprimer →" /> </p> </form> {elseif count($liste) == 0} <p class="alert">Aucune recherche enregistrée. <a href="{$admin_url}membres/recherche.php">Faire une nouvelle recherche</a></p> {else} <table class="list"> <thead> <tr> <th>Recherche</th> <th>Type</th> <th>Statut</th> <th></th> </tr> </thead> <tbody> {foreach from=$liste item="recherche"} <tr> <th>{$recherche.intitule}</th> <td>{if $recherche.type == Recherche::TYPE_JSON}Avancée{else}SQL{/if}</td> <td>{if !$recherche.id_membre}Publique{else}Privée{/if}</td> <td class="actions"> <a href="{$admin_url}membres/recherche{if $recherche.type == Recherche::TYPE_SQL}_sql{/if}.php?id={$recherche.id}" class="icn" title="Exécuter">𝍢</a> {if $recherche.id_membre || $session->canAccess('membres', Membres::DROIT_ADMIN)} <a href="{$admin_url}membres/recherches.php?edit={$recherche.id}" class="icn" title="Modifier">✎</a> <a href="{$admin_url}membres/recherches.php?delete={$recherche.id}" class="icn" title="Supprimer">✘</a> {/if} </td> |
︙ | ︙ |
Modified src/www/admin/membres/recherches.php from [5d489fac1a] to [8f31ef1dc2].
1 2 3 4 5 6 7 | <?php namespace Garradin; require_once __DIR__ . '/_inc.php'; $recherche = new Recherche; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | <?php namespace Garradin; require_once __DIR__ . '/_inc.php'; $recherche = new Recherche; $mode = null; if (qg('edit') || qg('delete')) { $r = $recherche->get(qg('edit') ?: qg('delete')); if (!$r) { throw new UserException('Recherche non trouvée'); } if ($r->id_membre !== null && $r->id_membre != $user->id) { throw new UserException('Recherche privée appartenant à un autre membre.'); } $tpl->assign('recherche', $r); $mode = qg('edit') ? 'edit' : 'delete'; } if ($mode == 'edit' && f('save') && $form->check('edit_recherche_' . $r->id)) { try { $recherche->edit($r->id, [ 'intitule' => f('intitule'), 'id_membre' => f('prive') ? $user->id : null, ]); Utils::redirect('/admin/membres/recherches.php'); } catch (UserException $e) { $form->addError($e->getMessage()); } } elseif ($mode == 'delete' && f('delete') && $form->check('del_recherche_' . $r->id)) { $recherche->remove($r->id); Utils::redirect('/admin/membres/recherches.php'); } $tpl->assign('mode', $mode); if (!$mode) { $tpl->assign('liste', $recherche->getList($user->id)); } $tpl->display('admin/membres/recherches.tpl'); |