Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | 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
//
29
// $Id: cartographie.php,v 1.1 2005-09-22 14:02:49 ddelon Exp $
30
// FICHIER : $RCSfile: cartographie.php,v $
31
// AUTEUR    : $Author: ddelon $
32
// VERSION : $Revision: 1.1 $
33
// DATE        : $Date: 2005-09-22 14:02:49 $
34
*/
35
include_once 'configuration/ins_annuaire.config.inc.php';
36
include_once INS_CHEMIN_APPLI.'configuration/cartographie.config.inc.php';
37
include_once INS_CHEMIN_APPLI.'bibliotheque/cartographie.fonct.php';
38
include_once INS_CHEMIN_APPLI.'bibliotheque/lib.carto.php';
39
include_once INS_CHEMIN_APPLI.'bibliotheque/cartographie.fonct.php';
40
//include_once 'HTML/QuickForm.php' ;
41
 
42
// Ajout d'une feuille de style externe
43
GEN_stockerStyleExterne('cartographie', 'presentations/cartographie.css') ;
44
 
45
if (isset($GLOBALS['logout']) && $GLOBALS['logout']==1) {
46
    $GLOBALS['AUTH']->logout();
47
}
48
//================================================================================================
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
 
62
//=================================================================================================
63
    $requete_01 =
64
        "SELECT CP_ID_Continent,count(cp_id_continent) AS nbr".
65
        " FROM ".INS_ANNUAIRE.", carto_PAYS".
66
        " WHERE ".INS_CHAMPS_PAYS." = cp_id_pays".
67
        " GROUP BY cp_id_continent";
68
    $resultat_01 = $GLOBALS['ins_db']->query($requete_01) ;
69
    if (DB::isError($resultat_01)) {
70
        die ($resultat_01->getMessage().'<br />'.$resultat_01->getDebugInfo()) ;
71
    }
72
 
73
    $tableau_ad_continent=array();
74
 
75
    while ($ligne_01 = $resultat_01->fetchRow(DB_FETCHMODE_OBJECT)) {
76
        $tableau_ad_continent[$ligne_01->CP_ID_Continent] = $ligne_01->nbr;
77
 
78
    }
79
    $info_continent['nom_table_zone'] = 'carto_CONTINENT';
80
    $info_continent['nom_chp_id_zone'] = 'CC_ID_Continent';
81
    $info_continent['nom_chp_nom_zone'] = 'CC_Intitule_continent';
82
    $info_continent['nom_chp_rouge'] = 'CC_Couleur_R';
83
    $info_continent['nom_chp_vert'] = 'CC_Couleur_V';
84
    $info_continent['nom_chp_bleu'] = 'CC_Couleur_B';
85
    $info_continent['nom_chp_zone_sup'] = '';
86
    $info_continent['tableau_valeurs_zone'] = $tableau_ad_continent;
87
 
88
    //============================================================================================================
89
 
90
    $requete_02 = 'SELECT CC_ID_Continent FROM carto_CONTINENT';
91
 
92
    $resultat_02 = $GLOBALS['ins_db']->query($requete_02) ;
93
    if (DB::isError($resultat_02)) {
94
        die ($resultat_02->getMessage().'<br />'.$resultat_02->getDebugInfo()) ;
95
    }
96
 
97
    while ($ligne_02 = $resultat_02->fetchRow(DB_FETCHMODE_OBJECT)) {
98
        $requete_03 =
99
             'SELECT CP_ID_Pays, count(cp_id_pays) as nbr '.
100
            ' FROM '.INS_ANNUAIRE.', carto_PAYS'.
101
            ' WHERE '.INS_CHAMPS_PAYS.'= cp_id_pays'.
102
            ' AND cp_id_continent = "'.$ligne_02->CC_ID_Continent.'"'.
103
            ' GROUP BY cp_id_pays';
104
 
105
        $resultat_03 = $GLOBALS['ins_db']->query($requete_03) ;
106
        if (DB::isError($resultat_03)) {
107
            die ($resultat_03->getMessage().'<br />'.$resultat_03->getDebugInfo()) ;
108
        }
109
 
110
        $tableau_ad_pays = array();
111
 
112
        while ($ligne_03 = $resultat_03->fetchRow(DB_FETCHMODE_OBJECT)) {
113
            $tableau_ad_pays[$ligne_03->CP_ID_Pays] = $ligne_03->nbr;
114
        }
115
 
116
        $info_pays[$ligne_02->CC_ID_Continent]['nom_table_zone'] = 'carto_PAYS';
117
        $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_id_zone'] = 'CP_ID_Pays';
118
        $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_nom_zone'] = 'CP_Intitule_pays';
119
        $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_rouge'] = 'CP_Couleur_R';
120
        $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_vert'] = 'CP_Couleur_V';
121
        $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_bleu'] = 'CP_Couleur_B';
122
        $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_zone_sup'] = 'CP_ID_Continent';
123
        $info_pays[$ligne_02->CC_ID_Continent]['tableau_valeurs_zone'] = $tableau_ad_pays;
124
    }
125
    //============================================================================================================
126
    //récupération du numéro de département à partir du code postal
127
    $requete_cp = 'SELECT a_code_postal FROM '.INS_ANNUAIRE.' WHERE '.INS_CHAMPS_PAYS.' = "fr"';
128
    $resultat_cp = $GLOBALS['ins_db']->query($requete_cp) ;
129
    if (DB::isError($resultat_cp)) {
130
        die('
131
            <H2 class="erreur">Erreur de requête</H2>'.
132
            '<b>Requete : </b>'.$requete_cp.
133
            '<br/><br/><b>Erreur : </b>'.$resultat_cp->getMessage());
134
    }
135
    $tableau_ad_dpt_france = array();
136
    while ($ligne_cp = $resultat_cp->fetchRow(DB_FETCHMODE_ASSOC)) {
137
         if (preg_match("/^97|98[0-9]*/", $ligne_cp['a_code_postal'])) {
138
		 $n_dpt = substr($ligne_cp['a_code_postal'], 0, 3) ;
139
	 } else {
140
		 $n_dpt = substr($ligne_cp['a_code_postal'], 0, 2) ;
141
	 }
142
	 $requete_04 = 'SELECT cd_id_departement '.
143
	 ' FROM '.INS_ANNUAIRE.', carto_DEPARTEMENT'.
144
	 ' WHERE '.INS_CHAMPS_PAYS.' = "fr"'.
145
	 ' AND  cd_id_departement = '.$n_dpt;
146
	 $resultat_04 = $GLOBALS['ins_db']->query($requete_04) ;
147
	 if (DB::isError($resultat_04)) {
148
		 die('
149
		 <H2 class="erreur">Erreur de requête</H2>'.
150
		 '<b>Requete : </b>'.$requete_04.
151
		 '<br/><br/><b>Erreur : </b>'.$resultat_04->getMessage());
152
	 }
153
 
154
	 while ($ligne_04 = $resultat_04->fetchRow(DB_FETCHMODE_OBJECT)) {
155
		 $tableau_ad_dpt_france[$ligne_04->cd_id_departement] = $resultat_04->numRows();
156
	 }
157
    }
158
 
159
    $info_dpt_france['nom_table_zone'] = 'carto_DEPARTEMENT';
160
    $info_dpt_france['nom_chp_id_zone'] = 'CD_ID_Departement';
161
    $info_dpt_france['nom_chp_nom_zone'] = 'CD_Intitule_departement';
162
    $info_dpt_france['nom_chp_rouge'] = 'CD_Couleur_R';
163
    $info_dpt_france['nom_chp_vert'] = 'CD_Couleur_V';
164
    $info_dpt_france['nom_chp_bleu'] = 'CD_Couleur_B';
165
    $info_dpt_france['nom_chp_zone_sup'] = 'CD_ID_Pays';
166
    $info_dpt_france['tableau_valeurs_zone'] = $tableau_ad_dpt_france;
167
 
168
    //============================================================================================================
169
 
170
 
171
    //============================================================================================================
172
    // On cree tout d'abord l'arborescence
173
 
174
    $monde = new Carto_Carte('continent', '', 'Monde', 'monde_masque5c.png', 'monde5c.png', INS_CHEMIN_APPLI.'presentations/fonds/', $info_continent);
175
 
176
    $monde->definirCouleurs('255', '255', '255','255', '250', '130','255', '204', '0','255', '153', '0') ;
177
 
178
    $monde->historique_cartes = $historique_cartes;
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
 
197
        $ligne_05 = $resultat_05->fetchRow(DB_FETCHMODE_OBJECT);
198
 
199
        $monde->ajouterFils($ligne_05->CDC_ID_Carte, $ligne_05->CDC_ID_Zone_geo_carte, $ligne_05->CDC_Titre_carte,
200
                                        $ligne_05->CDC_Carte_masque, $ligne_05->CDC_Carte_fond, $valeur);
201
        $monde->fils[$ligne_05->CDC_ID_Carte]->definirCouleurs ('255', '255', '255','255', '250', '130','255', '204', '0','255', '153', '0') ;
202
    }
203
 
204
    $monde->fils['europe']->ajouterFils('france', 'fr', 'France' ,'france_masque.png', 'france.png', $info_dpt_france);
205
    $monde->fils['europe']->fils['france']->definirCouleurs ('255', '255', '255','255', '250', '130','255', '204', '0','255', '153', '0') ;
206
 
207
    // Une fois l'arborescence créée on lance la methode donnerFormulaireImage() pour recuperer la carte
208
    // (dans $img). S'il n'y a pas de carte a afficher donnerFormulaireImage() renvoi false. On peut alors recuperer
209
    // le niveau ou on en est grace a $monde->historique (du type continent*namerique*ca).
210
    $res = '';
211
 
212
 
213
    $img = false;
214
    if ($mailer == 1 || $fin == true) {
215
        $objet_carte = $_SESSION['carte'] ;
216
        $monde = unserialize($objet_carte);}
217
    else {
218
        $img = $monde->donnerFormulaireImage();
219
    }
220
 
221
    // On teste donc img
222
 
223
    if (!$img ) {
224
        include 'bibliotheque/cartographie.fonct.liste_inscrit.php';
225
        return $res;
226
    }
227
    else {
228
        $historique_carte = new Carto_HistoriqueCarte ($monde, '&gt;', 'chemin_carto');
229
        $res .= $historique_carte->afficherHistoriqueCarte();
230
        $res .= "<br />\n" ;
231
        $tab = explode('*',$monde->historique);
232
 
233
        $res .= $img;
234
        $res .= '<br /><div style="text-align: center;"><strong>'.INS_COULEUR.'</strong></div><br />'."\n";
235
        $res .= '<br /><small><strong>'.INS_AVERTISSEMENT_TITRE.' : </strong>';
236
        $res .= INS_AVERTISSEMENT.'</small>'."\n";
237
 
238
        return $res;
239
    }
240
}
241
 
242
 
243
//-- Fin du code source    ------------------------------------------------------------
244
/*
245
* $Log: not supported by cvs2svn $
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
?>