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