New file |
0,0 → 1,252 |
<?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 BiblioBota - Organisme Carto. | |
// | | |
// | 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: bb_organisme_carto.php,v 1.1 2005-11-23 10:22:25 jp_milcent Exp $ |
/** |
* Application affichant une cartographie des organismes |
* |
* Fournit une carte des organimes liés à la botanique stockés dans la base Biblio Bota. |
* |
*@package BiblioBota-OrganismeCarto |
//Auteur original : |
*@author Jean-Charles GRANGER <tela@vecteur.org> |
//Autres auteurs : |
*@author Jean-Pascal MILCENT <jpm@clapas.org> |
*@copyright Tela-Botanica 2000-2005 |
*@version $Revision: 1.1 $ $Date: 2005-11-23 10:22:25 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
// +------------------------------------------------------------------------------------------------------+ |
// | ENTETE du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
/** Inclusion du fichier de configuration de l'application Organisme Carto. */ |
require_once BB_CHEMIN_APPLI.'bb_organisme_carto/configuration/bboc_config.inc.php'; |
|
// Appel du fichier de traduction des textes de l'application Organisme Carto de Biblio Bota |
if (file_exists(BBOC_CHEMIN_LANGUES.'bboc_langue_'.BB_URL_I18N.'.inc.php')) { |
/** Inclusion du fichier de traduction de l'application Organisme Carto. */ |
include_once BBOC_CHEMIN_LANGUES.'bboc_langue_'.BB_URL_I18N.'.inc.php'; |
} else { |
/** Inclusion du fichier de traduction fr par défaut. */ |
include_once BBOC_CHEMIN_LANGUES.'bboc_langue_fr.inc.php'; |
} |
|
/** Inclusion du fichier comportant des fonctions fournissant des informations pour l'application Organisme Carto.*/ |
include_once BBOC_CHEMIN_BIBLIO.'bboc_information.fonct.php'; |
|
/** Inclusion de la bibliothèque Cartographie. */ |
require_once BBOC_CHEMIN_BIBLIO_CARTO.'carto_carte.class.php'; |
|
// +------------------------------------------------------------------------------------------------------+ |
// Initialisation des variables |
$res = ''; |
$res .= '<!-- BiblioBota - Organisme Carto : DEBUT -->'."\n"; |
|
// +------------------------------------------------------------------------------------------------------+ |
// | CORPS du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
|
// +------------------------------------------------------------------------------------------------------+ |
// Instanciation du tableau contenant les champs de la table action |
$info_table_action['nom_table_action'] = BB_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'; |
|
// +------------------------------------------------------------------------------------------------------+ |
$requete_01 = 'SELECT DISTINCT CP_ID_Continent, count(CP_ID_Continent) as nbr '. |
'FROM '.BB_BDD_NOM.'.biblio_str, '.BB_BDD_NOM_CARTO.'.carto_PAYS '. |
'WHERE B_S_PAYS = CP_ID_Pays '. |
'AND CP_ID_Continent <> 0 '. |
'GROUP BY CP_ID_Continent'; |
|
$resultat_01 = mysql_query($requete_01) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_01)); |
|
$tableau_asso_continent = array(); |
|
while ($ligne_01 = mysql_fetch_object($resultat_01)) { |
$tableau_asso_continent[$ligne_01->CP_ID_Continent] = $ligne_01->nbr; |
} |
|
$info_continent['nom_table_zone'] = BB_BDD_NOM_CARTO.'.carto_CONTINENT'; |
$info_continent['nom_chp_id_zone'] = 'CC_ID_Continent'; |
$info_continent['nom_chp_nom_zone'] = 'CC_Intitule_continent'; |
$info_continent['nom_chp_rouge'] = 'CC_Couleur_R'; |
$info_continent['nom_chp_vert'] = 'CC_Couleur_V'; |
$info_continent['nom_chp_bleu'] = 'CC_Couleur_B'; |
$info_continent['nom_chp_zone_sup'] = ''; |
$info_continent['tableau_valeurs_zone'] = $tableau_asso_continent; |
|
// +------------------------------------------------------------------------------------------------------+ |
$requete_02 = 'SELECT CC_ID_Continent '. |
'FROM '.BB_BDD_NOM_CARTO.'.carto_CONTINENT'; |
|
$resultat_02 = mysql_query ($requete_02) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_02)); |
|
while ($ligne_02 = mysql_fetch_object($resultat_02)) { |
$requete_03 = 'SELECT CP_ID_Pays, count(B_S_PAYS) as nbr '. |
'FROM '.BB_BDD_NOM.'.biblio_str, '.BB_BDD_NOM_CARTO.'.carto_PAYS '. |
'WHERE B_S_PAYS = CP_ID_Pays '. |
'AND CP_ID_Continent = "'.$ligne_02->CC_ID_Continent.'" '. |
'GROUP BY B_S_PAYS'; |
$resultat_03 = mysql_query($requete_03) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_03)); |
|
$tableau_asso_pays = array(); |
|
while ($ligne_03 = mysql_fetch_object($resultat_03)) { |
$tableau_asso_pays[$ligne_03->CP_ID_Pays] = $ligne_03->nbr; |
} |
|
$info_pays[$ligne_02->CC_ID_Continent]['nom_table_zone'] = BB_BDD_NOM_CARTO.'.carto_PAYS'; |
$info_pays[$ligne_02->CC_ID_Continent]['nom_chp_id_zone'] = 'CP_ID_Pays'; |
$info_pays[$ligne_02->CC_ID_Continent]['nom_chp_nom_zone'] = 'CP_Intitule_pays'; |
$info_pays[$ligne_02->CC_ID_Continent]['nom_chp_rouge'] = 'CP_Couleur_R'; |
$info_pays[$ligne_02->CC_ID_Continent]['nom_chp_vert'] = 'CP_Couleur_V'; |
$info_pays[$ligne_02->CC_ID_Continent]['nom_chp_bleu'] = 'CP_Couleur_B'; |
$info_pays[$ligne_02->CC_ID_Continent]['nom_chp_zone_sup'] = 'CP_ID_Continent'; |
$info_pays[$ligne_02->CC_ID_Continent]['tableau_valeurs_zone'] = $tableau_asso_pays; |
} |
|
// +------------------------------------------------------------------------------------------------------+ |
$requete_04 = 'SELECT CD_ID_Departement, COUNT(CD_ID_Departement) AS nbr '. |
'FROM '.BB_BDD_NOM.'.biblio_str, '.BB_BDD_NOM_CARTO.'.carto_DEPARTEMENT '. |
'WHERE B_S_PAYS = "fr" '. |
'AND CD_ID_Departement = IF (SUBSTRING(B_S_CODEPOSTAL,1,2)<>"97", SUBSTRING(B_S_CODEPOSTAL, 1,2), SUBSTRING(B_S_CODEPOSTAL,1,3)) '. |
'GROUP BY CD_ID_Departement'; |
$resultat_04 = mysql_query($requete_04) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_04)); |
|
$tableau_asso_dpt_france = array(); |
|
while ($ligne_04 = mysql_fetch_object($resultat_04)) { |
$tableau_asso_dpt_france[$ligne_04->CD_ID_Departement] = $ligne_04->nbr; |
} |
|
$info_dpt_france['nom_table_zone'] = BB_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_asso_dpt_france; |
|
// On cree tout d'abords l'arborescence |
$monde = new Carto_Carte('continent', '', 'Monde', 'monde_masque5c.png', 'monde5c.png', BBOC_CHEMIN_CARTE, $info_continent, $info_table_action); |
|
$monde->historique_cartes = isset($GLOBALS['historique_cartes']) ? $GLOBALS['historique_cartes'] : ''; |
$monde->image_x = isset($GLOBALS['image_x']) ? $GLOBALS['image_x'] : ''; |
$monde->image_y = isset($GLOBALS['image_y']) ? $GLOBALS['image_y'] : ''; |
$monde->liste_zone_carte = isset($GLOBALS['liste_zone_carte']) ? $GLOBALS['liste_zone_carte'] : ''; |
$monde->url = $GLOBALS['_BIBLIO_']['url']->getURL(); |
|
foreach ($info_pays as $cle => $valeur) { |
$requete_05 = 'SELECT CDC_Titre_carte, CDC_ID_Carte, CDC_Carte_fond, CDC_Carte_masque, CDC_ID_Zone_geo_carte '. |
'FROM '.BB_BDD_NOM_CARTO.'.carto_DESCRIPTION_CARTE, '.BB_BDD_NOM_CARTO.'.carto_ACTION '. |
'WHERE CA_ID_Zone_geo = "'.$cle.'" '. |
'AND CA_Type_zone = 1 '. |
'AND CA_ID_Carte_destination = CDC_ID_Carte'; |
$resultat_05 = mysql_query($requete_05) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_05)); |
$resultat_05_nbre = mysql_num_rows($resultat_05); |
|
if ($resultat_05_nbre > 0) { |
$ligne_05 = mysql_fetch_object($resultat_05); |
$monde->ajouterFils( $ligne_05->CDC_ID_Carte, $ligne_05->CDC_ID_Zone_geo_carte, $ligne_05->CDC_Titre_carte, |
$ligne_05->CDC_Carte_masque, $ligne_05->CDC_Carte_fond, $valeur, $info_table_action); |
} |
} |
|
$monde->fils['europe']->ajouterFils('france', 'fr', 'France' ,'france_masque.png', 'france.png', $info_dpt_france, $info_table_action); |
|
// Une fois l'arborescence créée on lance la méthode donnerFormulaireImage() pour récuperer le formulaire de la carte |
// (dans $img). S'il n'y a pas de carte à afficher donnerFormulaireImage() renvoi false. On peut alors récupérer |
// le niveau ou on en est grâce à $monde->historique (du type continent*namerique*ca). |
$img = $monde->donnerFormulaireImage(); |
|
// Test d'img |
if (!$img ) { |
/** Inclusion du fichier d'affichage des infos sur les organismes d'une zone. */ |
include_once BBOC_CHEMIN_RACINE.'bboc_organisme_liste.inc.php'; |
} else { |
// Construction du titre de la carte et de l'historique de navigation dans les cartes |
$historique_carte = new Carto_Historique($monde, '>', 'lien_non_souligne'); |
$tab = explode('*',$monde->historique); |
$id_carte = $tab[(count($tab)-1)]; |
$requete_06 = 'SELECT CDC_Titre_carte, CDC_Type_zone_carte, CDC_ID_Zone_geo_carte '. |
'FROM '.BB_BDD_NOM_CARTO.'.carto_DESCRIPTION_CARTE '. |
'WHERE CDC_ID_Carte = "'.$id_carte.'"'; |
$resultat_06 = mysql_query($requete_06) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_06)); |
$ligne_06 = mysql_fetch_object($resultat_06); |
$structure_nbre = bboc_consulterNbreStructure($id_carte, $ligne_06->CDC_Type_zone_carte, $ligne_06->CDC_ID_Zone_geo_carte); |
$titre = ''; |
if ($structure_nbre == 0) { |
$titre .= $ligne_06->CDC_Titre_carte.' : aucun organisme répertorié'; |
} else if ($structure_nbre == 1) { |
$titre .= $ligne_06->CDC_Titre_carte.' : '.$structure_nbre.' organisme répertorié'; |
} else { |
$titre .= $ligne_06->CDC_Titre_carte.' : '.$structure_nbre.' organismes répertoriés'; |
} |
|
// Sortie XHTML |
$res .= '<h1 class="titre1_cartographie">'.$titre.'</h1>'."\n"; |
$res .= '<p><strong>'.$historique_carte->afficherHistoriqueCarte().'</strong></p>'."\n"; |
|
$res .= '<h2 class="titre2_cartographie">Cliquez sur une zone de la carte pour zoomer.</h2>'."\n"; |
$res .= '<p>La couleur est proportionnelle au nombre d\'organisations.'."\n"; |
|
$res .= $img; |
|
$res .= '<h2 class="titre2_cartographie">'.'Avertissement et déni de responsabilité : '.'</h2>'."\n"; |
$res .= '<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 | |
// +------------------------------------------------------------------------------------------------------+ |
$res .= '<!-- BiblioBota - Organisme Carto : FIN -->'."\n"; |
$sortie = $res; |
|
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.4 2005/05/30 09:10:26 jpm |
* Ajout de class aux titres! |
* |
* Revision 1.3 2005/05/17 10:10:08 jpm |
* Correction des bogues avant mise en ligne du site v4. |
* |
* Revision 1.2 2005/04/13 10:12:29 jpm |
* Ajout de la constante indiquant la bdd des tables de la carto. |
* |
* Revision 1.1 2005/03/01 15:19:17 jpm |
* Ajout des fichiers principaux de l'application Organisme Carto de Biblio Bota. |
* |
* |
* +-- Fin du code ----------------------------------------------------------------------------------------+ |
*/ |
?> |