Subversion Repositories eFlore/Applications.bibliobota

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1                                                                                      |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or                                        |
// | modify it under the terms of the GNU Lesser General Public                                           |
// | License as published by the Free Software Foundation; either                                         |
// | version 2.1 of the License, or (at your option) any later version.                                   |
// |                                                                                                      |
// | This library 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                                    |
// | Lesser General Public License for more details.                                                      |
// |                                                                                                      |
// | You should have received a copy of the GNU Lesser General Public                                     |
// | License along with this library; if not, write to the Free Software                                  |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bbc_moteur_lien.fonct.php,v 1.1 2005-11-23 10:22:25 jp_milcent Exp $
/**
* Fonctions de création du moteur de recherche des liens.
*
* Contient les fonctions permettant de retourner l'affichage du moteur de recherche des liens.
* Valable pour le paramètre "lien".
*
*@package BiblioBota-Consultation
*@subpackage Fonctions
//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                                       |
// +------------------------------------------------------------------------------------------------------+



// +------------------------------------------------------------------------------------------------------+
// |                                           LISTE de FONCTIONS                                         |
// +------------------------------------------------------------------------------------------------------+

// mkengine() :
// fonction spécifique du moteur LINK
// créé le bloc de recherche pour le paramètre LINK de Finder 
// Entrée : -
// Sortie (par retour) : string
function mkengine()
{
    global $label_bbota, $tbl, $TabFinder, $nbr_total;
    $retour = '';
    
    // Comptage du nombre total de données dans la table (hors CACHER = 1)
    $requete =  'SELECT COUNT(*) AS CPT '.
                'FROM '.$tbl['link'].' '.
                'WHERE B_L_CACHER = 0';
    $result = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    if (mysql_num_rows($result) == 1) {
        $tmp_nb = mysql_fetch_object($result);
        $nbr_total = $tmp_nb->CPT;
        if ($nbr_total > 0) {
            $chaine = 'parmi '.$nbr_total.' sites web';
        }
    }
    mysql_free_result($result);
    
    // Titre de la page
    $retour .= presa_mk_title('Chercher '.$chaine.' :', 1);
    
    // Construction du moteur de liens
    $retour .= '<form id="bb_moteur_lien" action="'.BB_URL_COURANTE_CONSULTATION.'" method="post">'."\n";
    $retour .= '<ul>'."\n";
    
    // Ligne de recherche
    $retour .= '<li>'."\n";
    $retour .= form_mk_chaine(stripslashes($TabFinder['chaine'])).' ';
    $retour .= form_mk_typque($TabFinder['typque']);
    $retour .= form_mk_categ($TabFinder['categ']);
    $retour .= '</li>'."\n";
    
    if ($TabFinder['finder_mode'] == 'advance') {
        $retour .= '<li>'."\n";
        $retour .= form_mk_since($TabFinder['since']);
        $retour .= '</li>'."\n";
    }
    
    // Ligne de regroupement (frequente)
    if ($TabFinder['finder_mode'] == 'advance') {
        $retour .= '<li>'."\n".form_mk_step($TabFinder['step']).'</li>'."\n";
        $retour .= '<li>'."\n".form_mk_sort($TabFinder['sort']).'</li>'."\n";
    }
    
    $retour .= '<li class="bb_aligner_droite">'."\n";
    $retour .= form_mk_advance().' '.form_mk_submit();
    $retour .= '</li>'."\n";
    
    $retour .= '</ul>'."\n";
    $retour .= '</form>'."\n";
    
    // Ajout d'un lien pour les moteurs de recherche
    $link = BB_URL_COURANTE_CONSULTATION.'&amp;TransTab=typque,1!valid,1!finder_mode,normal!sort,B_L_TITRE!'.
            'pstart,0!step,20!pend,231!plugin,!geo,!chaine,!auteur,!categ,!categ_2,!categ_3,!since,!nom,!prenom,!ville,!dept,!pays,!cotisant,!mail,!';
    $retour .= '<p><a href="'.$link.'" style="visibility:hidden;">'.'tout'.'</a></p>'."\n";
    return $retour;
}


// form_mk_sort($actualsort,$class) :
// fonction spécifique du moteur LINK
// créé une liste déroulante TabFinder[sort] pour ordonner les pages de résultats
// Entrée : $actualsort (valeur de TabFinder['sort']), $class (classe CSS) par défaut "insInputForm"
// Sortie (par retour) : string
function form_mk_sort($actualsort, $class = 'bb_champ')
{
    $retour = '';
    $id = 'TabFinder[sort]';
    
    $retour .= '<label for="'.$id.'">'.'Trier par : '.'</label>';
    $retour .= '<select id="'.$id.'" name="'.$id.'" class="'.$class.'">'."\n";
    
    $retour .= '   <option value="B_L_TITRE" ';
    if ($actualsort == 'B_L_TITRE') {
        $retour .= 'selected="selected"';
    }
    $retour .= '>'.'titre'.'</option>'."\n";
    
    $retour .= '   <option value="B_L_MAJFICHE" ';
    if ($actualsort == 'B_L_MAJFICHE') {
        $retour .= 'selected="selected"';
    }
    $retour .= '>'.'date'.'</option>'."\n";
    
    $retour .= '   <option value="B_L_URL" ';
    if ($actualsort == 'B_L_URL') {
        $retour .= 'selected="selected"';
    }
    $retour .= '>'.'adresse'.'</option>'."\n";
    
    $retour .= '</select>'."\n\n";
    
    return $retour;
}


// form_mk_categ($actualsort,$class) :
// fonction spécifique du moteur LINK
// créé une liste déroulante TabFinder[categ] pour affiner les résultats
// Entrée : $actualcateg (valeur de TabFinder['categ']), $class (classe CSS) par défaut "insInputForm"
// Sortie (par retour) : string
function form_mk_categ($actualcateg, $class = 'bb_champ')
{
    global $tbl;
    $retour = '';
    
    $retour .= '<select name="TabFinder[categ]" class="'.$class.'">'."\n";
    $retour .= '    <option value="0"';
    if ($actualcateg == 0) {
        $retour .= ' selected="selected"';
    }
    $retour .= '>'.'Toutes catégories'.'</option>'."\n";
    
    $requete =  'SELECT * '.
                'FROM '.$tbl['cat'].' '.
                'ORDER BY B_CAT_IDCAT';
    $result_cat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    while ($row = mysql_fetch_object($result_cat)) {
        $cat_id = $row->B_CAT_IDCAT;
        $cat_nom = $row->B_CAT_LABEL;
        $retour .= '    <option value="'.$cat_id.'"';
        if ($actualcateg == $cat_id) {
            $retour .= ' selected="selected"';
        }
        $retour .= '>'.$cat_nom.'</option>'."\n";
    }
    mysql_free_result($result_cat);
    
    $retour .= '</select>'."\n\n";
    return $retour;
}

/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.4  2005/05/17 10:10:08  jpm
* Correction des bogues avant mise en ligne du site v4.
*
* Revision 1.3  2005/03/03 08:25:38  jpm
* Remplacement d'un & par &amp;
*
* Revision 1.2  2004/09/14 11:49:52  jpm
* Ajout de l'entête au fichier.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>