Subversion Repositories Applications.papyrus

Rev

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