Subversion Repositories Applications.papyrus

Rev

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

Rev Author Line No. Line
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
//
820 alexandre_ 29
// $Id: cartographie.php,v 1.5 2006-04-19 13:49:04 alexandre_tb Exp $
448 ddelon 30
// FICHIER : $RCSfile: cartographie.php,v $
820 alexandre_ 31
// AUTEUR    : $Author: alexandre_tb $
32
// VERSION : $Revision: 1.5 $
33
// DATE        : $Date: 2006-04-19 13:49:04 $
448 ddelon 34
*/
612 florian 35
include_once PAP_CHEMIN_RACINE.'/client/bottin/configuration/bottin.config.inc.php';
448 ddelon 36
include_once INS_CHEMIN_APPLI.'configuration/cartographie.config.inc.php';
810 florian 37
include_once INS_CHEMIN_APPLI.'bibliotheque/bottin.fonct.php';
448 ddelon 38
include_once INS_CHEMIN_APPLI.'bibliotheque/lib.carto.php';
39
 
40
//================================================================================================
810 florian 41
if ( isset($_GET['voir_fiche']) or isset($_GET['voir_abonnement']) or isset($_GET['voir_actus']) or isset($_GET['voir_ressources']) or isset($_GET['voir_competences']) ) {
42
	//---------------le menu de l'appli-----------
43
	function afficherContenuNavigation () {
44
		$res =inscription_onglets();
45
		return $res ;
46
	}
47
}
48
 
448 ddelon 49
//================================================================================================
50
 
51
function afficherContenuCorps()
52
{
53
    global $image_x;
54
    global $image_y;
55
    global $historique_cartes;
56
    global $mailer;
57
    global $fin;
58
    global $sendpwd;//utilisé dans liste_inscrit.php
59
    global $select;//utilisé dans liste_inscrit.php
60
    global $liste_zone_carte;
61
 
810 florian 62
	//=================================================================================================
63
	//Gestion de la configuration
820 alexandre_ 64
    $requete = 'SELECT * FROM carto_config WHERE cc_menu_id='.$GLOBALS['_GEN_commun']['info_menu']->gm_id_menu;
805 florian 65
    $resultat = $GLOBALS['ins_db']->query($requete) ;
66
    if (DB::isError($resultat)) {
67
       	die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
68
    }
69
    if ($resultat->numRows()>0) {
70
       	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
71
        	//valeurs par defaut enregistrees dans la table
72
        	$titre=$ligne['cc_titre_carto'];
73
        	$nom_table1=$ligne['cc_table1'];
74
        	$nom_table2=$ligne['cc_table2'];
75
        	$nom_champs_pays=$ligne['cc_pays'];
76
        	$nom_champs_cp=$ligne['cc_cp'];
77
        	$requete_sql=$ligne['cc_sql'];
78
        }
810 florian 79
    	//on affiche les infos lorsqu'on regarde une fiche
80
    	if ( isset($_GET['voir_fiche']) or isset($_GET['voir_abonnement']) or isset($_GET['voir_actus']) or isset($_GET['voir_ressources']) or isset($_GET['voir_competences']) ) {
81
    		$res = affiche_onglet_info();
82
    	} else {
83
		//=================================================================================================
84
		$requete_01 = 'SELECT CP_ID_Continent,count(cp_id_continent) AS nbr'.
85
		    		  ' FROM '.$nom_table1.', carto_PAYS';
86
		if ($nom_table2!=0) $requete_01 .=  ', '.$nom_table2;
87
		$requete_01 .= ' WHERE '.$nom_champs_pays.' = cp_id_pays';
88
		if ($requete_sql!='') $requete_01 .=  ' AND ('.$requete_sql.')';
89
		$requete_01 .= ' GROUP BY cp_id_continent';
90
		$resultat_01 = $GLOBALS['ins_db']->query($requete_01) ;
91
		if (DB::isError($resultat_01)) {
92
		    die ($resultat_01->getMessage().'<br />'.$resultat_01->getDebugInfo()) ;
93
		}
94
		$tableau_ad_continent=array();
95
		while ($ligne_01 = $resultat_01->fetchRow(DB_FETCHMODE_OBJECT)) {
96
		    $tableau_ad_continent[$ligne_01->CP_ID_Continent] = $ligne_01->nbr;
97
 
98
		}
99
		$info_continent['nom_table_zone'] = 'carto_CONTINENT';
100
		$info_continent['nom_chp_id_zone'] = 'CC_ID_Continent';
101
		$info_continent['nom_chp_nom_zone'] = 'CC_Intitule_continent';
102
		$info_continent['nom_chp_rouge'] = 'CC_Couleur_R';
103
		$info_continent['nom_chp_vert'] = 'CC_Couleur_V';
104
		$info_continent['nom_chp_bleu'] = 'CC_Couleur_B';
105
		$info_continent['nom_chp_zone_sup'] = '';
106
		$info_continent['tableau_valeurs_zone'] = $tableau_ad_continent;
107
 
108
		//============================================================================================================
109
 
110
		$requete_02 = 'SELECT CC_ID_Continent FROM carto_CONTINENT';
111
 
112
		$resultat_02 = $GLOBALS['ins_db']->query($requete_02) ;
113
		if (DB::isError($resultat_02)) {
114
		    die ($resultat_02->getMessage().'<br />'.$resultat_02->getDebugInfo()) ;
115
		}
116
 
117
		while ($ligne_02 = $resultat_02->fetchRow(DB_FETCHMODE_OBJECT)) {
118
		    $requete_03 = 'SELECT CP_ID_Pays, count(cp_id_pays) as nbr '.
119
		                  ' FROM '.$nom_table1.', carto_PAYS';
120
		    if ($nom_table2!=0) $requete_03 .=  ', '.$nom_table2;
121
		    $requete_03 .= ' WHERE '.$nom_champs_pays.'= cp_id_pays';
122
		    if ($requete_sql!='') $requete_03 .=  ' AND ('.$requete_sql.')';
123
		    $requete_03 .= ' AND cp_id_continent = "'.$ligne_02->CC_ID_Continent.'"'.
124
		                   ' GROUP BY cp_id_pays';
125
		    $resultat_03 = $GLOBALS['ins_db']->query($requete_03) ;
126
		    if (DB::isError($resultat_03)) {
127
		        die ($resultat_03->getMessage().'<br />'.$resultat_03->getDebugInfo()) ;
128
		    }
129
 
130
		    $tableau_ad_pays = array();
131
		    while ($ligne_03 = $resultat_03->fetchRow(DB_FETCHMODE_OBJECT)) {
132
		        $tableau_ad_pays[$ligne_03->CP_ID_Pays] = $ligne_03->nbr;
133
		    }
134
 
135
		    $info_pays[$ligne_02->CC_ID_Continent]['nom_table_zone'] = 'carto_PAYS';
136
		    $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_id_zone'] = 'CP_ID_Pays';
137
		    $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_nom_zone'] = 'CP_Intitule_pays';
138
		    $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_rouge'] = 'CP_Couleur_R';
139
		    $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_vert'] = 'CP_Couleur_V';
140
		    $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_bleu'] = 'CP_Couleur_B';
141
		    $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_zone_sup'] = 'CP_ID_Continent';
142
		    $info_pays[$ligne_02->CC_ID_Continent]['tableau_valeurs_zone'] = $tableau_ad_pays;
143
		}
144
		//============================================================================================================
145
			//if (!isset($_POST['historique_cartes']) && INS_ECHELLE_DEPART!='france') {
146
				$requete_04 = 'SELECT CD_ID_Departement, count(cd_id_departement) as nbr'.
147
		    	    	      ' FROM '.$nom_table1.', carto_DEPARTEMENT'.
148
		        			  ' WHERE '.$nom_champs_pays.' = "fr"'.
149
							  ' AND SUBSTRING('.$nom_champs_cp.' FROM 1 FOR 2) = cd_id_Departement'.
150
		        			  ' GROUP BY cd_id_Departement';
151
		    	$resultat_04 = $GLOBALS['ins_db']->query ($requete_04) ;
152
		    	$tableau_ad_dpt_france = array();
153
		    	while ($ligne_04 = $resultat_04->fetchRow(DB_FETCHMODE_OBJECT)) {
154
		    		$tableau_ad_dpt_france[$ligne_04->CD_ID_Departement] = $ligne_04->nbr;
155
		    	}
156
		    	$info_dpt_france['nom_table_zone'] = 'carto_DEPARTEMENT';
157
		    	$info_dpt_france['nom_chp_id_zone'] = 'CD_ID_Departement';
158
		    	$info_dpt_france['nom_chp_nom_zone'] = 'CD_Intitule_departement';
159
		    	$info_dpt_france['nom_chp_rouge'] = 'CD_Couleur_R';
160
		    	$info_dpt_france['nom_chp_vert'] = 'CD_Couleur_V';
161
		    	$info_dpt_france['nom_chp_bleu'] = 'CD_Couleur_B';
162
		    	$info_dpt_france['nom_chp_zone_sup'] = 'CD_ID_Pays';
163
		    	$info_dpt_france['tableau_valeurs_zone'] = $tableau_ad_dpt_france;
164
		    //}
165
 
166
		//============================================================================================================
167
 
168
 
169
		//============================================================================================================
170
		// On cree tout d'abord l'arborescence
171
 
172
		$monde = new Carto_Carte('continent', '', 'Monde', 'monde_masque5c.png', 'monde5c.png', INS_CHEMIN_APPLI.'presentations/fonds/', $info_continent);
173
		$monde->definirCouleurs('255', '255', '255','255', '250', '130','255', '204', '0','255', '153', '0') ;
174
		if (isset($_POST['historique_cartes'])) {
175
			$monde->historique_cartes = $_POST['historique_cartes'];
176
		} else {
177
			$monde->historique_cartes = INS_ECHELLE_DEPART;
178
		}
179
		$monde->image_x = $image_x;
180
		$monde->image_y = $image_y;
181
		$monde->liste_zone_carte = $liste_zone_carte;
182
		$monde->url = $GLOBALS['ins_url']->getURL();
183
 
184
		foreach ($info_pays as $cle => $valeur) {
185
		    $requete_05 =
186
		        "SELECT CDC_Titre_carte, CDC_ID_Carte, CDC_Carte_fond, CDC_Carte_masque, CDC_ID_Zone_geo_carte".
187
		        " FROM carto_DESCRIPTION_CARTE, carto_ACTION ".
188
		        " WHERE CA_ID_Zone_geo = '$cle'".
189
		        " AND CA_Type_zone = 1".
190
		        " AND CA_ID_Carte_destination = CDC_ID_Carte";
191
 
192
		    $resultat_05 = $GLOBALS['ins_db']->query ($requete_05) ;
193
		    if (DB::isError($resultat_05)) {
194
		        die ($resultat_05->getMessage().'<br />'.$resultat_05->getDebugInfo()) ;
195
		    }
196
		    $ligne_05 = $resultat_05->fetchRow(DB_FETCHMODE_OBJECT);
197
		    $monde->ajouterFils($ligne_05->CDC_ID_Carte, $ligne_05->CDC_ID_Zone_geo_carte, $ligne_05->CDC_Titre_carte,
198
		                                    $ligne_05->CDC_Carte_masque, $ligne_05->CDC_Carte_fond, $valeur);
199
		    $monde->fils[$ligne_05->CDC_ID_Carte]->definirCouleurs ('255', '255', '255','255', '250', '130','255', '204', '0','255', '153', '0') ;
200
		}
201
 
202
		$monde->fils['europe']->ajouterFils('france', 'fr', 'France' ,'france_masque.png', 'france.png', $info_dpt_france);
203
		$monde->fils['europe']->fils['france']->definirCouleurs ('255', '255', '255','255', '250', '130','255', '204', '0','255', '153', '0') ;
204
 
205
		// Une fois l'arborescence créée on lance la methode donnerFormulaireImage() pour recuperer la carte
206
		// (dans $img). S'il n'y a pas de carte a afficher donnerFormulaireImage() renvoi false. On peut alors recuperer
207
		// le niveau ou on en est grace a $monde->historique (du type continent*namerique*ca).
208
 
209
		$img = false;
210
		if ($mailer == 1 || $fin == true) {
211
		    $objet_carte = $_SESSION['carte'] ;
212
		    $monde = unserialize($objet_carte);}
213
		else {
214
		    $img = $monde->donnerFormulaireImage();
215
		}
216
 
217
		// Quoi qu'il arrive, on ouvre la balise formulaire
218
		if ($titre!='') $res = '<h1>'.$titre.'</h1>'."\n";
219
		else $res = '<h1>'.INS_CARTOGRAPHIE.'</h1>'."\n";
220
		$res .= '<form name="formmail" action="'.$monde->url.'" method="post">'."\n";
221
		if ((INS_AFFICHE_ECHELLE)and($img)) {
222
		   	$historique_carte = new Carto_HistoriqueCarte ($monde, '&gt;', 'chemin_carto');
223
		   	$res .= $historique_carte->afficherHistoriqueCarte()."\n" ;
224
		}
225
		if (!$img ) {
226
			//include 'bibliotheque/cartographie.fonct.liste_inscrit.php';
227
		    $res .= carto_liste_fiches($monde, $nom_table1, $nom_table2, $nom_champs_pays, $nom_champs_cp, $requete_sql);
228
		    return $res;
229
		} else {
230
			$res .= $img;
231
		    $res .= '<p class="zone_info">'."\n";
232
			$res .= '<strong>'.INS_CLIQUER_ACCEDER.'</strong><br />'."\n";
233
		    $res .= INS_COULEUR."\n".'</p>'."\n";
234
		}
235
		$res .= '</form>'."\n";
448 ddelon 236
    }
805 florian 237
    return $res;
238
 
239
//----------------------------------------------------------------------------------------------------------------------
240
// Cas ou la carto n'a pas encore ete configuree
241
    } else {
242
    	return '<p class="zone_alert">'.INS_FAUT_CONFIGURER_CARTO.'</p>'."\n";
243
    }
448 ddelon 244
}
245
 
246
 
247
//-- Fin du code source    ------------------------------------------------------------
248
/*
249
* $Log: not supported by cvs2svn $
820 alexandre_ 250
* Revision 1.4  2006/04/10 14:01:36  florian
251
* uniformisation de l'appli bottin: plus qu'un fichier de fonctions
252
*
810 florian 253
* Revision 1.3  2006/04/04 12:23:05  florian
254
* modifs affichage fiches, généricité de la carto, modification totale de l'appli annuaire
255
*
805 florian 256
* Revision 1.2  2005/11/24 16:17:52  florian
257
* changement template inscription + modifs carto
258
*
612 florian 259
* Revision 1.1  2005/09/22 14:02:49  ddelon
260
* nettoyage annuaire et php5
261
*
448 ddelon 262
* Revision 1.2  2005/09/22 13:30:49  florian
263
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
264
*
265
* Revision 1.1  2004/12/15 13:33:03  alex
266
* version initiale
267
*
268
* Revision 1.2  2004/06/18 08:48:03  alex
269
* améliorations diverses
270
*
271
* Revision 1.1  2004/06/09 13:56:47  alex
272
* corrections diverses
273
*
274
* Revision 1.9  2003/05/06 12:49:27  alex
275
* remplacement include par include_once
276
*
277
* Revision 1.8  2003/03/07 15:20:32  jpm
278
* Correction d'une erreur de texte.
279
*
280
* Revision 1.7  2003/02/28 08:43:33  jpm
281
* Gestion des nouvelles tables MySql carto.
282
*
283
* Revision 1.6  2003/02/21 13:50:19  jpm
284
* Mise à jour nouvel objet Carto_Carte.
285
*
286
* Revision 1.5  2003/02/17 14:33:52  jpm
287
* Modification pour être compatible avec la nouvelle classe carte.
288
*
289
*
290
*/
291
?>