Subversion Repositories Sites.tela-botanica.org

Rev

Rev 463 | 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
 
364 jpm 45
$corps = (isset($_POST['corps'])) ? $_POST['corps'] : '' ;
46
$titre_mail = (isset($_POST['titre_mail'])) ? $_POST['titre_mail'] : '';
87 alex 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 {
463 jpm 115
    $res .= '<form action="'.$url.'?mailer=1&amp;fin=true" method="post" name="formmail">'.
116
            '	<div id="div_inscrit">'.
117
            '		<table id="table_inscrits">'.
118
            '			<colgroup>'.
119
			'				<col />'.
120
			'				<col />'.
121
			'				<col />'.
122
			'				<col />'.
123
			'				<col />'.
124
			'				<col />'.
125
			'			</colgroup>'.
126
			'			<thead>'.
127
			'				<tr>'.
128
			'					<th>&nbsp;</th>'.
129
			'					<th>'.CAR_NOM.'</th>'.
130
			'					<th>'.CAR_PRENOM.'</th>'.
131
			'					<th>'.CAR_DATE_INS.'</th>'.
132
			'					<th>'.CAR_REGION.'</th>'.
133
			'					<th>'.CAR_VILLE.'</th>'.
134
			'				</tr>'.
135
			'			</thead>'.
136
			'			<tbody>';
87 alex 137
 
138
        $requete = "select * from ".CAR_ANNUAIRE.
139
                " where ".CAR_CHAMPS_CE_PAYS."='$argument'".
140
                " order by ".CAR_CHAMPS_NOM.", ".CAR_CHAMPS_PRENOM;
141
        $resultat= $GLOBALS['car_db']->query($requete);
142
        if (DB::isError($resultat)) {
143
        	die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
144
        }
145
        $indic=0;
146
        $i=1;
147
        while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
148
            if ($indic==0) {
149
                $res.="<tr class=\"ligne_impaire\">\n";
150
                $indic=1;
151
            }
152
            else {
153
                $res.="<tr class=\"ligne_paire\">\n";
154
                $indic=0;
155
            }
156
            $res.="<td><input type=\"checkbox\" name=\"select[]\" value=\"".$ligne[CAR_CHAMPS_MAIL]."\" /></td>
258 jpm 157
                            <td>".strtoupper($ligne[CAR_CHAMPS_NOM])."&nbsp;</td>\n
158
                        	<td>".str_replace(' - ', '-', ucwords(strtolower(str_replace('-', ' - ', $ligne[CAR_CHAMPS_PRENOM]))))."&nbsp;</td>\n
87 alex 159
                            <td>".date("d m Y", strtotime($ligne[CAR_CHAMPS_DATE_INS]))."&nbsp;</td>
258 jpm 160
                            <td>".str_replace(' - ', '-', ucwords(strtolower(str_replace('-', ' - ', $ligne[CAR_CHAMPS_REGION]))))."&nbsp;</td>
161
                            <td>".strtoupper($ligne[CAR_CHAMPS_VILLE])."&nbsp;</td>\n";
87 alex 162
            $res .= "</tr>\n";
163
        }
463 jpm 164
        $res .= "</tbody></table></div>\n";
87 alex 165
 
166
        if ($mailer==1) {
167
            if (!is_array($select)) {
168
                $res .= "<div>".CAR_NO_DESTINATAIRE."</div>";
169
            } else {
540 jpm 170
                $res .= envoie_mail_modere($GLOBALS['car_db']) ;
87 alex 171
            }
172
        } else {
173
            $res .= carto_texte_cocher() ;
174
        }
175
 
176
        $res .= carto_formulaire($titre_mail, $corps) ;
177
    }
178
 
179
// 2 ème cas, on vient de cliquer sur un département français
180
 
181
} else if (count($tabmonde) == 4) {
182
    $argument = $tabmonde[3];
183
 
184
    $requete = "select * from gen_FRENCH_DPT where GFD_ID='$argument'";
185
    $resultat = $GLOBALS['car_db']->query($requete);
186
    if (DB::isError($resultat)) {
187
        die ($resultat->getMessage() .'<br />'.$resultat->getDebugInfo());
188
    }
189
    $ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT);
190
    $nom = $ligne->GFD_NAME;
191
 
192
    $tabonglet=explode ('*', $monde->historique);
193
    $tabnom=explode ('*', $monde->nom);
194
    $res.="<div>\n";
195
    foreach ($tabonglet as $key=>$value) {
196
        if ($key==0) {
197
            $chemin=$value;
198
            $value='monde';
199
            $res.= "<a class=\"chemin_carto\" href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key]."</a>";
200
        }
201
        else if ($key==(count($tabonglet)-1)) {
202
            $res.="<a class=\"chemin_carto\">&nbsp;&gt;&nbsp;$nom</a>";
203
        }
204
        else {
205
            $chemin.='*'.$value;
206
            $res.= "<a class=\"chemin_carto\" href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key]."</a>";
207
        }
208
    }
209
    $res .= "</div>\n";
210
 
211
    $requete_2 = " SELECT count(".CAR_CHAMPS_ID.") as nbr".
212
            " FROM ".CAR_ANNUAIRE.
213
            " WHERE ".CAR_CHAMPS_DPT." = '$argument'".
214
            " AND ".CAR_CHAMPS_CE_PAYS."='fr'";
215
 
216
    $resultat_2 = $GLOBALS['car_db']->query($requete_2);
217
    if (DB::isError($resultat_2)) {
218
    	die ($resultat_2->getMessage().'<br />'.$resultat_2->getDebugInfo()) ;
219
    }
220
 
221
    $ligne_2 = $resultat_2->fetchRow(DB_FETCHMODE_OBJECT);
222
 
223
    $res .= '<h1 class="titre1_cartographie">'.$nom.' : ' ;
224
    if ($ligne_2->nbr == 0) {
225
        $res .= 'aucun inscrit '.CAR_LABEL_PROJET."</h1>\n";
226
        if (!$GLOBALS['car_auth']->getAuth()) {
227
            $res .= AUTH_formulaire_login();
228
        } else {
229
            $res .= '<div class="message_pas_dinscrit">'.CAR_PAS_D_INSCRIT.'</div>'."\n" ;
230
        }
231
        return $res ;
232
    } else if ($ligne_2->nbr == 1) {
233
        $res .= $ligne_2->nbr." inscrit " ;
234
    } else {
235
        $res .= $ligne_2->nbr." inscrits " ;
236
    }
237
    $res .= CAR_LABEL_PROJET."</h1>\n";
238
 
239
    if (!$GLOBALS['car_auth']->getAuth()) {
240
        $res .= AUTH_formulaire_login();
241
    } else {
364 jpm 242
        $res.= "<form action=\"$url?argument=$argument&amp;fin=true&amp;mailer=1\"
87 alex 243
                method=\"post\" name=\"formmail\">
244
                    <div id=\"div_inscrit\"><table id=\"table_inscrits\">
245
                        <colgroup>
246
                            <col />
247
                            <col />
248
                            <col />
249
                            <col />
250
                            <col />
251
                            <col />
252
                        </colgroup>
463 jpm 253
                        <thead>
87 alex 254
                        <tr>
255
                            <th>&nbsp;</th>
256
                            <th>".CAR_NOM."</th>
257
                            <th>".CAR_PRENOM."</th>
258
                            <th>".CAR_DATE_INS."</th>
259
                            <th>".CAR_CP."</th>
260
                            <th>".CAR_VILLE."</th>
463 jpm 261
                        </tr></thead><tbody>\n";
87 alex 262
 
263
        $requete = "SELECT * FROM ".CAR_ANNUAIRE.
264
                " WHERE ".CAR_CHAMPS_DPT." = '$argument'".
265
                " AND ".CAR_CHAMPS_CE_PAYS."='fr'".
266
                " ORDER BY ".CAR_CHAMPS_NOM.", ".CAR_CHAMPS_PRENOM;
267
        $resultat = $GLOBALS['car_db']->query($requete);
268
        if (DB::isError($resultat)) {
269
            die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
270
        }
271
 
272
        $indic=0;
273
        $i=1;
274
        while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
275
            if ($indic==0) {
276
                $res.="<tr class=\"ligne_impaire\">\n";
277
                $indic=1;
278
            } else {
279
                $res.="<tr class=\"ligne_paire\">\n";
280
                $indic=0;
281
            }
282
            $res.="<td><input type=\"checkbox\" name=\"select[]\" value=\"".$ligne[CAR_CHAMPS_MAIL]."\" /></td>
208 jpm 283
                                    <td>".strtoupper($ligne[CAR_CHAMPS_NOM])."&nbsp;</td>
284
                                    <td>".str_replace(' - ', '-', ucwords(strtolower(str_replace('-', ' - ', $ligne[CAR_CHAMPS_PRENOM]))))."&nbsp;</td>
87 alex 285
                                    <td>".date("d m Y", strtotime($ligne[CAR_CHAMPS_DATE_INS]))."</td>
286
                                    <td>".$ligne[CAR_CHAMPS_CODE_POSTAL]."&nbsp;</td>
208 jpm 287
                                    <td>".strtoupper($ligne[CAR_CHAMPS_VILLE])."&nbsp;</td>
87 alex 288
                                    </tr>\n";
289
        }
463 jpm 290
        $res.="</tbody></table></div>\n";
87 alex 291
        if ($mailer==1) {
292
            if (!is_array($select)) {
293
                $res.= CAR_NO_DESTINATAIRE;
294
            } else {
540 jpm 295
                $res .= envoie_mail_modere($GLOBALS['car_db']) ;
87 alex 296
            }
297
        } else {
298
            $res .=carto_texte_cocher() ;
299
        }
300
        $res .= carto_formulaire($titre_mail, $corps) ;
301
    }
302
}
303
?>