Overview
Comment:Ajout option list_row pour gérer le tableau de liste des membres
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4dfcbdc0cb117a6acccc338ab42762d042484c30
User & Date: bohwaz on 2013-01-29 19:01:13
Other Links: manifest | tags
Context
2013-01-30
14:53
Amélioration recherche check-in: e89a17318a user: bohwaz tags: trunk
2013-01-29
19:01
Ajout option list_row pour gérer le tableau de liste des membres check-in: 4dfcbdc0cb user: bohwaz tags: trunk
19:00
Correction oubli check-in: 82e2363297 user: bohwaz tags: trunk
Changes

Modified include/class.champs_membres.php from [769331bd91] to [85e92511fe].

18
19
20
21
22
23
24










25
26
27
28
29
30

31
32
33
34
35
36
37
		'tel'		=>	'Numéro de téléphone',
		'select'	=>	'Sélecteur à choix unique',
        'multiple'  =>  'Sélecteur à choix multiple',
		'country'	=>	'Sélecteur de pays',
		'text'		=>	'Texte',
		'textarea'	=>	'Texte multi-lignes',
	);











    protected $config_fields = array(
        'type',
        'title',
        'help',
        'editable',

        'mandatory',
        'private',
        'options'
    );

    static protected $presets = null;








>
>
>
>
>
>
>
>
>
>






>







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
		'tel'		=>	'Numéro de téléphone',
		'select'	=>	'Sélecteur à choix unique',
        'multiple'  =>  'Sélecteur à choix multiple',
		'country'	=>	'Sélecteur de pays',
		'text'		=>	'Texte',
		'textarea'	=>	'Texte multi-lignes',
	);

    protected $text_types = array(
        'email',
        'text',
        'select',
        'textarea',
        'url',
        'password',
        'country'
    );

    protected $config_fields = array(
        'type',
        'title',
        'help',
        'editable',
        'list_row',
        'mandatory',
        'private',
        'options'
    );

    static protected $presets = null;

111
112
113
114
115
116
117
118











119
120
121
122































123
124
125
126
127
128
129
                return $this->champs[$champ][$key];
            else
                return null;
        }

		return $this->champs[$champ];
	}












	public function getAll()
	{
		return $this->champs;
	}
































    /**
     * Vérifie la cohérence et la présence des bons éléments pour un champ
     * @param  string $name     Nom du champ
     * @param  array $config    Configuration du champ
     * @return boolean true
     */








>
>
>
>
>
>
>
>
>
>
>




>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
                return $this->champs[$champ][$key];
            else
                return null;
        }

		return $this->champs[$champ];
	}

    public function isText($champ)
    {
        if (!array_key_exists($champ, $this->champs))
            return null;

        if (in_array($this->champs[$champ]['type'], $this->text_types))
            return true;
        else
            return false;
    }

	public function getAll()
	{
		return $this->champs;
	}

    public function getList()
    {
        $champs = $this->champs;
        unset($champs['passe']);
        return $champs;
    }

    public function getFirst()
    {
        reset($this->champs);
        return key($this->champs);
    }

    public function getListedFields()
    {
        $champs = $this->champs;

        $champs = array_filter($champs, function ($a) {
            return empty($a['list_row']) ? false : true;
        });

        uasort($champs, function ($a, $b) {
            if ($a['list_row'] == $b['list_row'])
                return 0;

            return ($a['list_row'] > $b['list_row']) ? 1 : -1;
        });

        return $champs;
    }

    /**
     * Vérifie la cohérence et la présence des bons éléments pour un champ
     * @param  string $name     Nom du champ
     * @param  array $config    Configuration du champ
     * @return boolean true
     */
147
148
149
150
151
152
153




154
155
156
157
158
159
160
            {
                throw new \BadMethodCallException('Champ '.$key.' non valide.');
            }

            if ($key == 'editable' || $key == 'private' || $key == 'mandatory')
            {
                $value = (bool) (int) $value;




            }
            elseif ($key == 'help' || $key == 'title')
            {
                $value = trim((string) $value);
            }
            elseif ($key == 'options')
            {







>
>
>
>







200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
            {
                throw new \BadMethodCallException('Champ '.$key.' non valide.');
            }

            if ($key == 'editable' || $key == 'private' || $key == 'mandatory')
            {
                $value = (bool) (int) $value;
            }
            elseif ($key == 'list_row')
            {
                $value = (int) $value;
            }
            elseif ($key == 'help' || $key == 'title')
            {
                $value = trim((string) $value);
            }
            elseif ($key == 'options')
            {
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
    		elseif ($cfg['type'] == 'multiple' || $cfg['type'] == 'checkbox')
    			$type = 'INTEGER';
    		elseif ($cfg['type'] == 'file')
    			$type = 'BLOB';
    		else
    			$type = 'TEXT';

    		$line = $key . ' ' . $type . ' ' . ',';

            if (!empty($cfg['title']))
            {
                $line .= '-- ' . str_replace(array("\n", "\r"), '', $cfg['title']);
            }

            $create[] = $line;

    		if (array_key_exists($key, $anciens_champs))
    		{
    			$copy[] = $key;







|



|







380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
    		elseif ($cfg['type'] == 'multiple' || $cfg['type'] == 'checkbox')
    			$type = 'INTEGER';
    		elseif ($cfg['type'] == 'file')
    			$type = 'BLOB';
    		else
    			$type = 'TEXT';

    		$line = $key . ' ' . $type . ',';

            if (!empty($cfg['title']))
            {
                $line .= ' -- ' . str_replace(array("\n", "\r"), '', $cfg['title']);
            }

            $create[] = $line;

    		if (array_key_exists($key, $anciens_champs))
    		{
    			$copy[] = $key;

Modified include/class.membres.php from [10533ef891] to [7a8f852d64].

421
422
423
424
425
426
427
428
429
430

431
432

433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462

463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483







484
485
486
487
488
489
490
491
492
                $droits[$key] = (int) $value;
            }
        }

        return $droits;
    }

    public function search($field = null, $query)
    {
        $db = DB::getInstance();


        if (is_null($field) || !in_array($field, array('id', 'nom', 'email', 'code_postal', 'ville', 'adresse', 'telephone')))

        {
            $field = 'nom';
        }

        if ($field == 'id' || $field == 'code_postal')
        {
            $where = 'WHERE '.$field.' = \''.$db->escapeString($query).'\'';
            $order = $field;
        }
        else
        {
            $where = 'WHERE transliterate_to_ascii('.$field.') LIKE transliterate_to_ascii(\'%'.$db->escapeString($query).'%\')';
            $order = 'transliterate_to_ascii('.$field.') COLLATE NOCASE';
        }

        return $db->simpleStatementFetch(
            'SELECT id, id_categorie, nom, email, code_postal, ville,
                strftime(\'%s\', date_cotisation) AS date_cotisation,
                strftime(\'%s\', date_inscription) AS date_inscription
                FROM membres '.$where.'
                ORDER BY '.$order.' LIMIT 100;',
            SQLITE3_ASSOC
        );
    }

    public function listByCategory($cat = 0, $page = 1, $order = 'nom', $desc = false)
    {
        $begin = ($page - 1) * self::ITEMS_PER_PAGE;

        $db = DB::getInstance();


        if (is_int($cat) && $cat)
            $where = 'WHERE id_categorie = '.(int)$cat;
        elseif (is_array($cat))
            $where = 'WHERE id_categorie IN ('.implode(',', $cat).')';
        else
            $where = '';

        if (!in_array($order, array('nom', 'id', 'ville', 'date_cotisation', 'date_inscription')))
            $order = 'nom';

        if ($order == 'nom' || $order == 'ville')
        {
            $order = 'transliterate_to_ascii('.$order.') COLLATE NOCASE';
        }

        if ($desc)
        {
            $order .= ' DESC';
        }








        return $db->simpleStatementFetch(
            'SELECT id, id_categorie, nom, email, code_postal, ville,
                strftime(\'%s\', date_cotisation) AS date_cotisation,
                strftime(\'%s\', date_inscription) AS date_inscription
                FROM membres '.$where.'
                ORDER BY '.$order.' LIMIT ?, ?;',
            SQLITE3_ASSOC,
            $begin,
            self::ITEMS_PER_PAGE







|


>

<
>

|


|




















|




>








|
|

|









>
>
>
>
>
>
>

|







421
422
423
424
425
426
427
428
429
430
431
432

433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
                $droits[$key] = (int) $value;
            }
        }

        return $droits;
    }

    public function search($field, $query)
    {
        $db = DB::getInstance();
        $champs = Config::getInstance()->get('champs_membres');


        if (!$champs->get($field))
        {
            throw new \UnexpectedValue($field . ' is not a valid field');
        }

        if (!$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).'%\')';
            $order = 'transliterate_to_ascii('.$field.') COLLATE NOCASE';
        }

        return $db->simpleStatementFetch(
            'SELECT id, id_categorie, nom, email, code_postal, ville,
                strftime(\'%s\', date_cotisation) AS date_cotisation,
                strftime(\'%s\', date_inscription) AS date_inscription
                FROM membres '.$where.'
                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;

        $db = DB::getInstance();
        $champs = Config::getInstance()->get('champs_membres');

        if (is_int($cat) && $cat)
            $where = 'WHERE id_categorie = '.(int)$cat;
        elseif (is_array($cat))
            $where = 'WHERE id_categorie IN ('.implode(',', $cat).')';
        else
            $where = '';

        if (is_null($order) || !$champs->get($order))
            $order = 'id';

        if (!empty($fields) && $order != 'id' && $champs->isText($order))
        {
            $order = 'transliterate_to_ascii('.$order.') COLLATE NOCASE';
        }

        if ($desc)
        {
            $order .= ' DESC';
        }

        if (!in_array('email', $fields))
        {
            $fields []= 'email';
        }

        $fields = implode(', ', $fields);

        return $db->simpleStatementFetch(
            'SELECT id, id_categorie, '.$fields.',
                strftime(\'%s\', date_cotisation) AS date_cotisation,
                strftime(\'%s\', date_inscription) AS date_inscription
                FROM membres '.$where.'
                ORDER BY '.$order.' LIMIT ?, ?;',
            SQLITE3_ASSOC,
            $begin,
            self::ITEMS_PER_PAGE

Modified include/data/champs_membres.ini from [6b80d17df1] to [5dac66666b].

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
;	title = "Super champ trop cool"
;	mandatory = true
;	editable = false
;
;	Description des options possibles pour chaque champ :
;
;	type: (défaut: text) OBLIGATOIRE
;		tous les types gérés par input type de HTML5 plus :


;		+ country = sélecteur de pays
;		+ checkbox = case à cocher

;		+ multiple = multiples cases à cocher (jusqu'à 32, binaire)
;		+ select = un choix parmis plusieurs
;	title: OBLIGATOIRE
;		Titre du champ
;	help:
;		Texte d'aide sur les fiches membres
;	options[]:
;		pour définir les options d'un champ de type select ou multiple
;	editable:
;		true = modifiable par le membre
;		false = modifiable uniquement par un admin (défaut)
;	mandatory:
;		true = obligatoire, la fiche membre ne pourra être enregistrée si ce champ est vide
;		false = facultatif (défaut)
;	private:
;		true = non visible par le membre lui-même
;		false = visible par le membre (défaut)





;	install:
;		true = sera ajouté aux fiches membres à l'installation
;		false = sera seulement présent dans les champs supplémentaires possibles (défaut)

[nom]
type = text
title = "Nom & prénom"
mandatory = true
install = true
editable = true


[email]
; ce champ est obligatoirement présent et de type 'email'
type = email
title = "Adresse E-Mail"
mandatory = true
install = true







|
>
>
|
<
>
|
|















>
>
>
>
>










>







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
;	title = "Super champ trop cool"
;	mandatory = true
;	editable = false
;
;	Description des options possibles pour chaque champ :
;
;	type: (défaut: text) OBLIGATOIRE
;		certains types gérés par <input type> de HTML5 :
;		text, number, date, datetime, url, email, checkbox, file, password, tel
;		champs spécifiques :
;		- country = sélecteur de pays

;		- textarea = texte multi lignes
;		- multiple = multiples cases à cocher (jusqu'à 32, binaire)
;		- select = un choix parmis plusieurs
;	title: OBLIGATOIRE
;		Titre du champ
;	help:
;		Texte d'aide sur les fiches membres
;	options[]:
;		pour définir les options d'un champ de type select ou multiple
;	editable:
;		true = modifiable par le membre
;		false = modifiable uniquement par un admin (défaut)
;	mandatory:
;		true = obligatoire, la fiche membre ne pourra être enregistrée si ce champ est vide
;		false = facultatif (défaut)
;	private:
;		true = non visible par le membre lui-même
;		false = visible par le membre (défaut)
;	list_row:
;		Si absent ou zéro ('0') ou false, ce champ n'apparaîtra pas dans la liste des membres
;		Si présent et un chiffre supérieur à 0, alors le champ apparaîtra dans la liste des membres
;		dans l'ordre défini par le chiffre (si nom est à 2 et email à 1, alors email sera
;		la première colonne et nom la seconde)
;	install:
;		true = sera ajouté aux fiches membres à l'installation
;		false = sera seulement présent dans les champs supplémentaires possibles (défaut)

[nom]
type = text
title = "Nom & prénom"
mandatory = true
install = true
editable = true
list_row = 1

[email]
; ce champ est obligatoirement présent et de type 'email'
type = email
title = "Adresse E-Mail"
mandatory = true
install = true
68
69
70
71
72
73
74

75
76
77
78
79
80

81
82
83
84
85
86
87
editable = true

[code_postal]
type = text
title = "Code postal"
install = true
editable = true


[ville]
type = text
title = "Ville"
install = true
editable = true


[pays]
type = country
title = "Pays"
install = true
editable = true








>






>







76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
editable = true

[code_postal]
type = text
title = "Code postal"
install = true
editable = true
list_row = 2

[ville]
type = text
title = "Ville"
install = true
editable = true
list_row = 3

[pays]
type = country
title = "Pays"
install = true
editable = true

Modified templates/admin/config/membres.tpl from [386555cfc4] to [f5d0be5f0d].

156
157
158
159
160
161
162



163
164
165
166
167
168
169
                    {else}
                        {assign var="more" value=0}
                    {/if}
                    {if $champ.type == 'select' || $more < 32}
                        <dd>{if $champ.type == 'multiple'}{math a=$more equation="a+1"}. {/if}<input type="text" name="champs[{$nom|escape}][options][{$more|escape}]" value="" size="50" /></dd>
                    {/if}
                {/if}



            </dl>
        </fieldset>
        {/foreach}
    </div>

    <fieldset id="f_passe">
        <legend>Mot de passe</legend>







>
>
>







156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
                    {else}
                        {assign var="more" value=0}
                    {/if}
                    {if $champ.type == 'select' || $more < 32}
                        <dd>{if $champ.type == 'multiple'}{math a=$more equation="a+1"}. {/if}<input type="text" name="champs[{$nom|escape}][options][{$more|escape}]" value="" size="50" /></dd>
                    {/if}
                {/if}
                <dt><label for="f_list_row">Numéro de colonne dans la liste des membres</label></dt>
                <dd class="help">Laisser vide ou indiquer le chiffre zéro pour que ce champ n'apparaisse pas dans la liste des membres. Inscrire un chiffre entre 1 et 10 pour indiquer l'ordre d'affichage du champ dans le tableau de la liste des membres.</dd>
                <dd><input type="number" id="f_list_row" name="champs[{$nom|escape}][list_row]" min="0" max="10" value="{form_field data=$champs[$nom] name=list_row}" /></dd>
            </dl>
        </fieldset>
        {/foreach}
    </div>

    <fieldset id="f_passe">
        <legend>Mot de passe</legend>

Modified templates/admin/membres/index.tpl from [102d5adb69] to [6d8ec02715].

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

70

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
            {/if}
        {/foreach}
        </select>
        <input type="submit" value="Filtrer &rarr;" />
    </fieldset>
</form>

<form method="get" action="{$self_url|escape}" class="searchMember">
    <fieldset>
        <legend>Rechercher un membre</legend>
        <input type="text" name="search_query" value="{$search_query|escape}" />
        <input type="submit" value="Chercher &rarr;" />
    </fieldset>
</form>

{if $user.droits.membres >= Garradin\Membres::DROIT_ECRITURE}

    <form method="post" action="action.php" class="memberList">

    {if !empty($liste)}
    <table class="list">
        <thead>
            <td class="check"><input type="checkbox" value="Tout cocher / décocher" onclick="checkUncheck();" /></td>
            {if !empty($order)}
                <td class="num{if $order == 'id'} cur {if $desc}desc{else}asc{/if}{/if}" title="Numéro de membre"># <a href="?o=id&amp;a">&darr;</a><a href="?o=id&amp;d">&uarr;</a></td>

                <th class="{if $order == 'nom'}cur {if $desc}desc{else}asc{/if}{/if}">Nom <a href="?o=nom&amp;a">&darr;</a><a href="?o=nom&amp;d">&uarr;</a></th>
                <td class="{if $order == 'date_cotisation'}cur {if $desc}desc{else}asc{/if}{/if}">Cotisation <a href="?o=date_cotisation&amp;a">&darr;</a><a href="?o=date_cotisation&amp;d">&uarr;</a></td>
                <td class="{if $order == 'date_inscription'}cur {if $desc}desc{else}asc{/if}{/if}">Inscription <a href="?o=date_inscription&amp;a">&darr;</a><a href="?o=date_inscription&amp;d">&uarr;</a></td>
                <td class="{if $order == 'ville'}cur {if $desc}desc{else}asc{/if}{/if}">Ville <a href="?o=ville&amp;a">&darr;</a><a href="?o=ville&amp;d">&uarr;</a></td>
            {else}
                <td title="Numéro de membre">#</td>
                <th>Nom</th>
                <td>Cotisation</td>
                <td>Inscription</td>
                <td>Ville</td>
            {/if}
            <td></td>
        </thead>
        <tbody>
            {foreach from=$liste item="membre"}
                <tr>
                    <td class="check">{if $user.droits.membres == Garradin\Membres::DROIT_ADMIN}<input type="checkbox" name="selected[]" value="{$membre.id|escape}" />{/if}</td>
                    <td class="num"><a title="Fiche membre" href="{$www_url}admin/membres/fiche.php?id={$membre.id|escape}">{$membre.id|escape}</a></td>

                    <th>{$membre.nom|escape}</th>

                    {if empty($membre.date_cotisation)}
                        <td class="error">jamais réglée</td>
                    {elseif $membre.date_cotisation > strtotime('12 months ago')} {* FIXME durée de cotisation variable *}
                        <td class="confirm">à jour</td>
                    {else}
                        <td class="alert">en retard</td>
                    {/if}
                    <td>{$membre.date_inscription|date_fr:'d/m/Y'}</td>
                    <td>{$membre.ville|escape}</td>
                    <td class="actions">
                        {if !empty($membre.email)}<a class="icn" href="{$www_url}admin/membres/message.php?id={$membre.id|escape}" title="Envoyer un message">✉</a> {/if}
                        <a class="icn" href="modifier.php?id={$membre.id|escape}">✎</a>
                    </td>
                </tr>
            {/foreach}
        </tbody>







|


|











|
<
|
>
|
<
<
<
|
<
<
|
<
<
<





|
|
>
|
>







<
<







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
70
71


72
73
74
75
76
77
78
            {/if}
        {/foreach}
        </select>
        <input type="submit" value="Filtrer &rarr;" />
    </fieldset>
</form>

<form method="get" action="{$admin_url}membres/recherche.php" class="searchMember">
    <fieldset>
        <legend>Rechercher un membre</legend>
        <input type="text" name="r" value="" />
        <input type="submit" value="Chercher &rarr;" />
    </fieldset>
</form>

{if $user.droits.membres >= Garradin\Membres::DROIT_ECRITURE}

    <form method="post" action="action.php" class="memberList">

    {if !empty($liste)}
    <table class="list">
        <thead>
            {if $user.droits.membres == Garradin\Membres::DROIT_ADMIN}<td class="check"><input type="checkbox" value="Tout cocher / décocher" onclick="checkUncheck();" /></td>{/if}

            <td class="{if $order == 'id'} cur {if $desc}desc{else}asc{/if}{/if}" title="Numéro unique"><a href="?o=id&amp;a">&darr;</a><a href="?o=id&amp;d">&uarr;</a></td>
            {foreach from=$champs key="c" item="champ"}
                <td class="{if $order == $c} cur {if $desc}desc{else}asc{/if}{/if}">{$champ.title|escape} <a href="?o={$c|escape}&amp;a">&darr;</a><a href="?o={$c|escape}&amp;d">&uarr;</a></td>



            {/foreach}


            <td>Cotisation</td>



            <td></td>
        </thead>
        <tbody>
            {foreach from=$liste item="membre"}
                <tr>
                    {if $user.droits.membres == Garradin\Membres::DROIT_ADMIN}<td class="check"><input type="checkbox" name="selected[]" value="{$membre.id|escape}" /></td>{/if}
                    <td class="num"><a href="{$admin_url}membres/fiche.php?id={$membre.id|escape}">{$membre.id|escape}</a></th>
                    {foreach from=$champs key="c" item="champ"}
                        <td>{$membre[$c]|escape}</td>
                    {/foreach}
                    {if empty($membre.date_cotisation)}
                        <td class="error">jamais réglée</td>
                    {elseif $membre.date_cotisation > strtotime('12 months ago')} {* FIXME durée de cotisation variable *}
                        <td class="confirm">à jour</td>
                    {else}
                        <td class="alert">en retard</td>
                    {/if}


                    <td class="actions">
                        {if !empty($membre.email)}<a class="icn" href="{$www_url}admin/membres/message.php?id={$membre.id|escape}" title="Envoyer un message">✉</a> {/if}
                        <a class="icn" href="modifier.php?id={$membre.id|escape}">✎</a>
                    </td>
                </tr>
            {/foreach}
        </tbody>

Modified www/admin/membres/index.php from [48cea2b44a] to [23d868714b].

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
70
71
72
73
74
75
76
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['membres'] < Membres::DROIT_ACCES)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$cats = new Membres_Categories;

$membres_cats = $cats->listSimple();
$membres_cats_cachees = $cats->listHidden();

$cat = (int) utils::get('cat') ?: 0;
$page = (int) utils::get('p') ?: 1;

$search_query = trim(utils::get('search_query')) ?: '';

if ($search_query)
{
    if (is_numeric(trim($search_query))) {
        $search_field = 'id';
    }
    elseif (strpos($search_query, '@') !== false) {
        $search_field = 'email';
    }
    else {
        $search_field = 'nom';
    }

    $tpl->assign('liste', $membres->search($search_field, $search_query));
    $tpl->assign('total', -1);
    $tpl->assign('pagination_url', utils::getSelfUrl() . '?p=[ID]');
}
else
{
    if (!$cat)
    {
        $cat_id = array_diff(array_keys($membres_cats), array_keys($membres_cats_cachees));
    }
    else
    {
        $cat_id = (int) $cat;
    }

    $order = 'nom';
    $desc = false;

    if (utils::get('o'))
        $order = utils::get('o');

    if (isset($_GET['d']))
        $desc = true;

    $tpl->assign('order', $order);
    $tpl->assign('desc', $desc);





    $tpl->assign('liste', $membres->listByCategory($cat_id, $page, $order, $desc));
    $tpl->assign('total', $membres->countByCategory($cat_id));

    $tpl->assign('pagination_url', utils::getSelfUrl(true) . '?p=[ID]&amp;o=' . $order . ($desc ? '&amp;d' : ''));
}

$tpl->assign('membres_cats', $membres_cats);
$tpl->assign('membres_cats_cachees', $membres_cats_cachees);
$tpl->assign('current_cat', $cat);

$tpl->assign('page', $page);
$tpl->assign('bypage', Membres::ITEMS_PER_PAGE);

$tpl->assign('search_query', $search_query);

$tpl->display('admin/membres/index.tpl');

?>











>






<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
|
|
|
|
|
|

|
|

|
|

|
|

|
|

>
>
>
>
|
|

|
<








<
<



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
<?php
namespace Garradin;

require_once __DIR__ . '/../_inc.php';

if ($user['droits']['membres'] < Membres::DROIT_ACCES)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$cats = new Membres_Categories;

$membres_cats = $cats->listSimple();
$membres_cats_cachees = $cats->listHidden();

$cat = (int) utils::get('cat') ?: 0;
$page = (int) utils::get('p') ?: 1;





















if (!$cat)
{
    $cat_id = array_diff(array_keys($membres_cats), array_keys($membres_cats_cachees));
}
else
{
    $cat_id = (int) $cat;
}

$order = 'nom';
$desc = false;

if (utils::get('o'))
    $order = utils::get('o');

if (isset($_GET['d']))
    $desc = true;

$tpl->assign('order', $order);
$tpl->assign('desc', $desc);

$fields = $config->get('champs_membres')->getListedFields();

$tpl->assign('champs', $fields);

$tpl->assign('liste', $membres->listByCategory($cat_id, array_keys($fields), $page, $order, $desc));
$tpl->assign('total', $membres->countByCategory($cat_id));

$tpl->assign('pagination_url', utils::getSelfUrl(true) . '?p=[ID]&amp;o=' . $order . ($desc ? '&amp;d' : ''));


$tpl->assign('membres_cats', $membres_cats);
$tpl->assign('membres_cats_cachees', $membres_cats_cachees);
$tpl->assign('current_cat', $cat);

$tpl->assign('page', $page);
$tpl->assign('bypage', Membres::ITEMS_PER_PAGE);



$tpl->display('admin/membres/index.tpl');

?>

Modified www/admin/static/admin.css from [eac2078f61] to [77de133239].

332
333
334
335
336
337
338

339
340
341
342
343
344
345

table.list .confirm {
    color: darkgreen;
}

table.list .num {
    text-align: center;

}

table.list .check {
    width: 1%;
}









>







332
333
334
335
336
337
338
339
340
341
342
343
344
345
346

table.list .confirm {
    color: darkgreen;
}

table.list .num {
    text-align: center;
    font-size: .9em;
}

table.list .check {
    width: 1%;
}