Overview
Comment:Affichage des infos du membre dans sa fiche
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6bd977274f57b7b6b5f8c7083649bc8f8f9a4ea6
User & Date: bohwaz on 2013-01-30 16:03:25
Other Links: manifest | tags
Context
2013-01-30
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
15:34
Adapter la modif de membre aux champs personnalisés check-in: ef410c3196 user: bohwaz tags: trunk
Changes

Modified include/class.champs_membres.php from [ec688c4d23] to [2773639a9f].

136
137
138
139
140
141
142

143
144
145
146
147
148
149
            return true;
        else
            return false;
    }

	public function getAll()
	{

		return $this->champs;
	}

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







>







136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
            return true;
        else
            return false;
    }

	public function getAll()
	{
        $this->champs['passe']['title'] = 'Mot de passe';
		return $this->champs;
	}

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

Modified include/class.membres.php from [eddd440dec] to [2283df17eb].

279
280
281
282
283
284
285
























286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
                {
                    $data[$key] = 0;
                }

                if (!is_numeric($data[$key]))
                    throw new UserException('Le champ "' . $config['title'] . '" doit contenir un chiffre.');
            }
























        }

        if (!empty($data['code_postal']))
        {
            if (!empty($data['pays']) && $data['pays'] == 'FR' && !preg_match('!^\d{5}$!', $data['code_postal']))
            {
                throw new UserException('Code postal invalide.');
            }
        }

        if (!empty($data['passe']) && strlen($data['passe']) < 5)
        {
            throw new UserException('Le mot de passe doit faire au moins 5 caractères.');
        }

        return true;
    }

    public function add($data = array(), $check_mandatory = true)
    {
        $this->_checkFields($data);
        $db = DB::getInstance();

        if (!empty($data['email'])
            && $db->simpleQuerySingle('SELECT 1 FROM membres WHERE email = ? LIMIT 1;', false, $data['email']))
        {
            throw new UserException('Cette adresse e-mail est déjà utilisée par un autre membre, il faut en choisir une autre.');
        }







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




















|







279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
                {
                    $data[$key] = 0;
                }

                if (!is_numeric($data[$key]))
                    throw new UserException('Le champ "' . $config['title'] . '" doit contenir un chiffre.');
            }
            elseif ($config['type'] == 'select' && !in_array($data[$key], $config['options']))
            {
                throw new UserException('Le champ "' . $config['title'] . '" ne correspond pas à un des choix proposés.');
            }
            elseif ($config['type'] == 'multiple')
            {
                if (empty($data[$key]) || !is_array($data[$key]))
                {
                    $data[$key] = 0;
                    continue;
                }

                $binary = 0;

                foreach ($data[$key] as $k => $v)
                {
                    if (array_key_exists($k, $config['options']) && !empty($v))
                    {
                        $binary |= 0x01 << $k;
                    }
                }

                $data[$key] = $binary;
            }
        }

        if (!empty($data['code_postal']))
        {
            if (!empty($data['pays']) && $data['pays'] == 'FR' && !preg_match('!^\d{5}$!', $data['code_postal']))
            {
                throw new UserException('Code postal invalide.');
            }
        }

        if (!empty($data['passe']) && strlen($data['passe']) < 5)
        {
            throw new UserException('Le mot de passe doit faire au moins 5 caractères.');
        }

        return true;
    }

    public function add($data = array(), $check_mandatory = true)
    {
        $this->_checkFields($data, $check_mandatory);
        $db = DB::getInstance();

        if (!empty($data['email'])
            && $db->simpleQuerySingle('SELECT 1 FROM membres WHERE email = ? LIMIT 1;', false, $data['email']))
        {
            throw new UserException('Cette adresse e-mail est déjà utilisée par un autre membre, il faut en choisir une autre.');
        }

Modified include/lib.template.php from [6747116197] to [3eaa3d2fec].

497
498
499
500
501
502
503







504
505
506
507
508
509
510

$tpl->register_modifier('get_country_name', array('Garradin\utils', 'getCountryName'));
$tpl->register_modifier('format_tel', 'Garradin\tpl_format_tel');
$tpl->register_modifier('format_wiki', 'Garradin\tpl_format_wiki');
$tpl->register_modifier('liens_wiki', 'Garradin\tpl_liens_wiki');
$tpl->register_modifier('escape_money', 'Garradin\escape_money');
$tpl->register_modifier('abs', 'abs');








//$tpl->register_modifier('retard_cotisation', array('Membres', 'checkCotisation'));

$tpl->register_modifier('strftime_fr', 'Garradin\tpl_strftime_fr');
$tpl->register_modifier('date_fr', 'Garradin\tpl_date_fr');

?>







>
>
>
>
>
>
>







497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517

$tpl->register_modifier('get_country_name', array('Garradin\utils', 'getCountryName'));
$tpl->register_modifier('format_tel', 'Garradin\tpl_format_tel');
$tpl->register_modifier('format_wiki', 'Garradin\tpl_format_wiki');
$tpl->register_modifier('liens_wiki', 'Garradin\tpl_liens_wiki');
$tpl->register_modifier('escape_money', 'Garradin\escape_money');
$tpl->register_modifier('abs', 'abs');

$tpl->register_modifier('format_sqlite_date_to_french', function ($d) {
    if (strlen($d) == 10)
        return \DateTime::createFromFormat('Y-m-d', $d)->format('d/m/Y');
    else
        return \DateTime::createFromFormat('Y-m-d H:i:s', $d)->format('d/m/Y H:i');
});

//$tpl->register_modifier('retard_cotisation', array('Membres', 'checkCotisation'));

$tpl->register_modifier('strftime_fr', 'Garradin\tpl_strftime_fr');
$tpl->register_modifier('date_fr', 'Garradin\tpl_date_fr');

?>

Modified templates/admin/membres/fiche.tpl from [2a06a6a32e] to [ac17437d3f].

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
        {$error|escape}
    </p>
{/if}

<dl class="describe">
    <dt>Numéro d'adhérent</dt>
    <dd>{$membre.id|escape}</dd>
    <dt>Nom et prénom</dt>
    <dd><strong>{$membre.nom|escape}</strong></dd>
    <dt>Adresse</dt>
    <dd>
        {if !empty($membre.adresse) || !empty($membre.code_postal) || !empty($membre.ville) || !empty($membre.pays)}
            {if !empty($membre.adresse)}
                {$membre.adresse|escape|nl2br}<br />
            {/if}
            {if !empty($membre.code_postal)}


                {$membre.code_postal|escape}
            {/if}
            {if !empty($membre.ville)}
                {$membre.ville|escape}<br />
            {/if}
            ({$membre.pays|get_country_name|escape})
        {else}
            <em>(Non renseignée)</em>
        {/if}
    </dd>

    <dt>Téléphone</dt>
    <dd>
        {if !empty($membre.telephone)}

            <a href="tel:{$membre.telephone|escape}">{$membre.telephone|escape|format_tel}</a>
        {else}
            <em>(Non renseigné)</em>
        {/if}
    <dt>Adresse E-Mail</dt>
    <dd>

        {if !empty($membre.email)}
            <a href="mailto:{$membre.email|escape}">{$membre.email|escape}</a>
            | <a href="{$www_url}admin/membres/message.php?id={$membre.id|escape}">Envoyer un message</a>
            {if $membre.lettre_infos}
                <em>(inscrit-e à la lettre d'informations)</em>
            {/if}


        {else}
            <em>(Non renseignée)</em>

        {/if}
    </dd>

    <dt>Catégorie</dt>
    <dd>{$categorie.nom|escape} <span class="droits">{format_droits droits=$categorie}</span></dd>
    <dt>Inscription</dt>
    <dd>{$membre.date_inscription|date_fr:'d/m/Y'}</dd>
    <dt>Dernière connexion</dt>
    <dd>{if empty($membre.date_connexion)}Jamais{else}{$membre.date_connexion|date_fr:'d/m/Y à H:i'}{/if}</dd>
    <dt>Mot de passe</dt>
    <dd>{if empty($membre.passe)}Non{else}Oui{/if}</dd>
    <dt>Cotisation</dt>
    <dd>
    {if empty($membre.date_cotisation)}
        <span class="error">Jamais réglée</span>
    {elseif $verif_cotisation === true}
        <span class="confirm">Réglée le {$membre.date_cotisation|date_fr:'d/m/Y'}</span>
    {else}
        <span class="alert">En retard de {$verif_cotisation|escape} jours</span>
    {/if}
    </dd>
    <dd>
        <form method="post" action="{$self_url}">
            <fieldset>
                <legend>Mettre à jour la cotisation</legend>
                <dl>
                    <dt><label for="f_date">L'adhésion commence le...</label></dt>
                    <dd>
                        <input type="date" name="date" value="{form_field name=nom default=$date_cotisation_defaut}" id="f_date" />







|
|
<

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

<
>


>






<
<









|
<







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
        {$error|escape}
    </p>
{/if}

<dl class="describe">
    <dt>Numéro d'adhérent</dt>
    <dd>{$membre.id|escape}</dd>
    {foreach from=$champs key="c" item="config"}
    <dt>{$config.title|escape}</dt>

    <dd>

        {if $config.type == 'checkbox'}

            {if $membre[$c]}Oui{else}Non{/if}
        {elseif empty($membre[$c])}
            <em>(Non renseigné)</em>
        {elseif $c == 'nom'}
            <strong>{$membre[$c]|escape}</strong>
        {elseif $c == 'email'}
            <a href="mailto:{$membre[$c]|escape}">{$membre[$c]|escape}</a>
            | <a href="{$www_url}admin/membres/message.php?id={$membre.id|escape}">Envoyer un message</a>
        {elseif $config.type == 'email'}
            <a href="mailto:{$membre[$c]|escape}">{$membre[$c]|escape}</a>
        {elseif $config.type == 'tel'}



            <a href="tel:{$membre[$c]|escape}">{$membre[$c]|escape|format_tel}</a>
        {elseif $config.type == 'country'}

            {$membre[$c]|get_country_name|escape}
        {elseif $config.type == 'date' || $config.type == 'datetime'}
            {$membre[$c]|format_sqlite_date_to_french}
        {elseif $config.type == 'multiple'}



            <ul>
            {foreach from=$config.options key="b" item="name"}
                {if $membre[$c] & (0x01 << $b)}
                    <li>{$name|escape}</li>



                {/if}
            {/foreach}
            </ul>
        {else}

            {$membre[$c]|escape|rtrim|nl2br}
        {/if}
    </dd>
    {/foreach}
    <dt>Catégorie</dt>
    <dd>{$categorie.nom|escape} <span class="droits">{format_droits droits=$categorie}</span></dd>
    <dt>Inscription</dt>
    <dd>{$membre.date_inscription|date_fr:'d/m/Y'}</dd>
    <dt>Dernière connexion</dt>
    <dd>{if empty($membre.date_connexion)}Jamais{else}{$membre.date_connexion|date_fr:'d/m/Y à H:i'}{/if}</dd>


    <dt>Cotisation</dt>
    <dd>
    {if empty($membre.date_cotisation)}
        <span class="error">Jamais réglée</span>
    {elseif $verif_cotisation === true}
        <span class="confirm">Réglée le {$membre.date_cotisation|date_fr:'d/m/Y'}</span>
    {else}
        <span class="alert">En retard de {$verif_cotisation|escape} jours</span>
    {/if}
        <br />

        <form method="post" action="{$self_url}">
            <fieldset>
                <legend>Mettre à jour la cotisation</legend>
                <dl>
                    <dt><label for="f_date">L'adhésion commence le...</label></dt>
                    <dd>
                        <input type="date" name="date" value="{form_field name=nom default=$date_cotisation_defaut}" id="f_date" />

Modified www/admin/membres/ajouter.php from [e610f8440b] to [75729f89f3].

56
57
58
59
60
61
62


63
64
65
66

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

$tpl->assign('membres_cats', $cats->listSimple());
$tpl->assign('current_cat', utils::post('id_categorie') ?: $config->get('categorie_membres'));



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

?>







>
>




56
57
58
59
60
61
62
63
64
65
66
67
68

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

$tpl->assign('membres_cats', $cats->listSimple());
$tpl->assign('current_cat', utils::post('id_categorie') ?: $config->get('categorie_membres'));

$tpl->assign('custom_js', array('datepickr.js'));

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

?>

Modified www/admin/membres/fiche.php from [bee81cec02] to [9afcee1910].

18
19
20
21
22
23
24

25
26
27
28
29
30
31
$membre = $membres->get($id);

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


$error = false;

if (!empty($_POST['cotisation']))
{
    if (!utils::CSRF_check('cotisation_'.$id))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';







>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$membre = $membres->get($id);

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

$champs = $config->get('champs_membres');
$error = false;

if (!empty($_POST['cotisation']))
{
    if (!utils::CSRF_check('cotisation_'.$id))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
63
64
65
66
67
68
69


70
71
72
73
74
75
76
    $prochaine_cotisation = $prochaine_cotisation->getTimestamp();
}
else
{
    $prochaine_cotisation = time();
}
$tpl->assign('date_cotisation_defaut', date('Y-m-d', $prochaine_cotisation));



$tpl->assign('error', $error);
$tpl->assign('custom_js', array('datepickr.js'));

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

?>







>
>







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
    $prochaine_cotisation = $prochaine_cotisation->getTimestamp();
}
else
{
    $prochaine_cotisation = time();
}
$tpl->assign('date_cotisation_defaut', date('Y-m-d', $prochaine_cotisation));

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

$tpl->assign('error', $error);
$tpl->assign('custom_js', array('datepickr.js'));

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

?>

Modified www/admin/membres/modifier.php from [bb64342991] to [9f896b92ba].

78
79
80
81
82
83
84


85
86
87
88

$tpl->assign('membres_cats', $cats->listSimple());
$tpl->assign('current_cat', utils::post('id_categorie') ?: $membre['id_categorie']);

$tpl->assign('can_change_id', $user['droits']['membres'] == Membres::DROIT_ADMIN);

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



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

?>







>
>




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

$tpl->assign('membres_cats', $cats->listSimple());
$tpl->assign('current_cat', utils::post('id_categorie') ?: $membre['id_categorie']);

$tpl->assign('can_change_id', $user['droits']['membres'] == Membres::DROIT_ADMIN);

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

$tpl->assign('custom_js', array('datepickr.js'));

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

?>

Modified www/admin/static/admin.css from [0d8a113d56] to [bec0ea9091].

910
911
912
913
914
915
916




917
918
919
920
921
922
923
924
    float: left;
    clear: left;
    margin-bottom: .5em;
}

dl.describe > dd {
    margin-bottom: .5em;




    margin-left: 15em;
}

.infos_asso {
    width: 20%;
    float: right;
    margin: .5em;
    border: .1em solid #ccc;







>
>
>
>
|







910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
    float: left;
    clear: left;
    margin-bottom: .5em;
}

dl.describe > dd {
    margin-bottom: .5em;
    float: left;
}

dl.describe ul {
    margin-left: 1em;
}

.infos_asso {
    width: 20%;
    float: right;
    margin: .5em;
    border: .1em solid #ccc;