Subversion Repositories eFlore/Archives.herbiers

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1                                                                                      |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org)                                         |
// +------------------------------------------------------------------------------------------------------+
// | This file is part of Herbier - Cartographie.                                                         |
// |                                                                                                      |
// | Foobar is free software; you can redistribute it and/or modify                                       |
// | it under the terms of the GNU General Public License as published by                                 |
// | the Free Software Foundation; either version 2 of the License, or                                    |
// | (at your option) any later version.                                                                  |
// |                                                                                                      |
// | Foobar is distributed in the hope that it will be useful,                                            |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
// | GNU General Public License for more details.                                                         |
// |                                                                                                      |
// | You should have received a copy of the GNU General Public License                                    |
// | along with Foobar; if not, write to the Free Software                                                |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: hb_carto.php,v 1.1 2005-11-23 10:32:32 jp_milcent Exp $
/**
* Application fournissant une cartographie des herbiers
*
* Fournit la carte des herbiers enregistrés dans la base de données.
*
*@package Herbier-Cartographie
//Auteur original :
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
//Autres auteurs :
*@author        Jean-Pascal MILCENT <jpm@clapas.org>
*@copyright     Tela-Botanica 2000-2005
*@version       $Revision: 1.1 $ $Date: 2005-11-23 10:32:32 $
// +------------------------------------------------------------------------------------------------------+
*/

// +------------------------------------------------------------------------------------------------------+
// |                                            ENTETE du PROGRAMME                                       |
// +------------------------------------------------------------------------------------------------------+
/** Inclusion du fichier de configuration de l'application Herbier - Cartographie. */
require_once HB_CHEMIN_APPLI.'hb_carto'.GEN_SEP.'configuration'.GEN_SEP.'hbca_config.inc.php';

/** Inclusion de la classe principale d'Herbier : herbier */
//require_once HB_CHEMIN_BIBLIO.'hb_herbier.class.php';
/** Inclusion de la classe Herbier : collection */
//require_once HB_CHEMIN_BIBLIO.'hb_collection.class.php';
/** Inclusion de la classe Herbier : indic */
//require_once HB_CHEMIN_BIBLIO.'hb_indic.class.php';
/** Inclusion de la classe Herbier : indic_hist */
//require_once HB_CHEMIN_BIBLIO.'hb_indic_hist.class.php';
/** Inclusion de la classe Herbier : organisation */
//require_once HB_CHEMIN_BIBLIO.'hb_organisation.class.php';
/** Inclusion de la classe Herbier : type */
//require_once HB_CHEMIN_BIBLIO.'hb_type.class.php';
/** Inclusion de la classe Herbier : equipe */
//require_once HB_CHEMIN_BIBLIO.'hb_equipe.class.php';

// Appel du fichier de traduction des textes de l'application Cartographie de Herbier
if (file_exists(HBCA_CHEMIN_LANGUES.'hbca_langue_'.HB_I18N.'.inc.php')) {
    /** Inclusion du fichier de traduction de l'application Lien Favoris. */
    include_once HBCA_CHEMIN_LANGUES.'hbca_langue_'.HB_I18N.'.inc.php';
} else {
    /** Inclusion du fichier de traduction fr par défaut. */
    include_once HBCA_CHEMIN_LANGUES.'hbca_langue_fr.inc.php';
}
/** Inclusion du fichier fournissant des informations pour la cartographie. */
require_once HBCA_CHEMIN_BIBLIO.'hbca_information.fonct.php';

/** Inclusion de la bibliothèque Cartographie. */
require_once HB_CHEMIN_BIBLIO_CARTO.'carto_carte.class.php';

// Initialisation de la variable à retourner
$sortie .= '<!-- Herbier - Cartographie : DEBUT -->'."\n";

// +------------------------------------------------------------------------------------------------------+
// |                                            CORPS du PROGRAMME                                        |
// +------------------------------------------------------------------------------------------------------+

global $NOM_FICHIER;
global $image_x;
global $image_y;
global $historique_cartes;
global $liste_zone_carte;

$requete =  'SELECT *, COUNT(CD_ID_Departement) AS nbr '.
            'FROM '.HB_BDD_NOM.'.HERBIERS_ORGANISATION, '.HB_BDD_NOM_CARTO.'.carto_DEPARTEMENT '.
            'WHERE COUNTRY_CODE = "fr" '.
            '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)) '.
            'GROUP BY CD_ID_Departement';

$resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
$tableau_organisation = array();
while ($ligne = mysql_fetch_object($resultat)) {
    $tableau_organisation[$ligne->CD_ID_Departement] = $ligne->nbr;
}

$info_dpt_france['nom_table_zone'] = HB_BDD_NOM_CARTO.'.carto_DEPARTEMENT';
$info_dpt_france['nom_chp_id_zone'] = 'CD_ID_Departement';
$info_dpt_france['nom_chp_nom_zone'] = 'CD_Intitule_departement';
$info_dpt_france['nom_chp_rouge'] = 'CD_Couleur_R';
$info_dpt_france['nom_chp_vert'] = 'CD_Couleur_V';
$info_dpt_france['nom_chp_bleu'] = 'CD_Couleur_B';
$info_dpt_france['nom_chp_zone_sup'] = 'CD_ID_Pays';
$info_dpt_france['tableau_valeurs_zone'] = $tableau_organisation;

// Instanciation du tableau contenant les champs de la table action
$info_table_action['nom_table_action'] = HB_BDD_NOM_CARTO.'.carto_ACTION';
$info_table_action['nom_chp_id_carte'] = 'CA_ID_Carte';
$info_table_action['nom_chp_id_zg_action'] = 'CA_ID_Zone_geo';
$info_table_action['nom_chp_type_zg'] = 'CA_Type_zone';
$info_table_action['nom_chp_action'] = 'CA_Action';
$info_table_action['nom_chp_id_carte_destination'] = 'CA_ID_Carte_destination';

// On cree tout d'abords l'arborescence
$france = new Carto_Carte(  'france', 
                            'fr', 
                            'France', 
                            CAR_FICHIER_CARTE_FR_DPT_MASQUE, 
                            CAR_FICHIER_CARTE_FR_DPT, 
                            HB_CHEMIN_CARTE, 
                            $info_dpt_france, 
                            $info_table_action);

$france->historique_cartes = $historique_cartes;
$france->image_x = $image_x;
$france->image_y = $image_y;
$france->liste_zone_carte = $liste_zone_carte;
$france->url = HB_URL_COURANTE;

// Une fois l'arborescence creee on lance la methode donnerFormulaireImage() pour recuperer la carte
// (dans $carte_france). S'il n'y a pas de carte a afficher donnerFormulaireImage() renvoi false. On peut alors recuperer
// le niveau ou on en est grace a $france->historique (du type france*34).
$img_carte_france = $france->donnerFormulaireImage();

// On teste $donc carte_france
if (!$img_carte_france) {
    include 'hbca_herbier_liste.inc.php';
} else {
    // Construction du titre de la carte et de l'historique de navigation dans les cartes
    $historique_carte = new Carto_Historique($france, '&gt;', 'lien_non_souligne');
    $tab = explode('*', $france->historique);
    $id_carte = $tab[(count($tab) - 1)];
    $requete_historique =   'SELECT CDC_Titre_carte, CDC_Type_zone_carte, CDC_ID_Zone_geo_carte '.
                            'FROM '.HB_BDD_NOM_CARTO.'.carto_DESCRIPTION_CARTE '.
                            'WHERE CDC_ID_Carte = "'.$id_carte.'"';
    $resultat_historique = mysql_query($requete_historique) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_historique));
    $ligne_historique = mysql_fetch_object($resultat_historique);
    $structure_nbre = hbca_consulterNbreStructure($id_carte, $ligne_historique->CDC_Type_zone_carte, $ligne_historique->CDC_ID_Zone_geo_carte);
    $titre = '';
    if ($structure_nbre == 0) {
        $titre .= $ligne_historique->CDC_Titre_carte.' : aucun organisme répertorié';
    } else if ($structure_nbre == 1) {
        $titre .= $ligne_historique->CDC_Titre_carte.' : '.$structure_nbre.' organisme répertorié';
    } else {
        $titre .= $ligne_historique->CDC_Titre_carte.' : '.$structure_nbre.' organismes répertoriés';
    }
    
    // Sortie XHTML
    $sortie .= '<h1>'.$titre.'</h1>'."\n";
    $sortie .= '<p><strong>'.$historique_carte->afficherHistoriqueCarte().'</strong></p>'."\n";
    
    $sortie .= '<h2>Cliquez sur une zone de la carte pour zoomer.</h2>'."\n";
    $sortie .= '<p>La couleur est proportionnelle au nombre d\'organisations.'."\n";
    
    $sortie .= $img_carte_france;
    
    $sortie .= '<h2>'.'Avertissement et déni de responsabilité : '.'</h2>'."\n";
    $sortie .= '<p>'.'La représentation et l\'utilisation des frontières, des noms géographiques et autres données employés '."\n".
            'sur les cartes et utilisés dans les listes, les tableaux, les documents et les bases de données de ce site '."\n".
            'ne sont pas garanties sans erreurs, de même qu\'elles n\'engagent pas la responsabilité de l\'association '."\n".
            'ni n\'impliquent de reconnaissance officielle de sa part.'.'</p>'."\n";
}

// +------------------------------------------------------------------------------------------------------+
// |                                            PIED du PROGRAMME                                         |
// +------------------------------------------------------------------------------------------------------+
$sortie .= '<!-- Herbier - Cartographie : FIN -->'."\n";

/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.1  2005/03/09 15:55:44  jpm
* Ajout de l'application Cartographie des Herbiers.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>