Subversion Repositories Applications.papyrus

Rev

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