Subversion Repositories eFlore/Applications.bibliobota

Compare Revisions

Ignore whitespace Rev 1 → Rev 2

/trunk/applications/bb_lien_favoris/bb_lien_favoris.php
New file
0,0 → 1,208
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This file is part of BiblioBota - Lien Favoris. |
// | |
// | Foobar is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | Foobar is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bb_lien_favoris.php,v 1.1 2005-11-23 10:22:25 jp_milcent Exp $
/**
* Application affichant des listes des sites web
*
* Fournit la liste des sites web favoris de Tela Botanica.
* Il est possible d'afficher une liste de sites web :
* - partenaires
* - références
*
*@package BiblioBota-LienFavoris
//Auteur original :
*@author Jean-Charles GRANGER <tela@vecteur.org>
//Autres auteurs :
*@author Jean-Pascal MILCENT <jpm@clapas.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1 $ $Date: 2005-11-23 10:22:25 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
/** Inclusion du fichier de configuration de l'application Lien Favoris. */
require_once BB_CHEMIN_APPLI.'bb_lien_favoris/configuration/bblf_config.inc.php';
 
// Appel du fichier de traduction des textes de l'application Lien Favoris de Biblio Bota
if (file_exists(BBLF_CHEMIN_LANGUES.'bblf_langue_'.BB_URL_I18N.'.inc.php')) {
/** Inclusion du fichier de traduction de l'application Lien Favoris. */
include_once BBLF_CHEMIN_LANGUES.'bblf_langue_'.BB_URL_I18N.'.inc.php';
} else {
/** Inclusion du fichier de traduction fr par défaut. */
include_once BBLF_CHEMIN_LANGUES.'bblf_langue_fr.inc.php';
}
 
// Initialisation de la variable à retourner
$var_to_ret = '';
$var_to_ret .= '<!-- BiblioBota - Partenaire : DEBUT -->'."\n";
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
global $GS_GLOBAL, $TransTab;
 
if ((isset($TransTab)) && ($TransTab != '')) {
$tableau = FRAG_decoupageChaine($TransTab);
}
if (empty($tableau['pstart'])) {
$tableau['pstart'] = 0;
}
if (empty($tableau['step'])) {
$tableau['step'] = $how_bloc;
}
$tableau['libelle'] = 'lien';
$tableau['feminin'] = 0;
 
// Récupèration des arguments de l'application pour la page donnée
$tableau['selecteur'] = $GLOBALS['_GEN_commun']['info_application']->selecteur;
 
// +------------------------------------------------------------------------------------------------------+
// Création du contenu
if ($tableau['selecteur'] == 'ref') {
$add_to_query = 'B_L_REFERENCE';
$le_titre = ' de référence';
$le_texte = '&nbsp;';
} else if ($tableau['selecteur'] == 'part') {
$add_to_query = 'B_L_PARTENAIRE';
$le_titre = ' des partenaires de Tela Botanica';
$le_texte = '&nbsp;';
} else {
$le_titre = '';
$le_texte = '';
}
 
// Titre de la page
$var_to_ret .= '<h1>'.'Sites '.$le_titre.'</h1>';
// Petit descriptif
$var_to_ret .= '<p>'.$le_texte.'</p>'."\n";
 
if (($tableau['selecteur'] == 'ref') || ($tableau['selecteur'] == 'part')) {
$query_tot = 'SELECT COUNT(*) AS cpt '.
'FROM '.$GLOBALS['tbl']['link'].' '.
'WHERE '.$add_to_query.' = 1 '.
'AND B_L_CACHER = 0';
$do_query_tot = mysql_query($query_tot) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query_tot));
$tmp_total = mysql_fetch_object($do_query_tot);
$nb_total = $tmp_total->cpt;
mysql_free_result($do_query_tot);
if ($nb_total == 0) {
$var_to_ret .= '<p>'.'Pas encore de liens indexés...'.'</p>'."\n";
} else {
$query = 'SELECT '.$GLOBALS['tbl']['link'].'.* '.
'FROM '.$GLOBALS['tbl']['link'].' '.
'WHERE '.$add_to_query.' = 1 '.
'AND B_L_CACHER = 0 '.
'ORDER BY B_L_TITRE '.
'LIMIT '.$tableau['pstart'].', '.$tableau['step'];
$do_query = mysql_query($query) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query));
$nb_results = mysql_num_rows($do_query);
if (empty($tableau['pend'])) {
$tableau['pend'] = $nb_total;
}
$var_to_ret .= '<p id="frag_nbre_resultat">'.FRAG_afficherTxtNbreResultat('synth', $tableau, $nb_results, $nb_total).'</p>'."\n";
// Ici on fragmente en pages, pour une navigation plus facile
$frag = new fragmenteur();
$frag_txt = $frag->fragmente($tableau, $nb_total);
if (($frag->nb_pages) > 1) {
$var_to_ret .= '<p id="frag_navigation">';
$var_to_ret .= $frag_txt;
$var_to_ret .= '</p>'."\n";
}
// Fin fragmentation
$o = 1;
while ($row = mysql_fetch_object($do_query)) {
$idlink = $row->B_L_IDLINK;
$titrelink = $row->B_L_TITRE;
$urllink = $row->B_L_URL;
$resumlink = $row->B_L_RESUMCLE;
$comlink = $row->B_L_COMMENT;
$get_part = $row->B_L_PARTENAIRE;
$get_ref = $row->B_L_REFERENCE;
$var_to_ret .= '<img class="'.BB_CLASS_IMG_WEB.'" src="'.BB_IMG_WEB.'" alt="'.'Lien Web'.'"/>'."\n";
$var_to_ret .= '<a href="'.$urllink.'">';
if ($titrelink != '') {
$var_to_ret .= $titrelink;
} else {
$var_to_ret .= $urllink;
}
$var_to_ret .= '</a>'."\n";
if ($resumlink != '') {
$var_to_ret .= ' - '.$resumlink;
}
if ($comlink != '') {
$var_to_ret .= ' - '.$comlink;
}
if (($get_ref == 1) && ($tableau['selecteur'] == 'part')) {
$var_to_ret .= ' <img class="'.BB_CLASS_IMG_REFERENCE.'" src="'.BB_IMG_REFERENCE.'" alt="'.'Site Référence'.'" /> '."\n";
}
if (($get_part == 1) && ($tableau['selecteur'] == 'ref')) {
$var_to_ret .= ' <img class="'.BB_CLASS_IMG_PARTENAIRE.'" src="'.BB_IMG_PARTENAIRE.'" alt="'.'Site Partenaire de Tela Botanica'.'" /> '."\n";
}
if ($comlink != '') {
$var_to_ret .= ' - '.$comlink;
}
if ($o < $nb_results) {
$var_to_ret .= '<br /><br />';
}
$o++;
}
mysql_free_result($do_query);
}
} else {
$var_to_ret .= '<p>'.'Echec d\'exécution du script : pas de paramètre valide [réf|part].'.'</p>'."\n";
}
 
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
$var_to_ret .= '<!-- BiblioBota - Partenaire : FIN -->'."\n";
$sortie .= $var_to_ret;
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.3 2005/03/01 15:18:37 jpm
* Ajout de commentaire html de début et fin d'appli.
*
* Revision 1.2 2005/02/28 14:34:10 jpm
* Changement du nom de l'appli en Lien Favoris.
*
* Revision 1.1 2005/02/28 14:23:51 jpm
* Ajout des fichiers de l'application Lien Favoris.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>