Subversion Repositories Applications.papyrus

Rev

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