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_lien.fonct.php,v 1.1 2005-11-23 10:22:25 jp_milcent Exp $
22
// CVS : $Id: bbc_moteur_lien.fonct.php,v 1.3 2005/03/03 08:25:38 jpm Exp $
23
/**
23
/**
24
* Fonctions de création du moteur de recherche des liens.
24
* Fonctions de création du moteur de recherche des liens.
25
*
25
*
26
* Contient les fonctions permettant de retourner l'affichage du moteur de recherche des liens.
26
* Contient les fonctions permettant de retourner l'affichage du moteur de recherche des liens.
27
* Valable pour le paramètre "lien".
27
* Valable pour le paramètre "lien".
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.3 $ $Date: 2005/03/03 08:25:38 $
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
// +------------------------------------------------------------------------------------------------------+
46
// +------------------------------------------------------------------------------------------------------+
47
// |                                           LISTE de FONCTIONS                                         |
47
// |                                           LISTE de FONCTIONS                                         |
48
// +------------------------------------------------------------------------------------------------------+
48
// +------------------------------------------------------------------------------------------------------+
49
 
49
 
50
// mkengine() :
50
// mkengine() :
51
// fonction spécifique du moteur LINK
51
// fonction spécifique du moteur LINK
52
// créé le bloc de recherche pour le paramètre LINK de Finder 
52
// créé le bloc de recherche pour le paramètre LINK de Finder 
53
// Entrée : -
53
// Entrée : -
54
// Sortie (par retour) : string
54
// Sortie (par retour) : string
55
function mkengine()
55
function mkengine()
56
{
56
{
57
    global $label_bbota, $tbl, $TabFinder, $nbr_total;
57
    global $label_bbota, $tbl, $TabFinder, $nbr_total;
58
    $retour = '';
58
    $retour = '';
59
    
59
    
60
    // Comptage du nombre total de données dans la table (hors CACHER = 1)
60
    // Comptage du nombre total de données dans la table (hors CACHER = 1)
61
    $requete =  'SELECT COUNT(*) AS CPT '.
61
    $requete =  'SELECT COUNT(*) AS CPT '.
62
                'FROM '.$tbl['link'].' '.
62
                'FROM '.$tbl['link'].' '.
63
                'WHERE B_L_CACHER = 0';
63
                'WHERE B_L_CACHER = 0';
64
    $result = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
64
    $result = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
65
    if (mysql_num_rows($result) == 1) {
65
    if (mysql_num_rows($result) == 1) {
66
        $tmp_nb = mysql_fetch_object($result);
66
        $tmp_nb = mysql_fetch_object($result);
67
        $nbr_total = $tmp_nb->CPT;
67
        $nbr_total = $tmp_nb->CPT;
68
        if ($nbr_total > 0) {
68
        if ($nbr_total > 0) {
69
            $chaine = 'parmi '.$nbr_total.' sites web';
69
            $chaine = 'parmi '.$nbr_total.' sites web';
70
        }
70
        }
71
    }
71
    }
72
    mysql_free_result($result);
72
    mysql_free_result($result);
73
    
73
    
74
    // Titre de la page
74
    // Titre de la page
75
    $retour .= presa_mk_title('Chercher '.$chaine.' :', 1);
75
    $retour .= presa_mk_title('Chercher '.$chaine.' :', 1);
76
    
76
    
77
    // Construction du moteur de liens
77
    // Construction du moteur de liens
78
    $retour .= '<form id="bb_moteur_lien" action="'.BB_URL_COURANTE_CONSULTATION.'" method="post">'."\n";
78
    $retour .= '<form id="bb_moteur_lien" action="'.BB_URL_COURANTE_CONSULTATION.'" method="post">'."\n";
79
    $retour .= '<ul>'."\n";
79
    $retour .= '<ul>'."\n";
80
    
80
    
81
    // Ligne de recherche
81
    // Ligne de recherche
82
    $retour .= '<li>'."\n";
82
    $retour .= '<li>'."\n";
83
    $retour .= form_mk_chaine(stripslashes($TabFinder['chaine'])).' ';
83
    $retour .= form_mk_chaine(stripslashes($TabFinder['chaine'])).' ';
84
    $retour .= form_mk_typque($TabFinder['typque']);
84
    $retour .= form_mk_typque($TabFinder['typque']);
85
    $retour .= form_mk_categ($TabFinder['categ']);
85
    $retour .= form_mk_categ($TabFinder['categ']);
86
    $retour .= '</li>'."\n";
86
    $retour .= '</li>'."\n";
87
    
87
    
88
    if ($TabFinder['finder_mode'] == 'advance') {
88
    if ($TabFinder['finder_mode'] == 'advance') {
89
        $retour .= '<li>'."\n";
89
        $retour .= '<li>'."\n";
90
        $retour .= form_mk_since($TabFinder['since']);
90
        $retour .= form_mk_since($TabFinder['since']);
91
        $retour .= '</li>'."\n";
91
        $retour .= '</li>'."\n";
92
    }
92
    }
93
    
93
    
94
    // Ligne de regroupement (frequente)
94
    // Ligne de regroupement (frequente)
95
    if ($TabFinder['finder_mode'] == 'advance') {
95
    if ($TabFinder['finder_mode'] == 'advance') {
96
        $retour .= '<li>'."\n".form_mk_step($TabFinder['step']).'</li>'."\n";
96
        $retour .= '<li>'."\n".form_mk_step($TabFinder['step']).'</li>'."\n";
97
        $retour .= '<li>'."\n".form_mk_sort($TabFinder['sort']).'</li>'."\n";
97
        $retour .= '<li>'."\n".form_mk_sort($TabFinder['sort']).'</li>'."\n";
98
    }
98
    }
99
    
99
    
100
    $retour .= '<li class="bb_aligner_droite">'."\n";
100
    $retour .= '<li class="bb_aligner_droite">'."\n";
101
    $retour .= form_mk_advance().' '.form_mk_submit();
101
    $retour .= form_mk_advance().' '.form_mk_submit();
102
    $retour .= '</li>'."\n";
102
    $retour .= '</li>'."\n";
103
    
103
    
104
    $retour .= '</ul>'."\n";
104
    $retour .= '</ul>'."\n";
105
    $retour .= '</form>'."\n";
105
    $retour .= '</form>'."\n";
106
    
106
    
107
    // Ajout d'un lien pour les moteurs de recherche
107
    // Ajout d'un lien pour les moteurs de recherche
108
    $link = BB_URL_COURANTE_CONSULTATION.'&amp;TransTab=typque,1!valid,1!finder_mode,normal!sort,B_L_TITRE!'.
108
    $link = BB_URL_COURANTE_CONSULTATION.'&amp;TransTab=typque,1!valid,1!finder_mode,normal!sort,B_L_TITRE!'.
109
            'pstart,0!step,20!pend,231!plugin,!geo,!chaine,!auteur,!categ,!categ_2,!categ_3,!since,!nom,!prenom,!ville,!dept,!pays,!cotisant,!mail,!';
109
            'pstart,0!step,20!pend,231!plugin,!geo,!chaine,!auteur,!categ,!categ_2,!categ_3,!since,!nom,!prenom,!ville,!dept,!pays,!cotisant,!mail,!';
110
    $retour .= '<p><a href="'.$link.'" style="visibility:hidden;">'.'tout'.'</a></p>'."\n";
110
    $retour .= '<p><a href="'.$link.'" style="visibility:hidden;">'.'tout'.'</a></p>'."\n";
111
    return $retour;
111
    return $retour;
112
}
112
}
113
 
113
 
114
 
114
 
115
// form_mk_sort($actualsort,$class) :
115
// form_mk_sort($actualsort,$class) :
116
// fonction spécifique du moteur LINK
116
// fonction spécifique du moteur LINK
117
// créé une liste déroulante TabFinder[sort] pour ordonner les pages de résultats
117
// créé une liste déroulante TabFinder[sort] pour ordonner les pages de résultats
118
// Entrée : $actualsort (valeur de TabFinder['sort']), $class (classe CSS) par défaut "insInputForm"
118
// Entrée : $actualsort (valeur de TabFinder['sort']), $class (classe CSS) par défaut "insInputForm"
119
// Sortie (par retour) : string
119
// Sortie (par retour) : string
120
function form_mk_sort($actualsort, $class = 'bb_champ')
120
function form_mk_sort($actualsort, $class = 'bb_champ')
121
{
121
{
122
    $retour = '';
122
    $retour = '';
123
    $id = 'TabFinder[sort]';
123
    $id = 'TabFinder[sort]';
124
    
124
    
125
    $retour .= '<label for="'.$id.'">'.'Trier par : '.'</label>';
125
    $retour .= '<label for="'.$id.'">'.'Trier par : '.'</label>';
126
    $retour .= '<select id="'.$id.'" name="'.$id.'" class="'.$class.'">'."\n";
126
    $retour .= '<select id="'.$id.'" name="'.$id.'" class="'.$class.'">'."\n";
127
    
127
    
128
    $retour .= '   <option value="B_L_TITRE" ';
128
    $retour .= '   <option value="B_L_TITRE" ';
129
    if ($actualsort == 'B_L_TITRE') {
129
    if ($actualsort == 'B_L_TITRE') {
130
        $retour .= 'selected="selected"';
130
        $retour .= 'selected="selected"';
131
    }
131
    }
132
    $retour .= '>'.'titre'.'</option>'."\n";
132
    $retour .= '>'.'titre'.'</option>'."\n";
133
    
133
    
134
    $retour .= '   <option value="B_L_MAJFICHE" ';
134
    $retour .= '   <option value="B_L_MAJFICHE" ';
135
    if ($actualsort == 'B_L_MAJFICHE') {
135
    if ($actualsort == 'B_L_MAJFICHE') {
136
        $retour .= 'selected="selected"';
136
        $retour .= 'selected="selected"';
137
    }
137
    }
138
    $retour .= '>'.'date'.'</option>'."\n";
138
    $retour .= '>'.'date'.'</option>'."\n";
139
    
139
    
140
    $retour .= '   <option value="B_L_URL" ';
140
    $retour .= '   <option value="B_L_URL" ';
141
    if ($actualsort == 'B_L_URL') {
141
    if ($actualsort == 'B_L_URL') {
142
        $retour .= 'selected="selected"';
142
        $retour .= 'selected="selected"';
143
    }
143
    }
144
    $retour .= '>'.'adresse'.'</option>'."\n";
144
    $retour .= '>'.'adresse'.'</option>'."\n";
145
    
145
    
146
    $retour .= '</select>'."\n\n";
146
    $retour .= '</select>'."\n\n";
147
    
147
    
148
    return $retour;
148
    return $retour;
149
}
149
}
150
 
150
 
151
 
151
 
152
// form_mk_categ($actualsort,$class) :
152
// form_mk_categ($actualsort,$class) :
153
// fonction spécifique du moteur LINK
153
// fonction spécifique du moteur LINK
154
// créé une liste déroulante TabFinder[categ] pour affiner les résultats
154
// créé une liste déroulante TabFinder[categ] pour affiner les résultats
155
// Entrée : $actualcateg (valeur de TabFinder['categ']), $class (classe CSS) par défaut "insInputForm"
155
// Entrée : $actualcateg (valeur de TabFinder['categ']), $class (classe CSS) par défaut "insInputForm"
156
// Sortie (par retour) : string
156
// Sortie (par retour) : string
157
function form_mk_categ($actualcateg, $class = 'bb_champ')
157
function form_mk_categ($actualcateg, $class = 'bb_champ')
158
{
158
{
159
    global $tbl;
159
    global $tbl;
160
    $retour = '';
160
    $retour = '';
161
    
161
    
162
    $retour .= '<select name="TabFinder[categ]" class="'.$class.'">'."\n";
162
    $retour .= '<select name="TabFinder[categ]" class="'.$class.'">'."\n";
163
    $retour .= '    <option value="0"';
163
    $retour .= '    <option value="0"';
164
    if ($actualcateg == 0) {
164
    if ($actualcateg == 0) {
165
        $retour .= ' selected="selected"';
165
        $retour .= ' selected="selected"';
166
    }
166
    }
167
    $retour .= '>'.'Toutes catégories'.'</option>'."\n";
167
    $retour .= '>'.'Toutes catégories'.'</option>'."\n";
168
    
168
    
169
    $requete =  'SELECT * '.
169
    $requete =  'SELECT * '.
170
                'FROM '.$tbl['cat'].' '.
170
                'FROM '.$tbl['cat'].' '.
171
                'ORDER BY B_CAT_IDCAT';
171
                'ORDER BY B_CAT_IDCAT';
172
    $result_cat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
172
    $result_cat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
173
    while ($row = mysql_fetch_object($result_cat)) {
173
    while ($row = mysql_fetch_object($result_cat)) {
174
        $cat_id = $row->B_CAT_IDCAT;
174
        $cat_id = $row->B_CAT_IDCAT;
175
        $cat_nom = $row->B_CAT_LABEL;
175
        $cat_nom = $row->B_CAT_LABEL;
176
        $retour .= '    <option value="'.$cat_id.'"';
176
        $retour .= '    <option value="'.$cat_id.'"';
177
        if ($actualcateg == $cat_id) {
177
        if ($actualcateg == $cat_id) {
178
            $retour .= ' selected="selected"';
178
            $retour .= ' selected="selected"';
179
        }
179
        }
180
        $retour .= '>'.$cat_nom.'</option>'."\n";
180
        $retour .= '>'.$cat_nom.'</option>'."\n";
181
    }
181
    }
182
    mysql_free_result($result_cat);
182
    mysql_free_result($result_cat);
183
    
183
    
184
    $retour .= '</select>'."\n\n";
184
    $retour .= '</select>'."\n\n";
185
    return $retour;
185
    return $retour;
186
}
186
}
187
 
187
 
188
/* +--Fin du code ----------------------------------------------------------------------------------------+
188
/* +--Fin du code ----------------------------------------------------------------------------------------+
189
*
189
*
190
* $Log: not supported by cvs2svn $
190
* $Log: bbc_moteur_lien.fonct.php,v $
191
* Revision 1.4  2005/05/17 10:10:08  jpm
-
 
192
* Correction des bogues avant mise en ligne du site v4.
-
 
193
*
-
 
194
* Revision 1.3  2005/03/03 08:25:38  jpm
191
* Revision 1.3  2005/03/03 08:25:38  jpm
195
* Remplacement d'un & par &amp;
192
* Remplacement d'un & par &amp;
196
*
193
*
197
* Revision 1.2  2004/09/14 11:49:52  jpm
194
* Revision 1.2  2004/09/14 11:49:52  jpm
198
* Ajout de l'entête au fichier.
195
* Ajout de l'entête au fichier.
199
*
196
*
200
*
197
*
201
* +-- Fin du code ----------------------------------------------------------------------------------------+
198
* +-- Fin du code ----------------------------------------------------------------------------------------+
202
*/
199
*/
203
?>
200
?>