Subversion Repositories eFlore/Archives.herbiers

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 jp_milcent 1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This file is part of Herbier - Cartographie.                                                         |
9
// |                                                                                                      |
10
// | Foobar is free software; you can redistribute it and/or modify                                       |
11
// | it under the terms of the GNU General Public License as published by                                 |
12
// | the Free Software Foundation; either version 2 of the License, or                                    |
13
// | (at your option) any later version.                                                                  |
14
// |                                                                                                      |
15
// | Foobar is distributed in the hope that it will be useful,                                            |
16
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
17
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
18
// | GNU General Public License for more details.                                                         |
19
// |                                                                                                      |
20
// | You should have received a copy of the GNU General Public License                                    |
21
// | along with Foobar; if not, write to the Free Software                                                |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
23
// +------------------------------------------------------------------------------------------------------+
8 jp_milcent 24
// CVS : $Id: hb_carto.php,v 1.2 2006-10-31 10:31:36 jp_milcent Exp $
2 jp_milcent 25
/**
26
* Application fournissant une cartographie des herbiers
27
*
28
* Fournit la carte des herbiers enregistrés dans la base de données.
29
*
30
*@package Herbier-Cartographie
31
//Auteur original :
32
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
33
//Autres auteurs :
34
*@author        Jean-Pascal MILCENT <jpm@clapas.org>
35
*@copyright     Tela-Botanica 2000-2005
8 jp_milcent 36
*@version       $Revision: 1.2 $ $Date: 2006-10-31 10:31:36 $
2 jp_milcent 37
// +------------------------------------------------------------------------------------------------------+
38
*/
39
 
40
// +------------------------------------------------------------------------------------------------------+
41
// |                                            ENTETE du PROGRAMME                                       |
42
// +------------------------------------------------------------------------------------------------------+
43
/** Inclusion du fichier de configuration de l'application Herbier - Cartographie. */
8 jp_milcent 44
require_once HB_CHEMIN_MODULE.'hb_carto'.GEN_SEP.'configuration'.GEN_SEP.'hbca_config.inc.php';
2 jp_milcent 45
 
46
/** Inclusion de la classe principale d'Herbier : herbier */
47
//require_once HB_CHEMIN_BIBLIO.'hb_herbier.class.php';
48
/** Inclusion de la classe Herbier : collection */
49
//require_once HB_CHEMIN_BIBLIO.'hb_collection.class.php';
50
/** Inclusion de la classe Herbier : indic */
51
//require_once HB_CHEMIN_BIBLIO.'hb_indic.class.php';
52
/** Inclusion de la classe Herbier : indic_hist */
53
//require_once HB_CHEMIN_BIBLIO.'hb_indic_hist.class.php';
54
/** Inclusion de la classe Herbier : organisation */
55
//require_once HB_CHEMIN_BIBLIO.'hb_organisation.class.php';
56
/** Inclusion de la classe Herbier : type */
57
//require_once HB_CHEMIN_BIBLIO.'hb_type.class.php';
58
/** Inclusion de la classe Herbier : equipe */
59
//require_once HB_CHEMIN_BIBLIO.'hb_equipe.class.php';
60
 
61
// Appel du fichier de traduction des textes de l'application Cartographie de Herbier
62
if (file_exists(HBCA_CHEMIN_LANGUES.'hbca_langue_'.HB_I18N.'.inc.php')) {
63
    /** Inclusion du fichier de traduction de l'application Lien Favoris. */
64
    include_once HBCA_CHEMIN_LANGUES.'hbca_langue_'.HB_I18N.'.inc.php';
65
} else {
66
    /** Inclusion du fichier de traduction fr par défaut. */
67
    include_once HBCA_CHEMIN_LANGUES.'hbca_langue_fr.inc.php';
68
}
69
/** Inclusion du fichier fournissant des informations pour la cartographie. */
70
require_once HBCA_CHEMIN_BIBLIO.'hbca_information.fonct.php';
71
 
72
/** Inclusion de la bibliothèque Cartographie. */
73
require_once HB_CHEMIN_BIBLIO_CARTO.'carto_carte.class.php';
74
 
75
// Initialisation de la variable à retourner
76
$sortie .= '<!-- Herbier - Cartographie : DEBUT -->'."\n";
77
 
78
// +------------------------------------------------------------------------------------------------------+
79
// |                                            CORPS du PROGRAMME                                        |
80
// +------------------------------------------------------------------------------------------------------+
81
 
82
global $NOM_FICHIER;
83
global $image_x;
84
global $image_y;
85
global $historique_cartes;
86
global $liste_zone_carte;
87
 
88
$requete =  'SELECT *, COUNT(CD_ID_Departement) AS nbr '.
89
            'FROM '.HB_BDD_NOM.'.HERBIERS_ORGANISATION, '.HB_BDD_NOM_CARTO.'.carto_DEPARTEMENT '.
90
            'WHERE COUNTRY_CODE = "fr" '.
91
            'AND CD_ID_Departement = if (substring(ZIP,1,2)<>"97", if (substring(ZIP,1,2)<>"98", substring(ZIP, 1,2),substring(ZIP,1,3)), substring(ZIP,1,3)) '.
92
            'GROUP BY CD_ID_Departement';
93
 
94
$resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
95
$tableau_organisation = array();
96
while ($ligne = mysql_fetch_object($resultat)) {
97
    $tableau_organisation[$ligne->CD_ID_Departement] = $ligne->nbr;
98
}
99
 
100
$info_dpt_france['nom_table_zone'] = HB_BDD_NOM_CARTO.'.carto_DEPARTEMENT';
101
$info_dpt_france['nom_chp_id_zone'] = 'CD_ID_Departement';
102
$info_dpt_france['nom_chp_nom_zone'] = 'CD_Intitule_departement';
103
$info_dpt_france['nom_chp_rouge'] = 'CD_Couleur_R';
104
$info_dpt_france['nom_chp_vert'] = 'CD_Couleur_V';
105
$info_dpt_france['nom_chp_bleu'] = 'CD_Couleur_B';
106
$info_dpt_france['nom_chp_zone_sup'] = 'CD_ID_Pays';
107
$info_dpt_france['tableau_valeurs_zone'] = $tableau_organisation;
108
 
109
// Instanciation du tableau contenant les champs de la table action
110
$info_table_action['nom_table_action'] = HB_BDD_NOM_CARTO.'.carto_ACTION';
111
$info_table_action['nom_chp_id_carte'] = 'CA_ID_Carte';
112
$info_table_action['nom_chp_id_zg_action'] = 'CA_ID_Zone_geo';
113
$info_table_action['nom_chp_type_zg'] = 'CA_Type_zone';
114
$info_table_action['nom_chp_action'] = 'CA_Action';
115
$info_table_action['nom_chp_id_carte_destination'] = 'CA_ID_Carte_destination';
116
 
117
// On cree tout d'abords l'arborescence
118
$france = new Carto_Carte(  'france',
119
                            'fr',
120
                            'France',
121
                            CAR_FICHIER_CARTE_FR_DPT_MASQUE,
122
                            CAR_FICHIER_CARTE_FR_DPT,
123
                            HB_CHEMIN_CARTE,
124
                            $info_dpt_france,
125
                            $info_table_action);
126
 
127
$france->historique_cartes = $historique_cartes;
128
$france->image_x = $image_x;
129
$france->image_y = $image_y;
130
$france->liste_zone_carte = $liste_zone_carte;
131
$france->url = HB_URL_COURANTE;
132
 
133
// Une fois l'arborescence creee on lance la methode donnerFormulaireImage() pour recuperer la carte
134
// (dans $carte_france). S'il n'y a pas de carte a afficher donnerFormulaireImage() renvoi false. On peut alors recuperer
135
// le niveau ou on en est grace a $france->historique (du type france*34).
136
$img_carte_france = $france->donnerFormulaireImage();
137
 
138
// On teste $donc carte_france
139
if (!$img_carte_france) {
140
    include 'hbca_herbier_liste.inc.php';
141
} else {
142
    // Construction du titre de la carte et de l'historique de navigation dans les cartes
143
    $historique_carte = new Carto_Historique($france, '&gt;', 'lien_non_souligne');
144
    $tab = explode('*', $france->historique);
145
    $id_carte = $tab[(count($tab) - 1)];
146
    $requete_historique =   'SELECT CDC_Titre_carte, CDC_Type_zone_carte, CDC_ID_Zone_geo_carte '.
147
                            'FROM '.HB_BDD_NOM_CARTO.'.carto_DESCRIPTION_CARTE '.
148
                            'WHERE CDC_ID_Carte = "'.$id_carte.'"';
149
    $resultat_historique = mysql_query($requete_historique) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_historique));
150
    $ligne_historique = mysql_fetch_object($resultat_historique);
151
    $structure_nbre = hbca_consulterNbreStructure($id_carte, $ligne_historique->CDC_Type_zone_carte, $ligne_historique->CDC_ID_Zone_geo_carte);
152
    $titre = '';
153
    if ($structure_nbre == 0) {
154
        $titre .= $ligne_historique->CDC_Titre_carte.' : aucun organisme répertorié';
155
    } else if ($structure_nbre == 1) {
156
        $titre .= $ligne_historique->CDC_Titre_carte.' : '.$structure_nbre.' organisme répertorié';
157
    } else {
158
        $titre .= $ligne_historique->CDC_Titre_carte.' : '.$structure_nbre.' organismes répertoriés';
159
    }
160
 
161
    // Sortie XHTML
162
    $sortie .= '<h1>'.$titre.'</h1>'."\n";
163
    $sortie .= '<p><strong>'.$historique_carte->afficherHistoriqueCarte().'</strong></p>'."\n";
164
 
165
    $sortie .= '<h2>Cliquez sur une zone de la carte pour zoomer.</h2>'."\n";
166
    $sortie .= '<p>La couleur est proportionnelle au nombre d\'organisations.'."\n";
167
 
168
    $sortie .= $img_carte_france;
169
 
170
    $sortie .= '<h2>'.'Avertissement et déni de responsabilité : '.'</h2>'."\n";
171
    $sortie .= '<p>'.'La représentation et l\'utilisation des frontières, des noms géographiques et autres données employés '."\n".
172
            'sur les cartes et utilisés dans les listes, les tableaux, les documents et les bases de données de ce site '."\n".
173
            'ne sont pas garanties sans erreurs, de même qu\'elles n\'engagent pas la responsabilité de l\'association '."\n".
174
            'ni n\'impliquent de reconnaissance officielle de sa part.'.'</p>'."\n";
175
}
176
 
177
// +------------------------------------------------------------------------------------------------------+
178
// |                                            PIED du PROGRAMME                                         |
179
// +------------------------------------------------------------------------------------------------------+
180
$sortie .= '<!-- Herbier - Cartographie : FIN -->'."\n";
181
 
182
/* +--Fin du code ----------------------------------------------------------------------------------------+
183
*
184
* $Log: not supported by cvs2svn $
8 jp_milcent 185
* Revision 1.1  2005/11/23 10:32:32  jp_milcent
186
* Ajout au dépot de l'application Herbiers.
187
* Elle doit à terme migrer dans eFlore.
188
*
2 jp_milcent 189
* Revision 1.1  2005/03/09 15:55:44  jpm
190
* Ajout de l'application Cartographie des Herbiers.
191
*
192
*
193
* +-- Fin du code ----------------------------------------------------------------------------------------+
194
*/
195
?>