Subversion Repositories Sites.tela-botanica.org

Rev

Rev 87 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
87 alex 1
<?
2
// +--------------------------------------------------------------------------------+
3
// | liste_inscrit.php                                                              |
4
// +--------------------------------------------------------------------------------+
5
// | Copyright (c) 2002                                                             |
6
// +--------------------------------------------------------------------------------+
7
// |                                                                                |
8
// +--------------------------------------------------------------------------------+
9
// | Auteur : Alexandre Granier <alexandre@tela-botanica.org>                       |
10
// +--------------------------------------------------------------------------------+
11
//
12
// $Id: liste_inscrit.php,v 1.6 2005/03/14 10:10:02 alex Exp $
13
 
14
global $HTTP_USER_AGENT;
15
 
16
 
17
$javascript = "function confirmer ()
18
    {
19
        if (window.confirm ('Cliquez sur OK pour confirmer.')) {
20
            window.formmail.submit();
21
        }
22
    }
23
function setCheckboxes(the_form)
24
{
25
    var do_check=document.forms[the_form].elements['selecttotal'].checked;
26
    var elts            = document.forms[the_form].elements['select[]'];
27
    var elts_cnt = (typeof(elts.length) != 'undefined')
28
                        ? elts.length
29
                        : 0;
30
    if (elts_cnt) {
31
        for (var i = 0; i < elts_cnt; i++) {
32
            elts[i].checked = do_check;
33
        } // Fin for
34
    }
35
    else {
36
        elts.checked = do_check;
37
    } // Fin if... else
38
    return true;
39
} // Fin de la fonction 'setCheckboxes()'";
40
 
41
GEN_stockerCodeScript($javascript);
42
 
43
$url = CAR_URL ;
44
 
45
isset ($corps) ? '': $corps = '' ;
46
isset ($titre_mail) ? '': $titre_mail = '' ;
47
 
48
$tabmonde = explode ('*',$monde->historique);
49
 
50
// Premier cas, on vient de cliquer sur un pays qui n'est pas
51
// la France, on affiche les adhérents de ce pays
52
 
53
if (count($tabmonde) == 3) {
54
    $argument = $tabmonde[2];
55
 
56
    $requete = "select * from carto_PAYS where CP_ID_pays='$argument'";
57
    $resultat = $GLOBALS['car_db']->query($requete);
58
    if (DB::isError($resultat)) {
59
    	die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
60
    }
61
    $ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
62
 
63
    $pays = $ligne->CP_Intitule_pays;
64
    $monde->nom = $monde->nom.'*'.$pays;
65
 
66
    $tabonglet = explode ('*', $monde->historique);
67
    $tabnom = explode ('*', $monde->nom);
68
    foreach ($tabonglet as $key => $value) {
69
        $res .= '<a class="chemin_carto"' ;
70
        if ($key == 0) {
71
            $chemin = $value;
72
            $value = 'monde';
73
            $res .= " href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key] ;
74
        }
75
        else if ($key == (count($tabonglet)-1)) {
76
            $res .= ">&nbsp;&gt;&nbsp;$pays";
77
        }
78
        else {
79
            $chemin .= '*'.$value;
80
            $res .= " href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key] ;
81
        }
82
        $res .= '</a>' ;
83
    }
84
 
85
    $capitale = $ligne->CP_Intitule_capitale;
86
 
87
    $requete_2 = " SELECT count(".CAR_CHAMPS_ID.") as nbr".
88
            " from ".CAR_ANNUAIRE.
89
            " where ".CAR_CHAMPS_CE_PAYS."='$argument'";
90
 
91
    $resultat_2 = $GLOBALS['car_db']->query($requete_2);
92
    if (DB::isError($resultat_2)) {
93
    	die ($resultat_2->getMessage().'<br />'.$resultat_2->getDebugInfo()) ;
94
    }
95
    $ligne_2 = $resultat_2->fetchRow(DB_FETCHMODE_OBJECT) ;
96
    $res .= '<h1 class="titre1_cartographie">'.$pays.' ('.$capitale.') : ' ;
97
    if ($ligne_2->nbr == 0) {
98
        $res .= 'aucun inscrit '.CAR_LABEL_PROJET."</h1>\n";
99
        if (!$GLOBALS['car_auth']->getAuth()) {
100
            $res .= AUTH_formulaire_login();
101
        } else {
102
            $res .= '<div class="message_pas_dinscrit">'.CAR_PAS_D_INSCRIT.'</div>'."\n" ;
103
        }
104
        return $res ;
105
    } else if ($ligne_2->nbr == 1) {
106
        $res .= $ligne_2->nbr." inscrit " ;
107
    } else {
108
        $res .= $ligne_2->nbr." inscrits " ;
109
    }
110
    $res .= CAR_LABEL_PROJET."</h1>\n";
111
 
112
    if (!$GLOBALS['car_auth']->getAuth()) {
113
        $res .= AUTH_formulaire_login();
114
    } else {
115
    $res .= "<form action=\"$url&amp;mailer=1"."&amp;select=$select\" method=\"post\" name=\"formmail\">
116
                <div id=\"div_inscrit\"><table id=\"table_inscrits\">
117
                    <colgroup>
118
                        <col />
119
                        <col />
120
                        <col />
121
                        <col />
122
                        <col />
123
                        <col />
124
                    </colgroup>
125
                        <tr>
126
                            <th>&nbsp;</th>
127
                            <th>".CAR_NOM."</th>
128
                            <th>".CAR_PRENOM."</th>
129
                            <th>".CAR_DATE_INS."</th>
130
                            <th>".CAR_REGION."</th>
131
                            <th>".CAR_VILLE."</th>
132
                        </tr>\n";
133
 
134
        $requete = "select * from ".CAR_ANNUAIRE.
135
                " where ".CAR_CHAMPS_CE_PAYS."='$argument'".
136
                " order by ".CAR_CHAMPS_NOM.", ".CAR_CHAMPS_PRENOM;
137
        $resultat= $GLOBALS['car_db']->query($requete);
138
        if (DB::isError($resultat)) {
139
        	die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
140
        }
141
        $indic=0;
142
        $i=1;
143
        while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
144
            if ($indic==0) {
145
                $res.="<tr class=\"ligne_impaire\">\n";
146
                $indic=1;
147
            }
148
            else {
149
                $res.="<tr class=\"ligne_paire\">\n";
150
                $indic=0;
151
            }
152
            $res.="<td><input type=\"checkbox\" name=\"select[]\" value=\"".$ligne[CAR_CHAMPS_MAIL]."\" /></td>
153
                            <td>".$ligne[CAR_CHAMPS_NOM]."&nbsp;</td>
154
                            <td>".$ligne[CAR_CHAMPS_PRENOM]."&nbsp;</td>
155
                            <td>".date("d m Y", strtotime($ligne[CAR_CHAMPS_DATE_INS]))."&nbsp;</td>
156
                            <td>".$ligne[CAR_CHAMPS_REGION]."&nbsp;</td>
157
                            <td>".$ligne[CAR_CHAMPS_VILLE]."&nbsp;</td>\n" ;
158
            $res .= "</tr>\n";
159
        }
160
        $res .= "</table></div>\n";
161
 
162
        if ($mailer==1) {
163
            if (!is_array($select)) {
164
                $res .= "<div>".CAR_NO_DESTINATAIRE."</div>";
165
            } else {
166
                $res .= envoie_mail($GLOBALS['car_db']) ;
167
            }
168
        } else {
169
            $res .= carto_texte_cocher() ;
170
        }
171
 
172
        $res .= carto_formulaire($titre_mail, $corps) ;
173
    }
174
 
175
// 2 ème cas, on vient de cliquer sur un département français
176
 
177
} else if (count($tabmonde) == 4) {
178
    $argument = $tabmonde[3];
179
 
180
    $requete = "select * from gen_FRENCH_DPT where GFD_ID='$argument'";
181
    $resultat = $GLOBALS['car_db']->query($requete);
182
    if (DB::isError($resultat)) {
183
        die ($resultat->getMessage() .'<br />'.$resultat->getDebugInfo());
184
    }
185
    $ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT);
186
    $nom = $ligne->GFD_NAME;
187
 
188
    $tabonglet=explode ('*', $monde->historique);
189
    $tabnom=explode ('*', $monde->nom);
190
    $res.="<div>\n";
191
    foreach ($tabonglet as $key=>$value) {
192
        if ($key==0) {
193
            $chemin=$value;
194
            $value='monde';
195
            $res.= "<a class=\"chemin_carto\" href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key]."</a>";
196
        }
197
        else if ($key==(count($tabonglet)-1)) {
198
            $res.="<a class=\"chemin_carto\">&nbsp;&gt;&nbsp;$nom</a>";
199
        }
200
        else {
201
            $chemin.='*'.$value;
202
            $res.= "<a class=\"chemin_carto\" href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key]."</a>";
203
        }
204
    }
205
    $res .= "</div>\n";
206
 
207
    $requete_2 = " SELECT count(".CAR_CHAMPS_ID.") as nbr".
208
            " FROM ".CAR_ANNUAIRE.
209
            " WHERE ".CAR_CHAMPS_DPT." = '$argument'".
210
            " AND ".CAR_CHAMPS_CE_PAYS."='fr'";
211
 
212
    $resultat_2 = $GLOBALS['car_db']->query($requete_2);
213
    if (DB::isError($resultat_2)) {
214
    	die ($resultat_2->getMessage().'<br />'.$resultat_2->getDebugInfo()) ;
215
    }
216
 
217
    $ligne_2 = $resultat_2->fetchRow(DB_FETCHMODE_OBJECT);
218
 
219
    $res .= '<h1 class="titre1_cartographie">'.$nom.' : ' ;
220
    if ($ligne_2->nbr == 0) {
221
        $res .= 'aucun inscrit '.CAR_LABEL_PROJET."</h1>\n";
222
        if (!$GLOBALS['car_auth']->getAuth()) {
223
            $res .= AUTH_formulaire_login();
224
        } else {
225
            $res .= '<div class="message_pas_dinscrit">'.CAR_PAS_D_INSCRIT.'</div>'."\n" ;
226
        }
227
        return $res ;
228
    } else if ($ligne_2->nbr == 1) {
229
        $res .= $ligne_2->nbr." inscrit " ;
230
    } else {
231
        $res .= $ligne_2->nbr." inscrits " ;
232
    }
233
    $res .= CAR_LABEL_PROJET."</h1>\n";
234
 
235
    if (!$GLOBALS['car_auth']->getAuth()) {
236
        $res .= AUTH_formulaire_login();
237
    } else {
238
        $res.= "<form action=\"$url&amp;fin=true&amp;argument=$argument&amp;mailer=1&amp;select=$select&amp;$titre_mail&amp;corps=$corps\"
239
                method=\"post\" name=\"formmail\">
240
                    <div id=\"div_inscrit\"><table id=\"table_inscrits\">
241
                        <colgroup>
242
                            <col />
243
                            <col />
244
                            <col />
245
                            <col />
246
                            <col />
247
                            <col />
248
                        </colgroup>
249
                        <tr>
250
                            <th>&nbsp;</th>
251
                            <th>".CAR_NOM."</th>
252
                            <th>".CAR_PRENOM."</th>
253
                            <th>".CAR_DATE_INS."</th>
254
                            <th>".CAR_CP."</th>
255
                            <th>".CAR_VILLE."</th>
256
                        </tr>\n";
257
 
258
        $requete = "SELECT * FROM ".CAR_ANNUAIRE.
259
                " WHERE ".CAR_CHAMPS_DPT." = '$argument'".
260
                " AND ".CAR_CHAMPS_CE_PAYS."='fr'".
261
                " ORDER BY ".CAR_CHAMPS_NOM.", ".CAR_CHAMPS_PRENOM;
262
        $resultat = $GLOBALS['car_db']->query($requete);
263
        if (DB::isError($resultat)) {
264
            die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
265
        }
266
 
267
        $indic=0;
268
        $i=1;
269
        while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
270
            if ($indic==0) {
271
                $res.="<tr class=\"ligne_impaire\">\n";
272
                $indic=1;
273
            } else {
274
                $res.="<tr class=\"ligne_paire\">\n";
275
                $indic=0;
276
            }
277
            $res.="<td><input type=\"checkbox\" name=\"select[]\" value=\"".$ligne[CAR_CHAMPS_MAIL]."\" /></td>
208 jpm 278
                                    <td>".strtoupper($ligne[CAR_CHAMPS_NOM])."&nbsp;</td>
279
                                    <td>".str_replace(' - ', '-', ucwords(strtolower(str_replace('-', ' - ', $ligne[CAR_CHAMPS_PRENOM]))))."&nbsp;</td>
87 alex 280
                                    <td>".date("d m Y", strtotime($ligne[CAR_CHAMPS_DATE_INS]))."</td>
281
                                    <td>".$ligne[CAR_CHAMPS_CODE_POSTAL]."&nbsp;</td>
208 jpm 282
                                    <td>".strtoupper($ligne[CAR_CHAMPS_VILLE])."&nbsp;</td>
87 alex 283
                                    </tr>\n";
284
        }
285
        $res.="</table></div>\n";
286
        if ($mailer==1) {
287
            if (!is_array($select)) {
288
                $res.= CAR_NO_DESTINATAIRE;
289
            } else {
290
                $res .= envoie_mail($GLOBALS['car_db']) ;
291
            }
292
        } else {
293
            $res .=carto_texte_cocher() ;
294
        }
295
        $res .= carto_formulaire($titre_mail, $corps) ;
296
    }
297
}
298
?>