Overview
Comment: | Uniformisation des actions en bas des listes de membres |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
ec3640ce301a902cfb2b915d571679c0 |
User & Date: | bohwaz on 2018-10-03 11:34:11 |
Other Links: | branch diff | manifest | tags |
Context
2018-10-03
| ||
11:46 | Rendre une recherche SQL enregistrée accessible aux non-admins check-in: d612a3d0b0 user: bohwaz tags: dev | |
11:34 | Uniformisation des actions en bas des listes de membres check-in: ec3640ce30 user: bohwaz tags: dev | |
2018-10-02
| ||
16:01 | Indiquer le contexte d'envoi des emails check-in: f55dfbd38e user: bohwaz tags: dev | |
Changes
Modified src/include/lib/Garradin/Membres/Import.php from [5ce42c5c94] to [3f31ffe733].
︙ | ︙ | |||
257 258 259 260 261 262 263 | $db->commit(); fclose($fp); return true; } | | > | > > | | | | | 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | $db->commit(); fclose($fp); return true; } protected function export(array $list = null) { $db = DB::getInstance(); $champs = Config::getInstance()->get('champs_membres')->getKeys(); $champs_sql = 'm.' . implode(', m.', $champs); $where = $list ? 'WHERE ' . $db->where('m.id', $list) : ''; $res = $db->iterate('SELECT ' . $champs_sql . ', c.nom AS categorie FROM membres AS m LEFT JOIN membres_categories AS c ON m.id_categorie = c.id ' . $where . ' ORDER BY c.id;'); return [ array_merge($champs, ['categorie']), $res, sprintf('Export membres - %s - %s', Config::getInstance()->get('nom_asso'), date('Y-m-d')), ]; } public function toCSV(array $list = null) { list($champs, $result, $name) = $this->export($list); return Utils::toCSV($name, $result, $champs); } public function toODS(array $list = null) { list($champs, $result, $name) = $this->export($list); return Utils::toODS($name, $result, $champs); } } |
Modified src/include/lib/Garradin/Recherche.php from [7584e020e0] to [aac01b2fe7].
︙ | ︙ | |||
111 112 113 114 115 116 117 | } public function get($id) { return DB::getInstance()->first('SELECT * FROM recherches WHERE id = ?;', (int) $id); } | | > | | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | } public function get($id) { return DB::getInstance()->first('SELECT * FROM recherches WHERE id = ?;', (int) $id); } public function getList($id_membre, $cible) { return DB::getInstance()->get('SELECT id, type, intitule, type, id_membre FROM recherches WHERE (id_membre IS NULL OR id_membre = ?) AND cible = ? ORDER BY intitule;', (int)$id_membre, $cible); } /** * Lancer une recherche enregistrée */ public function search($id) { |
︙ | ︙ |
Modified src/templates/admin/membres/index.tpl from [0c54cc1cfc] to [079c03ecc2].
︙ | ︙ | |||
59 60 61 62 63 64 65 | <td class="actions"> <a class="icn" href="{$admin_url}membres/fiche.php?id={$membre.id}" title="Fiche membre">👤</a> {if $session->canAccess('membres', Membres::DROIT_ECRITURE)}<a class="icn" href="{$admin_url}membres/modifier.php?id={$membre.id}" title="Modifier la fiche membre">✎</a>{/if} </td> </tr> {/foreach} </tbody> | < < < < < < < < > > | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | <td class="actions"> <a class="icn" href="{$admin_url}membres/fiche.php?id={$membre.id}" title="Fiche membre">👤</a> {if $session->canAccess('membres', Membres::DROIT_ECRITURE)}<a class="icn" href="{$admin_url}membres/modifier.php?id={$membre.id}" title="Modifier la fiche membre">✎</a>{/if} </td> </tr> {/foreach} </tbody> {if $session->canAccess('membres', Membres::DROIT_ADMIN)} {include file="admin/membres/_list_actions.tpl" colspan=count((array)$champs)+1} {/if} </table> {pagination url=$pagination_url page=$page bypage=$bypage total=$total} {else} <p class="alert"> Aucun membre trouvé. </p> {/if} </form> {include file="admin/_foot.tpl"} |
Modified src/templates/admin/membres/recherche.tpl from [24575e24c1] to [3618a80c24].
︙ | ︙ | |||
139 140 141 142 143 144 145 | <a class="icn" href="{$admin_url}membres/modifier.php?id={$row.id}" title="Modifier la fiche membre">✎</a> {/if} </td> </tr> {/foreach} </tbody> {if $session->canAccess('membres', Membres::DROIT_ADMIN)} | < < < | < < < < < < < < < < < < < < < < < < | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | <a class="icn" href="{$admin_url}membres/modifier.php?id={$row.id}" title="Modifier la fiche membre">✎</a> {/if} </td> </tr> {/foreach} </tbody> {if $session->canAccess('membres', Membres::DROIT_ADMIN)} {include file="admin/membres/_list_actions.tpl" colspan=count($result_header)+1} {/if} </table> {if $session->canAccess('membres', Membres::DROIT_ECRITURE)} </form> {/if} {elseif $result !== null} |
︙ | ︙ |
Modified src/templates/admin/membres/recherche_sql.tpl from [f417399f3f] to [0b6e16946c].
︙ | ︙ | |||
55 56 57 58 59 60 61 62 63 | <a class="icn" href="{$admin_url}membres/modifier.php?id={$row.id}" title="Modifier ce membre">✎</a> {/if} </td> {/if} </tr> {/foreach} </tbody> </table> | > > > < < < < < < | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | <a class="icn" href="{$admin_url}membres/modifier.php?id={$row.id}" title="Modifier ce membre">✎</a> {/if} </td> {/if} </tr> {/foreach} </tbody> {if $session->canAccess('membres', Membres::DROIT_ADMIN)} {include file="admin/membres/_list_actions.tpl" colspan=count((array)$result[0])+1} {/if} </table> {else} <p class="alert"> Aucun membre trouvé. </p> {/if} </form> {include file="admin/_foot.tpl"} |
Modified src/www/admin/membres/action.php from [e3f13ad9f8] to [b5ff480d3c].
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 | <?php namespace Garradin; require_once __DIR__ . '/_inc.php'; $session->requireAccess('membres', Membres::DROIT_ADMIN); if (!f('selected') || !is_array(f('selected')) || !count(f('selected'))) { throw new UserException("Aucun membre sélectionné."); } $action = f('action'); if (!$action) { throw new UserException('Aucune action sélectionnée.'); } if ($action == 'move' || $action == 'delete') { foreach (f('selected') as &$id) { $id = (int) $id; | > > > > > > > > > > > > > > > > > | 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 | <?php namespace Garradin; require_once __DIR__ . '/_inc.php'; $session->requireAccess('membres', Membres::DROIT_ADMIN); if (!f('selected') || !is_array(f('selected')) || !count(f('selected'))) { throw new UserException("Aucun membre sélectionné."); } $action = f('action'); $list = f('selected'); if (!$action) { throw new UserException('Aucune action sélectionnée.'); } if ($action == 'ods' || $action == 'csv') { $import = new Membres\Import; if ($action == 'ods') { $import->toODS($list); } else { $import->toCSV($list); } exit; } if ($action == 'move' || $action == 'delete') { foreach (f('selected') as &$id) { $id = (int) $id; |
︙ | ︙ | |||
54 55 56 57 58 59 60 | if (!$form->hasErrors()) { $membres->delete(f('selected')); Utils::redirect(ADMIN_URL . 'membres/'); } } | | | | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | if (!$form->hasErrors()) { $membres->delete(f('selected')); Utils::redirect(ADMIN_URL . 'membres/'); } } $tpl->assign('selected', $list); $tpl->assign('nb_selected', count($list)); if ($action == 'move') { $cats = new Membres\Categories; $tpl->assign('membres_cats', $cats->listSimple()); } $tpl->assign('action', $action); $tpl->display('admin/membres/action.tpl'); |
Modified src/www/admin/membres/recherche_sql.php from [177e1e82d4] to [c927d80610].
︙ | ︙ | |||
16 17 18 19 20 21 22 | $r = $recherche->get($id); if (!$r || $r->type != Recherche::TYPE_SQL) { throw new UserException('Recherche inconnue'); } | > > | > > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | $r = $recherche->get($id); if (!$r || $r->type != Recherche::TYPE_SQL) { throw new UserException('Recherche inconnue'); } if (!$query) { $query = $r->contenu; } $tpl->assign('recherche', $r); } $tpl->assign('schema', $recherche->schema('membres')); $tpl->assign('query', $query); if ($query != '') |
︙ | ︙ |
Modified src/www/admin/membres/recherches.php from [8f31ef1dc2] to [7efc82999d].
︙ | ︙ | |||
45 46 47 48 49 50 51 | Utils::redirect('/admin/membres/recherches.php'); } $tpl->assign('mode', $mode); if (!$mode) { | | | 45 46 47 48 49 50 51 52 53 54 55 | Utils::redirect('/admin/membres/recherches.php'); } $tpl->assign('mode', $mode); if (!$mode) { $tpl->assign('liste', $recherche->getList($user->id, 'membres')); } $tpl->display('admin/membres/recherches.tpl'); |