Subversion Repositories Applications.papyrus

Rev

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

Rev Author Line No. Line
231 alex 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
//
404 ddelon 29
// $Id: cartographie.php,v 1.2 2005-07-04 22:13:02 ddelon Exp $
231 alex 30
// FICHIER : $RCSfile: cartographie.php,v $
404 ddelon 31
// AUTEUR    : $Author: ddelon $
32
// VERSION : $Revision: 1.2 $
33
// DATE        : $Date: 2005-07-04 22:13:02 $
231 alex 34
*/
35
 
36
include_once 'client/cartographie/configuration/car_config.inc.php' ;
37
if (isset($lang)) {
38
    include_once CAR_CHEMIN_APPLI."/langues/car_langue_$lang.inc.php" ;
39
} else {
40
    include_once CAR_CHEMIN_APPLI.'/langues/car_langue_fr.inc.php' ;
41
}
42
 
43
include_once CAR_CHEMIN_APPLI.'/bibliotheque/lib.carto.php' ;
44
include_once CAR_CHEMIN_APPLI.'/bibliotheque/car_cartographie.fonct.php' ;
45
include_once 'HTML/QuickForm.php' ;
46
 
47
// Ajout d'une feuille de style externe
48
GEN_stockerStyleExterne ('cartographie', 'client/cartographie/cartographie.css') ;
49
 
50
if (isset($GLOBALS['logout']) && $GLOBALS['logout']==1) {
51
    $GLOBALS['car_auth']->logout();
52
}
53
//================================================================================================
54
//================================================================================================
55
function AUTH_formulaire_login() {
56
 
57
     // l'url de la page en cours
58
    $url = CAR_URL;
59
 
60
    $res = '';
61
    $form = new HTML_QuickForm ('inscription', 'post', preg_replace ('/&amp;/', '&', $url).'&historique_cartes='.$GLOBALS['historique_cartes'].'&fin=true') ;
62
    $form->addElement ('text', 'username', CAR_EMAIL) ;
63
    $form->addElement ('password', 'password', CAR_MOT_DE_PASSE) ;
64
    $form->addElement('submit', 'connexion', CAR_VALIDER);
65
 
66
    $res .= $form->toHTML() ;
67
    $res .= "<div>".CAR_LAIUS_INSCRIPTION."&nbsp;<a href=\"\">".CAR_S_INSCRIRE."</a></div>\n" ;
68
    $res .= "<div>".CAR_TEXTE_PERDU."</div>\n" ;
69
    return $res;
70
}
71
 
72
function afficherContenuCorps ()
73
{
74
    global $image_x;
75
    global $image_y;
76
    global $historique_cartes;
77
    global $mailer;
78
    global $fin;
79
    global $sendpwd;//utilisé dans liste_inscrit.php
80
    global $select;//utilisé dans liste_inscrit.php
81
    global $liste_zone_carte;
82
 
83
    //===========================================================================================================
84
    $requete_01 =
85
        "SELECT CP_ID_Continent,count(cp_id_continent) as nbr".
86
        " FROM ".CAR_ANNUAIRE.", carto_PAYS".
87
        " WHERE ".CAR_CHAMPS_CE_PAYS." = cp_id_pays".
88
        " GROUP BY cp_id_continent";
89
 
90
    $resultat_01 = $GLOBALS['car_db']->query ($requete_01) ;
404 ddelon 91
    if (DB::isError($resultat_01)) {
231 alex 92
        die ($resultat_01->getMessage().'<br />'.$resultat_01->getDebugInfo()) ;
93
    }
94
 
95
    $tableau_ad_continent=array();
96
 
97
    while ($ligne_01 = $resultat_01->fetchRow(DB_FETCHMODE_OBJECT)) {
98
        $tableau_ad_continent[$ligne_01->CP_ID_Continent] = $ligne_01->nbr;
99
 
100
    }
101
    $info_continent['nom_table_zone'] = 'carto_CONTINENT';
102
    $info_continent['nom_chp_id_zone'] = 'CC_ID_Continent';
103
    $info_continent['nom_chp_nom_zone'] = 'CC_Intitule_continent';
104
    $info_continent['nom_chp_rouge'] = 'CC_Couleur_R';
105
    $info_continent['nom_chp_vert'] = 'CC_Couleur_V';
106
    $info_continent['nom_chp_bleu'] = 'CC_Couleur_B';
107
    $info_continent['nom_chp_zone_sup'] = '';
108
    $info_continent['tableau_valeurs_zone'] = $tableau_ad_continent;
109
 
110
    //============================================================================================================
111
 
112
    $requete_02 = 'SELECT CC_ID_Continent FROM carto_CONTINENT';
113
 
114
    $resultat_02 = $GLOBALS['car_db']->query ($requete_02) ;
115
    if (DB::isError($resultat)) {
116
        die ($resultat_02->getMessage().'<br />'.$resultat_02->getDebugInfo()) ;
117
    }
118
 
119
    while ($ligne_02 = $resultat_02->fetchRow(DB_FETCHMODE_OBJECT)) {
120
        $requete_03 =
121
             'SELECT CP_ID_Pays, count(cp_id_pays) as nbr '.
122
            ' FROM '.CAR_ANNUAIRE.', carto_PAYS'.
123
            ' WHERE '.CAR_CHAMPS_CE_PAYS.'= cp_id_pays'.
124
            ' AND cp_id_continent = "'.$ligne_02->CC_ID_Continent.'"'.
125
            ' GROUP BY cp_id_pays';
126
 
127
        $resultat_03 = $GLOBALS['car_db']->query ($requete_03) ;
128
        if (DB::isError($resultat_03)) {
129
            die ($resultat_03->getMessage().'<br />'.$resultat_03->getDebugInfo()) ;
130
        }
131
 
132
        $tableau_ad_pays = array();
133
 
134
        while ($ligne_03 = $resultat_03->fetchRow(DB_FETCHMODE_OBJECT)) {
135
            $tableau_ad_pays[$ligne_03->CP_ID_Pays] = $ligne_03->nbr;
136
        }
137
 
138
        $info_pays[$ligne_02->CC_ID_Continent]['nom_table_zone'] = 'carto_PAYS';
139
        $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_id_zone'] = 'CP_ID_Pays';
140
        $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_nom_zone'] = 'CP_Intitule_pays';
141
        $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_rouge'] = 'CP_Couleur_R';
142
        $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_vert'] = 'CP_Couleur_V';
143
        $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_bleu'] = 'CP_Couleur_B';
144
        $info_pays[$ligne_02->CC_ID_Continent]['nom_chp_zone_sup'] = 'CP_ID_Continent';
145
        $info_pays[$ligne_02->CC_ID_Continent]['tableau_valeurs_zone'] = $tableau_ad_pays;
146
    }
147
    //============================================================================================================
148
 
149
    $requete_04 = "SELECT * ,count(cd_id_departement) as nbr".
150
        " FROM ".CAR_ANNUAIRE.", carto_DEPARTEMENT".
151
        " WHERE ".CAR_CHAMPS_CE_PAYS." = 'fr'".
152
        " AND  a_numero_dpt = cd_id_departement".
153
        " GROUP BY cd_id_Departement";
154
 
155
    $resultat_04 = $GLOBALS['car_db']->query ($requete_04) ;
156
    if (DB::isError($resultat_04)) {
157
        die('
158
            <H2 class="erreur">Erreur de requête</H2>'.
159
            '<b>Requete : </b>'.$requete_04.
160
            '<br/><br/><b>Erreur : </b>'.$resultat_04->getMessage());
161
    }
162
 
163
    $tableau_ad_dpt_france = array();
164
 
165
    while ($ligne_04 = $resultat_04->fetchRow(DB_FETCHMODE_OBJECT)) {
166
        $tableau_ad_dpt_france[$ligne_04->CD_ID_Departement] = $ligne_04->nbr;
167
    }
168
 
169
    $info_dpt_france['nom_table_zone'] = 'carto_DEPARTEMENT';
170
    $info_dpt_france['nom_chp_id_zone'] = 'CD_ID_Departement';
171
    $info_dpt_france['nom_chp_nom_zone'] = 'CD_Intitule_departement';
172
    $info_dpt_france['nom_chp_rouge'] = 'CD_Couleur_R';
173
    $info_dpt_france['nom_chp_vert'] = 'CD_Couleur_V';
174
    $info_dpt_france['nom_chp_bleu'] = 'CD_Couleur_B';
175
    $info_dpt_france['nom_chp_zone_sup'] = 'CD_ID_Pays';
176
    $info_dpt_france['tableau_valeurs_zone'] = $tableau_ad_dpt_france;
177
 
178
    //============================================================================================================
179
 
180
 
181
    //============================================================================================================
182
    // On cree tout d'abord l'arborescence
183
 
184
    $monde = new Carto_Carte ('continent', '', 'Monde', 'monde_masque5c.png', 'monde5c.png', CAR_CHEMIN_APPLI.'/fonds/', $info_continent);
185
 
186
    $monde->definirCouleurs ('255', '255', '255','255', '250', '130','255', '204', '0','255', '153', '0') ;
187
 
188
    $monde->historique_cartes = $historique_cartes;
189
    $monde->image_x = $image_x;
190
    $monde->image_y = $image_y;
191
    $monde->liste_zone_carte = $liste_zone_carte;
192
    $monde->url = CAR_URL;
193
 
194
    foreach ($info_pays as $cle => $valeur) {
195
        $requete_05 =
196
            "SELECT CDC_Titre_carte, CDC_ID_Carte, CDC_Carte_fond, CDC_Carte_masque, CDC_ID_Zone_geo_carte".
197
            " FROM carto_DESCRIPTION_CARTE, carto_ACTION ".
198
            " WHERE CA_ID_Zone_geo = '$cle'".
199
            " AND CA_Type_zone = 1".
200
            " AND CA_ID_Carte_destination = CDC_ID_Carte";
201
 
202
        $resultat_05 = $GLOBALS['car_db']->query ($requete_05) ;
203
        if (DB::isError($resultat)) {
204
            die ($resultat_05->getMessage().'<br />'.$resultat_05->getDebugInfo()) ;
205
        }
206
 
207
        $ligne_05 = $resultat_05->fetchRow(DB_FETCHMODE_OBJECT);
208
 
209
        $monde->ajouterFils($ligne_05->CDC_ID_Carte, $ligne_05->CDC_ID_Zone_geo_carte, $ligne_05->CDC_Titre_carte,
210
                                        $ligne_05->CDC_Carte_masque, $ligne_05->CDC_Carte_fond, $valeur);
211
        $monde->fils[$ligne_05->CDC_ID_Carte]->definirCouleurs ('255', '255', '255','255', '250', '130','255', '204', '0','255', '153', '0') ;
212
    }
213
 
214
    $monde->fils['europe']->ajouterFils('france', 'fr', 'France' ,'france_masque.png', 'france.png', $info_dpt_france);
215
    $monde->fils['europe']->fils['france']->definirCouleurs ('255', '255', '255','255', '250', '130','255', '204', '0','255', '153', '0') ;
216
 
217
    // Une fois l'arborescence créée on lance la methode donnerFormulaireImage() pour recuperer la carte
218
    // (dans $img). S'il n'y a pas de carte a afficher donnerFormulaireImage() renvoi false. On peut alors recuperer
219
    // le niveau ou on en est grace a $monde->historique (du type continent*namerique*ca).
220
    $res = '';
221
 
222
 
223
    $img = false;
224
    if ($mailer == 1 || $fin == true) {
225
        $objet_carte = $_SESSION['carte'] ;
226
        $monde = unserialize($objet_carte);}
227
    else {
228
        $img = $monde->donnerFormulaireImage();
229
    }
230
 
231
    // On teste donc img
232
 
233
    if (!$img ) {
234
        include 'liste_inscrit.php';
235
        return $res;
236
    }
237
    else {
238
        $historique_carte = new Carto_HistoriqueCarte ($monde, '&gt;', 'chemin_carto');
239
        $res .= $historique_carte->afficherHistoriqueCarte();
240
        $res .= "<br />\n" ;
241
        $tab = explode('*',$monde->historique);
242
 
243
        $res .= $img;
244
        $res .= ''.CAR_CLIQUER;
245
        $res .= '<br />'.CAR_COULEUR."\n";
246
        $res .= '<div class="avertissement_carto" id="d"><strong>'.CAR_AVERTISSEMENT_TITRE.' : </strong>';
247
        $res .= CAR_AVERTISSEMENT."</div>\n";
248
 
249
        return $res;
250
    }
251
}
252
 
253
 
254
//-- Fin du code source    ------------------------------------------------------------
255
/*
256
* $Log: not supported by cvs2svn $
404 ddelon 257
* Revision 1.1  2004/12/15 13:33:03  alex
258
* version initiale
259
*
231 alex 260
* Revision 1.2  2004/06/18 08:48:03  alex
261
* améliorations diverses
262
*
263
* Revision 1.1  2004/06/09 13:56:47  alex
264
* corrections diverses
265
*
266
* Revision 1.9  2003/05/06 12:49:27  alex
267
* remplacement include par include_once
268
*
269
* Revision 1.8  2003/03/07 15:20:32  jpm
270
* Correction d'une erreur de texte.
271
*
272
* Revision 1.7  2003/02/28 08:43:33  jpm
273
* Gestion des nouvelles tables MySql carto.
274
*
275
* Revision 1.6  2003/02/21 13:50:19  jpm
276
* Mise à jour nouvel objet Carto_Carte.
277
*
278
* Revision 1.5  2003/02/17 14:33:52  jpm
279
* Modification pour être compatible avec la nouvelle classe carte.
280
*
281
*
282
*/
283
?>