Subversion Repositories Sites.obs-saisons.fr

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 aurelien 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
define("LATIN1_UC_CHARS", "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝ");
17
define("LATIN1_LC_CHARS", "àáâãäåæçèéêëìíîïðñòóôõöøùúûüý");
18
 
19
if (!function_exists("uc_latin1")) {
20
 
21
	function uc_latin1 ($str) {
22
    	$str = strtoupper(strtr($str, LATIN1_LC_CHARS, LATIN1_UC_CHARS));
23
    	return strtr($str, array("ß" => "SS"));
24
	}
25
 
26
}
27
 
28
$javascript = "<script language=\"javascript\">\n" .
29
		"function confirmer ()
30
    {
31
        if (window.confirm ('Cliquez sur OK pour confirmer.')) {
32
            window.formmail.submit();
33
        }
34
    }
35
function setCheckboxes(the_form)
36
{
37
    var do_check=document.forms[the_form].elements['selecttotal'].checked;
38
    var elts            = document.forms[the_form].elements['select[]'];
39
    var elts_cnt = (typeof(elts.length) != 'undefined')
40
                        ? elts.length
41
                        : 0;
42
    if (elts_cnt) {
43
        for (var i = 0; i < elts_cnt; i++) {
44
            elts[i].checked = do_check;
45
        } // Fin for
46
    }
47
    else {
48
        elts.checked = do_check;
49
    } // Fin if... else
50
    return true;
51
} // Fin de la fonction 'setCheckboxes()'" .
52
"</script>";
53
 
54
echo $javascript;
55
 
56
$url = $GLOBALS['car_url']->getURL() ;
57
 
58
$corps = (isset($_POST['corps'])) ? $_POST['corps'] : '' ;
59
$titre_mail = (isset($_POST['titre_mail'])) ? $_POST['titre_mail'] : '';
60
 
61
$tabmonde = explode ('*',$monde->historique);
62
 
63
// Premier cas, on vient de cliquer sur un pays qui n'est pas
64
// la France, on affiche les adhérents de ce pays
65
 
66
if (count($tabmonde) == 3) {
67
    $argument = $tabmonde[2];
68
 
69
    $requete = "select * from carto_PAYS where CP_ID_pays='$argument'";
70
    $resultat = $GLOBALS['car_db']->query($requete);
71
    if (DB::isError($resultat)) {
72
    	die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
73
    }
74
    $ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
75
 
76
    $pays = $ligne->CP_Intitule_pays;
77
    $monde->nom = $monde->nom.'*'.$pays;
78
 
79
    $tabonglet = explode ('*', $monde->historique);
80
    $tabnom = explode ('*', $monde->nom);
81
    foreach ($tabonglet as $key => $value) {
82
        $res .= '<a class="chemin_carto"' ;
83
        if ($key == 0) {
84
            $chemin = $value;
85
            $value = 'monde';
86
            $res .= " href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key] ;
87
        }
88
        else if ($key == (count($tabonglet)-1)) {
89
            $res .= ">&nbsp;&gt;&nbsp;$pays";
90
        }
91
        else {
92
            $chemin .= '*'.$value;
93
            $res .= " href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key] ;
94
        }
95
        $res .= '</a>' ;
96
    }
97
 
98
    $capitale = $ligne->CP_Intitule_capitale;
99
 
100
    $requete_2 = " SELECT count(".CAR_CHAMPS_ID.") as nbr".
101
            " from ".CAR_ANNUAIRE.
102
            " where ".CAR_CHAMPS_CE_PAYS."='$argument'";
103
    if (defined('SQL_SUPPLEMENTAIRE') && SQL_SUPPLEMENTAIRE != '') {
104
		$requete_2 .= ' AND '.SQL_SUPPLEMENTAIRE.' ';
105
	}
106
 
107
    $resultat_2 = $GLOBALS['car_db']->query($requete_2);
108
    if (DB::isError($resultat_2)) {
109
    	die ($resultat_2->getMessage().'<br />'.$resultat_2->getDebugInfo()) ;
110
    }
111
    $ligne_2 = $resultat_2->fetchRow(DB_FETCHMODE_OBJECT) ;
112
    $res .= '<h1 class="titre1_cartographie">'.$pays.' ('.$capitale.') : ' ;
113
    if ($ligne_2->nbr == 0) {
114
        $res .= 'aucun inscrit '.CAR_LABEL_PROJET."</h1>\n";
115
        if (!$GLOBALS['car_auth']->getAuth()) {
116
            //$res .= AUTH_formulaire_login();
117
        } else {
118
            $res .= '<div class="message_pas_dinscrit">'.CAR_PAS_D_INSCRIT.'</div>'."\n" ;
119
        }
120
        return $res ;
121
    } else if ($ligne_2->nbr == 1) {
122
        $res .= $ligne_2->nbr." inscrit " ;
123
    } else {
124
        $res .= $ligne_2->nbr." inscrits " ;
125
    }
126
    $res .= CAR_LABEL_PROJET."</h1>\n";
127
 
128
    if (!$GLOBALS['car_auth']->getAuth()) {
129
        //$res .= AUTH_formulaire_login();
130
    } else {
131
    $res .= '<form action="'.$url.'&amp;mailer=1&amp;fin=true" method="post" name="formmail">'.
132
            '	<div id="div_inscrit">'.
133
            '		<table id="table_inscrits">'.
134
			'			<thead>'.
135
			'				<tr>'.
136
			'					<th>&nbsp;</th>'.
137
			'					<th>'.CAR_NOM.'</th>'.
138
			'					<th>'.CAR_DATE_INS.'</th>'.
139
			'					<th>'.CAR_VILLE.'</th>'.
140
			'				</tr>'.
141
			'			</thead>'.
142
			'			<tbody>';
143
 
144
        $requete = "select * from ".CAR_ANNUAIRE.
145
                " where ".CAR_CHAMPS_CE_PAYS."='$argument'";
146
        if (defined('SQL_SUPPLEMENTAIRE') && SQL_SUPPLEMENTAIRE != '') {
147
			$requete .= ' AND '.SQL_SUPPLEMENTAIRE.' ';
148
		}
149
        $requete .= " order by ".CAR_CHAMPS_VILLE;
150
        $resultat= $GLOBALS['car_db']->query($requete);
151
        if (DB::isError($resultat)) {
152
        	die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
153
        }
154
        $indic=0;
155
        $i=1;
156
        while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
157
            if ($indic==0) {
158
                $res.="<tr class=\"ligne_impaire\">\n";
159
                $indic=1;
160
            }
161
            else {
162
                $res.="<tr class=\"ligne_paire\">\n";
163
                $indic=0;
164
            }
165
            $res .=	"<td>&nbsp;".
166
					"<input type=\"checkbox\" name=\"select[]\" value=\"".$ligne[CAR_CHAMPS_MAIL]."\" />".
167
					"</td>".
168
                            "<td>";
169
 
170
                            if ($ligne['PARTICIPANT_NOM_PRENOM_VISIBLE']) {
171
                            	$res .= strtoupper($ligne[CAR_CHAMPS_NOM])."&nbsp;".
172
                            str_replace(' - ', '-', ucwords(strtolower(str_replace('-', ' - ', $ligne[CAR_CHAMPS_PRENOM]))));
173
                            } else {
174
                            	$res .= $ligne['PARTICIPANT_PSEUDO'];
175
                            }
176
                            $res .= "&nbsp;</td>\n
177
                            <td>".date("d.m.Y", strtotime($ligne[CAR_CHAMPS_DATE_INS]))."&nbsp;</td>
178
                            <td>".uc_latin1($ligne[CAR_CHAMPS_VILLE])."&nbsp;</td>\n";
179
            $res .= "</tr>\n";
180
        }
181
        $res .= "</tbody></table></div>\n";
182
 
183
        if ($mailer == 1) {
184
            if (!is_array($select)) {
185
                $res .= "<div>".CAR_NO_DESTINATAIRE."</div>";
186
            } else {
187
                $res .= envoie_mail($GLOBALS['car_db']);
188
            }
189
        } else {
190
            $res .= carto_texte_cocher();
191
        }
192
        $res .= carto_formulaire($titre_mail, $corps) ;
193
    }
194
 
195
 
196
// 2 ème cas, on vient de cliquer sur un département français
197
 
198
} else if (count($tabmonde) == 4) {
199
    $argument = $tabmonde[3];
200
 
201
    $requete = "SELECT * FROM ".CAR_TABLE_DPT." WHERE lpad(".CAR_CHAMPS_CARTO_DEP.", 2, '0' )='$argument'";
202
    $resultat = $GLOBALS['car_db']->query($requete);
203
    if (DB::isError($resultat)) {
204
        die ($resultat->getMessage() .'<br />'.$resultat->getDebugInfo());
205
    }
206
    $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
207
    $nom = $ligne[CAR_CHAMPS_NOM_DEP];
208
 
209
    $tabonglet=explode ('*', $monde->historique);
210
    $tabnom=explode ('*', $monde->nom);
211
    $res.="<div>\n";
212
    foreach ($tabonglet as $key=>$value) {
213
        if ($key==0) {
214
            $chemin=$value;
215
            $value='monde';
216
            $res.= "<a class=\"chemin_carto\" href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key]."</a>";
217
        }
218
        else if ($key==(count($tabonglet)-1)) {
219
            $res.="<a class=\"chemin_carto\">&nbsp;&gt;&nbsp;$nom</a>";
220
        }
221
        else {
222
            $chemin.='*'.$value;
223
            $res.= "<a class=\"chemin_carto\" href=\"".$monde->url."&amp;historique_cartes=$chemin\">&nbsp;&gt;&nbsp;".$tabnom[$key]."</a>";
224
        }
225
    }
226
    $res .= "</div>\n";
227
 
228
    $requete_2 = " SELECT count(".CAR_CHAMPS_ID.") as nbr".
229
            " FROM ".CAR_ANNUAIRE.
230
            " WHERE ".CAR_CHAMPS_DPT." = '$argument'".
231
            " AND ".CAR_CHAMPS_CE_PAYS."='fr'";
232
    if (defined('SQL_SUPPLEMENTAIRE') && SQL_SUPPLEMENTAIRE != '') {
233
		$requete_2 .= ' AND '.SQL_SUPPLEMENTAIRE.' ';
234
	}
235
 
236
    $resultat_2 = $GLOBALS['car_db']->query($requete_2);
237
    if (DB::isError($resultat_2)) {
238
    	die ($resultat_2->getMessage().'<br />'.$resultat_2->getDebugInfo()) ;
239
    }
240
 
241
    $ligne_2 = $resultat_2->fetchRow(DB_FETCHMODE_OBJECT);
242
 
243
    $res .= '<h1 class="titre1_cartographie">'.$nom.' : ' ;
244
   if ($ligne_2->nbr == 0) {
245
        $res .= 'aucun inscrit '.CAR_LABEL_PROJET."</h1>\n";
246
        if (!$GLOBALS['car_auth']->getAuth()) {
247
          //  $res .= AUTH_formulaire_login();
248
        } else {
249
            $res .= '<div class="message_pas_dinscrit">'.CAR_PAS_D_INSCRIT.'</div>'."\n" ;
250
        }
251
        return $res ;
252
    } else if ($ligne_2->nbr == 1) {
253
        $res .= $ligne_2->nbr." inscrit " ;
254
    } else {
255
        $res .= $ligne_2->nbr." inscrits " ;
256
    }
257
    $res .= CAR_LABEL_PROJET."</h1>\n";
258
 
259
    if (!$GLOBALS['car_auth']->getAuth()) {
260
       // $res .= AUTH_formulaire_login();
261
    } else {
262
        $res.= "<form action=\"$url&amp;argument=$argument&amp;fin=true&amp;mailer=1\"
263
                method=\"post\" name=\"formmail\">
264
                    <div id=\"div_inscrit\"><table id=\"table_inscrits\">
265
                        <thead>
266
                        <tr>
267
                            <th>&nbsp;</th>
268
                            <th>".CAR_NOM."</th>
269
                            <th>".CAR_DATE_INS."</th>
270
                            <th>".CAR_CP."</th>
271
                            <th>".CAR_VILLE."</th>
272
                        </tr></thead><tbody>\n";
273
 
274
        $requete = "SELECT * FROM ".CAR_ANNUAIRE.
275
                " WHERE ".CAR_CHAMPS_DPT." = '$argument'".
276
                " AND ".CAR_CHAMPS_CE_PAYS."='fr'";
277
        if (defined('SQL_SUPPLEMENTAIRE') && SQL_SUPPLEMENTAIRE != '') {
278
			$requete .= ' AND '.SQL_SUPPLEMENTAIRE.' ';
279
		}
280
        $requete .= " ORDER BY ".CAR_CHAMPS_VILLE;
281
        $resultat = $GLOBALS['car_db']->query($requete);
282
        if (DB::isError($resultat)) {
283
            die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
284
        }
285
 
286
        $indic=0;
287
        $i=1;
288
        while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
289
            if ($indic==0) {
290
                $res.="<tr class=\"ligne_impaire\">\n";
291
                $indic=1;
292
            } else {
293
                $res.="<tr class=\"ligne_paire\">\n";
294
                $indic=0;
295
            }
296
            $res .=	"<td>&nbsp;".
297
					"<input type=\"checkbox\" name=\"select[]\" value=\"".$ligne[CAR_CHAMPS_MAIL]."\" />".
298
					"</td>".
299
                            "<td>";
300
                            if ($ligne['PARTICIPANT_NOM_PRENOM_VISIBLE']) {
301
                            	$res .= uc_latin1($ligne[CAR_CHAMPS_NOM])."&nbsp;".
302
                            str_replace(' - ', '-', ucwords(strtolower(str_replace('-', ' - ', $ligne[CAR_CHAMPS_PRENOM]))));
303
                            } else {
304
                            	$res .= $ligne['PARTICIPANT_PSEUDO'];
305
                            }
306
                            $res .= "&nbsp;</td>\n
307
                                    <td>".date("d m Y", strtotime($ligne[CAR_CHAMPS_DATE_INS]))."</td>
308
                                    <td>".$ligne[CAR_CHAMPS_CODE_POSTAL]."&nbsp;</td>
309
                                    <td>".uc_latin1($ligne[CAR_CHAMPS_VILLE])."&nbsp;</td>
310
                                    </tr>\n";
311
        }
312
        $res.="</tbody></table></div>\n";
313
        if ($mailer==1) {
314
            if (!is_array($select)) {
315
                $res.= CAR_NO_DESTINATAIRE;
316
            } else {
317
                $res .= envoie_mail($GLOBALS['car_db']) ;
318
            }
319
        } else {
320
			$res .=carto_texte_cocher() ;
321
        }
322
        $res .= carto_formulaire($titre_mail, $corps) ;
323
    }
324
}
325
?>