Overview
Comment: | Recherche plus intuitive des champs multiple, select et checkbox |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
eb23b90b2c876658504457eabf644275 |
User & Date: | bohwaz on 2013-01-30 16:49:20 |
Other Links: | manifest | tags |
Context
2013-01-30
| ||
17:01 | Affichage du champ correctement plutôt que de manière brute dans les listes check-in: 84bf6d7579 user: bohwaz tags: trunk | |
16:49 | Recherche plus intuitive des champs multiple, select et checkbox check-in: eb23b90b2c user: bohwaz tags: trunk | |
16:03 | Affichage des infos du membre dans sa fiche check-in: 6bd977274f user: bohwaz tags: trunk | |
Changes
Modified include/class.membres.php from [2283df17eb] to [ae31108732].
︙ | ︙ | |||
470 471 472 473 474 475 476 | $champs = Config::getInstance()->get('champs_membres'); if ($field != 'id' && !$champs->get($field)) { throw new \UnexpectedValueException($field . ' is not a valid field'); } | > > > > > > > | | 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | $champs = Config::getInstance()->get('champs_membres'); if ($field != 'id' && !$champs->get($field)) { throw new \UnexpectedValueException($field . ' is not a valid field'); } $champ = $champs->get($field); if ($champ['type'] == 'multiple') { $where = 'WHERE '.$field.' & (1 << '.(int)$query.')'; $order = false; } elseif (!$champs->isText($field)) { $where = 'WHERE '.$field.' = \''.$db->escapeString($query).'\''; $order = $field; } else { $where = 'WHERE transliterate_to_ascii('.$field.') LIKE transliterate_to_ascii(\'%'.$db->escapeString($query).'%\')'; |
︙ | ︙ | |||
492 493 494 495 496 497 498 | $fields[] = $field; } return $db->simpleStatementFetch( 'SELECT id, id_categorie, ' . implode(', ', $fields) . ', strftime(\'%s\', date_cotisation) AS date_cotisation, strftime(\'%s\', date_inscription) AS date_inscription | | | | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | $fields[] = $field; } return $db->simpleStatementFetch( 'SELECT id, id_categorie, ' . implode(', ', $fields) . ', strftime(\'%s\', date_cotisation) AS date_cotisation, strftime(\'%s\', date_inscription) AS date_inscription FROM membres ' . $where . ($order ? ' ORDER BY ' . $order : '') . ' LIMIT 100;', SQLITE3_ASSOC ); } public function listByCategory($cat, $fields, $page = 1, $order = null, $desc = false) { $begin = ($page - 1) * self::ITEMS_PER_PAGE; |
︙ | ︙ |
Modified include/lib.template.php from [3eaa3d2fec] to [a9252aaf97].
︙ | ︙ | |||
47 48 49 50 51 52 53 54 55 56 57 58 59 60 | $value = utils::CSRF_create($params['key']); return '<input type="hidden" name="'.$name.'" value="'.$value.'" />'; } function tpl_form_field($params) { $name = $params['name']; if (isset($_POST[$name])) $value = $_POST[$name]; elseif (isset($params['data']) && isset($params['data'][$name])) $value = $params['data'][$name]; elseif (isset($params['default'])) | > > > | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | $value = utils::CSRF_create($params['key']); return '<input type="hidden" name="'.$name.'" value="'.$value.'" />'; } function tpl_form_field($params) { if (!isset($params['name'])) throw new \BadFunctionCallException('name argument is mandatory'); $name = $params['name']; if (isset($_POST[$name])) $value = $_POST[$name]; elseif (isset($params['data']) && isset($params['data'][$name])) $value = $params['data'][$name]; elseif (isset($params['default'])) |
︙ | ︙ |
Modified templates/admin/membres/recherche.tpl from [f1c4c1fe3e] to [db716247fe].
︙ | ︙ | |||
9 10 11 12 13 14 15 | <select name="c" id="f_champ"> {foreach from=$champs_liste key="k" item="v"} <option value="{$k|escape}"{form_field name="c" default=$champ selected=$k}>{$v.title|escape}</option> {/foreach} </select> </dd> <dt><label for="f_texte">Recherche</label></dt> | | > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <select name="c" id="f_champ"> {foreach from=$champs_liste key="k" item="v"} <option value="{$k|escape}"{form_field name="c" default=$champ selected=$k}>{$v.title|escape}</option> {/foreach} </select> </dd> <dt><label for="f_texte">Recherche</label></dt> <dd id="f_free"><input id="f_texte" type="text" name="r" value="{$recherche|escape}" /></dd> {foreach from=$champs_liste key="k" item="v"} {if $v.type == 'select'} <dd class="special" id="f_{$k|escape}"> <select name="r" disabled="disabled"> {foreach from=$v.options item="opt"} <option value="{$opt|escape}"{form_field name="r" default=$recherche selected=$opt}>{$opt|escape}</option> {/foreach} </select> </dd> {elseif $v.type == 'multiple'} <dd class="special" id="f_{$k|escape}"> <select name="r" disabled="disabled"> {foreach from=$v.options key="opt_k" item="opt"} <option value="{$opt_k|escape}"{form_field name="r" default=$recherche selected=$opt_k}>{$opt|escape}</option> {/foreach} </select> </dd> {elseif $v.type == 'checkbox'} <dd class="special" id="f_{$k|escape}"> <select name="r" disabled="disabled"> <option value="1"{form_field name="r" default=$recherche selected=1}>Oui</option> <option value="0"{form_field name="r" default=$recherche selected=0}>Non</option> </select> </dd> {/if} {/foreach} </dl> <p class="submit"> <input type="submit" value="Chercher →" /> </p> </fieldset> </form> |
︙ | ︙ | |||
133 134 135 136 137 138 139 | </td> </tr> {/foreach} </tbody> </table> {else} <p class="info"> | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | </td> </tr> {/foreach} </tbody> </table> {else} <p class="info"> Aucun membre trouvé. </p> {/if} {/if} <script type="text/javascript"> {literal} (function() { var current = false; var selectField = function(elm) { if (current) { document.getElementById('f_' + current).style.display = 'none'; document.getElementById('f_' + current).querySelector('select').disabled = true; current = false; } if (document.getElementById('f_' + elm.value)) { document.getElementById('f_' + elm.value).style.display = 'block'; document.getElementById('f_' + elm.value).querySelector('select').disabled = false; document.getElementById('f_free').style.display = 'none'; document.getElementById('f_texte').disabled = true; current = elm.value; } else { document.getElementById('f_texte').disabled = false; document.getElementById('f_free').style.display = 'block'; } return true; } document.getElementById('f_champ').onchange = function() { selectField(this); }; window.onload = selectField(document.getElementById('f_champ')); }()) {/literal} </script> {include file="admin/_foot.tpl"} |
Modified www/admin/membres/recherche.php from [8aa006c8df] to [643dee6d8f].
︙ | ︙ | |||
36 37 38 39 40 41 42 | throw new UserException('Le champ demandé n\'existe pas.'); } } $champs_liste = $champs->getList(); $champs_liste = array_merge( | | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | throw new UserException('Le champ demandé n\'existe pas.'); } } $champs_liste = $champs->getList(); $champs_liste = array_merge( array('id' => array('title' => 'Numéro unique', 'type' => 'number')), $champs_liste ); $champs_entete = $champs->getListedFields(); if (!array_key_exists($champ, $champs_entete)) { |
︙ | ︙ |
Modified www/admin/static/admin.css from [bec0ea9091] to [40aa565543].
︙ | ︙ | |||
524 525 526 527 528 529 530 531 532 533 534 535 536 537 | } .searchMember { width: 49%; float: left; font-size: 80%; } .filterCategory p.submit { margin-top: -2em; float: right; } .memberList { | > > > > | 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 | } .searchMember { width: 49%; float: left; font-size: 80%; } .searchMember .special { display: none; } .filterCategory p.submit { margin-top: -2em; float: right; } .memberList { |
︙ | ︙ |