Subversion Repositories eFlore/Applications.bibliobota

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 BiblioBota - Organisme Carto.                                                   |
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
// +------------------------------------------------------------------------------------------------------+
24
// CVS : $Id: bboc_organisme_liste.inc.php,v 1.1 2005-11-23 10:22:25 jp_milcent Exp $
25
/**
26
* Liste des organismes d'une zone géographique.
27
*
28
* Fichier fournissant la liste des organismes présents dans une zone géographique donnée.
29
*
30
*@package BiblioBota-OrganismeCarto
31
//Auteur original :
32
*@author        Jean-Charles GRANGER <tela@vecteur.org>
33
//Autres auteurs :
34
*@author        Jean-Pascal MILCENT <jpm@clapas.org>
35
*@copyright     Tela-Botanica 2000-2005
36
*@version       $Revision: 1.1 $ $Date: 2005-11-23 10:22:25 $
37
// +------------------------------------------------------------------------------------------------------+
38
*/
39
 
40
// +------------------------------------------------------------------------------------------------------+
41
// |                                            ENTETE du PROGRAMME                                       |
42
// +------------------------------------------------------------------------------------------------------+
43
$res .= '<!-- BiblioBota - Organisme Carto Liste : DEBUT -->'."\n";
44
 
45
// +------------------------------------------------------------------------------------------------------+
46
// |                                            CORPS du PROGRAMME                                        |
47
// +------------------------------------------------------------------------------------------------------+
48
$tabmonde = explode ('*', $monde->historique);
49
// +------------------------------------------------------------------------------------------------------+
50
// Nous avons à faire à un pays.
51
if (count($tabmonde) == 3) {
52
    $argument = $tabmonde[2];
53
 
54
    $query =    'SELECT * '.
55
                'FROM gen_COUNTRY '.
56
                'WHERE GC_ID = "'.$argument.'"';
57
    $result = mysql_query($query);
58
    $row = mysql_fetch_object($result) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query));
59
    $capitale = $row->GC_CAPITAL;
60
    $pays = $row->GC_NAME;
61
    $monde->nom = $monde->nom.'*'.$pays;
62
 
63
    // Titre de la page
64
    $query2 =   'SELECT COUNT(B_S_IDSTR) AS nbr '.
65
                'FROM biblio_str '.
66
                'WHERE B_S_PAYS = "'.$argument.'"';
67
    $result2 = mysql_query($query2);
68
    $row2 = mysql_fetch_object($result2) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query2));
69
    $res .= '<h1 class="titre1_cartographie">';
70
    if ($row2->nbr == 0) {
71
        $res .= $pays.' ('.$capitale.') : aucun organisme répertorié.';
72
    } else if ($row2->nbr==1) {
73
        $res .= $pays.' ('.$capitale.') : '.$row2->nbr.' organisme répertorié';
74
    } else {
75
        $res .= $pays.' ('.$capitale.') : '.$row2->nbr.' organismes répertoriés';
76
    }
77
    $res .= '</h1>'."\n";
78
 
79
    // Chemin historique navigation dans les cartes
80
    $tabonglet = explode('*', $monde->historique);
81
    $tabnom = explode('*', $monde->nom);
82
    $res .= '<p><strong>'."\n";
83
    foreach ($tabonglet as $key => $value) {
84
        if ($key == 0) {
85
            $chemin = $value;
86
            $value = 'monde';
87
            $res .=  '<a class="lien_non_souligne" href="'.$monde->url.'&amp;historique_cartes='.$chemin.'">'.
88
                    '&nbsp;&gt;&nbsp;'.$tabnom[$key].
89
                    '</a>';
90
        } else if ($key == (count($tabonglet) - 1)) {
91
            $res .=  '<a class="lien_non_souligne">'.
92
                    '&nbsp;&gt;&nbsp;'.$pays.
93
                    '</a>';
94
        } else {
95
            $chemin .= '*'.$value;
96
            $res .=  '<a class="lien_non_souligne" href="'.$monde->url.'&amp;historique_cartes='.$chemin.'">'.
97
                    '&nbsp;&gt;&nbsp;'.$tabnom[$key].
98
                    '</a>';
99
        }
100
    }
101
    $res .= '</strong></p>'."\n";
102
 
103
    // Création de la liste des organismes de la zone géographique.
104
    $query =    'SELECT * '.
105
                'FROM biblio_str, biblio_str_type '.
106
                'WHERE B_S_PAYS = "'.$argument.'" '.
107
                'AND B_S_CACHER = 0 '.
108
                'AND B_S_TYPESTR = B_TYPSTR_ID '.
109
                'ORDER BY B_S_NOM';
110
    $result = mysql_query($query);
111
    $nbr_final = mysql_num_rows($result) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query));
112
 
113
    $res .= '<h1 class="titre1_cartographie">'.'Liste des organismes :'.'</h1>'."\n";
114
    $res .= '<ul>'."\n";
115
    $i = 0;
116
    while ($row = mysql_fetch_object($result)) {
117
        $get_idstr = $row->B_S_IDSTR;
118
        $get_name = $row->B_S_NOM;
119
        $get_cp = $row->B_S_CODEPOSTAL;
120
        $get_ville = $row->B_S_VILLE;
121
        $get_date = $row->B_S_MAJFICHE;
122
        $get_categ = $row->B_S_TYPESTR;
123
        $get_categ_nom = $row->B_TYPSTR_LABEL;
124
 
125
        $res .= '<li>';
126
        $res .= '<strong>'.$get_name.'</strong> ';
127
        if ($get_ville != '') {
128
            $res .= '('.$get_ville.')';
129
        }
130
        $res .= ' - ';
131
        if ($get_categ > 0) {
132
            $res .= $get_categ_nom;
133
        }
134
        /* Cross Biblio est le module qui permet d'avoir accès au popup transversal BBPOPUP */
135
        if ($GLOBALS['var_biblio']['open_biblio_str'] == true) {
136
            $res .= ' - <a href="'.BB_URL_COURANTE_CONSULTATION_AVANCEE.'&amp;str='.$get_idstr.'&amp;arg_0=str%3D'.$get_idstr.
137
                    '&amp;arg_1=coll%3D'.$get_idstr.'&amp;arg_2=book%3D'.$get_idstr.'&amp;arg_3=media%3D'.$get_idstr.'">'.
138
                    'Plus d\'infos'.'</a>';
139
        }
140
        $res .= '</li>'."\n";
141
        $i++;
142
    }
143
    $res .= '</ul>'."\n";
144
// +------------------------------------------------------------------------------------------------------+
145
// Nous avons à faire à un département français.
146
} else if (count($tabmonde) == 4) {
147
    $argument = $tabmonde[3];
148
 
149
    $query =    'SELECT *'.
150
                ' FROM gen_FRENCH_DPT'.
151
                ' WHERE GFD_ID = "'.$argument.'"';
152
    $result = mysql_query($query);
153
    $row = mysql_fetch_object($result) or die (BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query));
154
    $nom = $row->GFD_NAME;
155
 
156
    // Titre de la page
157
    $query2 =   ' SELECT count(B_S_IDSTR) as nbr'.
158
                ' FROM biblio_str'.
159
                ' WHERE if (substring(B_S_CODEPOSTAL,1,2)<>"97", substring(B_S_CODEPOSTAL, 1,2), substring(B_S_CODEPOSTAL,1,3)) = '.$argument.
160
                ' AND B_S_PAYS="fr"';
161
    $result2 = mysql_query($query2);
162
    $row2 = mysql_fetch_object($result2) or die (BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query2));
163
    $res .= '<h1 class="titre1_cartographie">';
164
    if ($row2->nbr == 0) {
165
        $res .= $nom.' : aucun organisme répertoriée';
166
    } else if ($row2->nbr == 1) {
167
        $res .= $nom.' : '.$row2->nbr.' organisme répertorié';
168
    } else {
169
        $res .= $nom.' : '.$row2->nbr.' organismes répertoriés';
170
    }
171
    $res .= '</h1>'."\n";
172
 
173
    // Chemin historique navigation dans les cartes
174
    $tabonglet = explode ('*', $monde->historique);
175
    $tabnom = explode ('*', $monde->nom);
176
    $res .= '<p><strong>'."\n";
177
    foreach ($tabonglet as $key => $value) {
178
        if ($key == 0) {
179
            $chemin = $value;
180
            $value = 'monde';
181
            $res .= '<a class="lien_non_souligne" href="'.$monde->url.'&amp;historique_cartes='.$chemin.'">'.
182
                    '&nbsp;&gt;&nbsp;'.$tabnom[$key].
183
                    '</a>';
184
        } else if ($key == (count($tabonglet) - 1)) {
185
            $res .= '<a class="lien_non_souligne">'.
186
                    '&nbsp;&gt;&nbsp;'.$nom.
187
                    '</a>';
188
        } else {
189
            $chemin .= '*'.$value;
190
            $res .= '<a class="lien_non_souligne" href="'.$monde->url.'&amp;historique_cartes='.$chemin.'">'.
191
                    '&nbsp;&gt;&nbsp;'.$tabnom[$key].
192
                    '</a>';
193
        }
194
    }
195
    $res .= '</strong></p>'."\n";
196
 
197
    // Création de la liste des organismes de la zone géographique.
198
    $query =    'SELECT *'.
199
                ' FROM biblio_str, biblio_str_type'.
200
                ' WHERE B_S_PAYS="fr"'.
201
                ' AND if (substring(B_S_CODEPOSTAL,1,2) <> "97", substring(B_S_CODEPOSTAL, 1,2), substring(B_S_CODEPOSTAL,1,3)) = '.$argument.
202
                ' AND B_S_CACHER = 0'.
203
                ' AND B_S_TYPESTR = B_TYPSTR_ID'.
204
                ' ORDER BY B_S_NOM';
205
    $result = mysql_query($query);
206
    $nbr_final = mysql_num_rows($result) or die (BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query));
207
 
208
    $res .= '<h1 class="titre1_cartographie">'.'Liste des organismes :'.'</h1>'."\n";
209
    $res .= '<ul>'."\n";
210
    $i = 0;
211
    while ($row = mysql_fetch_object($result)) {
212
        $get_idstr = $row->B_S_IDSTR;
213
        $get_name =    $row->B_S_NOM;
214
        $get_cp = $row->B_S_CODEPOSTAL;
215
        $get_ville = $row->B_S_VILLE;
216
        $get_date = $row->B_S_MAJFICHE;
217
        $get_categ = $row->B_S_TYPESTR;
218
        $get_categ_nom = $row->B_TYPSTR_LABEL;
219
 
220
        $res .= '<li>';
221
        $res .= '<strong>'.$get_name.'</strong> ';
222
        if ($get_ville != '') {
223
            $res .= '('.$get_ville.')';
224
        }
225
        $res .= ' - ';
226
        if ($get_categ > 0) {
227
            $res .= $get_categ_nom;
228
        }
229
        /* Cross Biblio est le module qui permet d'avoir accès au popup transversal BBPOPUP */
230
        if ($GLOBALS['var_biblio']['open_biblio_str'] == true) {
231
            $res .= ' - <a href="'.BB_URL_COURANTE_CONSULTATION_AVANCEE.'&amp;str='.$get_idstr.'&amp;arg_0=str%3D'.$get_idstr.
232
                    '&amp;arg_1=coll%3D'.$get_idstr.'&amp;arg_2=book%3D'.$get_idstr.'&amp;arg_3=media%3D'.$get_idstr.'">'.
233
                    'Plus d\'infos'.'</a>';
234
        }
235
        $res .= '</li>'."\n";
236
        $i++;
237
    }
238
    $res .= '</ul>'."\n";
239
}
240
 
241
// +------------------------------------------------------------------------------------------------------+
242
// |                                            PIED du PROGRAMME                                         |
243
// +------------------------------------------------------------------------------------------------------+
244
$res .= '<!-- BiblioBota - Organisme Carto Liste : FIN -->'."\n";
245
 
246
/* +--Fin du code ----------------------------------------------------------------------------------------+
247
*
248
* $Log: not supported by cvs2svn $
249
* Revision 1.2  2005/05/30 09:14:04  jpm
250
* Ajout de class aux titres!
251
*
252
* Revision 1.1  2005/03/01 15:19:17  jpm
253
* Ajout des fichiers principaux de l'application Organisme Carto de Biblio Bota.
254
*
255
*
256
* +-- Fin du code ----------------------------------------------------------------------------------------+
257
*/
258
?>