Overview
Comment:Avancement sur les champs membres personnalisés + réflexion sur la suite des cotisations...
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 932ea4a33e51579998c1c695b040f1ad79fc0eae
User & Date: bohwaz on 2013-01-13 15:37:06
Other Links: manifest | tags
Context
2013-01-18
13:31
Garder l'ancien comportement pour le moment check-in: 03c6e31ed5 user: bohwaz tags: trunk
2013-01-13
15:37
Avancement sur les champs membres personnalisés + réflexion sur la suite des cotisations... check-in: 932ea4a33e user: bohwaz tags: trunk
2013-01-04
07:33
Renommage du fichier de base de données check-in: 25db7dcbc2 user: bohwaz tags: trunk
Changes

Modified include/class.champs_membres.php from [6cc5cf3775] to [6205058156].

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
<?php

namespace Garradin;

class Champs_Membres
{
	protected $champs = null;

	protected $types = array(
		'email'		=>	'Adresse E-Mail',
		'url'		=>	'Adresse URL',
		'checkbox'	=>	'Case à cocher',
		'multiple'	=>	'Combinaison de cases à cocher',
		'date'		=>	'Date',
		'datetime'	=>	'Date et heure',
		'file'		=>	'Fichier',
        'password'  =>  'Mot de passe',
		'number'	=>	'Numéro',
		'tel'		=>	'Numéro de téléphone',
		'select'	=>	'Sélecteur de choix',

		'country'	=>	'Sélecteur de pays',
		'text'		=>	'Texte',
		'textarea'	=>	'Texte multi-lignes',
	);

    protected $config_fields = array(
        'type',












<






|
>







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
<?php

namespace Garradin;

class Champs_Membres
{
	protected $champs = null;

	protected $types = array(
		'email'		=>	'Adresse E-Mail',
		'url'		=>	'Adresse URL',
		'checkbox'	=>	'Case à cocher',

		'date'		=>	'Date',
		'datetime'	=>	'Date et heure',
		'file'		=>	'Fichier',
        'password'  =>  'Mot de passe',
		'number'	=>	'Numéro',
		'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',
116
117
118
119
120
121
122







123
124
125
126
127
128
129
		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
     */







>
>
>
>
>
>
>







116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
		return $this->champs[$champ];
	}

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

    public function getPublic()
    {
        return array_filter($this->champs, function ($row) {
            return empty($row['private']) ? true : false;
        });
    }

    /**
     * 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
     */
155
156
157
158
159
160
161








162
163
164
165
166
167
168
            elseif ($key == 'help' || $key == 'title')
            {
                $value = trim((string) $value);
            }
            elseif ($key == 'options')
            {
                $value = (array) $value;








            }
        }

        if (empty($config['title']))
        {
            throw new UserException('Champ "'.$name.'" : Le titre est obligatoire.');
        }







>
>
>
>
>
>
>
>







162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
            elseif ($key == 'help' || $key == 'title')
            {
                $value = trim((string) $value);
            }
            elseif ($key == 'options')
            {
                $value = (array) $value;

                foreach ($value as $option_key=>$option_value)
                {
                    if (!trim($option_value))
                    {
                        unset($value[$option_key]);
                    }
                }
            }
        }

        if (empty($config['title']))
        {
            throw new UserException('Champ "'.$name.'" : Le titre est obligatoire.');
        }

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

509
510
511
512
513
514
515
516
517

518
519
520
521
522
523
524

    public function countAllButHidden()
    {
        $db = DB::getInstance();
        return $db->simpleQuerySingle('SELECT COUNT(*) FROM membres WHERE id_categorie NOT IN (SELECT id FROM membres_categories WHERE cacher = 1);');
    }

    static public function checkCotisation($date_membre, $duree_cotisation, $date_verif = null)
    {

        if (is_null($date_verif))
            $date_verif = time();

        if (!$date_membre)
            return false;

        $echeance = new \DateTime($date_membre);







|

>







509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525

    public function countAllButHidden()
    {
        $db = DB::getInstance();
        return $db->simpleQuerySingle('SELECT COUNT(*) FROM membres WHERE id_categorie NOT IN (SELECT id FROM membres_categories WHERE cacher = 1);');
    }

    static public function checkCotisation($id)
    {
        return true;
        if (is_null($date_verif))
            $date_verif = time();

        if (!$date_membre)
            return false;

        $echeance = new \DateTime($date_membre);

Modified include/data/schema.sql from [ec287cf265] to [01ca919fb3].

57
58
59
60
61
62
63































64
65
66
67
68
69
70
    -- Dernière cotisation enregistrée
    date_cotisation TEXT,

    FOREIGN KEY (id_categorie) REFERENCES membres_categories (id)
);

CREATE INDEX membres_id_categorie ON membres (id_categorie);
































--
-- WIKI
--

CREATE TABLE wiki_pages
-- Pages du wiki







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







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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
    -- Dernière cotisation enregistrée
    date_cotisation TEXT,

    FOREIGN KEY (id_categorie) REFERENCES membres_categories (id)
);

CREATE INDEX membres_id_categorie ON membres (id_categorie);

-- Paiements possibles
CREATE TABLE types_transactions
(
    id INTEGER PRIMARY KEY,
    id_categorie_compta INTEGER NULL, -- NULL si le type n'est pas associé automatiquement à la compta

    titre TEXT NOT NULL,
    description TEXT NOT NULL,
    montant REAL NOT NULL,
    duree INTEGER NULL,
    debut TEXT NULL,
    fin TEXT NULL,

    FOREIGN KEY (id_categorie_compta) REFERENCES compta_categories (id)
);

-- Paiements enregistrés
CREATE TABLE membres_transactions
(
    id_membre INTEGER NOT NULL,
    id_transaction INTEGER NOT NULL,
    id_operation INTEGER NULL,

    date TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
    montant REAL NOT NULL,

    FOREIGN KEY (id_membre) REFERENCES membres (id),
    FOREIGN KEY (id_transaction) REFERENCES transactions (id),
    FOREIGN KEY (id_operation) REFERENCES compta_journal (id)
);

--
-- WIKI
--

CREATE TABLE wiki_pages
-- Pages du wiki

Modified include/lib.template.php from [8ff6a87056] to [d93f2441d6].

359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
        throw new \BadFunctionCallException('Paramètres type et name obligatoires.');

    $config = $params['config'];
    $type = $config['type'];

    if ($type == 'select')
    {
        if (empty($params['options']))
            throw new \BadFunctionCallException('Paramètre options obligatoire pour champ de type select.');
    }
    elseif ($type == 'country')
    {
        $type = 'select';
        $params['options'] = utils::getCountryList();
        $params['default'] = Config::getInstance()->get('pays');
    }
    elseif ($type == 'multiple')
    {
        if (empty($params['options']))
            throw new \BadFunctionCallException('Paramètre options obligatoire pour champ de type multiple.');
    }

    $field = '';
    $value = tpl_form_field($params);
    $attributes = 'name="' . htmlspecialchars($params['name'], ENT_QUOTES, 'UTF-8') . '" ';
    $attributes .= 'id="f_' . htmlspecialchars($params['name'], ENT_QUOTES, 'UTF-8') . '" ';

    if (!empty($params['disabled']))
    {
        $attributes .= 'disabled="disabled" ';
    }

    if ($type == 'select')
    {
        $field .= '<select '.$attributes.'>';
        foreach ($params['options'] as $k=>$v)
        {
            if (is_int($k))
                $k = $v;

            $field .= '<option value="' . htmlspecialchars($k, ENT_QUOTES, 'UTF-8') . '"';

            if ($value == $k)
                $field .= ' selected="selected"';

            $field .= '>' . htmlspecialchars($v, ENT_QUOTES, 'UTF-8') . '</option>';
        }
        $field .= '</select>';
    }
    elseif ($type == 'multiple')
    {
        foreach ($params['options'] as $k=>$v)
        {
            $b = 0x01 << (int)$k;
            $field .= '<label><input type="checkbox" name="' 
                . htmlspecialchars($params['name'], ENT_QUOTES, 'UTF-8') . '[' . (int)$k . ']" value="1" '
                . (($value & $b) ? 'checked="checked"' : '') . ' /> ' 
                . htmlspecialchars($v, ENT_QUOTES, 'UTF-8') . '</label><br />';
        }







|





|




|
















|






|








|







359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
        throw new \BadFunctionCallException('Paramètres type et name obligatoires.');

    $config = $params['config'];
    $type = $config['type'];

    if ($type == 'select')
    {
        if (empty($config['options']))
            throw new \BadFunctionCallException('Paramètre options obligatoire pour champ de type select.');
    }
    elseif ($type == 'country')
    {
        $type = 'select';
        $config['options'] = utils::getCountryList();
        $params['default'] = Config::getInstance()->get('pays');
    }
    elseif ($type == 'multiple')
    {
        if (empty($config['options']))
            throw new \BadFunctionCallException('Paramètre options obligatoire pour champ de type multiple.');
    }

    $field = '';
    $value = tpl_form_field($params);
    $attributes = 'name="' . htmlspecialchars($params['name'], ENT_QUOTES, 'UTF-8') . '" ';
    $attributes .= 'id="f_' . htmlspecialchars($params['name'], ENT_QUOTES, 'UTF-8') . '" ';

    if (!empty($params['disabled']))
    {
        $attributes .= 'disabled="disabled" ';
    }

    if ($type == 'select')
    {
        $field .= '<select '.$attributes.'>';
        foreach ($config['options'] as $k=>$v)
        {
            if (is_int($k))
                $k = $v;

            $field .= '<option value="' . htmlspecialchars($k, ENT_QUOTES, 'UTF-8') . '"';

            if ($value == $k || empty($value) && !empty($params['default']))
                $field .= ' selected="selected"';

            $field .= '>' . htmlspecialchars($v, ENT_QUOTES, 'UTF-8') . '</option>';
        }
        $field .= '</select>';
    }
    elseif ($type == 'multiple')
    {
        foreach ($config['options'] as $k=>$v)
        {
            $b = 0x01 << (int)$k;
            $field .= '<label><input type="checkbox" name="' 
                . htmlspecialchars($params['name'], ENT_QUOTES, 'UTF-8') . '[' . (int)$k . ']" value="1" '
                . (($value & $b) ? 'checked="checked"' : '') . ' /> ' 
                . htmlspecialchars($v, ENT_QUOTES, 'UTF-8') . '</label><br />';
        }

Modified templates/admin/config/index.tpl from [5ad6698fd9] to [d3a9ce1c4b].

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
        {$error|escape}
    </p>
    {/if}
{/if}

<ul class="actions">
    <li class="current"><a href="{$www_url}admin/config/">Général</a></li>
    <li><a href="{$www_url}admin/config/membres.php">Fiche membres</a></li>
    <li><a href="{$www_url}admin/config/site.php">Site public</a></li>
</ul>

<form method="post" action="{$self_url|escape}">

    <fieldset>
        <legend>Garradin</legend>







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
        {$error|escape}
    </p>
    {/if}
{/if}

<ul class="actions">
    <li class="current"><a href="{$www_url}admin/config/">Général</a></li>
    <li><a href="{$www_url}admin/config/membres.php">Fiche des membres</a></li>
    <li><a href="{$www_url}admin/config/site.php">Site public</a></li>
</ul>

<form method="post" action="{$self_url|escape}">

    <fieldset>
        <legend>Garradin</legend>

Modified templates/admin/config/membres.tpl from [109faa7d86] to [25243cba6e].

1
2
3
4
5
6
7
8
9
10
11
12
{include file="admin/_head.tpl" title="Configuration — Fiche membres" current="config"}

<ul class="actions">
    <li><a href="{$www_url}admin/config/">Général</a></li>
    <li class="current"><a href="{$www_url}admin/config/membres.php">Fiche membres</a></li>
    <li><a href="{$www_url}admin/config/site.php">Site public</a></li>
</ul>

{if $error}
    {if $error == 'OK'}
    <p class="confirm">
        La configuration a bien été enregistrée.




|







1
2
3
4
5
6
7
8
9
10
11
12
{include file="admin/_head.tpl" title="Configuration — Fiche membres" current="config"}

<ul class="actions">
    <li><a href="{$www_url}admin/config/">Général</a></li>
    <li class="current"><a href="{$www_url}admin/config/membres.php">Fiche des membres</a></li>
    <li><a href="{$www_url}admin/config/site.php">Site public</a></li>
</ul>

{if $error}
    {if $error == 'OK'}
    <p class="confirm">
        La configuration a bien été enregistrée.
125
126
127
128
129
130
131

132
133
134
135



136
137
138
139
140
141
142
                    <dt><label>Options disponibles</label></dt>
                    {if $champ.type == 'multiple'}
                        <dd class="help">Attention changer l'ordre des options peut avoir des effets indésirables.</dd>
                    {else}
                        <dd class="help">Attention renommer ou supprimer une option n'affecte pas ce qui a déjà
                            été enregistré dans les fiches des membres.</dd>
                    {/if}

                    {foreach from=$champ.options key="key" item="opt"}
                        <dd>{if $champ.type == 'multiple'}{math a=$key equation="a+1"}. {/if}<input type="text" name="champs[{$nom|escape}][options][{$key|escape}]" value="{$opt|escape}" size="50" /></dd>
                    {/foreach}
                    {assign var="more" value=$champ.options|@count}



                    {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}







>
|
|
|
|
>
>
>







125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
                    <dt><label>Options disponibles</label></dt>
                    {if $champ.type == 'multiple'}
                        <dd class="help">Attention changer l'ordre des options peut avoir des effets indésirables.</dd>
                    {else}
                        <dd class="help">Attention renommer ou supprimer une option n'affecte pas ce qui a déjà
                            été enregistré dans les fiches des membres.</dd>
                    {/if}
                    {if !empty($champ.options)}
                        {foreach from=$champ.options key="key" item="opt"}
                            <dd>{if $champ.type == 'multiple'}{math a=$key equation="a+1"}. {/if}<input type="text" name="champs[{$nom|escape}][options][{$key|escape}]" value="{$opt|escape}" size="50" /></dd>
                        {/foreach}
                        {assign var="more" value=$champ.options|@count}
                    {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}

Modified templates/admin/mes_infos.tpl from [4aa35a8ebb] to [9e2c8a3fd2].

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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
{include file="admin/_head.tpl" title="Mes informations personnelles" current="mes_infos"}

{if $error}
    <p class="error">
        {$error|escape}
    </p>
{/if}

<form method="post" action="{$self_url|escape}">


    <fieldset>
        <legend>Informations personnelles</legend>
        <dl>
        {if in_array('nom', $config.champs_modifiables_membre)}
            <dt><label for="f_nom">Prénom et nom</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="text" name="nom" id="f_nom" value="{form_field data=$membre name=nom}" /></dd>
        {else}
            <dt>Prénom et nom <b>(non modifiable)</b></dt>
            <dd>{$membre.nom|escape}</dd>
        {/if}
        {if in_array('email', $config.champs_modifiables_membre)}
            <dt><label for="f_email">Adresse E-Mail</label>{if in_array('email', $obligatoires)} <b title="(Champ obligatoire)">obligatoire</b>{/if}</dt>
            <dd><input type="email" name="email" id="f_email" value="{form_field data=$membre name=email}" /></dd>
        {else}
            <dt>E-Mail <b>(non modifiable)</b></dt>
            <dd>{$membre.email|escape}</dd>
        {/if}
        {if in_array('telephone', $config.champs_modifiables_membre)}
            <dt><label for="f_telephone">Numéro de téléphone</label>{if in_array('telephone', $obligatoires)} <b title="(Champ obligatoire)">obligatoire</b>{/if}</dt>
            <dd><input type="tel" name="telephone" id="f_telephone" value="{form_field data=$membre name=telephone}" /></dd>
        {else}
            <dt>Numéro de téléphone <b>(non modifiable)</b></dt>
            <dd>{$membre.telephone|escape}</dd>
        {/if}
        {if in_array('adresse', $config.champs_modifiables_membre)}
            <dt><label for="f_adresse">Adresse</label> (numéro, rue, etc.){if in_array('adresse', $obligatoires)} <b title="(Champ obligatoire)">obligatoire</b>{/if}</dt>
            <dd><textarea name="adresse" id="f_adresse" rows="4" cols="30">{form_field data=$membre name=adresse}</textarea></dd>
        {else}
            <dt>Adresse <b>(non modifiable)</b></dt>
            <dd>{$membre.adresse|escape|nl2br}</dd>
        {/if}
        {if in_array('code_postal', $config.champs_modifiables_membre)}
            <dt><label for="f_code_postal">Code postal</label>{if in_array('code_postal', $obligatoires)} <b title="(Champ obligatoire)">obligatoire</b>{/if}</dt>
            <dd><input type="number" name="code_postal" id="f_code_postal" value="{form_field data=$membre name=code_postal}" /></dd>
        {else}
            <dt>Code postal <b>(non modifiable)</b></dt>
            <dd>{$membre.code_postal|escape}</dd>
        {/if}
        {if in_array('ville', $config.champs_modifiables_membre)}
            <dt><label for="f_ville">Ville</label>{if in_array('ville', $obligatoires)} <b title="(Champ obligatoire)">obligatoire</b>{/if}</dt>
            <dd><input type="text" name="ville" id="f_ville" value="{form_field data=$membre name=ville}" /></dd>
        {else}
            <dt>Ville <b>(non modifiable)</b></dt>
            <dd>{if $membre.ville}{$membre.ville|escape}{else}(vide){/if}</dd>
        {/if}
        {if in_array('pays', $config.champs_modifiables_membre)}
            <dt><label for="f_pays">Pays</label> {if in_array('pays', $obligatoires)} <b title="(Champ obligatoire)">obligatoire</b>{/if}</dt>
            <dd>
                <select name="pays" id="f_pays">
                {foreach from=$pays key="cc" item="nom"}
                    <option value="{$cc|escape}"{if $cc == $current_cc} selected="selected"{/if}>{$nom|escape}</option>
                {/foreach}
                </select>
            </dd>
        {else}
            <dt>Pays <b>(non modifiable)</b></dt>
            <dd>{if $membre.pays}{$membre.pays|get_country_name}{else}(vide){/if}</dd>
        {/if}
        </dl>
    </fieldset>

    {if in_array('passe', $config.champs_modifiables_membre)}
    <fieldset>
        <legend>Changer mon mot de passe</legend>



        <dl>
            <dd>Vous avez déjà un mot de passe, ne remplissez pas les champs suivants si vous ne souhaitez pas les changer.</dd>
            <dt><label for="f_passe">Nouveau mot de passe</label></dt>
            <dd class="help">
                Pas d'idée ? Voici une suggestion choisie au hasard :
                <tt title="Cliquer pour utiliser cette suggestion comme mot de passe" onclick="fillPassword(this);">{$passphrase|escape}</tt>
            </dd>
            <dd><input type="password" name="passe" id="f_passe" value="{form_field name=passe}" /></dd>
            <dt><label for="f_repasse">Encore le mot de passe</label> (vérification)</dt>
            <dd><input type="password" name="repasse" id="f_repasse" value="{form_field name=repasse}" /></dd>
        </dl>
    </fieldset>
    {/if}

    <fieldset>
        <legend>Général</legend>
        <dl>
            <dt>
                <input type="checkbox" id="f_lettre" name="lettre_infos" value="1" {form_field name="lettre_infos" data=$membre checked="1"} />
                <label for="f_lettre">Inscription à la lettre d'information</label>
            </dt>
        </dl>
    </fieldset>

    <p class="submit">
        {csrf_field key="edit_me"}
        <input type="submit" name="save" value="Enregistrer &rarr;" />
    </p>

</form>









>




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



|


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







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
{include file="admin/_head.tpl" title="Mes informations personnelles" current="mes_infos"}

{if $error}
    <p class="error">
        {$error|escape}
    </p>
{/if}

<form method="post" action="{$self_url|escape}">


    <fieldset>
        <legend>Informations personnelles</legend>
        <dl>







            {foreach from=$champs item="champ" key="nom"}













            {if empty($champ.private) && $nom != 'passe'}




                {html_champ_membre config=$champ name=$nom data=$membre}
            {/if}




















            {/foreach}






        </dl>
    </fieldset>

    {if array_key_exists('passe', $champs)}
    <fieldset>
        <legend>Changer mon mot de passe</legend>
        {if empty($champs.passe.editable)}
            <p class="help">Vous devez contacter un administrateur pour changer votre mot de passe.</p>
        {else}
            <dl>
                <dd>Vous avez déjà un mot de passe, ne remplissez pas les champs suivants si vous ne souhaitez pas les changer.</dd>
                <dt><label for="f_passe">Nouveau mot de passe</label></dt>
                <dd class="help">
                    Pas d'idée ? Voici une suggestion choisie au hasard :
                    <tt title="Cliquer pour utiliser cette suggestion comme mot de passe" onclick="fillPassword(this);">{$passphrase|escape}</tt>
                </dd>
                <dd><input type="password" name="passe" id="f_passe" value="{form_field name=passe}" /></dd>
                <dt><label for="f_repasse">Encore le mot de passe</label> (vérification)</dt>
                <dd><input type="password" name="repasse" id="f_repasse" value="{form_field name=repasse}" /></dd>
            </dl>

        {/if}

    </fieldset>





    {/if}



    <p class="submit">
        {csrf_field key="edit_me"}
        <input type="submit" name="save" value="Enregistrer &rarr;" />
    </p>

</form>

Modified www/admin/config/membres.php from [700b9b9b4e] to [314afb4bc4].

77
78
79
80
81
82
83
84
85
86
87
88
89
90
91


92
93
94
95
96
97
98
                    $champs->add(utils::post('preset'), $presets[utils::post('preset')]);
                }
                elseif (utils::post('new'))
                {
                    $presets = Champs_Membres::importPresets();
                    $new = utils::post('new');

                    if (array_key_exists($new['name'], $presets))
                    {
                        throw new UserException('Le champ ajouté a le même nom qu\'un champ pré-défini.');
                    }

                    $config = array(
                        'type'  =>  'text',
                        'title' =>  utils::post('new_title'),


                    );

                    $champs->add($new, $config);
                }

                $membres->sessionStore('champs_membres', (string) $champs);








|

|



|

>
>







77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
                    $champs->add(utils::post('preset'), $presets[utils::post('preset')]);
                }
                elseif (utils::post('new'))
                {
                    $presets = Champs_Membres::importPresets();
                    $new = utils::post('new');

                    if (array_key_exists($new, $presets))
                    {
                        throw new UserException('Le champ personnalisé ne peut avoir le même nom qu\'un champ pré-défini.');
                    }

                    $config = array(
                        'type'  =>  utils::post('new_type'),
                        'title' =>  utils::post('new_title'),
                        'editable'  =>  true,
                        'mandatory' =>  false,
                    );

                    $champs->add($new, $config);
                }

                $membres->sessionStore('champs_membres', (string) $champs);

Modified www/admin/index.php from [abba5d78d2] to [b0dc52bbe0].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
namespace Garradin;

require_once __DIR__ . '/_inc.php';

$cats = new Membres_Categories;
$categorie = $cats->get($user['id_categorie']);

$tpl->assign('categorie', $categorie);
$tpl->assign('verif_cotisation', Membres::checkCotisation($user['date_cotisation'], $categorie['duree_cotisation']));

$wiki = new Wiki;
$page = $wiki->getByURI($config->get('accueil_connexion'));
$tpl->assign('page', $page);

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

?>









|








1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
namespace Garradin;

require_once __DIR__ . '/_inc.php';

$cats = new Membres_Categories;
$categorie = $cats->get($user['id_categorie']);

$tpl->assign('categorie', $categorie);
$tpl->assign('verif_cotisation', Membres::checkCotisation($user['id']));

$wiki = new Wiki;
$page = $wiki->getByURI($config->get('accueil_connexion'));
$tpl->assign('page', $page);

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

?>

Modified www/admin/mes_infos.php from [6caeebaa2e] to [ee56d13ace].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
namespace Garradin;

require_once __DIR__ . '/_inc.php';

if (count($config->get('champs_modifiables_membre')) == 0)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$membre = $membres->getLoggedUser();

if (!$membre)
{
    throw new UserException("Ce membre n'existe pas.");
}






<
<
<
<
<







1
2
3
4
5





6
7
8
9
10
11
12
<?php
namespace Garradin;

require_once __DIR__ . '/_inc.php';






$membre = $membres->getLoggedUser();

if (!$membre)
{
    throw new UserException("Ce membre n'existe pas.");
}

54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
            $error = $e->getMessage();
        }
    }
}

$tpl->assign('error', $error);
$tpl->assign('passphrase', utils::suggestPassword());
$tpl->assign('obligatoires', $config->get('champs_obligatoires'));

$tpl->assign('pays', utils::getCountryList());
$tpl->assign('current_cc', utils::post('pays') ?: $membre['pays']);

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

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

?>







|
<
<
<






49
50
51
52
53
54
55
56



57
58
59
60
61
62
            $error = $e->getMessage();
        }
    }
}

$tpl->assign('error', $error);
$tpl->assign('passphrase', utils::suggestPassword());
$tpl->assign('champs', $config->get('champs_membres')->getAll());




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

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

?>