448 |
ddelon |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
//vim: set expandtab tabstop=4 shiftwidth=4:
|
|
|
4 |
// +-----------------------------------------------------------------------------------------------+
|
|
|
5 |
// | PHP version 4.0 |
|
|
|
6 |
// +-----------------------------------------------------------------------------------------------+
|
|
|
7 |
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
|
|
|
8 |
// +-----------------------------------------------------------------------------------------------+
|
|
|
9 |
// | This source file is subject to version 2.0 of the PHP license, |
|
|
|
10 |
// | that is bundled with this package in the file LICENSE, and is |
|
|
|
11 |
// | available at through the world-wide-web at |
|
|
|
12 |
// | http://www.php.net/license/2_02.txt. |
|
|
|
13 |
// | If you did not receive a copy of the PHP license and are unable to |
|
|
|
14 |
// | obtain it through the world-wide-web, please send a note to |
|
|
|
15 |
// | license@php.net so we can mail you a copy immediately. |
|
|
|
16 |
// +-----------------------------------------------------------------------------------------------+
|
|
|
17 |
/**
|
|
|
18 |
*
|
|
|
19 |
*Page permettant l'affichage des informations de cartographie des inscrits
|
|
|
20 |
*
|
|
|
21 |
*@package cartographie
|
|
|
22 |
//Auteur original :
|
|
|
23 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
|
|
|
24 |
//Autres auteurs :
|
|
|
25 |
*@copyright Tela-Botanica 2000-2004
|
|
|
26 |
*@version 03 mai 2004
|
|
|
27 |
// +-----------------------------------------------------------------------------------------------+
|
|
|
28 |
//
|
1298 |
neiluj |
29 |
// $Id: cartographie.fonct.php,v 1.4 2007-04-11 08:30:12 neiluj Exp $
|
448 |
ddelon |
30 |
// FICHIER : $RCSfile: cartographie.fonct.php,v $
|
1292 |
neiluj |
31 |
// AUTEUR : $Author: neiluj $
|
1298 |
neiluj |
32 |
// VERSION : $Revision: 1.4 $
|
|
|
33 |
// DATE : $Date: 2007-04-11 08:30:12 $
|
448 |
ddelon |
34 |
*/
|
|
|
35 |
|
805 |
florian |
36 |
/** function carto_liste_fiches()
|
|
|
37 |
*
|
|
|
38 |
*
|
|
|
39 |
* @return string HTML
|
|
|
40 |
*/
|
|
|
41 |
function carto_liste_fiches(&$monde, $nom_table1, $nom_table2, $nom_champs_pays, $nom_champs_cp, $requete_sql) {
|
|
|
42 |
|
|
|
43 |
global $mailer;
|
|
|
44 |
global $select;//utilisé dans liste_inscrit.php
|
|
|
45 |
|
|
|
46 |
$javascript = "
|
|
|
47 |
function confirmer () {
|
|
|
48 |
if (window.confirm ('Cliquez sur OK pour confirmer.')) {
|
|
|
49 |
window.formmail.submit();
|
|
|
50 |
}
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
function setCheckboxes(the_form)
|
|
|
54 |
{
|
|
|
55 |
var do_check=document.forms[the_form].elements['selecttotal'].checked;
|
|
|
56 |
var elts = document.forms[the_form].elements['select[]'];
|
|
|
57 |
var elts_cnt = (typeof(elts.length) != 'undefined')
|
|
|
58 |
? elts.length
|
|
|
59 |
: 0;
|
|
|
60 |
if (elts_cnt) {
|
|
|
61 |
for (var i = 0; i < elts_cnt; i++) {
|
|
|
62 |
elts[i].checked = do_check;
|
|
|
63 |
} // Fin for
|
|
|
64 |
}
|
|
|
65 |
else {
|
|
|
66 |
elts.checked = do_check;
|
|
|
67 |
} // Fin if... else
|
|
|
68 |
return true;
|
|
|
69 |
} // Fin de la fonction 'setCheckboxes()'
|
|
|
70 |
|
|
|
71 |
";
|
|
|
72 |
GEN_stockerCodeScript($javascript);
|
|
|
73 |
|
|
|
74 |
$res = '';
|
|
|
75 |
$tabmonde = explode ('*',$monde->historique);
|
|
|
76 |
|
|
|
77 |
// Premier cas, on vient de cliquer sur un pays qui n'est pas
|
|
|
78 |
// la France, on affiche les adhérents de ce pays
|
|
|
79 |
if (count($tabmonde) == 3) {
|
|
|
80 |
$argument = $tabmonde[2];
|
|
|
81 |
$query = 'SELECT * FROM carto_PAYS WHERE CP_ID_pays="'.$argument.'"';
|
|
|
82 |
$result = $GLOBALS['ins_db']->query($query);
|
|
|
83 |
if (DB::isError($result)) {
|
|
|
84 |
die ($result->getMessage().'<br />'.$result->getDebugInfo()) ;
|
|
|
85 |
}
|
|
|
86 |
$row = $result->fetchRow(DB_FETCHMODE_OBJECT) ;
|
|
|
87 |
$pays = $row->CP_Intitule_pays;
|
|
|
88 |
$monde->nom = $monde->nom.'*'.$pays;
|
|
|
89 |
$tabonglet = explode ('*', $monde->historique);
|
|
|
90 |
$tabnom = explode ('*', $monde->nom);
|
|
|
91 |
$res .= "<b>\n";
|
|
|
92 |
foreach ($tabonglet as $key => $value) {
|
|
|
93 |
if ($key == 0) {
|
|
|
94 |
$chemin = $value;
|
|
|
95 |
$value = 'monde';
|
|
|
96 |
$res .= "<a class=\"chemin_carto\" href=\"".$monde->url."&historique_cartes=$chemin\"> > ".$tabnom[$key]."</a>";
|
|
|
97 |
} else if ($key == (count($tabonglet)-1)) {
|
|
|
98 |
$res .= "<a class=\"chemin_carto\"> > $pays</a>";
|
|
|
99 |
} else {
|
|
|
100 |
$chemin .= '*'.$value;
|
|
|
101 |
$res .= "<a class=\"chemin_carto\" href=\"".$monde->url."&historique_cartes=$chemin\"> > ".$tabnom[$key]."</a>";
|
|
|
102 |
}
|
|
|
103 |
}
|
|
|
104 |
$res .= "</b>\n";
|
|
|
105 |
$capitale = $row->CP_Intitule_capitale;
|
|
|
106 |
$query2 = ' SELECT count('.$nom_champs_cp.') as nbr'.
|
|
|
107 |
' FROM '.$nom_table1;
|
|
|
108 |
if ($nom_table2!=0) $query2 .= ', '.$nom_table2;
|
|
|
109 |
$query2 .= ' WHERE '.$nom_champs_pays.'="'.$argument.'"';
|
|
|
110 |
if ($requete_sql!='') $query2 .= ' AND ('.$requete_sql.')';
|
|
|
111 |
|
|
|
112 |
$result2 = $GLOBALS['ins_db']->query($query2);
|
|
|
113 |
if (DB::isError($result2)) {
|
|
|
114 |
die ($result2->getMessage().'<br />'.$result2->getDebugInfo()) ;
|
|
|
115 |
}
|
|
|
116 |
$row2 = $result2->fetchRow(DB_FETCHMODE_OBJECT) ;
|
|
|
117 |
$res .= '<br /><br /><div class="info_pays">'.$pays.' (capitale: '.$capitale.') : ' ;
|
|
|
118 |
if ($row2->nbr == 0) {
|
|
|
119 |
$res .= INS_AUCUN_INSCRIT.' '.INS_LABEL_PROJET ;
|
|
|
120 |
|
|
|
121 |
}
|
|
|
122 |
else if ($row2->nbr == 1) {
|
|
|
123 |
$res .= $row2->nbr.' '.INS_INSCRIT.' '.INS_LABEL_PROJET ;
|
|
|
124 |
}
|
|
|
125 |
else {
|
|
|
126 |
$res .= $row2->nbr.' '.INS_INSCRIT.'s '.INS_LABEL_PROJET ;
|
|
|
127 |
}
|
|
|
128 |
$res .= "</div>\n";
|
|
|
129 |
if ($row2->nbr>0) {
|
|
|
130 |
if ((INS_NECESSITE_LOGIN)and(!$GLOBALS['AUTH']->getAuth())) {
|
|
|
131 |
$res .= '<br /><p class="zone_alert">'.INS_VOUS_DEVEZ_ETRE_INSCRIT.'</p>'."\n" ;
|
|
|
132 |
}
|
|
|
133 |
else {
|
|
|
134 |
$requete = 'SELECT * FROM '.$nom_table1;
|
|
|
135 |
if ($nom_table2!=0) $requete .= ', '.$nom_table2;
|
|
|
136 |
$requete .= ' WHERE '.$nom_champs_pays.'="'.$argument.'"';
|
|
|
137 |
if ($requete_sql!='') $requete .= ' AND ('.$requete_sql.')';
|
|
|
138 |
//todo: gerer l'ordre ' ORDER BY '.INS_CHAMPS_NOM.', '.INS_CHAMPS_PRENOM;
|
|
|
139 |
|
|
|
140 |
if ($row2->nbr >= 1) {
|
|
|
141 |
$res .= listes_inscrit($requete, $select, $_SERVER['REQUEST_URI']) ;
|
|
|
142 |
if ($mailer==1) {
|
|
|
143 |
if (!is_array($select)) {
|
|
|
144 |
$res .= "<div>".INS_NO_DESTINATAIRE."</div>";
|
|
|
145 |
}
|
|
|
146 |
else {
|
|
|
147 |
$res .= '<div class="zone_info">'.INS_MESSAGE_ENVOYE.'</div>'."\n" ;
|
|
|
148 |
carto_envoie_mail() ;
|
|
|
149 |
}
|
|
|
150 |
}
|
|
|
151 |
else {
|
|
|
152 |
$res .= carto_texte_cocher() ;
|
|
|
153 |
}
|
|
|
154 |
$res .= carto_formulaire() ;
|
|
|
155 |
}
|
|
|
156 |
}
|
|
|
157 |
}
|
|
|
158 |
|
|
|
159 |
// 2 ème cas, on vient de cliquer sur un département français
|
|
|
160 |
} else if (count($tabmonde) == 4) {
|
|
|
161 |
$argument = $tabmonde[3];
|
|
|
162 |
$query = 'SELECT * FROM '.INS_TABLE_DPT.' WHERE '.INS_CHAMPS_ID_DEPARTEMENT.'='.$argument;
|
|
|
163 |
$result = $GLOBALS['ins_db']->query($query);
|
|
|
164 |
if (DB::isError($result)) {
|
|
|
165 |
die ($result->getMessage() .'<br />'.$result->getDebugInfo());
|
|
|
166 |
}
|
|
|
167 |
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
|
|
|
168 |
$nom = $row[INS_CHAMPS_NOM_DEPARTEMENT];
|
|
|
169 |
|
|
|
170 |
$tabonglet=explode ('*', $monde->historique);
|
|
|
171 |
$tabnom=explode ('*', $monde->nom);
|
|
|
172 |
$res.="<div><b>\n";
|
|
|
173 |
foreach ($tabonglet as $key=>$value) {
|
|
|
174 |
if ($key==0) {
|
|
|
175 |
$chemin=$value;
|
|
|
176 |
$value='monde';
|
|
|
177 |
$res.= "<a class=\"chemin_carto\" href=\"".$monde->url."&historique_cartes=$chemin\"> > ".$tabnom[$key]."</a>";
|
|
|
178 |
}
|
|
|
179 |
else if ($key==(count($tabonglet)-1)) {
|
|
|
180 |
$res.="<a class=\"chemin_carto\"> > $nom</a>";
|
|
|
181 |
}
|
|
|
182 |
else {
|
|
|
183 |
$chemin.='*'.$value;
|
|
|
184 |
$res.= "<a class=\"chemin_carto\" href=\"".$monde->url."&historique_cartes=$chemin\"> > ".$tabnom[$key]."</a>";
|
|
|
185 |
}
|
|
|
186 |
}
|
|
|
187 |
$res .= "</b></div>\n";
|
|
|
188 |
|
|
|
189 |
$query2 = ' SELECT count('.$nom_champs_cp.') as nbr'.
|
|
|
190 |
' FROM '.$nom_table1;
|
|
|
191 |
if ($nom_table2!=0) $query2 .= ', '.$nom_table2;
|
|
|
192 |
$query2 .= ' WHERE '.$nom_champs_cp.' LIKE "'.$argument.'%"'.
|
|
|
193 |
' AND '.$nom_champs_pays.'="FR"';
|
|
|
194 |
if ($requete_sql!='') $query2 .= ' AND ('.$requete_sql.')';
|
|
|
195 |
$result2 = $GLOBALS['ins_db']->query($query2);
|
|
|
196 |
if (DB::isError($result2)) {
|
|
|
197 |
die ($result2->getMessage().'<br />'.$result2->getDebugInfo()) ;
|
|
|
198 |
}
|
|
|
199 |
|
|
|
200 |
$row2 = $result2->fetchRow(DB_FETCHMODE_OBJECT);
|
|
|
201 |
$res .= '<br /><br /><div class="nb_inscrits">' ;
|
|
|
202 |
if ($row2->nbr == 0) {
|
|
|
203 |
$res .= INS_AUCUN_INSCRIT." ".INS_LABEL_PROJET ;
|
|
|
204 |
}
|
|
|
205 |
else if ($row2->nbr == 1) {
|
|
|
206 |
$res .= $row2->nbr." ".INS_INSCRIT." ".INS_LABEL_PROJET ;
|
|
|
207 |
}
|
|
|
208 |
else {
|
|
|
209 |
$res .= $row2->nbr." ".INS_INSCRIT."s ".INS_LABEL_PROJET ;
|
|
|
210 |
}
|
|
|
211 |
$res .= "</div><br />\n";
|
|
|
212 |
if ($row2->nbr>0) {
|
|
|
213 |
if ((INS_NECESSITE_LOGIN)and(!$GLOBALS['AUTH']->getAuth())) {
|
|
|
214 |
$res .= '<br /><p class="zone_alert">'.INS_VOUS_DEVEZ_ETRE_INSCRIT.'</p>'."\n" ;
|
|
|
215 |
} else {
|
|
|
216 |
$requete = 'SELECT * FROM '.$nom_table1;
|
|
|
217 |
if ($nom_table2!=0) $requete .= ', '.$nom_table2;
|
|
|
218 |
|
|
|
219 |
if (strlen($argument)==1) {
|
|
|
220 |
$argument='0'.$argument;
|
|
|
221 |
}
|
|
|
222 |
|
|
|
223 |
$requete .= ' WHERE '.$nom_champs_cp.' LIKE "'.$argument.'%"'.
|
|
|
224 |
' AND '.$nom_champs_pays.'="FR"';
|
|
|
225 |
|
|
|
226 |
if ($requete_sql!='') $requete .= ' AND ('.$requete_sql.')';
|
|
|
227 |
//todo: ' ORDER BY '.INS_CHAMPS_NOM.', '.INS_CHAMPS_PRENOM;
|
|
|
228 |
$res .= listes_inscrit($requete, $select, $_SERVER['REQUEST_URI']) ;
|
|
|
229 |
if ($mailer==1) {
|
|
|
230 |
if (!is_array($select)) {
|
|
|
231 |
$res.= INS_NO_DESTINATAIRE;
|
|
|
232 |
} else {
|
|
|
233 |
$res .= '<p class="zone_info">'.INS_MESSAGE_ENVOYE."</p>\n" ;
|
|
|
234 |
carto_envoie_mail() ;
|
|
|
235 |
}
|
|
|
236 |
} else {
|
|
|
237 |
$res .=carto_texte_cocher() ;
|
|
|
238 |
}
|
|
|
239 |
$res .= carto_formulaire() ;
|
|
|
240 |
}
|
|
|
241 |
}
|
|
|
242 |
}
|
|
|
243 |
return $res;
|
|
|
244 |
}
|
|
|
245 |
|
|
|
246 |
|
448 |
ddelon |
247 |
/** function carto_texte_cocher ()
|
|
|
248 |
*
|
|
|
249 |
*
|
|
|
250 |
* @return string HTML
|
|
|
251 |
*/
|
|
|
252 |
function carto_texte_cocher() {
|
|
|
253 |
$res = "<div class=\"texte\">".INS_CHECK_UNCHECK ;
|
|
|
254 |
$res .= " <input type=\"checkbox\" name=\"selecttotal\" onclick=\"javascript:setCheckboxes('formmail');\" /></div>";
|
|
|
255 |
return $res ;
|
|
|
256 |
}
|
|
|
257 |
|
|
|
258 |
|
|
|
259 |
/** function carto_formulaire ()
|
|
|
260 |
*
|
|
|
261 |
*
|
|
|
262 |
*
|
|
|
263 |
* @return string HTML
|
|
|
264 |
*/
|
|
|
265 |
function carto_formulaire($titre_mail="", $corps="") {
|
|
|
266 |
$res = "<br /><h2>".INS_ENVOYER_MAIL."</h2><br />\n";
|
|
|
267 |
$res .= INS_SUJET.' :<br /><input class="forml" type="text" name="titre_mail" size="60" value="'.$titre_mail.'" /><br /><br />'."\n"
|
|
|
268 |
.INS_MESSAGE.' :<br /><textarea class="forml" name="corps" rows="5" cols="60">'.$corps.'</textarea><br />'."\n";
|
|
|
269 |
$res.='<br /><input class="bouton" type="submit" onclick="javascript:confirmer();" value="'.INS_ENVOYER.'" /></form>'."\n";
|
|
|
270 |
return $res ;
|
|
|
271 |
}
|
|
|
272 |
|
|
|
273 |
/**
|
|
|
274 |
* Renvoie le code HTML de la liste des inscrits
|
|
|
275 |
* en fonction de la requete passé en parametre
|
|
|
276 |
*
|
|
|
277 |
* @return Renvoie le code HTML de la liste des inscrits
|
|
|
278 |
*/
|
|
|
279 |
|
|
|
280 |
function listes_inscrit($requete, $select, $url) {
|
805 |
florian |
281 |
$res='';
|
448 |
ddelon |
282 |
$resultat= $GLOBALS['ins_db']->query($requete);
|
|
|
283 |
if (DB::isError($resultat)) {
|
|
|
284 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
|
|
|
285 |
}
|
|
|
286 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
805 |
florian |
287 |
$res.='<input type="checkbox" name="select[]" value="'.$ligne[INS_CHAMPS_MAIL].'" />'."\n".
|
|
|
288 |
$ligne[INS_CHAMPS_NOM].' '.$ligne[INS_CHAMPS_PRENOM].' '.
|
|
|
289 |
$ligne[INS_CHAMPS_CODE_POSTAL].' '.$ligne[INS_CHAMPS_VILLE].' '.
|
|
|
290 |
date("d.m.Y", strtotime($ligne[INS_CHAMPS_DATE_INSCRIPTION])).'<br /><br />'."\n";
|
|
|
291 |
}
|
|
|
292 |
$res .= '<input type="hidden" name="mailer" value="1" />'."\n";
|
|
|
293 |
$res .= '<input type="hidden" name="select" value="'.$select.'" /><br />'."\n";
|
448 |
ddelon |
294 |
return $res ;
|
|
|
295 |
}
|
|
|
296 |
|
|
|
297 |
/** envoie_mail()
|
|
|
298 |
*
|
|
|
299 |
*
|
|
|
300 |
* @return envoie l'email
|
|
|
301 |
*/
|
|
|
302 |
function carto_envoie_mail() {
|
|
|
303 |
$requete = 'SELECT '.INS_CHAMPS_MAIL.' FROM '.INS_ANNUAIRE.' WHERE '.INS_CHAMPS_ID.'='.$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID);
|
|
|
304 |
$resultat = $GLOBALS['ins_db']->query($requete);
|
|
|
305 |
if (DB::isError($resultat)) {
|
|
|
306 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo());
|
|
|
307 |
}
|
|
|
308 |
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
|
|
|
309 |
$entete = "From: <".$ligne[INS_CHAMPS_MAIL].">\n";
|
|
|
310 |
|
|
|
311 |
$GLOBALS['corps'] .= INS_TEXTE_FIN_MAIL;
|
|
|
312 |
$GLOBALS['corps'] = stripslashes($GLOBALS['corps']) ;
|
|
|
313 |
$liste = "" ;
|
|
|
314 |
foreach ($GLOBALS['select'] as $key => $value) {
|
|
|
315 |
mail ($value, stripslashes($GLOBALS['titre_mail']), $GLOBALS['corps'] , $entete) ;
|
|
|
316 |
$liste .= $value."\n" ;
|
|
|
317 |
}
|
|
|
318 |
|
|
|
319 |
$GLOBALS['corps'] .= "\n----------------------------------------------------------------------------";
|
|
|
320 |
$GLOBALS['corps'] .= "\n".INS_MESSAGE_ENVOYE_A." :\n $liste" ;
|
|
|
321 |
|
|
|
322 |
mail(INS_MAIL_ADMIN, stripslashes(INS_SURVEILLANCE_ENVOI_MAIL.$GLOBALS['titre_mail']), $GLOBALS['corps'], $entete);
|
|
|
323 |
$GLOBALS['corps'] = '';
|
|
|
324 |
$GLOBALS['titre_mail'] = '';
|
|
|
325 |
}
|
|
|
326 |
//-- Fin du code source ------------------------------------------------------------
|
|
|
327 |
/*
|
|
|
328 |
* $Log: not supported by cvs2svn $
|
1298 |
neiluj |
329 |
* Revision 1.2 2006/04/04 12:23:05 florian
|
|
|
330 |
* modifs affichage fiches, généricité de la carto, modification totale de l'appli annuaire
|
|
|
331 |
*
|
805 |
florian |
332 |
* Revision 1.1 2005/09/22 14:02:49 ddelon
|
|
|
333 |
* nettoyage annuaire et php5
|
|
|
334 |
*
|
448 |
ddelon |
335 |
* Revision 1.2 2005/09/22 13:30:49 florian
|
|
|
336 |
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
|
|
|
337 |
*
|
|
|
338 |
* Revision 1.1 2004/12/15 13:30:20 alex
|
|
|
339 |
* version initiale
|
|
|
340 |
*
|
|
|
341 |
*
|
|
|
342 |
*/
|
|
|
343 |
?>
|