Subversion Repositories eFlore/Applications.bibliobota

Compare Revisions

Ignore whitespace Rev 1 → Rev 2

/trunk/applications/bb_organisme_carto/bboc_organisme_liste.inc.php
New file
0,0 → 1,258
<?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: bboc_organisme_liste.inc.php,v 1.1 2005-11-23 10:22:25 jp_milcent Exp $
/**
* Liste des organismes d'une zone géographique.
*
* Fichier fournissant la liste des organismes présents dans une zone géographique donnée.
*
*@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 |
// +------------------------------------------------------------------------------------------------------+
$res .= '<!-- BiblioBota - Organisme Carto Liste : DEBUT -->'."\n";
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
$tabmonde = explode ('*', $monde->historique);
// +------------------------------------------------------------------------------------------------------+
// Nous avons à faire à un pays.
if (count($tabmonde) == 3) {
$argument = $tabmonde[2];
$query = 'SELECT * '.
'FROM gen_COUNTRY '.
'WHERE GC_ID = "'.$argument.'"';
$result = mysql_query($query);
$row = mysql_fetch_object($result) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query));
$capitale = $row->GC_CAPITAL;
$pays = $row->GC_NAME;
$monde->nom = $monde->nom.'*'.$pays;
// Titre de la page
$query2 = 'SELECT COUNT(B_S_IDSTR) AS nbr '.
'FROM biblio_str '.
'WHERE B_S_PAYS = "'.$argument.'"';
$result2 = mysql_query($query2);
$row2 = mysql_fetch_object($result2) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query2));
$res .= '<h1 class="titre1_cartographie">';
if ($row2->nbr == 0) {
$res .= $pays.' ('.$capitale.') : aucun organisme répertorié.';
} else if ($row2->nbr==1) {
$res .= $pays.' ('.$capitale.') : '.$row2->nbr.' organisme répertorié';
} else {
$res .= $pays.' ('.$capitale.') : '.$row2->nbr.' organismes répertoriés';
}
$res .= '</h1>'."\n";
// Chemin historique navigation dans les cartes
$tabonglet = explode('*', $monde->historique);
$tabnom = explode('*', $monde->nom);
$res .= '<p><strong>'."\n";
foreach ($tabonglet as $key => $value) {
if ($key == 0) {
$chemin = $value;
$value = 'monde';
$res .= '<a class="lien_non_souligne" href="'.$monde->url.'&amp;historique_cartes='.$chemin.'">'.
'&nbsp;&gt;&nbsp;'.$tabnom[$key].
'</a>';
} else if ($key == (count($tabonglet) - 1)) {
$res .= '<a class="lien_non_souligne">'.
'&nbsp;&gt;&nbsp;'.$pays.
'</a>';
} else {
$chemin .= '*'.$value;
$res .= '<a class="lien_non_souligne" href="'.$monde->url.'&amp;historique_cartes='.$chemin.'">'.
'&nbsp;&gt;&nbsp;'.$tabnom[$key].
'</a>';
}
}
$res .= '</strong></p>'."\n";
// Création de la liste des organismes de la zone géographique.
$query = 'SELECT * '.
'FROM biblio_str, biblio_str_type '.
'WHERE B_S_PAYS = "'.$argument.'" '.
'AND B_S_CACHER = 0 '.
'AND B_S_TYPESTR = B_TYPSTR_ID '.
'ORDER BY B_S_NOM';
$result = mysql_query($query);
$nbr_final = mysql_num_rows($result) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query));
$res .= '<h1 class="titre1_cartographie">'.'Liste des organismes :'.'</h1>'."\n";
$res .= '<ul>'."\n";
$i = 0;
while ($row = mysql_fetch_object($result)) {
$get_idstr = $row->B_S_IDSTR;
$get_name = $row->B_S_NOM;
$get_cp = $row->B_S_CODEPOSTAL;
$get_ville = $row->B_S_VILLE;
$get_date = $row->B_S_MAJFICHE;
$get_categ = $row->B_S_TYPESTR;
$get_categ_nom = $row->B_TYPSTR_LABEL;
$res .= '<li>';
$res .= '<strong>'.$get_name.'</strong> ';
if ($get_ville != '') {
$res .= '('.$get_ville.')';
}
$res .= ' - ';
if ($get_categ > 0) {
$res .= $get_categ_nom;
}
/* Cross Biblio est le module qui permet d'avoir accès au popup transversal BBPOPUP */
if ($GLOBALS['var_biblio']['open_biblio_str'] == true) {
$res .= ' - <a href="'.BB_URL_COURANTE_CONSULTATION_AVANCEE.'&amp;str='.$get_idstr.'&amp;arg_0=str%3D'.$get_idstr.
'&amp;arg_1=coll%3D'.$get_idstr.'&amp;arg_2=book%3D'.$get_idstr.'&amp;arg_3=media%3D'.$get_idstr.'">'.
'Plus d\'infos'.'</a>';
}
$res .= '</li>'."\n";
$i++;
}
$res .= '</ul>'."\n";
// +------------------------------------------------------------------------------------------------------+
// Nous avons à faire à un département français.
} else if (count($tabmonde) == 4) {
$argument = $tabmonde[3];
$query = 'SELECT *'.
' FROM gen_FRENCH_DPT'.
' WHERE GFD_ID = "'.$argument.'"';
$result = mysql_query($query);
$row = mysql_fetch_object($result) or die (BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query));
$nom = $row->GFD_NAME;
// Titre de la page
$query2 = ' SELECT count(B_S_IDSTR) as nbr'.
' FROM biblio_str'.
' WHERE if (substring(B_S_CODEPOSTAL,1,2)<>"97", substring(B_S_CODEPOSTAL, 1,2), substring(B_S_CODEPOSTAL,1,3)) = '.$argument.
' AND B_S_PAYS="fr"';
$result2 = mysql_query($query2);
$row2 = mysql_fetch_object($result2) or die (BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query2));
$res .= '<h1 class="titre1_cartographie">';
if ($row2->nbr == 0) {
$res .= $nom.' : aucun organisme répertoriée';
} else if ($row2->nbr == 1) {
$res .= $nom.' : '.$row2->nbr.' organisme répertorié';
} else {
$res .= $nom.' : '.$row2->nbr.' organismes répertoriés';
}
$res .= '</h1>'."\n";
// Chemin historique navigation dans les cartes
$tabonglet = explode ('*', $monde->historique);
$tabnom = explode ('*', $monde->nom);
$res .= '<p><strong>'."\n";
foreach ($tabonglet as $key => $value) {
if ($key == 0) {
$chemin = $value;
$value = 'monde';
$res .= '<a class="lien_non_souligne" href="'.$monde->url.'&amp;historique_cartes='.$chemin.'">'.
'&nbsp;&gt;&nbsp;'.$tabnom[$key].
'</a>';
} else if ($key == (count($tabonglet) - 1)) {
$res .= '<a class="lien_non_souligne">'.
'&nbsp;&gt;&nbsp;'.$nom.
'</a>';
} else {
$chemin .= '*'.$value;
$res .= '<a class="lien_non_souligne" href="'.$monde->url.'&amp;historique_cartes='.$chemin.'">'.
'&nbsp;&gt;&nbsp;'.$tabnom[$key].
'</a>';
}
}
$res .= '</strong></p>'."\n";
// Création de la liste des organismes de la zone géographique.
$query = 'SELECT *'.
' FROM biblio_str, biblio_str_type'.
' WHERE B_S_PAYS="fr"'.
' AND if (substring(B_S_CODEPOSTAL,1,2) <> "97", substring(B_S_CODEPOSTAL, 1,2), substring(B_S_CODEPOSTAL,1,3)) = '.$argument.
' AND B_S_CACHER = 0'.
' AND B_S_TYPESTR = B_TYPSTR_ID'.
' ORDER BY B_S_NOM';
$result = mysql_query($query);
$nbr_final = mysql_num_rows($result) or die (BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query));
$res .= '<h1 class="titre1_cartographie">'.'Liste des organismes :'.'</h1>'."\n";
$res .= '<ul>'."\n";
$i = 0;
while ($row = mysql_fetch_object($result)) {
$get_idstr = $row->B_S_IDSTR;
$get_name = $row->B_S_NOM;
$get_cp = $row->B_S_CODEPOSTAL;
$get_ville = $row->B_S_VILLE;
$get_date = $row->B_S_MAJFICHE;
$get_categ = $row->B_S_TYPESTR;
$get_categ_nom = $row->B_TYPSTR_LABEL;
$res .= '<li>';
$res .= '<strong>'.$get_name.'</strong> ';
if ($get_ville != '') {
$res .= '('.$get_ville.')';
}
$res .= ' - ';
if ($get_categ > 0) {
$res .= $get_categ_nom;
}
/* Cross Biblio est le module qui permet d'avoir accès au popup transversal BBPOPUP */
if ($GLOBALS['var_biblio']['open_biblio_str'] == true) {
$res .= ' - <a href="'.BB_URL_COURANTE_CONSULTATION_AVANCEE.'&amp;str='.$get_idstr.'&amp;arg_0=str%3D'.$get_idstr.
'&amp;arg_1=coll%3D'.$get_idstr.'&amp;arg_2=book%3D'.$get_idstr.'&amp;arg_3=media%3D'.$get_idstr.'">'.
'Plus d\'infos'.'</a>';
}
$res .= '</li>'."\n";
$i++;
}
$res .= '</ul>'."\n";
}
 
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
$res .= '<!-- BiblioBota - Organisme Carto Liste : FIN -->'."\n";
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.2 2005/05/30 09:14:04 jpm
* Ajout de class aux titres!
*
* 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 ----------------------------------------------------------------------------------------+
*/
?>