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
<?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
//
29
// $Id: cartographie.php,v 1.6 2005/03/14 09:43:13 alex Exp $
30
// FICHIER : $RCSfile: cartographie.php,v $
31
// AUTEUR    : $Author: alex $
32
// VERSION : $Revision: 1.6 $
33
// DATE        : $Date: 2005/03/14 09:43:13 $
34
*/
35
include_once 'connect.php';
36
include_once 'configuration/car_config.inc.php' ;
37
include_once CAR_CHEMIN_APPLI.'bibliotheque/lib.carto.php' ;
38
include_once CAR_CHEMIN_APPLI.'bibliotheque/car_cartographie.fonct.php' ;
39
 
40
 
41
//================================================================================================
42
 
43
$GLOBALS['car_auth']->start();
44
 
45
function afficherContenuCorps () {
46
 
47
    $image_x = null;
48
    if (isset($_POST['image_x'])) $image_x = $_POST['image_x'];
49
    $image_y = null;
50
    if (isset($_POST['image_y'])) $image_y = $_POST['image_y'];
51
    $historique_cartes = null;
52
    if (isset($_POST['historique_cartes'])) $historique_cartes = $_POST['historique_cartes'];
53
    if (isset($_GET['historique_cartes'])) $historique_cartes = $_GET['historique_cartes'];
54
    $mailer = null;
55
    if (isset($_GET['mailer'])) $mailer = $_GET['mailer'];
56
    $fin = null;
57
    if (isset($_GET['fin'])) $fin = $_GET['fin'];
58
    $sendpwd = null;//utilisé dans liste_inscrit.php
59
    if (isset($_GET['sendpwd'])) $sendpwd = $_GET['sendpwd'];
60
    $select = null;//utilisé dans liste_inscrit.php
61
    if (isset($_POST['select'])) $select = $_POST['select'];
62
    $liste_zone_carte = null;
63
    if (isset($_POST['liste_zone_carte'])) $liste_zone_carte = $_POST['liste_zone_carte'];
64
 
65
    //===========================================================================================================
66
    $requete_01 =
67
        "SELECT *,count(cp_id_continent) as nbr".
68
        " FROM ".CAR_ANNUAIRE.", carto_PAYS".
69
        " WHERE ".CAR_CHAMPS_CE_PAYS." = cp_id_pays";
70
    if (defined('SQL_SUPPLEMENTAIRE') && SQL_SUPPLEMENTAIRE != '') {
71
		$requete_01 .= ' AND '.SQL_SUPPLEMENTAIRE.' ';
72
    }
73
    $requete_01 .= " GROUP BY cp_id_continent";
74
 
75
    $resultat_01 = $GLOBALS['car_db']->query ($requete_01) ;
76
    if (DB::isError($resultat_01)) {
77
    	die ($resultat_01->getMessage().'<br />'.$resultat_01->getDebugInfo()) ;
78
    }
79
 
80
    $tableau_ad_continent=array();
81
 
82
    while ($ligne_01 = $resultat_01->fetchRow(DB_FETCHMODE_OBJECT)) {
83
        $tableau_ad_continent[$ligne_01->CP_ID_Continent] = $ligne_01->nbr;
84
 
85
    }
86
    $info_continent['nom_table_zone'] = 'carto_CONTINENT';
87
    $info_continent['nom_chp_id_zone'] = 'CC_ID_Continent';
88
    $info_continent['nom_chp_nom_zone'] = 'CC_Intitule_continent';
89
    $info_continent['nom_chp_rouge'] = 'CC_Couleur_R';
90
    $info_continent['nom_chp_vert'] = 'CC_Couleur_V';
91
    $info_continent['nom_chp_bleu'] = 'CC_Couleur_B';
92
    $info_continent['nom_chp_zone_sup'] = '';
93
    $info_continent['tableau_valeurs_zone'] = $tableau_ad_continent;
94
 
95
    //============================================================================================================
96
 
97
    $requete_02 = 'SELECT CC_ID_Continent FROM carto_CONTINENT';
98
 
99
    $resultat_02 = $GLOBALS['car_db']->query ($requete_02) ;
100
    if (DB::isError($resultat_02)) {
101
    	die ($resultat_02->getMessage().'<br />'.$resultat_02->getDebugInfo()) ;
102
    }
103
 
104
    while ($ligne_02 = $resultat_02->fetchRow(DB_FETCHMODE_OBJECT)) {
105
        $requete_03 =
106
             'SELECT *, count(cp_id_pays) as nbr '.
107
            ' FROM '.CAR_ANNUAIRE.', carto_PAYS'.
108
            ' WHERE '.CAR_CHAMPS_CE_PAYS.'= cp_id_pays';
109
        if (defined('SQL_SUPPLEMENTAIRE') && SQL_SUPPLEMENTAIRE != '') {
110
			$requete_03 .= ' AND '.SQL_SUPPLEMENTAIRE.' ';
111
		}
112
        $requete_03 .= ' AND cp_id_continent = "'.$ligne_02->CC_ID_Continent.'"'.
113
            ' GROUP BY cp_id_pays';
114
 
115
        $resultat_03 = $GLOBALS['car_db']->query ($requete_03) ;
116
        if (DB::isError($resultat_03)) {
117
        	die ($resultat_03->getMessage().'<br />'.$resultat_03->getDebugInfo()) ;
118
        }
119
 
120
        $tableau_ad_pays = array();
121
 
122
        while ($ligne_03 = $resultat_03->fetchRow(DB_FETCHMODE_OBJECT)) {
123
            $tableau_ad_pays[$ligne_03->CP_ID_Pays] = $ligne_03->nbr;
124
        }
125
 
126
        $info_pays[$ligne_02->CC_ID_Continent]['nom_table_zone'] = 'carto_PAYS';
127
        $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_id_zone'] = 'CP_ID_Pays';
128
        $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_nom_zone'] = 'CP_Intitule_pays';
129
        $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_rouge'] = 'CP_Couleur_R';
130
        $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_vert'] = 'CP_Couleur_V';
131
        $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_bleu'] = 'CP_Couleur_B';
132
        $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_zone_sup'] = 'CP_ID_Continent';
133
        $info_pays[$ligne_02->CC_ID_Continent]['tableau_valeurs_zone'] = $tableau_ad_pays;
134
    }
135
    //============================================================================================================
136
 
137
    $requete_04 = "SELECT * ,count(cd_id_departement) as nbr".
138
        " FROM ".CAR_ANNUAIRE.", carto_DEPARTEMENT".
139
        " WHERE ".CAR_CHAMPS_CE_PAYS." = 'fr'".
140
        " AND ".CAR_CHAMPS_DPT." = cd_id_departement";
141
    if (defined('SQL_SUPPLEMENTAIRE') && SQL_SUPPLEMENTAIRE != '') {
142
		$requete_04 .= ' AND '.SQL_SUPPLEMENTAIRE.' ';
143
	}
144
    $requete_04 .= " GROUP BY cd_id_Departement";
145
 
146
    $resultat_04 = $GLOBALS['car_db']->query ($requete_04) ;
147
    if (DB::isError($resultat_04)) {
148
        die('
149
            <H2 style="text-align: center; font-weight: bold; font-size: 26px;">Erreur de requête</H2>'.
150
            '<b>Requete : </b>'.$requete_04.
151
            '<br/><br/><b>Erreur : </b>'.$resultat_04->getMessage());
152
    }
153
 
154
    $tableau_ad_dpt_france = array();
155
 
156
    while ($ligne_04 = $resultat_04->fetchRow(DB_FETCHMODE_OBJECT)) {
157
        $tableau_ad_dpt_france[$ligne_04->CD_ID_Departement] = $ligne_04->nbr;
158
    }
159
 
160
    $info_dpt_france['nom_table_zone'] = 'carto_DEPARTEMENT';
161
    $info_dpt_france['nom_chp_id_zone'] = 'CD_ID_Departement';
162
    $info_dpt_france['nom_chp_nom_zone'] = 'CD_Intitule_departement';
163
    $info_dpt_france['nom_chp_rouge'] = 'CD_Couleur_R';
164
    $info_dpt_france['nom_chp_vert'] = 'CD_Couleur_V';
165
    $info_dpt_france['nom_chp_bleu'] = 'CD_Couleur_B';
166
    $info_dpt_france['nom_chp_zone_sup'] = 'CD_ID_Pays';
167
    $info_dpt_france['tableau_valeurs_zone'] = $tableau_ad_dpt_france;
168
 
169
    //============================================================================================================
170
 
171
 
172
    //============================================================================================================
173
    // On cree tout d'abord l'arborescence
174
 
175
    $monde = new Carto_Carte ('continent', '', 'Monde', 'monde_masque5c.png', 'monde5c.png', CAR_CHEMIN_APPLI.'fonds/', $info_continent);
176
 
177
    $monde->definirCouleurs ('255', '255', '255','255', '250', '130','255', '165', '0','255', '50', '0') ;
178
 
179
 
180
    // Affichage par defaut
181
 
182
    if (CAR_ECHELLE_DEPART) {
183
		if (isset($_REQUEST['historique_cartes'])) {
184
          	$monde->historique_cartes = $_REQUEST['historique_cartes'];
185
    	} else {
186
        	  $monde->historique_cartes = CAR_ECHELLE_DEPART;
187
    	}
188
    }
189
    else {
190
       $monde->historique_cartes = $historique_cartes;
191
    }
192
 
193
    $monde->image_x = $image_x;
194
    $monde->image_y = $image_y;
195
    $monde->liste_zone_carte = $liste_zone_carte;
196
    $monde->url = $GLOBALS['car_url']->getURL();
197
 
198
    foreach ($info_pays as $cle => $valeur) {
199
        $requete_05 =
200
            "SELECT CDC_Titre_carte, CDC_ID_Carte, CDC_Carte_fond, CDC_Carte_masque, CDC_ID_Zone_geo_carte".
201
            " FROM carto_DESCRIPTION_CARTE, carto_ACTION ".
202
            " WHERE CA_ID_Zone_geo = '$cle'".
203
            " AND CA_Type_zone = 1".
204
            " AND CA_ID_Carte_destination = CDC_ID_Carte";
205
 
206
        $resultat_05 = $GLOBALS['car_db']->query ($requete_05) ;
207
        if (DB::isError($resultat_05)) {
208
        	die ($resultat_05->getMessage().'<br />'.$resultat_05->getDebugInfo()) ;
209
        }
210
 
211
        $ligne_05 = $resultat_05->fetchRow(DB_FETCHMODE_OBJECT);
212
        if (is_object($ligne_05)) {
213
        	$monde->ajouterFils($ligne_05->CDC_ID_Carte, $ligne_05->CDC_ID_Zone_geo_carte, $ligne_05->CDC_Titre_carte,
214
                                        $ligne_05->CDC_Carte_masque, $ligne_05->CDC_Carte_fond, $valeur);
215
        	$monde->fils[$ligne_05->CDC_ID_Carte]->definirCouleurs ('255', '255', '255','255', '250', '130','255', '165', '0','255', '50', '0') ;
216
        }
217
    }
218
 
219
    $monde->fils['europe']->ajouterFils('france', 'fr', 'France' ,'france_masque.png', 'france_region.png', $info_dpt_france);
220
    $monde->fils['europe']->fils['france']->definirCouleurs ('255', '255', '255','255', '250', '130','255', '165', '0','255', '50', '0') ;
221
 
222
    // Une fois l'arborescence créée on lance la methode donnerFormulaireImage() pour recuperer la carte
223
    // (dans $img). S'il n'y a pas de carte a afficher donnerFormulaireImage() renvoi false. On peut alors recuperer
224
    // le niveau ou on en est grace a $monde->historique (du type continent*namerique*ca).
225
    $res = '';
226
 
227
 
228
    $img = false;
229
    if ($mailer == 1 || $fin == true) {
230
        $objet_carte = $_SESSION['carte'] ;
231
        $monde = unserialize($objet_carte);}
232
    else {
233
        $img = $monde->donnerFormulaireImage();
234
    }
235
 
236
    // On teste donc img
237
 
238
    if (!$img ) {
239
        include 'liste_inscrit.php';
240
        return $res;
241
    }
242
    else {
243
        $historique_carte = new Carto_HistoriqueCarte ($monde, '&gt;', 'chemin_carto');
244
        $res .= $historique_carte->afficherHistoriqueCarte();
245
        $res .= "<br />\n" ;
246
        $tab = explode('*',$monde->historique);
247
        $res .= carto_ad_consulterNbreInscrits($tab[(count($tab)-1)]);
248
        $res .= $img;
249
        $res .= '<div class="cliquer2">'.CAR_CLIQUER.'</div>';
250
        $res .= '<div class="couleur">'.CAR_COULEUR.'</div>'."\n";
251
        $res .= '<div class="avertissement_carto" id="d"><h2 class="titre2_cartographie">'.CAR_AVERTISSEMENT_TITRE.' : </h2>';
252
        $res .= '<span class="texte_avertissement">'.CAR_AVERTISSEMENT."</span></div>\n";
253
 
254
        return $res;
255
    }
256
}
257
 
258
echo afficherContenuCorps ().'<br /><br />'."\n";
259
 
260
if ($GLOBALS['car_auth']->getAuth()) {
261
 
262
 
263
	// Synchronisation avec l'identification d'origine
264
	if (!PARTICIPANT_EST_ADULTE) {
265
	 $requete_participant = mysql_query("select PARTICIPANT_ID from PARTICIPANT where PARTICIPANT_PSEUDO LIKE '".addSlashes($_POST['username'])."' and PARTICIPANT_MOTDEPASSE LIKE '".$_POST['password']."' and PARTICIPANT_EN_ATTENTE=0 and PARTICIPANT_ADULTE=0");
266
	}
267
	else {
268
	 $requete_participant = mysql_query("select PARTICIPANT_ID from PARTICIPANT where PARTICIPANT_PSEUDO LIKE '".addSlashes($_POST['username'])."' and PARTICIPANT_MOTDEPASSE LIKE '".$_POST['password']."' and PARTICIPANT_EN_ATTENTE=0 and PARTICIPANT_ADULTE=1");
269
	}
270
  	 $participant_ligne = mysql_fetch_row($requete_participant);
271
	 if ($participant_ligne) {
272
        	$_SESSION['participant'] = $participant_ligne[0];
273
	 }
274
 
275
 
276
	if($_GET[act] == 'logout') {
277
		// Synchronisation avec l'identification d'origine
278
		unset($_SESSION['participant']);
279
		// on déconnecte l'utilisateur
280
		$GLOBALS['car_auth']->logout();
281
		echo 'Vous êtes présentement déconnecté. '."\n";
282
		echo loginFunction();
283
	} else {
284
		// on affiche la possibilité de se déconnecter
285
		//echo 'Connecté en tant que '.$GLOBALS['car_auth']->getUsername().'. '."\n";
286
		//echo '<br><a href= "'.$GLOBALS['car_url']->getURL().'&act=logout">Se déconnecter</a><br />'."\n";
287
	}
288
} else  {
289
	// pas identifié, on propose le formulaire d'identification
290
	echo loginFunction();
291
}
292
 
293
?>