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) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This file is part of BiblioBota - Lien Favoris.                                                      |
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: bb_lien_favoris.php,v 1.1 2005-11-23 10:22:25 jp_milcent Exp $
25
/**
26
* Application affichant des listes des sites web
27
*
28
* Fournit la liste des sites web favoris de Tela Botanica.
29
* Il est possible d'afficher une liste de sites web :
30
* - partenaires
31
* - références
32
*
33
*@package BiblioBota-LienFavoris
34
//Auteur original :
35
*@author        Jean-Charles GRANGER <tela@vecteur.org>
36
//Autres auteurs :
37
*@author        Jean-Pascal MILCENT <jpm@clapas.org>
38
*@copyright     Tela-Botanica 2000-2004
39
*@version       $Revision: 1.1 $ $Date: 2005-11-23 10:22:25 $
40
// +------------------------------------------------------------------------------------------------------+
41
*/
42
 
43
// +------------------------------------------------------------------------------------------------------+
44
// |                                            ENTETE du PROGRAMME                                       |
45
// +------------------------------------------------------------------------------------------------------+
46
/** Inclusion du fichier de configuration de l'application Lien Favoris. */
47
require_once BB_CHEMIN_APPLI.'bb_lien_favoris/configuration/bblf_config.inc.php';
48
 
49
// Appel du fichier de traduction des textes de l'application Lien Favoris   de Biblio Bota
50
if (file_exists(BBLF_CHEMIN_LANGUES.'bblf_langue_'.BB_URL_I18N.'.inc.php')) {
51
    /** Inclusion du fichier de traduction de l'application Lien Favoris. */
52
    include_once BBLF_CHEMIN_LANGUES.'bblf_langue_'.BB_URL_I18N.'.inc.php';
53
} else {
54
    /** Inclusion du fichier de traduction fr par défaut. */
55
    include_once BBLF_CHEMIN_LANGUES.'bblf_langue_fr.inc.php';
56
}
57
 
58
// Initialisation de la variable à retourner
59
$var_to_ret = '';
60
$var_to_ret .= '<!-- BiblioBota - Partenaire : DEBUT -->'."\n";
61
 
62
// +------------------------------------------------------------------------------------------------------+
63
// |                                            CORPS du PROGRAMME                                        |
64
// +------------------------------------------------------------------------------------------------------+
65
global $GS_GLOBAL, $TransTab;
66
 
67
if ((isset($TransTab)) && ($TransTab != '')) {
68
    $tableau = FRAG_decoupageChaine($TransTab);
69
}
70
if (empty($tableau['pstart'])) {
71
    $tableau['pstart'] = 0;
72
}
73
if (empty($tableau['step'])) {
74
    $tableau['step'] = $how_bloc;
75
}
76
$tableau['libelle'] = 'lien';
77
$tableau['feminin'] = 0;
78
 
79
// Récupèration des arguments de l'application pour la page donnée
80
$tableau['selecteur'] = $GLOBALS['_GEN_commun']['info_application']->selecteur;
81
 
82
// +------------------------------------------------------------------------------------------------------+
83
// Création du contenu
84
if ($tableau['selecteur'] == 'ref') {
85
    $add_to_query = 'B_L_REFERENCE';
86
    $le_titre = ' de référence';
87
    $le_texte = '&nbsp;';
88
} else if ($tableau['selecteur'] == 'part') {
89
    $add_to_query = 'B_L_PARTENAIRE';
90
    $le_titre = ' des partenaires de Tela Botanica';
91
    $le_texte = '&nbsp;';
92
} else {
93
    $le_titre = '';
94
    $le_texte = '';
95
}
96
 
97
// Titre de la page
98
$var_to_ret .= '<h1>'.'Sites '.$le_titre.'</h1>';
99
// Petit descriptif
100
$var_to_ret .= '<p>'.$le_texte.'</p>'."\n";
101
 
102
if (($tableau['selecteur'] == 'ref') || ($tableau['selecteur'] == 'part')) {
103
    $query_tot =    'SELECT COUNT(*) AS cpt '.
104
                    'FROM '.$GLOBALS['tbl']['link'].' '.
105
                    'WHERE '.$add_to_query.' = 1 '.
106
                    'AND B_L_CACHER = 0';
107
    $do_query_tot = mysql_query($query_tot) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query_tot));
108
    $tmp_total = mysql_fetch_object($do_query_tot);
109
    $nb_total = $tmp_total->cpt;
110
    mysql_free_result($do_query_tot);
111
 
112
    if ($nb_total == 0) {
113
        $var_to_ret .= '<p>'.'Pas encore de liens indexés...'.'</p>'."\n";
114
    } else {
115
        $query =    'SELECT '.$GLOBALS['tbl']['link'].'.* '.
116
                    'FROM '.$GLOBALS['tbl']['link'].' '.
117
                    'WHERE '.$add_to_query.' = 1 '.
118
                    'AND B_L_CACHER = 0 '.
119
                    'ORDER BY B_L_TITRE '.
120
                    'LIMIT '.$tableau['pstart'].', '.$tableau['step'];
121
        $do_query = mysql_query($query) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query));
122
        $nb_results = mysql_num_rows($do_query);
123
 
124
        if (empty($tableau['pend'])) {
125
            $tableau['pend'] = $nb_total;
126
        }
127
 
128
        $var_to_ret .= '<p id="frag_nbre_resultat">'.FRAG_afficherTxtNbreResultat('synth', $tableau, $nb_results, $nb_total).'</p>'."\n";
129
 
130
        // Ici on fragmente en pages, pour une navigation plus facile
131
        $frag = new fragmenteur();
132
        $frag_txt = $frag->fragmente($tableau, $nb_total);
133
        if (($frag->nb_pages) > 1) {
134
            $var_to_ret .= '<p id="frag_navigation">';
135
            $var_to_ret .= $frag_txt;
136
            $var_to_ret .= '</p>'."\n";
137
        }
138
        // Fin fragmentation
139
 
140
        $o = 1;
141
 
142
        while ($row = mysql_fetch_object($do_query)) {
143
            $idlink = $row->B_L_IDLINK;
144
            $titrelink = $row->B_L_TITRE;
145
            $urllink = $row->B_L_URL;
146
            $resumlink = $row->B_L_RESUMCLE;
147
            $comlink = $row->B_L_COMMENT;
148
            $get_part = $row->B_L_PARTENAIRE;
149
            $get_ref = $row->B_L_REFERENCE;
150
 
151
            $var_to_ret .= '<img class="'.BB_CLASS_IMG_WEB.'" src="'.BB_IMG_WEB.'" alt="'.'Lien Web'.'"/>'."\n";
152
 
153
            $var_to_ret .= '<a href="'.$urllink.'">';
154
            if ($titrelink != '') {
155
                $var_to_ret .= $titrelink;
156
            } else {
157
                $var_to_ret .= $urllink;
158
            }
159
            $var_to_ret .= '</a>'."\n";
160
 
161
            if ($resumlink != '') {
162
                $var_to_ret .= ' - '.$resumlink;
163
            }
164
            if ($comlink != '') {
165
                $var_to_ret .= ' - '.$comlink;
166
            }
167
            if (($get_ref == 1) && ($tableau['selecteur'] == 'part')) {
168
                $var_to_ret .= ' <img class="'.BB_CLASS_IMG_REFERENCE.'" src="'.BB_IMG_REFERENCE.'" alt="'.'Site Référence'.'" /> '."\n";
169
            }
170
            if (($get_part == 1) && ($tableau['selecteur'] == 'ref')) {
171
                $var_to_ret .= ' <img class="'.BB_CLASS_IMG_PARTENAIRE.'" src="'.BB_IMG_PARTENAIRE.'" alt="'.'Site Partenaire de Tela Botanica'.'" /> '."\n";
172
            }
173
            if ($comlink != '') {
174
                $var_to_ret .= ' - '.$comlink;
175
            }
176
            if ($o < $nb_results) {
177
                $var_to_ret .= '<br /><br />';
178
            }
179
            $o++;
180
        }
181
        mysql_free_result($do_query);
182
    }
183
} else {
184
    $var_to_ret .= '<p>'.'Echec d\'exécution du script : pas de paramètre valide [réf|part].'.'</p>'."\n";
185
}
186
 
187
// +------------------------------------------------------------------------------------------------------+
188
// |                                            PIED du PROGRAMME                                         |
189
// +------------------------------------------------------------------------------------------------------+
190
$var_to_ret .= '<!-- BiblioBota - Partenaire : FIN -->'."\n";
191
$sortie .= $var_to_ret;
192
 
193
/* +--Fin du code ----------------------------------------------------------------------------------------+
194
*
195
* $Log: not supported by cvs2svn $
196
* Revision 1.3  2005/03/01 15:18:37  jpm
197
* Ajout de commentaire html de début et fin d'appli.
198
*
199
* Revision 1.2  2005/02/28 14:34:10  jpm
200
* Changement du nom de l'appli en Lien Favoris.
201
*
202
* Revision 1.1  2005/02/28 14:23:51  jpm
203
* Ajout des fichiers de l'application Lien Favoris.
204
*
205
*
206
* +-- Fin du code ----------------------------------------------------------------------------------------+
207
*/
208
?>