Subversion Repositories eFlore/Applications.bibliobota

Rev

Go to most recent revision | Details | 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) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | Lesser General Public License for more details.                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: bbc_moteur_structure.fonct.php,v 1.1 2005-11-23 10:22:25 jp_milcent Exp $
23
/**
24
* Fonctions de création du moteur de recherche des structures.
25
*
26
* Contient les fonctions permettant de retourner l'affichage du moteur de recherche des structures.
27
* Valable pour le paramètre "structure".
28
*
29
*@package BiblioBota-Consultation
30
*@subpackage Fonctions
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-2004
36
*@version       $Revision: 1.1 $ $Date: 2005-11-23 10:22:25 $
37
// +------------------------------------------------------------------------------------------------------+
38
*/
39
 
40
// +------------------------------------------------------------------------------------------------------+
41
// |                                            ENTETE du PROGRAMME                                       |
42
// +------------------------------------------------------------------------------------------------------+
43
 
44
 
45
// +------------------------------------------------------------------------------------------------------+
46
// |                                           LISTE de FONCTIONS                                         |
47
// +------------------------------------------------------------------------------------------------------+
48
 
49
/** Fonction mkengine() - Créé le moteur de recherche en XHTML pour les structures.
50
*
51
* Fonction créant le moteur de recherche en XHTML pour le
52
* paramètre "structure".
53
*
54
* @return  string le XHTML du moteur de recherche permettant de récupérer les structures.
55
*/
56
function mkengine()
57
{
58
    global $label_bbota, $tbl, $TabFinder, $nbr_total;
59
    $retour = '';
60
 
61
    // Comptage du nombre total de données dans la table (hors CACHER = 1)
62
    $requete =  'SELECT COUNT(*) AS cpt '.
63
                'FROM '.$tbl['str'].' '.
64
                'WHERE B_S_CACHER = 0';
65
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
66
 
67
    if (mysql_num_rows($resultat) == 1) {
68
        $tmp_nb = mysql_fetch_object($resultat);
69
        $nbr_total = $tmp_nb->cpt;
70
        if ($nbr_total > 0) {
71
            $chaine = 'parmi '.$nbr_total.' adresses d\'organismes';
72
        } else {
73
            die('<b>'.'Erreur'.'</b>'.' lors du comptage des structures ('.$nbr_total.' trouvées) : '.$requete);
74
        }
75
    } else {
76
        die('<b>'.'Erreur'.'</b>'.' lors du comptage des structures : '.$requete);
77
    }
78
    mysql_free_result($resultat);
79
 
80
    // Affichage du titre de la page
81
    $retour .= presa_mk_title('Chercher '.$chaine.' :', 1);
82
 
83
    // Construction du moteur de str
84
    $retour .= '<form id="bb_moteur_structure" action="'.BB_URL_COURANTE_CONSULTATION.'" method="post">'."\n";
85
    $retour .= '<ul>'."\n";
86
 
87
    // Ligne de recherche
88
    $retour .= '<li>'."\n";
89
    $retour .=  form_mk_chaine(stripslashes($TabFinder['chaine'])).' '.
90
                form_mk_typque($TabFinder['typque']).
91
                form_mk_categ($TabFinder['categ']);
92
    $retour .= '</li>'."\n";
93
 
94
    // Ligne de géographie
95
    $retour .= '<li>'."\n".form_mk_geo(stripslashes($TabFinder['geo'])).'</li>'."\n";
96
 
97
    if ($TabFinder['finder_mode'] == 'advance') {
98
        $retour .= '<li>'."\n".form_mk_since($TabFinder['since']).'</li>'."\n";
99
    }
100
 
101
    // Ligne de regroupement (frequente)
102
    if ($TabFinder['finder_mode'] == 'advance') {
103
        $retour .= '<li>'."\n".form_mk_step($TabFinder['step'])."\n".form_mk_sort($TabFinder['sort'])."\n".'</li>'."\n";
104
    }
105
 
106
    $retour .= '<li class="bb_aligner_droite">'."\n";
107
    $retour .= form_mk_advance().' '.form_mk_submit()."\n";
108
    $retour .= '</li>'."\n";
109
 
110
    $retour .= '</ul>'."\n";
111
    $retour .= '</form>'."\n\n";
112
 
113
    // Ajout d'un lien pour les moteurs de recherche
114
    $link = BB_URL_COURANTE_CONSULTATION.'&amp;TransTab=typque,1!valid,1!finder_mode,normal!sort,B_S_NOM!';
115
    $link .= 'pstart,0!step,20!pend,231!plugin,!geo,!chaine,!auteur,!categ,!categ_2,!categ_3,!since,!nom,!prenom,!ville,!dept,!pays,!cotisant,!mail,!';
116
    $retour .= '<a href="'.$link.'" style="visibility:hidden;">all</a>'."\n";
117
 
118
    return $retour;
119
}
120
 
121
/** Fonction form_mk_sort() - Créé la liste déroulante XHTML de l'ordre de trie des structures.
122
*
123
* Fonction créant liste déroulante XHTML de l'ordre de trie des structures.
124
*
125
* @param  string la type de trie sélectionné  : valeur de TabFinder['sort'].
126
* @param  string la classe à appliquer à la balise <select>.
127
*
128
* @return  string la liste déroulante XHTML de l'ordre de trie des structures.
129
*/
130
function form_mk_sort($actualsort, $class = 'bb_champ')
131
{
132
    $retour = '';
133
    $id = 'TabFinder[sort]';
134
 
135
    $retour .= '<label for="'.$id.'">'.'Trier par : '.'</label>';
136
    $retour .= '<select id="'.$id.'" name="'.$id.'" class="'.$class.'">'."\n";
137
 
138
    $retour .= '   <option value="B_S_NOM" ';
139
    if ($actualsort == 'B_S_NOM') {
140
        $retour .= 'selected="selected"';
141
    }
142
    $retour .= '>'.'nom'.'</option>'."\n";
143
 
144
    $retour .= '   <option value="GC_NAME" ';
145
    if ($actualsort == 'GC_NAME') {
146
        $retour .= 'selected="selected"';
147
    }
148
    $retour .= '>'.'pays'.'</option>'."\n";
149
 
150
    $retour .= '</select>'."\n\n";
151
 
152
    return $retour;
153
}
154
 
155
/** Fonction form_mk_categ() - Créé la liste déroulante XHTML des types de structures.
156
*
157
* Fonction créant liste déroulante XHTML des types de structures.
158
*
159
* @param  string l'identifiant du type de structure actuellement sélectionné  : valeur de TabFinder['categ'].
160
* @param  string la classe à appliquer à la balise <select>.
161
*
162
* @return  string la liste déroulante XHTML des types de structures.
163
*/
164
function form_mk_categ($actualcateg, $class = 'bb_champ')
165
{
166
    global $tbl, $label_bbota;
167
    $retour = '';
168
 
169
    $retour .= '   <select name="TabFinder[categ]" class="'.$class.'">'."\n";
170
    $retour .= '   <option value="tous" ';
171
    if ($actualcateg == 0) {
172
        $retour .= 'selected="selected"';
173
    }
174
    $retour .= '>'.$label_bbota['all_typstr'].'</option>'."\n";
175
 
176
    $requete =  'SELECT * '.
177
                'FROM '.$tbl['typestr'].' '.
178
                'ORDER BY B_TYPSTR_ID';
179
    $result_str = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
180
    while ($row = mysql_fetch_object($result_str)) {
181
        $typstr_id = $row->B_TYPSTR_ID;
182
        $typstr_nom = $row->B_TYPSTR_LABEL;
183
        $retour .= '<option value="'.$typstr_id.'"';
184
        if ($actualcateg == $typstr_id) {
185
            $retour .= ' selected="selected"';
186
        }
187
        $retour .= '>'.$typstr_nom.'</option>'."\n";
188
    }
189
    mysql_free_result($result_str);
190
 
191
    $retour .= '</select>'."\n\n";
192
 
193
    return $retour;
194
}
195
 
196
/* +--Fin du code ----------------------------------------------------------------------------------------+
197
*
198
* $Log: not supported by cvs2svn $
199
* Revision 1.3  2005/05/17 10:10:08  jpm
200
* Correction des bogues avant mise en ligne du site v4.
201
*
202
* Revision 1.2  2004/09/15 11:21:07  jpm
203
* Début mise en conformité avec la convention de codage et le standard XHTML Strict.
204
*
205
*
206
* +-- Fin du code ----------------------------------------------------------------------------------------+
207
*/
208
?>