Subversion Repositories eFlore/Applications.bibliobota

Rev

Rev 2 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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