Subversion Repositories eFlore/Applications.bibliobota

Compare Revisions

Ignore whitespace Rev 1 → Rev 2

/trunk/applications/bb_consultation/bibliotheque/bbc_affichage_lien.fonct.php
New file
0,0 → 1,159
<?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_affichage_lien.fonct.php,v 1.1 2005-11-23 10:22:25 jp_milcent Exp $
/**
* Fonctions de création de l'affichage des résultats d'un lien.
*
* Contient une fonction créant l'affichage des résultats 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 |
// +------------------------------------------------------------------------------------------------------+
/*Mettre ici les inclusions de fichiers*/
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
/*Mettre ici la liste de fonctions.*/
 
/*
Fichier de traitement de requêtes de l'appli FINDER v. 3.00 - 21/06/2002 - 08h30
Valable pour le paramètre "link".
 
retourne une chaine de données
*/
function mkresu()
{
global $result_final;
global $nbr_final;
global $tbl;
global $TabFinder;
global $var_biblio;
$retour = '';
$retour .= '<ul id="bb_liste_resultat_lien">'."\n";
// Boucle qui affiche les résultats
$i = 1;
while ($row = mysql_fetch_object($result_final)) {
$get_idlink = $row->B_L_IDLINK;
$get_urllink = $row->B_L_URL;
$get_titrelink = $row->B_L_TITRE;
$get_lkstr = $row->B_L_LKSTR;
$get_nomstr = $row->B_S_NOM;
$get_resum = $row->B_L_RESUMCLE;
$get_date = $row->B_L_MAJFICHE;
$get_part = $row->B_L_PARTENAIRE;
$get_ref = $row->B_L_REFERENCE;
$retour .= '<li>';
$retour .= '<img class="'.BB_CLASS_IMG_WEB.'" src="'.BB_IMG_WEB.'" alt="'.'Lien Web'.'" />'."\n";
$retour .= '<a href="'.$get_urllink.'">';
if ($get_titrelink != '') {
$retour .= $get_titrelink;
} else {
$retour .= ColorizeFound($get_urllink, strtolower($TabFinder['chaine']));
}
$retour .= '</a>'."\n";
if ($get_resum != '') {
$retour .= ' - '. ColorizeFound($get_resum, stripslashes($TabFinder['chaine']));
}
if ($get_lkstr != 0) {
$retour .= ' - <b>' . ColorizeFound($get_nomstr, stripslashes($TabFinder['chaine'])).'</b>'."\n\n";
}
// Affichage du lien vers la consultation avancée correspondant à la structure si elle existe dans la base
if ($var_biblio['open_biblio_link'] == true && $get_lkstr != 0) {
// Cross Biblio est le module qui permet d'avoir accès au popup transversal BBPOPUP
$retour .= '<a href="'.BB_URL_COURANTE_CONSULTATION_AVANCEE.'&amp;str='.$get_lkstr.'&amp;arg_0=str%3D'.$get_lkstr.
'&amp;arg_1=coll%3D'.$get_lkstr.'&amp;arg_2=book%3D'.$get_lkstr.'&amp;arg_3=media%3D'.$get_lkstr.'">'.'Plus d\'infos...'.'</a>';
}
if ($get_ref == 1) {
$retour .= '<img class="'.BB_CLASS_IMG_REFERENCE.'" src="'.BB_IMG_REFERENCE.'" alt="'.'Site Référence'.'" /> '."\n";
}
if ($get_part == 1) {
$retour .= '<img class="'.BB_CLASS_IMG_PARTENAIRE.'" src="'.BB_IMG_PARTENAIRE.'" alt="'.'Site Partenaire de Tela Botanica'.'" /> '."\n";
}
// Affichage des infos et des liens pour édition
$retour .= ' <span class="texte_inactif">('.'n°'.$get_idlink;
if ((check_if_modif($tbl['modif'], $tbl['link'], $get_idlink) == 0) && ($var_biblio['open_proposer_link'] == true)) {
$retour .= ' - ';
$retour .= '<a class="texte_inactif" href="'.BB_URL_COURANTE_ADMIN.'&amp;action=edit&ensemble=link&amp;ref='.$get_idlink.'">'.'éditer'.'</a>';
$retour .= ' - ';
$retour .= '<a class="texte_inactif" href="'.BB_URL_COURANTE_ADMIN.'&amp;action=supp&ensemble=link&amp;ref='.$get_idlink.'">'.'supprimer'.'</a>';
}
$retour .= ')'.'</span>'."\n";
if ($i < $nbr_final) {
$retour .= '<br /><br />';
}
$retour .= '</li>'."\n";
$i++;
}
$retour .= '</ul>'."\n";
if ($var_biblio['open_proposer_link'] == true) {
$retour .= '<p align="center">'."\n".
'<hr size="1" />'."\n".
'<a href="'.BB_URL_COURANTE_ADMIN.'&amp;action=new&ensemble=link">'.'Proposer un nouveau lien'.'</a>'."\n".
'<hr size="1" />'."\n".
'</p>'."\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 2004/09/15 15:47:36 jpm
* Ajout des images de site partenaire et référence.
*
* Revision 1.2 2004/09/14 11:49:52 jpm
* Ajout de l'entête au fichier.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/applications/bb_consultation/bibliotheque/bbc_requete_media.fonct.php
New file
0,0 → 1,377
<?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_requete_media.fonct.php,v 1.1 2005-11-23 10:22:25 jp_milcent Exp $
/**
* Fonctions de création de la requête sur un média.
*
* Contient une fonction créant la requête d'intérogation de la base de données.
* Valable pour le paramètre "media".
*
*@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 |
// +------------------------------------------------------------------------------------------------------+
 
/** Fonction mkquery() - Créé une requête intérogeant la base de donnée.
*
* Fonction créant la requête d'intérogation de la base de données pour le
* paramêtre "media".
*
* @return string la requête permettant de récupérer les média.
*/
function mkquery()
{
global $tbl;
global $TabFinder;
global $nbr_total;
global $var_biblio;
global $query_dom;
global $plugin_store;
// si limit_domain vaut 1, alors on réduit les recherches au seul domaine botanique
if ($var_biblio['limit_domain'] == 1) {
$add_from_dom = ', '.$tbl['domaine'].', '.$tbl['domaine_lk'];
// lien domaines -- table de jointure domaines
$add_limit_dom = ' AND ('.$tbl['domaine'].'.B_D_ID = '.$tbl['domaine_lk'].'.B_DL_IDDOM)';
// lien articles -- table de jointure domaines
$add_limit_dom .= ' AND ('.$tbl['item'].'.B_I_IDITEM = '.$tbl['domaine_lk'].'.B_DL_IDITEM)';
$add_limit_dom .= ' AND '.$tbl['domaine'].'.B_D_ID = 1';
} else {
$add_from_dom = ', '.$tbl['domaine'].', '.$tbl['domaine_lk'];
// lien domaines -- table de jointure domaines
$add_limit_dom = ' AND ('.$tbl['domaine'].'.B_D_ID = '.$tbl['domaine_lk'].'.B_DL_IDDOM)';
// lien articles -- table de jointure domaines
$add_limit_dom .= ' AND ('.$tbl['item'].'.B_I_IDITEM = '.$tbl['domaine_lk'].'.B_DL_IDITEM)';
}
/*
Pour une implémentation d'une recherche sur TOUTE LA TABLE ARTICLES
il faut une requête spéciale qui fasse une jointure à la fois avec les
tables structure-coll-serie-fasc-art et les tables str-art-media... gasp...
*/
/* si la variable de catégorie / type vaut 0, il n'y a pas affinage de la requête par catégorie */
if (BB_ARGUMENT_REGROUPEMENT == 'article') {
// On demande ici les articles : mise en place des réducteurs
$add_select = 'B_C_CRAI, '.$tbl['serie'].'.*, B_C_NOMCOMPLET, B_C_ABREGE, B_F_NUMERO, B_F_TITRE, B_F_DATE, B_A_PAGEDEBUT, B_A_PAGEFIN, ';
// $add_select = $tbl['collection'].".B_C_CRAI, ".$tbl['serie'].".*, ".$tbl['collection'].".B_C_NOMCOMPLET, ".$tbl['collection'].".B_C_ABREGE, ".$tbl['fascicule'].".B_F_TITRE, ".$tbl['fascicule'].".B_F_DATE, ".$tbl['article'].".B_A_PAGEDEBUT, ".$tbl['article'].".B_A_PAGEFIN, ";
$add_from = $tbl['collection'].' LEFT JOIN '.$tbl['str'].' ON B_C_LKSTR = B_S_IDSTR, '.$tbl['fascicule'].', '.$tbl['serie'].', '.$tbl['article'].',';
// jointure coll - serie
$special_join = ' AND ('.$tbl['collection'].'.B_C_CRAI = '.$tbl['serie'].'.B_SER_CRAICOLL)';
// jointure serie - fasc
$special_join .= ' AND ('.$tbl['serie'].'.B_SER_CRAICOLL = '.$tbl['fascicule'].'.B_F_CRAICOLL)';
$special_join .= ' AND ('.$tbl['serie'].'.B_SER_IDSERIE = '.$tbl['fascicule'].'.B_F_CRAISERIE)';
// jointure fasc - item
$special_join .= ' AND ('.$tbl['fascicule'].'.B_F_CRAICOLL = '.$tbl['article'].'.B_A_CRAICOLL)';
$special_join .= ' AND ('.$tbl['fascicule'].'.B_F_CRAISERIE = '.$tbl['article'].'.B_A_CRAISERIE)';
$special_join .= ' AND ('.$tbl['fascicule'].'.B_F_NUMERO = '.$tbl['article'].'.B_A_CRAIFASC)';
// jointure item - article
$special_join .= ' AND ('.$tbl['item'].'.B_I_IDITEM = '.$tbl['article'].'.B_A_IDART)';
// réducteur de catégorie (collections) categ
if ($TabFinder['categ'] != '') {
$add_to_query = ' AND ('.$tbl['article'].'.B_A_CRAICOLL like "'.$TabFinder['categ'].'%")';
} else {
$add_to_query = '';
}
} else {
// On demande ici les livres et médias
$add_select = $tbl['media'].'.*, '.$tbl['monnaie'].'.*, ';
// Ajout du FROM
$add_from = $tbl['media'].' LEFT JOIN '.$tbl['str'].' ON B_M_LKSTR = B_S_IDSTR, '.$tbl['monnaie'].', ';
// lien media -- article
$special_join = ' AND ('.$tbl['media'].'.B_M_IDMEDIA = '.$tbl['item'].'.B_I_IDITEM)';
// lien media -- monnaie
$special_join .= ' AND ('.$tbl['media'].'.B_M_LKMONNAIE = '.$tbl['monnaie'].'.GEN_MON_IDMONNAIE)';
//pas de réducteur de catégorie pour les livres
$add_to_query = '';
}
// Compte Total : comptage du nombre de données de la table
// d'abord, créer les critères de sélection physiques et logiques.
if (($TabFinder['categ_3'] == '') || (BB_ARGUMENT_REGROUPEMENT == 'article')) {
if ((!empty($query_dom['log']))) {
$create_log = $query_dom['log'];
} else {
$create_log = '';
}
} else {
$create_log = 'B_I_TYPLOG = '.$TabFinder['categ_3'];
}
if ($TabFinder['categ_2'] == '') {
if ((!empty($query_dom['phy']))) {
$create_phy = $query_dom['phy'];
} else {
$create_phy = '';
}
} else {
$create_phy = 'B_I_TYPPHY = '.$TabFinder['categ_2'];
}
if (($create_phy != "")&&($create_log != "")) {
$create_logphy = "$create_log AND $create_phy";
} else if (($create_phy != "")||($create_log != "")) {
$create_logphy = "$create_log$create_phy";
}
// Création du corps de la requête
// Création du SELECT général
$normal_query = "SELECT DISTINCT $add_select B_D_ID, B_D_LABEL, B_S_IDSTR, B_S_NOM, B_AS_LIBELLE, ".$tbl['item'].".*, ".$tbl['item_typlog'].".*, ".$tbl['item_typphy'].".* ";
// Création du FROM général
$normal_query .= " FROM $add_from ".$tbl['saisie'].", ".$tbl['item'].", ".$tbl['item_typlog'].", ".$tbl['item_typphy']."$add_from_dom";
// Création du WHERE
$normal_query .= " WHERE $create_logphy ";
$normal_query .= " AND B_I_CACHER = 0 ";
if (($TabFinder['typque'] == 0)&&($TabFinder['chaine'] != "")) {
// le mode de moteur demandé est : expression exacte
$normal_query .= " AND (";
// on vérifie si la chaine est entre crochets
$check_method = ereg("\[*\]",$TabFinder['chaine']);
if ($check_method == 1) {
// si oui, on utilise le FULL TEXT
$TabFinder['chaine'] = ereg_replace("\[","",$TabFinder['chaine']);
$TabFinder['chaine'] = ereg_replace("\]","",$TabFinder['chaine']);
$normal_query .= "MATCH(B_I_TITRE) against ('".$TabFinder['chaine']."')";
$normal_query .= " OR MATCH(B_I_RESUMCLE) against ('".$TabFinder['chaine']."')";
$normal_query .= " OR ".$tbl['item'].".B_I_COMMENT like '%".$TabFinder['chaine']."%'";
} else {
// si non, on utilise la methode classique
$normal_query .= $tbl['item'].".B_I_TITRE like '%".$TabFinder['chaine']."%'";
$normal_query .= " OR ".$tbl['item'].".B_I_RESUMCLE like '%".$TabFinder['chaine']."%'";
$normal_query .= " OR ".$tbl['item'].".B_I_COMMENT like '%".$TabFinder['chaine']."%'";
}
$normal_query .= ")";
} else if (($TabFinder['chaine'] != "")&&($TabFinder['typque'] == 1)) {
// le mode du moteur demandé est : chaque terme
$result_from_ex = explode (" ", $TabFinder['chaine']);
if (($result_from_ex != "")&&(count($result_from_ex)>=1)) {
$i_ex = 0;
$normal_query .= " AND (";
while ($i_ex < count($result_from_ex)) {
// on vérifie si la chaine est entre crochets
$check_method = ereg("\[*\]",$result_from_ex[$i_ex]);
if ($check_method == 1) {
$result_from_ex[$i_ex] = ereg_replace("\[","",$result_from_ex[$i_ex]);
$result_from_ex[$i_ex] = ereg_replace("\]","",$result_from_ex[$i_ex]);
// si oui, on utilise le FULL TEXT
$normal_query .= "MATCH(B_I_TITRE) against ('";
if ($result_from_ex[$i_ex] != "") $normal_query .= "$result_from_ex[$i_ex]";
$normal_query .= "') OR ";
$normal_query .= "MATCH(B_I_RESUMCLE) against ('";
if ($result_from_ex[$i_ex] != "") $normal_query .= "$result_from_ex[$i_ex]";
$normal_query .= "') OR ";
$normal_query .= "B_I_COMMENT like '%";
if ($result_from_ex[$i_ex] != "") $normal_query .= "$result_from_ex[$i_ex]";
$normal_query .= "%'";
if ($i_ex < (count($result_from_ex)-1)) $normal_query .= ") AND (";
} else {
// si non, on procède à une recherche classique
$normal_query .= $tbl['item'].".B_I_TITRE like '%";
if ($result_from_ex[$i_ex] != "") $normal_query .= "$result_from_ex[$i_ex]";
$normal_query .= "%' OR ";
$normal_query .= $tbl['item'].".B_I_RESUMCLE like '%";
if ($result_from_ex[$i_ex] != "") $normal_query .= "$result_from_ex[$i_ex]";
$normal_query .= "%' OR ";
$normal_query .= $tbl['item'].".B_I_COMMENT like '%";
if ($result_from_ex[$i_ex] != "") $normal_query .= "$result_from_ex[$i_ex]";
$normal_query .= "%'";
if ($i_ex < (count($result_from_ex)-1)) $normal_query .= ") AND (";
}
$i_ex++;
}
$normal_query .= ") ";
}
}
/* ajout, si nécessaire, de la contrainte categ */
if (($TabFinder['categ'] != '') && (BB_ARGUMENT_REGROUPEMENT == 'media')) {
if ($TabFinder['categ'] == 'VIDE') {
$normal_query .= ' AND (B_M_EDITEUR is null OR B_M_EDITEUR = "")';
} else {
$normal_query .= ' AND (B_M_EDITEUR like "%'.$TabFinder['categ'].'%")';
}
}
// Création des jointures
$normal_query .= " AND (".$tbl['saisie'].".B_AS_ID = ".$tbl['item'].".B_I_AUTEURSAISIE)"; // lien article -- type phy
$normal_query .= " AND (".$tbl['item'].".B_I_TYPPHY = ".$tbl['item_typphy'].".B_IP_ID)"; // lien article -- type phy
$normal_query .= " AND (".$tbl['item'].".B_I_TYPLOG = ".$tbl['item_typlog'].".B_IL_ID)"; // lien article -- type log
$normal_query .= " $add_limit_dom"; // si limitation au domaine principal
$normal_query.= $special_join;
// Si TabFinder['auteur'] est non vide : on ajoute le critère de sélection
if ($TabFinder['auteur'] != '') {
$tmp_auteur = explode(' ', $TabFinder['auteur']);
$normal_query .= ' AND (';
for ($tmp=0;$tmp<count($tmp_auteur);$tmp++) {
$normal_query .= $tbl['item'].'.B_I_AUTEURS like "%'.$tmp_auteur[$tmp].'%"';
if ( $tmp < (count($tmp_auteur) - 1) ) {
$normal_query .= ' AND ';
}
}
$normal_query .= ')';
}
// Si TabFinder['geo'] est non vide :
// 1- si TabFinder['chaine'] est vide on n'ajoute pas de AND
// 2- s'il n'est pas vide on ajoute AND
if ($TabFinder['geo'] != '') {
if ($TabFinder['geo'] == '1' || $TabFinder['geo'] == '2' || $TabFinder['geo'] == '3' || $TabFinder['geo'] == '4'
|| $TabFinder['geo'] == '5' || $TabFinder['geo'] == '6' || $TabFinder['geo'] == '7' || $TabFinder['geo'] == '8' || $TabFinder['geo'] == '9' ) {
$TabFinder['geo'] = '0'.$TabFinder['geo'];
$TabFinder['geo'] = ereg_replace('00', '0', $TabFinder['geo']);
}
$normal_query .= " AND (".$tbl['item'].".B_I_GEO like '%".$TabFinder['geo']."%' ";
/* ajout de la jointure dpt */
$comp_geo = "select * from ".$tbl['dpt']." where GFD_NAME like '%".$TabFinder['geo']."%'";
$comp_do = mysql_query($comp_geo) or die("<B>Erreur de requete GEO :</B> $comp_geo.");
$comp_num = mysql_num_rows($comp_do);
if ($comp_num > 0) {
$i = 1;
while ($row = mysql_fetch_object($comp_do)) {
$tmp_stock = $row->GFD_ID;
if ($tmp_stock != '') {
if ($tmp_stock == '1' || $tmp_stock == '2' || $tmp_stock == '3' || $tmp_stock == '4' ||
$tmp_stock == '5' || $tmp_stock == '6' || $tmp_stock == '7' || $tmp_stock == '8' || $tmp_stock == '9' ) {
$tmp_stock = '0'.$tmp_stock;
$tmp_stock = ereg_replace('00', '0', $tmp_stock);
}
if ($i == 1) {
$normal_query .= ' OR (';
}
$normal_query .= $tbl['item'].'.B_I_GEO like "%'.$tmp_stock.'%"';
if ($i < $comp_num) {
$normal_query .= ' OR ';
}
if ($i == $comp_num) {
$normal_query .= ') ';
}
$i++;
}
}
}
mysql_free_result($comp_do);
$normal_query .= ') ';
}
// traitement du réducteur SINCE (fonction de la date)
if ($TabFinder['since'] != '') {
$since_var = explode('/', $TabFinder['since']);
if (empty($since_var[0])) {
$since_var[0] = '';
}
if (empty($since_var[1])) {
$since_var[1] = '';
}
if (empty($since_var[2])) {
$since_var[2] = '';
}
$timestamp = mktime (NULL,NULL,NULL,$since_var[1],$since_var[0],$since_var[2]);
$normal_query .= ' AND B_I_MAJFICHE > '.$timestamp;
}
// Création de l'ordre de tri
$order_query = " ORDER BY ".$TabFinder['sort'];
// Affectation de la requête à la variable qui va l'envoyer au moteur
if (empty($plugin_store['query_add_query'])) {
$plugin_store['query_add_query'] = '';
}
$unreq = $normal_query.' '.$add_to_query.' '.$plugin_store['query_add_query'].' '.$order_query;
//echo "$unreq";
return $unreq;
}
 
/* +--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 2004/09/15 10:32:30 jpm
* Suppression d'une ligne après la balise de fermeture php.
*
* Revision 1.2 2004/09/14 10:18:17 jpm
* Mise en forme et amélioration du code.
* Passage au XHTML strict.
*
* Revision 1.1 2004/09/10 18:44:02 jpm
* Ajout des fichiers de gestion du moteur de recherche des médias.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/applications/bb_consultation/bibliotheque/bbc_moteur_media.fonct.php
New file
0,0 → 1,461
<?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_media.fonct.php,v 1.1 2005-11-23 10:22:25 jp_milcent Exp $
/**
* Fonctions de création du moteur de recherche des médias.
*
* Contient les fonctions permettant de retourner l'affichage du moteur de recherche des média.
* Valable pour le paramètre "media".
*
*@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 |
// +------------------------------------------------------------------------------------------------------+
 
/** Fonction mkengine() - Créé le moteur de recherche en XHTML pour les médias.
*
* Fonction créant le moteur de recherche en XHTML pour le
* paramêtre "media".
*
* @return string le XHTML du moteur de recherche permettant de récupérer les média.
*/
function mkengine()
{
// Initialisation des variables globales
global $label_bbota, $tbl, $TabFinder, $nbr_total, $query_dom, $var_biblio;
global $arg_0,$arg_1,$arg_2,$arg_3,$arg_4,$arg_5;
global $plugin_store;
// Initialisation des variables
$url_courante = BB_URL_COURANTE_CONSULTATION;
$retour = '';
$tmp_titre = eregi_replace('_', ' ', BB_ARGUMENT_TITRE);
// Comptage du nombre total de données dans la table (hors CACHER = 1)
if ($var_biblio['limit_domain'] == 1) {
$add_domain_fr = ', '.$tbl['domaine_lk'];
$add_domain_qu = ' AND B_I_IDITEM = B_DL_IDITEM AND B_DL_IDDOM = 1';
} else {
$add_domain_fr = '';
$add_domain_qu = '';
}
if (BB_ARGUMENT_REGROUPEMENT == 'article') {
$requete = 'SELECT DISTINCT COUNT(B_I_IDITEM) AS CPT '.
'FROM '.$tbl['item'].$add_domain_fr.$plugin_store['count_add_table'].' '.
'WHERE B_I_CACHER = 0 '.
'AND B_I_TYPLOG = 1 '.
'AND B_I_TYPPHY = 2 '.
$add_domain_qu.' '.
$plugin_store['count_add_query'];
} else if (BB_ARGUMENT_REGROUPEMENT == 'media') {
$requete = 'SELECT DISTINCT COUNT(B_I_IDITEM) AS CPT '.
'FROM '.$tbl['item'].$add_domain_fr.$plugin_store['count_add_table'].' '.
'WHERE B_I_CACHER = 0 '.
'AND B_I_TYPPHY <> 2 '.
$add_domain_qu.' '.
$plugin_store['count_add_query'];
}
// DEBOGAGE : pour voir la requete de comptage
//$GLOBALS['_DEBOGAGE_'] .= $requete.'<br>';
$resultat = $GLOBALS['db_bb']->query($requete);
(DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '';
if ($resultat->numRows() == 1) {
$tmp_nb = $resultat->fetchRow(DB_FETCHMODE_OBJECT);
$nbr_total = $tmp_nb->CPT;
if ($nbr_total > 0) {
$chaine = 'parmi '.$nbr_total;
} else {
$retour .= presa_mk_title('Rechercher '.$tmp_titre, 1);
$retour .= '<p class="information">'.'Ce moteur de recherche ne contient aucune donnée...'.'</p>';
// Cette variable sert à éviter l'affichage de l'aide
global $no_help;
$no_help = 1;
return $retour;
}
}
// Affichage du titre
$retour .= presa_mk_title('Rechercher '.$chaine.' '.$tmp_titre.' :', 1);
// Affichage du formulaire du moteur de recherche
$retour .= '<form id="bb_moteur_media" '.
'action="'.$url_courante."&amp;arg_0=$arg_0&amp;arg_1=$arg_1&amp;arg_2=$arg_2&amp;arg_3=$arg_3&amp;arg_4=$arg_4&amp;arg_5=$arg_5".'" '.
'method="post">'."\n";
$retour .= '<ul>'."\n";
$resultat->free();// Fin comptage
// Construction du moteur
// Ligne de recherche 1
$retour .= '<li id="bb_moteur_media_01">'."\n";
$retour .= form_mk_chaine(stripslashes($TabFinder['chaine'])).' '.form_mk_typque($TabFinder['typque']);
$retour .= '</li>'."\n";
// Ligne de recherche 2
$retour .= '<li id="bb_moteur_media_02">'."\n".form_mk_auteur(stripslashes($TabFinder['auteur'])).'</li>'."\n";
// Ligne de recherche 3
$retour .= '<li id="bb_moteur_media_03">'."\n".form_mk_categ($TabFinder['categ']).'</li>'."\n";
// Ligne de recherche 4
$retour .= '<li id="bb_moteur_media_04">'."\n";
$retour .= form_mk_geo(stripslashes($TabFinder['geo'])).' ';
if (BB_ARGUMENT_REGROUPEMENT == 'media') {
$retour .= form_mk_categ_3($TabFinder['categ_3']).' '.form_mk_categ_2($TabFinder['categ_2']);
}
$retour .= '</li>'."\n";
// Mode avancée
if ($TabFinder['finder_mode'] == 'advance') {
$retour .= '<li id="bb_moteur_media_05">'."\n".form_mk_since($TabFinder['since']).'</li>'."\n";
// Lignes de regroupement (frequente)
$retour .= '<li id="bb_moteur_media_06">'."\n".form_mk_step($TabFinder['step']).'</li>'."\n";
$retour .= '<li id="bb_moteur_media_07">'."\n".form_mk_sort($TabFinder['sort']).'</li>'."\n";
}
$retour .= '<li id="bb_moteur_media_08" class="bb_aligner_droite">'."\n";
$retour .= form_mk_plugin($TabFinder['plugin']).form_mk_advance().' '.form_mk_submit()."\n";
$retour .= '</li>'."\n";
$retour .= '</ul>'."\n";
$retour .= '</form>'."\n";
// Ajout de liens pour les moteurs de recherche
// Premier lien...
$retour .= '<p>'."\n";
$link = $url_courante.'&amp;TransTab=typque,1!valid,1!finder_mode,normal!sort,B_I_AUTEURS!';
$link .= 'pstart,0!step,20!pend,231!plugin,!geo,!chaine,!auteur,!categ,!categ_2,!categ_3,!since,!nom,!prenom,!ville,!dept,!pays,!cotisant,!mail,!';
$retour .= ' <a href="'.$link.'" style="visibility:hidden;">all</a>'."\n";
// Second lien...
$link = $url_courante.'&amp;TransTab=typque,1!valid,1!finder_mode,normal!sort,B_I_AUTEURS!';
$link .= 'pstart,0!step,20!pend,231!plugin,!geo,!chaine,!auteur,!categ,!categ_2,!categ_3,!since,!nom,!prenom,!ville,!dept,!pays,!cotisant,!mail,!';
$retour .= ' <a href="'.$link.'" style="visibility:hidden;">all</a>'."\n";
$retour .= '</p>'."\n";
return $retour;
}
 
 
// form_mk_sort($actualsort,$class) :
// fonction spécifique du moteur MEDIA
// 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')
{
global $TabFinder;
$retour = '';
$id = 'TabFinder[sort]';
$retour .= '<label for="'.$id.'">'.'Trier par : '.'</label>';
$retour .= '<select id="'.$id.'" name="'.$id.'" class="'.$class.'">'."\n";
$retour .= ' <option value="B_I_AUTEURS" ';
if ($actualsort == 'B_I_AUTEURS') {
$retour .= 'selected="selected"';
}
$retour .= '>'.'auteur(s)'.'</option>'."\n";
$retour .= ' <option value="B_I_TITRE" ';
if ($actualsort == 'B_I_TITRE') {
$retour .= 'selected="selected"';
}
$retour .= '>'.'titre'.'</option>'."\n";
if (BB_ARGUMENT_REGROUPEMENT == 'media') {
$retour .= ' <option value="B_I_TYPLOG" ';
if ($actualsort == 'B_I_TYPLOG') {
$retour .= 'selected="selected"';
}
$retour .= '>'.'type de contenu'.'</option>'."\n";
$retour .= ' <option value="B_I_TYPPHY" ';
if ($actualsort == 'B_I_TYPPHY') {
$retour .= 'selected="selected"';
}
$retour .= '>'.'type de support'.'</option>'."\n";
}
if (BB_ARGUMENT_REGROUPEMENT == 'article') {
$le_champ = 'B_F_DATE';
} else {
$le_champ = 'B_M_DATE';
}
$retour .= ' <option value="'.$le_champ.'" ';
if ($actualsort == $le_champ) {
$retour .= 'selected';
}
$retour .= '>'.'date'.'</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, $TabFinder, $plugin_store;
$retour = '';
$id = 'TabFinder[categ]';
if (BB_ARGUMENT_REGROUPEMENT == 'article') {
// Affichage du réducteur - collections
$requete = 'SELECT B_C_CRAI, B_C_NOMCOMPLET, B_C_ABREGE '.
'FROM '.$tbl['collection'].', '.$tbl['serie'].$plugin_store['categ_add_table'].' '.
'WHERE B_C_CRAI = B_SER_CRAICOLL '.
'AND B_SER_INTOBIBLIO = 1 '.
$plugin_store['categ_add_query'].
'GROUP BY B_C_CRAI '.
'ORDER BY B_C_NOMCOMPLET';
$result_str = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
$nb_results = mysql_num_rows($result_str);
$retour .= '<label for="'.$id.'">'.'Dans :'.'</label>';
$retour .= '<select name="'.$id.'" class="'.$class.'">'."\n";
if ($nb_results > 1) {
$retour .= ' <option value=""';
if ($actualcateg == '') {
$retour .= ' selected="selected"';
}
$retour .= '>Toutes les revues</option>'."\n";
}
while ($row = mysql_fetch_object($result_str)) {
$collection = $row->B_C_NOMCOMPLET;
$abrege = $row->B_C_ABREGE;
$crai = $row->B_C_CRAI;
$retour .= '<option value="'.$crai.'"';
if ($actualcateg == $crai) {
$retour .= ' selected="selected"';
}
$retour .= '>';
if ($abrege == '') {
$retour .= $collection;
} else {
$retour .= $abrege;
}
$retour .= '</option>'."\n";
}
$retour .= ' </select>'."\n\n";
mysql_free_result($result_str);
} else {
global $var_biblio;
// on recherche ici les éditeurs de médias
// si les médias sont autre chose que des livres, on affine
// la liste en ne proposant que les éditeurs publiant des médias.
$requete = 'SELECT B_M_EDITEUR '.
'FROM '.$tbl['media'].', '.$tbl['item'].$plugin_store['categ_add_table'].' '.
'WHERE B_I_IDITEM = B_M_IDMEDIA '.
$plugin_store['categ_add_query'].' '.
'GROUP BY B_M_EDITEUR '.
'ORDER BY B_M_EDITEUR';
$do_editeur_qu = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
$nb_edresults = mysql_num_rows($do_editeur_qu);
if ($var_biblio['how_editeurs'] >= $nb_edresults) {
// nb de résultats < $how_editeurs
// on affiche une liste déroulante
$retour .= '<label for="'.$id.'">'.'Pour :'.'</label>';
$retour .= '<select name="'.$id.'" class="'.$class.'">'."\n";
if ($nb_edresults > 1) {
$retour .= '<option value=""';
if ($actualcateg == '') {
$retour .= ' selected="selected"';
}
$retour .= '>';
$retour .= 'tous éditeurs';
$retour .= '</option>'."\n";
}
while ($row_ed = mysql_fetch_object($do_editeur_qu)) {
$tmp_id = $row_ed->B_M_EDITEUR;
if ($tmp_id != '') {
$retour .= '<option value="'.stripslashes($tmp_id).'"';
if (stripslashes(stripslashes($actualcateg)) == $tmp_id) {
$retour .= ' selected="selected"';
}
$retour .= '>';
$retour .= stripslashes($tmp_id);
} else {
$retour .= '<option value="VIDE"';
if (($actualcateg == 'NULL') && ($actualcateg != '')) {
$retour .= ' selected="selected"';
}
$retour .= '>';
$retour .= 'éditeurs inconnus';
}
$retour .= '</option>'."\n";
}
$retour .= ' </select>';
} else {
// nb de résultats > $how_editeurs
// on affiche une zone de texte
$retour .= '<label for="'.$id.'">'.'Éditeur :'.'</label>';
$retour .= '<input type="text" id="'.$id.'" name="'.$id.'" class="'.$class.'" value="'.$TabFinder['categ'].'" />'."\n";
}
mysql_free_result($do_editeur_qu);
}
return $retour;
}
 
 
// form_mk_categ_2($actualcateg_2,$class) :
// fonction spécifique du moteur MEDIA
// créé une liste déroulante TabFinder[categ_2] pour affiner les résultats
// Entrée : $actualcateg_2 (valeur de TabFinder['categ_2']), $class (classe CSS) par défaut "insInputForm"
// Sortie (par retour) : string
 
function form_mk_categ_2($actualcateg_2, $class = 'bb_champ')
{
global $tbl;
$retour = '';
$requete = 'SELECT * '.
'FROM '.$tbl['item_typphy'].' '.
'WHERE B_IP_ID <> 2 '.
'ORDER BY B_IP_LABEL DESC';
$type_phy_do = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
$retour .= '<select name="TabFinder[categ_2]" class="'.$class.'">'."\n";
$retour .= '<option value=""';
if ($actualcateg_2 == '') {
$retour .= ' selected="selected"';
}
$retour .= '>';
$retour .= 'tous supports';
$retour .= '</option>'."\n";
while ($row_phy = mysql_fetch_object($type_phy_do)) {
$tmp_label = $row_phy->B_IP_LABEL;
$tmp_id = $row_phy->B_IP_ID;
$this_number = (count_num_of_reductor('B_I_TYPPHY', $tmp_id));
if ($this_number > 0) {
$retour .= '<option value="'.$tmp_id.'"';
if ($actualcateg_2 == $tmp_id) {
$retour .= ' selected="selected"';
}
$retour .= '>';
$retour .= $tmp_label.' ('.$this_number.')';
$retour .= '</option>'."\n";
}
}
$retour .= ' </select>';
mysql_free_result($type_phy_do);
return $retour;
}
 
 
// form_mk_categ_2($actualcateg_2,$class) :
// fonction spécifique du moteur MEDIA
// créé une liste déroulante TabFinder[categ_2] pour affiner les résultats
// Entrée : $actualcateg_2 (valeur de TabFinder['categ_2']), $class (classe CSS) par défaut "insInputForm"
// Sortie (par retour) : string
function form_mk_categ_3($actualcateg_3, $class = 'bb_champ')
{
global $tbl;
$retour = '';
$requete = 'SELECT * '.
'FROM '.$tbl['item_typlog'].' '.
'ORDER BY B_IL_LABEL';
$type_log_do = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
$retour .= '<select name="TabFinder[categ_3]" class="'.$class.'">'."\n";
$retour .= '<option value=""';
if ($actualcateg_3 == '') {
$retour .= ' selected="selected"';
}
$retour .= '>';
$retour .= 'tous contenus';
$retour .= '</option>'."\n";
while ($row_phy = mysql_fetch_object($type_log_do)) {
$tmp_label = $row_phy->B_IL_LABEL;
$tmp_id = $row_phy->B_IL_ID;
$this_number = (count_num_of_reductor('B_I_TYPLOG', $tmp_id));
if ($this_number > 0) {
$retour .= '<option value="'.$tmp_id.'"';
if ($actualcateg_3 == $tmp_id) {
$retour .= ' selected="selected"';
}
$retour .= '>';
$retour .= "$tmp_label ($this_number)";
$retour .= '</option>'."\n";
}
}
$retour .= ' </select>';
mysql_free_result($type_log_do);
return $retour;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.5 2005/05/17 10:10:08 jpm
* Correction des bogues avant mise en ligne du site v4.
*
* Revision 1.4 2005/03/03 08:32:26 jpm
* Suppression de li vide.
*
* Revision 1.3 2004/09/14 11:49:28 jpm
* Ajout de l'info sur les logs cvs en bas de fichier.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/applications/bb_consultation/bibliotheque/bbc_requete_structure.fonct.php
New file
0,0 → 1,258
<?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_requete_structure.fonct.php,v 1.1 2005-11-23 10:22:25 jp_milcent Exp $
/**
* Fonctions de création de la requête sur une structure.
*
* Contient une fonction créant la requête d'intérogation de la base de données.
* Valable pour le paramètre "structure".
* Ajouts :
* - 27/06/02 : recherche aussi dans la table des collections + jointure coll/str
*
*@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 |
// +------------------------------------------------------------------------------------------------------+
 
/** Fonction mkquery() - Créé une requête intérogeant la base de donnée.
*
* Fonction créant la requête d'intérogation de la base de données pour le
* paramêtre "structure".
*
* @return string la requête permettant de récupérer les structures.
*/
function mkquery()
{
// Définition des variables globales
global $tbl;
global $TabFinder;
// Initialisation des variables
$normal_query = '';
$add_to_query = '';
$order_query = '';
// Si la variable de catégorie vaut 'tous', il n'y a pas affinage de la requête par catégorie
if ($TabFinder['categ'] != 'tous') {
$add_to_query = ' AND '.$tbl['str'].'.B_S_TYPESTR = '.$TabFinder['categ'].' ';
}
// Ccréation du corps de la requête
// Création du SELECT
$normal_query = 'SELECT DISTINCT '.$tbl['str'].'.*, '.$tbl['pays'].'.GC_NAME, '.$tbl['typestr'].'.B_TYPSTR_LABEL ';
// Création du FROM
$normal_query .= ' FROM '.$tbl['str'].' LEFT JOIN '.$tbl['collection'].' ON '.$tbl['collection'].'.B_C_LKSTR = '.$tbl['str'].'.B_S_IDSTR, '.$tbl['pays'].', '.$tbl['typestr'].' ';
// Création du WHERE
$normal_query .= 'WHERE B_S_IDSTR > 0 '.
'AND B_S_CACHER = 0 '.
'AND ';
if (($TabFinder['typque'] != 1) && ($TabFinder['chaine'] != '')) {
$normal_query .= ' (';
$normal_query .= $tbl['str'].'.B_S_NOM LIKE "%'.$TabFinder['chaine'].'%"';
$normal_query .= ' OR '.$tbl['str'].'.B_S_SIGLE LIKE "%'.$TabFinder['chaine'].'%"';
$normal_query .= ' OR '.$tbl['str'].'.B_S_VOCACTIV LIKE "%'.$TabFinder['chaine'].'%"';
$normal_query .= ' OR '.$tbl['str'].'.B_S_COMMENT LIKE "%'.$TabFinder['chaine'].'%"';
$normal_query .= ' OR '.$tbl['str'].'.B_S_SERVICE LIKE "%'.$TabFinder['chaine'].'%"';
$normal_query .= ' OR '.$tbl['collection'].'.B_C_NOMCOMPLET LIKE "%'.$TabFinder['chaine'].'%"';
$normal_query .= ' OR '.$tbl['collection'].'.B_C_ABREGE LIKE "%'.$TabFinder['chaine'].'%"';
$normal_query .= ' OR '.$tbl['collection'].'.B_C_COMMENT LIKE "%'.$TabFinder['chaine'].'%"';
$normal_query .= ')';
} else if ($TabFinder['chaine'] != '') {
$normal_query .= ' (';
$result_from_ex = explode(' ', $TabFinder['chaine']);
$i_ex = 0;
while ($i_ex < count($result_from_ex)) {
$normal_query .= $tbl['str'].'.B_S_NOM LIKE "%';
if ($result_from_ex[$i_ex] != '') {
$normal_query .= $result_from_ex[$i_ex];
}
$normal_query .= '%" OR ';
$normal_query .= $tbl['str'].'.B_S_VOCACTIV LIKE "%';
if ($result_from_ex[$i_ex] != '') {
$normal_query .= $result_from_ex[$i_ex];
}
$normal_query .= '%" OR ';
$normal_query .= $tbl['str'].'.B_S_SIGLE LIKE "%';
if ($result_from_ex[$i_ex] != '') {
$normal_query .= $result_from_ex[$i_ex];
}
$normal_query .= '%" OR ';
$normal_query .= $tbl['str'].'.B_S_COMMENT LIKE "%';
if ($result_from_ex[$i_ex] != '') {
$normal_query .= $result_from_ex[$i_ex];
}
$normal_query .= '%" OR ';
$normal_query .= $tbl['str'].'.B_S_SERVICE LIKE "%';
if ($result_from_ex[$i_ex] != '') {
$normal_query .= $result_from_ex[$i_ex];
}
$normal_query .= '%" OR ';
$normal_query .= $tbl['collection'].'.B_C_NOMCOMPLET LIKE "%';
if ($result_from_ex[$i_ex] != '') {
$normal_query .= $result_from_ex[$i_ex];
}
$normal_query .= '%" OR ';
$normal_query .= $tbl['collection'].'.B_C_ABREGE LIKE "%';
if ($result_from_ex[$i_ex] != '') {
$normal_query .= $result_from_ex[$i_ex];
}
$normal_query .= '%" OR ';
$normal_query .= $tbl['collection'].'.B_C_COMMENT LIKE "%';
if ($result_from_ex[$i_ex] != '') {
$normal_query .= $result_from_ex[$i_ex];
}
$normal_query .= '%"';
if ($i_ex < (count($result_from_ex) - 1)) {
$normal_query .= ') AND (';
}
$i_ex++;
}
$normal_query .= ')';
}
// Création de la jointure avec les pays et les types
if ($TabFinder['chaine'] != '') {
$normal_query .= ' AND ';
}
$normal_query .= ' B_S_PAYS = GC_ID ';
$normal_query .= ' AND GC_LOCALE = "fr" ';
$normal_query .= ' AND B_S_TYPESTR = B_TYPSTR_ID ';
// Si TabFinder['geo'] est non vide :
// 1- si TabFinder['chaine'] est vide on n'ajoute pas de AND
// 2- s'il n'est pas vide on ajoute AND
if ($TabFinder['geo'] != '') {
preg_replace('/^(\d)$/', "0$1", $TabFinder['geo']);
preg_replace('/^00$/', '0', $TabFinder['geo']);
$normal_query .= ' AND ('.$tbl['str'].'.B_S_CODEPOSTAL LIKE "'.$TabFinder['geo'].'%" '.
'OR '.$tbl['str'].'.B_S_VILLE LIKE "%'.$TabFinder['geo'].'%" '.
'OR '.$tbl['pays'].'.GC_NAME LIKE "%'.$TabFinder['geo'].'%" ';
// Ajout de la jointure dpt
$comp_geo = 'SELECT * '.
'FROM '.$tbl['dpt'].' '.
'WHERE GFD_NAME LIKE "%'.$TabFinder['geo'].'%"';
$comp_do = mysql_query($comp_geo) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $comp_geo));
$comp_num = mysql_num_rows($comp_do);
if ($comp_num > 0) {
$i = 1;
while ($row = mysql_fetch_object($comp_do)) {
$tmp_stock = $row->GFD_ID;
if ($tmp_stock != '') {
preg_replace('^(\d)$', "0$1", $tmp_stock);
preg_replace('^00$', '0', $tmp_stock);
if ($i == 1) {
$normal_query .= ' OR ';
}
$normal_query .= $tbl['str'].'.B_S_CODEPOSTAL LIKE "'.$tmp_stock.'%"';
if ($i < $comp_num) {
$normal_query .= ' OR ';
}
if ($i == $comp_num) {
$normal_query .= ' ';
}
$i++;
}
}
}
mysql_free_result($comp_do);
$normal_query .= ') ';
}
// Traitement du réducteur SINCE (fonction de la date)
if ($TabFinder['since'] != '') {
$since_var = explode('/', $TabFinder['since']);
if (empty($since_var[0])) {
$since_var[0] = '';
}
if (empty($since_var[1])) {
$since_var[1] = '';
}
if (empty($since_var[2])) {
$since_var[2] = '';
}
$timestamp = mktime(NULL, NULL, NULL, $since_var[1], $since_var[0], $since_var[2]);
$normal_query .= ' AND B_S_MAJFICHE > '.$timestamp;
}
// Création de l'ordre de tri
$order_query = 'ORDER BY '.$TabFinder['sort'];
// Affectation de la requête à la variable qui va l'envoyer au moteur
$queries = $normal_query.' '.$add_to_query.' '.$order_query;
return $queries;
}
 
/* +--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 2004/09/16 11:05:54 jpm
* Correction bogue mauvaise requete.
*
* Revision 1.2 2004/09/15 11:21:07 jpm
* Début mise en conformité avec la convention de codage et le standard XHTML Strict.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/applications/bb_consultation/bibliotheque/bbc_moteur_structure.fonct.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 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_structure.fonct.php,v 1.1 2005-11-23 10:22:25 jp_milcent Exp $
/**
* Fonctions de création du moteur de recherche des structures.
*
* Contient les fonctions permettant de retourner l'affichage du moteur de recherche des structures.
* Valable pour le paramètre "structure".
*
*@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 |
// +------------------------------------------------------------------------------------------------------+
 
/** Fonction mkengine() - Créé le moteur de recherche en XHTML pour les structures.
*
* Fonction créant le moteur de recherche en XHTML pour le
* paramètre "structure".
*
* @return string le XHTML du moteur de recherche permettant de récupérer les structures.
*/
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['str'].' '.
'WHERE B_S_CACHER = 0';
$resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
if (mysql_num_rows($resultat) == 1) {
$tmp_nb = mysql_fetch_object($resultat);
$nbr_total = $tmp_nb->cpt;
if ($nbr_total > 0) {
$chaine = 'parmi '.$nbr_total.' adresses d\'organismes';
} else {
die('<b>'.'Erreur'.'</b>'.' lors du comptage des structures ('.$nbr_total.' trouvées) : '.$requete);
}
} else {
die('<b>'.'Erreur'.'</b>'.' lors du comptage des structures : '.$requete);
}
mysql_free_result($resultat);
// Affichage du titre de la page
$retour .= presa_mk_title('Chercher '.$chaine.' :', 1);
// Construction du moteur de str
$retour .= '<form id="bb_moteur_structure" action="'.BB_URL_COURANTE_CONSULTATION.'" method="post">'."\n";
$retour .= '<ul>'."\n";
// Ligne de recherche
$retour .= '<li>'."\n";
$retour .= form_mk_chaine(stripslashes($TabFinder['chaine'])).' '.
form_mk_typque($TabFinder['typque']).
form_mk_categ($TabFinder['categ']);
$retour .= '</li>'."\n";
// Ligne de géographie
$retour .= '<li>'."\n".form_mk_geo(stripslashes($TabFinder['geo'])).'</li>'."\n";
if ($TabFinder['finder_mode'] == 'advance') {
$retour .= '<li>'."\n".form_mk_since($TabFinder['since']).'</li>'."\n";
}
// Ligne de regroupement (frequente)
if ($TabFinder['finder_mode'] == 'advance') {
$retour .= '<li>'."\n".form_mk_step($TabFinder['step'])."\n".form_mk_sort($TabFinder['sort'])."\n".'</li>'."\n";
}
$retour .= '<li class="bb_aligner_droite">'."\n";
$retour .= form_mk_advance().' '.form_mk_submit()."\n";
$retour .= '</li>'."\n";
$retour .= '</ul>'."\n";
$retour .= '</form>'."\n\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_S_NOM!';
$link .= 'pstart,0!step,20!pend,231!plugin,!geo,!chaine,!auteur,!categ,!categ_2,!categ_3,!since,!nom,!prenom,!ville,!dept,!pays,!cotisant,!mail,!';
$retour .= '<a href="'.$link.'" style="visibility:hidden;">all</a>'."\n";
return $retour;
}
 
/** Fonction form_mk_sort() - Créé la liste déroulante XHTML de l'ordre de trie des structures.
*
* Fonction créant liste déroulante XHTML de l'ordre de trie des structures.
*
* @param string la type de trie sélectionné : valeur de TabFinder['sort'].
* @param string la classe à appliquer à la balise <select>.
*
* @return string la liste déroulante XHTML de l'ordre de trie des structures.
*/
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_S_NOM" ';
if ($actualsort == 'B_S_NOM') {
$retour .= 'selected="selected"';
}
$retour .= '>'.'nom'.'</option>'."\n";
$retour .= ' <option value="GC_NAME" ';
if ($actualsort == 'GC_NAME') {
$retour .= 'selected="selected"';
}
$retour .= '>'.'pays'.'</option>'."\n";
$retour .= '</select>'."\n\n";
return $retour;
}
 
/** Fonction form_mk_categ() - Créé la liste déroulante XHTML des types de structures.
*
* Fonction créant liste déroulante XHTML des types de structures.
*
* @param string l'identifiant du type de structure actuellement sélectionné : valeur de TabFinder['categ'].
* @param string la classe à appliquer à la balise <select>.
*
* @return string la liste déroulante XHTML des types de structures.
*/
function form_mk_categ($actualcateg, $class = 'bb_champ')
{
global $tbl, $label_bbota;
$retour = '';
$retour .= ' <select name="TabFinder[categ]" class="'.$class.'">'."\n";
$retour .= ' <option value="tous" ';
if ($actualcateg == 0) {
$retour .= 'selected="selected"';
}
$retour .= '>'.$label_bbota['all_typstr'].'</option>'."\n";
$requete = 'SELECT * '.
'FROM '.$tbl['typestr'].' '.
'ORDER BY B_TYPSTR_ID';
$result_str = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
while ($row = mysql_fetch_object($result_str)) {
$typstr_id = $row->B_TYPSTR_ID;
$typstr_nom = $row->B_TYPSTR_LABEL;
$retour .= '<option value="'.$typstr_id.'"';
if ($actualcateg == $typstr_id) {
$retour .= ' selected="selected"';
}
$retour .= '>'.$typstr_nom.'</option>'."\n";
}
mysql_free_result($result_str);
$retour .= '</select>'."\n\n";
return $retour;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.3 2005/05/17 10:10:08 jpm
* Correction des bogues avant mise en ligne du site v4.
*
* Revision 1.2 2004/09/15 11:21:07 jpm
* Début mise en conformité avec la convention de codage et le standard XHTML Strict.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/applications/bb_consultation/bibliotheque/bbc_affichage_media.fonct.php
New file
0,0 → 1,364
<?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_affichage_media.fonct.php,v 1.1 2005-11-23 10:22:25 jp_milcent Exp $
/**
* Fonctions de création de l'affichage des résultats d'un média.
*
* Contient une fonction créant l'affichage des résultats pour le paramètre "media".
*
*@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 |
// +------------------------------------------------------------------------------------------------------+
/*Mettre ici les inclusions de fichiers*/
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
/*Mettre ici la liste de fonctions.*/
 
/** Fonction mkresu() - Traitement des requêtes.
*
* Fonction traitant la requête d'intérogation de la base de données pour le
* paramêtre "media".
*
* @return string les résultats à afficher.
*/
function mkresu()
{
global $result_final;
global $nbr_final;
global $tbl;
global $TabFinder;
global $nbr_total;
global $var_biblio;
global $query_dom;
global $phy;
// Initialisation des variables
$retour = '';
$retour .= '<ul id="bb_liste_resultat_media">'."\n";
$j = 1;
while ($row = mysql_fetch_object($result_final)) {
$retour .= '<li>';
// Récupération des données
$get_idstr = $row->B_S_IDSTR;
$get_nomstr = $row->B_S_NOM;
$get_iditem = $row->B_I_IDITEM;
$get_titreitem = $row->B_I_TITRE;
$get_auteuritem = $row->B_I_AUTEURS;
$get_geo = $row->B_I_GEO;
$get_langue = $row->B_I_LANGUE;
$get_resumcle = $row->B_I_RESUMCLE;
$get_image = $row->B_I_IMAGE;
$get_saisie = $row->B_AS_LIBELLE;
$get_comment = $row->B_I_COMMENT;
$get_domaine_id = $row->B_D_ID;
$get_domaine_nom = $row->B_D_LABEL;
if ($get_domaine_id != 1) {
$retour .= '<span class="texte_unactive">['.$get_domaine_nom.']</span>'."\n";
}
if (BB_ARGUMENT_REGROUPEMENT == 'article') {
$get_idcoll = $row->B_C_CRAI;
$get_seriecoll = $row->B_SER_IDSERIE;
$get_titreserie = $row->B_SER_SOUSTITRE;
$get_nomcoll = $row->B_C_NOMCOMPLET;
$get_abrege = $row->B_C_ABREGE;
$get_idfasc = $row->B_F_NUMERO;
$get_titrefasc = $row->B_F_TITRE;
$get_datefasc = $row->B_F_DATE;
$get_debut = $row->B_A_PAGEDEBUT;
$get_fin = $row->B_A_PAGEFIN;
} else {
$collection_book = $row->B_M_COLLECTION;
$numcoll_book = $row->B_M_NUMCOLL;
$isbn = $row->B_M_ISBN;
$editeur = $row->B_M_EDITEUR;
$get_datefasc = $row->B_M_DATE;
$prix = $row->B_M_PRIX;
$idmonnaie = $row->B_M_LKMONNAIE;
$monnaie = $row->GEN_MON_SYMBOLE;
$converter = $row->GEN_MON_VAL1EURO;
$volume = $row->B_M_VOLUME;
$edite = $row->B_M_EDITE;
$vendu = $row->B_M_VEND;
}
if ((BB_ARGUMENT_REGROUPEMENT == 'media') || (BB_ARGUMENT_REGROUPEMENT == 'mixte')) {
$id_phy = $row->B_IP_ID;
$item_phy = $row->B_IP_LABEL;
$icon_phy = $row->B_IP_IMAGE;
$id_log = $row->B_IL_ID;
$item_log = $row->B_IL_LABEL;
$icon_log = $row->B_IL_IMAGE;
$retour .= '<span class="texte_inactif">';
if ($icon_phy != '') {
$retour .= '<img class="bb_img_icone" src="'.BB_CHEMIN_IMAGES_TYPE_PHYSIQUE.$icon_phy.'" alt="'.$item_phy.'" /> ';
} else {
$retour .= '['.$item_phy.']';
}
if (($icon_phy == '') && ($icon_log)) {
$retour .= ' - ';
}
if ($icon_log != '') {
$retour .= ' <img class="bb_img_icone" src="'.BB_CHEMIN_IMAGES_TYPE_LOGIQUE.$icon_log.'" alt="'.$item_log.'" />';
} else {
$retour .= '['.$item_log.']';
}
$retour .= '</span> ';
}
// début de l'affichage
if ($get_auteuritem != '') {
$retour .= "\n";
$get_auteuritem = strtolower(ColorizeFound($get_auteuritem, stripslashes($TabFinder['auteur'])));
$retour .= ucwords($get_auteuritem);
} else {
$retour .= 'Anonyme';
}
$retour .= ' -'."\n".'<b>'.ColorizeFound($get_titreitem, stripslashes($TabFinder['chaine'])).'</b>'."\n";
if ($get_datefasc > 0) {
$retour .= ' - ' . DAT_formaterDateYYYYMMJJ($get_datefasc);
}
if (($get_resumcle != '') || ($get_comment != '')) {
$retour .= ' - <i>';
if ($get_resumcle != '') {
$retour .= ColorizeFound($get_resumcle, strtolower(stripslashes($TabFinder['chaine'])));
}
if (($get_resumcle != '') && ($get_comment != '')) {
$retour .= ' - ';
}
if ($get_comment != '') {
$retour .= ColorizeFound($get_comment, strtolower(stripslashes($TabFinder['chaine'])));
}
$retour .= '</i>';
}
if ((!empty($get_debut)) && (!empty($get_fin))) {
if (($get_debut > 0)||($get_fin > 0)) {
$retour .= ', p. ';
$retour .= $get_debut;
if (($get_debut > 0) && ($get_fin > 0)) {
$retour .= '-';
}
$retour .= $get_fin;
}
}
if ((!empty($volume))) {
$retour .= ' - '.$volume;
}
if (!empty($get_geo)) {
$retour .= ' - '.'Départ./Région : '.'<i>' . ColorizeFound($get_geo,ucFirst(stripslashes($TabFinder['geo']))).'</i>';
}
$retour .= ' - ';
if (BB_ARGUMENT_REGROUPEMENT == 'article') {
if (!empty($get_nomstr)) $retour .= "$get_nomstr, ";
if (empty($get_abrege)) {
$retour .= $get_nomcoll;
} else {
$retour .= $get_abrege;
}
if (!empty($get_titreserie)) {
$retour .= ', '.$get_titreserie;
}
if (($var_biblio['open_biblio_str'] == true) && ($get_nomstr != '')) {
$retour .= ', <a href="'.BB_URL_COURANTE_CONSULTATION_AVANCEE.'&amp;art='.$get_idcoll.'-'.$get_seriecoll.'-'.$get_idfasc.
'&amp;arg_0=str%3D'.$get_idstr.'&amp;arg_1=coll%3D'.$get_idstr.
'&amp;arg_2=book%3D'.$get_idstr.'&amp;arg_3=media%3D'.$get_idstr.'">'.
$get_titrefasc.
'</a>';
} else {
$retour .= ', '.$get_titrefasc;
}
} else if (BB_ARGUMENT_REGROUPEMENT == 'media') {
$retour .= 'Editeur : ';
if (($var_biblio['open_biblio_str'] == true) && ($editeur != '') && ($edite == 1) && ($get_idstr != '')) {
// sert à accéder à des pages différentes selon le type physique
// désactivé pour homogénéiser les accès au popup
if ($id_phy == $phy['perio']) {
$tmp_word = 'str';
$tmp_page = 0;
} else {
$tmp_word = 'str';
$tmp_page = 0;
}
$retour .= ' <a href="'.BB_URL_COURANTE_CONSULTATION_AVANCEE.'&amp;page='.$tmp_page.'&amp;'.
$tmp_word.'='.$get_idstr.'&amp;arg_0=str%3D'.$get_idstr.'&amp;arg_1=coll%3D'.$get_idstr.'&amp;arg_2=book%3D'.$get_idstr.
'&amp;arg_3=media%3D'.$get_idstr.'">'.$editeur.'</a>';
} else if (!empty($editeur)) {
$retour .= $editeur;
} else {
$retour .= 'inconnu';
}
} else {
if ($var_biblio['open_biblio_str'] == true) {
$retour .= '<a href="'.BB_URL_COURANTE_CONSULTATION_AVANCEE.'&amp;str='.$get_idstr.
'&amp;arg_0=str%3D'.$get_idstr.'&amp;arg_1=coll%3D'.$get_idstr.
'&amp;arg_2=book%3D'.$get_idstr.'&amp;arg_3=media%3D'.$get_idstr.'">
'.$get_nomstr.
'</a>';
} else {
$retour .= $get_nomstr;
}
}
if (((!empty($collection_book) && ($collection_book != ''))) || ((!empty($numcoll_book) && ($numcoll_book != '')))) {
$retour .= ' - '.'Collection : '.$collection_book.' '.$numcoll_book;
}
if ((!empty($isbn) && ($isbn != ''))) {
$retour .= ' - '.'ISBN : '.$isbn;
}
if ((!empty($prix) && ($prix > 0))) {
$retour .= ' - '.$prix.' '.$monnaie;
}
if ((!empty($vendu)&&($vendu == -1))) {
$retour .= ' - <img class="'.BB_CLASS_IMG_EPUISE.'" src="'.BB_IMG_EPUISE.'" alt="'.'Epuisé'.'" />';
}
if ((!empty($var_biblio['val_euro'])) && (!empty($idmonnaie)) && (!empty($converter))) {
if (($var_biblio['val_euro'] != $idmonnaie) && ($converter > 0) && ($prix > 0)) {
$retour .= ' ('.'env. '.round($prix/$converter,2).' &euro;)';
}
}
if ((!empty($get_langue) && ($get_langue != ''))) {
$retour .= ' - '.$get_langue;
}
if ($get_saisie != '') {
$get_saisie = 'Saisie : '.$get_saisie.' -';
} else if ($get_saisie == '') {
$get_saisie = 'Saisie : '.'? -';
}
/* correction du 28 nov 2002
if (($get_saisie != "")&&($get_saisie == $get_nomstr)) $get_saisie = "";
else if ($get_saisie != "") $get_saisie = "Saisie : $get_saisie -";
else if ($get_saisie == "") $get_saisie = "Saisie : ? -";
*/
// Là on affiche les Voir Aussi ... si y'en a
$UnVoirAussi = new VoirAussi($get_iditem, $tbl[BB_ARGUMENT_REGROUPEMENT]);
if ($UnVoirAussi->NbVA > 0) {
$liste_va = $UnVoirAussi->ListerVoirAussi();
$retour .= ' - '.'Consulter : ';
for ($i = 0; $i == (($UnVoirAussi->NbVA) - 1) ; $i++) {
$retour .= '<img class="'.BB_CLASS_IMG_ICONE.'" src="'.$liste_va[$i]['icon_src'].'" alt="'.$liste_va[$i]['icon_alt'].'"/> ';
$retour .= '<a '.$liste_va[$i]['target'].'>'.$liste_va[$i]['texte'].'</a>';
if ($liste_va[$i]['desc'] != '') {
$retour .= ' - <i>'.$liste_va[$i]['desc'].'</i>';
}
if (($i != 0) && ($i < ($UnVoirAussi->NbVA))) {
$retour .= '<br />'."\n";
}
}
}
// Fin des Voir Aussi
$retour .= ' - <span class="texte_inactif">';
if ((BB_ARGUMENT_REGROUPEMENT != 'article') && ($edite == 0)) {
$retour .= 'Donnée fournie par ';
if ($get_idstr != 0) {
$retour .= '<a href="'.BB_URL_COURANTE_CONSULTATION_AVANCEE.'&amp;str='.$get_idstr.'&amp;page=0&amp;arg_0=str%3D'.$get_idstr.'&amp;arg_1=coll%3D'.
$get_idstr.'&amp;arg_2=book%3D'.$get_idstr.'&amp;arg_3=media%3D'.$get_idstr.'">'.$get_nomstr.'</a>';
} else {
$retour .= $get_nomstr;
}
$retour .= ' - ';
}
$retour .= $get_saisie.' Art. n°'.$get_iditem.'.</span>';
$retour .= "\n";
if ($j < $nbr_final) {
$retour .= '<br /><br/>';
}
$retour .= '</li>'."\n";
$j++;
}
$retour .= '</ul>'."\n";
return $retour;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.6 2005/08/18 10:43:15 jpm
* Correction chemin.
*
* Revision 1.5 2005/05/31 13:03:51 jpm
* Correction affichage lien vers structure inconnue.
*
* Revision 1.4 2005/05/17 10:10:08 jpm
* Correction des bogues avant mise en ligne du site v4.
*
* Revision 1.3 2005/02/24 18:33:26 jpm
* Modification de la gestion des voir aussi.
*
* Revision 1.2 2004/09/14 10:18:17 jpm
* Mise en forme et amélioration du code.
* Passage au XHTML strict.
*
* Revision 1.1 2004/09/10 18:44:02 jpm
* Ajout des fichiers de gestion du moteur de recherche des médias.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/applications/bb_consultation/bibliotheque/bbc_affichage.fonct.php
New file
0,0 → 1,486
<?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_affichage.fonct.php,v 1.1 2005-11-23 10:22:25 jp_milcent Exp $
/**
* Fonctions de l'interface de consultation de Biblio Bota.
*
* Contient les fonctions fournissant du XHTML pour l'affichage de l'interface de consultation de BibioBota.
*
*@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 |
// +------------------------------------------------------------------------------------------------------+
/*Mettre ici les inclusions de fichiers*/
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
/*Mettre ici la liste de fonctions.*/
 
// string ColorizeFound($tomod,$tofind)
// Colorie dans une chaine de texte $tomod la chaine $tofind.
// $tofind peut contenir des espaces, chaque terme sera quand même colorié.
// Retourne la chaine de caractères $tomod convertie.
function ColorizeFound($tomod, $tofind)
{
$words = explode(' ', $tofind);
// Liste de mots générant des problèmes vis à vis de la chaine $edited
$forbid_lst[0] = 'la';
$forbid_lst[1] = 'texte';
$forbid_lst[2] = 'found';
$forbid_lst[3] = 'un';
$forbid_lst[4] = 'fou';
$forbid_lst[5] = 'las';
$forbid_lst[6] = 'class';
$forbid_lst[7] = 'text';
$forbid_lst[8] = 'ou';
$forbid_lst[9] = 'ext';
$forbid_lst[10] = 'te';
$forbid_lst[11] = 'ex';
$forbid_lst[12] = 'und';
$forbid_lst[13] = 'a';
$forbid_lst[14] = 'c';
$forbid_lst[15] = 'd';
$forbid_lst[16] = 'e';
$forbid_lst[17] = 'f';
$forbid_lst[18] = 'l';
$forbid_lst[19] = 'n';
$forbid_lst[20] = 'o';
$forbid_lst[21] = 'p';
$forbid_lst[22] = 's';
$forbid_lst[23] = 't';
$forbid_lst[24] = 'u';
$forbid_lst[25] = 'x';
for ($i = 0; $i < count($words); $i++) {
$words[$i] = ereg_replace('\[', '', $words[$i]);
$words[$i] = ereg_replace('\]', '', $words[$i]);
$edited = '<span class="bb_txt_trouve">'.$words[$i].'</span>';
if (($words[$i] != '') && ($tomod != '') && (! in_array($words[$i], $forbid_lst))){
$tomod = eregi_replace($words[$i], $edited, $tomod);
}
}
return $tomod;
}
 
// form_mk_submit($value) :
// créé un bouton de validation de formulaire
// Entrée : string $value (facultatif), string $class
// Sortie (par retour) : string
function form_mk_submit($value = 'Chercher', $class = 'texte_tb')
{
$retour = '';
$retour .= '<input type="submit" name="valider" value="'.$value.'" class="'.$class.'" />';
$retour .= '<input type="hidden" name="TabFinder[valid]" value="1" />';
return $retour;
}
 
 
// form_mk_reset($value) :
// créé un bouton d'effacement de formulaire
// Entrée : string $value (facultatif)
// Sortie (par retour) : string
function form_mk_reset($value = 'Effacer', $class = 'texte_tb')
{
return '<input type="reset" value="'.$value.'" name="valider" class="'.$class.'" />';
}
 
 
// form_mk_chaine($value,$class) :
// créé un champ texte "chaine"
// Entrée : $value (valeur de TabFinder['chaine']), $class (classe CSS) par défaut "insInputForm"
// Sortie (par retour) : string
function form_mk_chaine($value = '', $class = 'insInputForm')
{
$id = 'TabFinder[chaine]';
$retour = '<label for="'.$id.'">'.'Rechercher : '.'</label>';
$retour .= '<input type="text" id="'.$id.'" name="'.$id.'" class="'.$class.'" value="'.$value.'" />'."\n";
return $retour;
}
 
 
// form_mk_geo($value,$class) :
// créé un champ texte "geo"
// Entrée : $value (valeur de TabFinder['geo']), $class (classe CSS) par défaut "insInputForm"
// Sortie (par retour) : string
function form_mk_geo($value = '', $class = 'insInputForm')
{
$id = 'TabFinder[geo]';
$retour = '<label for="'.$id.'">'.'Zone géo. : '.'</label>';
$retour .= '<input type="text" id="'.$id.'" name="'.$id.'" class="'.$class.'" value="'.$value.'" />'."\n";
return $retour;
}
 
 
// form_mk_auteur($value,$class) :
// créé un champ texte "auteur"
// Entrée : $value (valeur de TabFinder['auteur']), $class (classe CSS) par défaut "insInputForm"
// Sortie (par retour) : string
function form_mk_auteur($value = '', $class = 'insInputForm')
{
$id = 'TabFinder[auteur]';
$retour = '<label for="'.$id.'">'.'Auteur : '.'</label>';
$retour .= '<input type="text" id="'.$id.'" name="'.$id.'" class="'.$class.'" value="'.$value.'" />';
return $retour;
}
 
 
// form_mk_step($actualstep,$class) :
// créé une liste déroulante TabFinder[step] pour fragmenter les pages en x résultats
// Entrée : $actualstep (valeur de TabFinder['step']), $class (classe CSS) par défaut "insInputForm"
// Sortie (par retour) : string
function form_mk_step($actualstep, $class = 'insInputForm')
{
$retour = '';
$id = 'TabFinder[step]';
$retour .= '<label for="'.$id.'">'.'Grouper les résultats : '.'</label>';
$retour .= '<select id="'.$id.'" name="'.$id.'" class="'.$class.'">'."\n";
$retour .= ' <option value="10"';
if ($actualstep == 10) {
$retour .= 'selected="selected"';
}
$retour .= '>par 10</option>'."\n";
$retour .= ' <option value="20"';
if (($actualstep == 20) || ($actualstep == '')) {
$retour .= 'selected="selected"';
}
$retour .= '>par 20</option>'."\n";
$retour .= ' <option value="50"';
if ($actualstep == 50) {
$retour .= 'selected="selected"';
}
$retour .= '>par 50</option>'."\n";
$retour .= '</select>'."\n";
return $retour;
}
 
 
// form_mk_typque($actualstep,$class) :
// créé une liste déroulante TabFinder[step] pour fragmenter les pages en x résultats
// Entrée : $actualtypque (valeur de TabFinder['typque']), $class (classe CSS) par défaut "insInputForm"
// Sortie (par retour) : string
function form_mk_typque($actualtypque, $class = 'insInputForm')
{
global $label_bbota;
$retour = '';
$retour .= '<select name="TabFinder[typque]" size="1" class="'.$class.'">'."\n";
$retour .= ' <option value="1"';
if (($actualtypque == '') || ($actualtypque == 1)) {
$retour .= ' selected="selected"';
}
$retour .= '>'.$label_bbota['bool_separe'].'</option>'."\n";
$retour .= ' <option value="0"';
if (($actualtypque == 0) && ($actualtypque != '')) $retour .= ' selected';
$retour .= '>'.$label_bbota['bool_exacte'].'</option>'."\n";
$retour .= '</select>'."\n";
return $retour;
}
 
// form_mk_since($value,$class) :
// créé un champ texte "since"
// Entrée : $value (valeur de TabFinder['since']), $class (classe CSS) par défaut "insInputForm"
// Sortie (par retour) : string
function form_mk_since($value = '', $class = 'insInputForm')
{
$id = 'TabFinder[since]';
$retour = '<label for="'.$id.'">'.'Réduire aux données mises en ligne depuis le : '.'</label>';
$retour .= '<input type="text" id="'.$id.'" name="'.$id.'" class="'.$class.'" value="'.$value.'" maxlength="10" />';
$retour .= ' (au format jj/mm/aaaa)'."\n";
return $retour;
}
 
 
// form_mk_plugin($value) :
// créé un element de formulaire caché en fonction du contenu de Plugin
// Entrée : string $value
// Sortie (par retour) : string ou void
function form_mk_plugin($value)
{
if ($value != '') {
return '<input type="hidden" name="TabFinder[plugin]" value="'.$value.'" />'."\n";
} else {
return '';
}
}
 
// form_mk_advance() :
// créé un element/lien formulaire appelant la page elle-même pour avoir un formulaire en mode "avancé"
// Entrée :
// Sortie (par retour) : string
function form_mk_advance()
{
global $TabFinder, $arg_0, $arg_1, $arg_2, $arg_3, $arg_4, $arg_5;
if (empty($TabFinder)) {
$TabFinder = '';
}
$stockagevar = '';
foreach($TabFinder as $tmp_stock_i => $value) {
if ($tmp_stock_i != 'args' && $tmp_stock_i != 'finder_mode') {
$stockagevar .= $tmp_stock_i.','.$value.'!';
}
}
$stockagevar = ereg_replace(' ', '{', $stockagevar);
if ($TabFinder['finder_mode'] == 'normal') {
$chaine_url_middle = 'advance';
$chaine_labelle = 'Plus';
} else if ($TabFinder['finder_mode'] == 'advance') {
$chaine_url_middle = 'normal';
$chaine_labelle = 'Moins';
}
$chaine_url_end = '&amp;arg_0='.$arg_0.'&amp;arg_1='.$arg_1.'&amp;arg_2='.$arg_2.'&amp;arg_3='.$arg_3.'&amp;arg_4='.$arg_4.'&amp;arg_5='.$arg_5;
$chaine_url_start = "\n".'<input type="button" class="texte_tb" value="'.$chaine_labelle.' d\'options" '.
'onclick="javascript:window.location.href=\''.$GLOBALS['_GEN_commun']['url']->getURL().
'&amp;TransTab='.$stockagevar.'finder_mode,'.$chaine_url_middle.$chaine_url_end.'\';" />'."\n";
return $chaine_url_start;
}
 
// presa_mk_title($value,$colspan) :
// créé une ligne de titre dans un <tr>
// Entrée : string $value, int $colspan
// ($value : titre ; $colspan : nombre de colonnes fusionnées ; par défaut $colspan = 1)
// Sortie (par retour) : string
 
function presa_mk_title($value, $niveau = '2', $class = 'insTitle1')
{
return '<h'.$niveau.' class="'.$class.'">'.$value.'</h'.$niveau.'>'."\n";
}
 
 
// presa_mk_maxtitle($value,$colspan) :
// créé une ligne de titre dans un <tr>
// Entrée : string $value, int $colspan
// ($value : titre ; $colspan : nombre de colonnes fusionnées ; par défaut $colspan = 1)
// Sortie (par retour) : string
function presa_mk_maxtitle($value, $niveau = '1', $class = 'insMsg')
{
return '<h'.$niveau.' class="'.$class.'">'.$value.'</h'.$niveau.'>'."\n";
}
 
 
// presa_mk_blkline($colspan=1) :
// créé une ligne vide dans un <tr>
// Entrée : int $colspan
// ($colspan : nombre de colonnes fusionnées ; par défaut $colspan = 1)
// Sortie (par retour) : string
function presa_mk_blkline($colspan=1)
{
return '<tr><td class="texte_tb" colspan="'.$colspan.'">&nbsp;</td></tr>'."\n";
}
 
// count_num_of_reductor($table,$id)
// retourne le nombre d'items de la table $tbl['item'] ayant un
// type de réducteur $id dans le champ $champ
 
function count_num_of_reductor($champ, $id)
{
global $tbl;
global $retour_biblio;
global $plugin_store;
if ($retour_biblio['limit_domain'] == 1) {
$from_ajout = ', '.$tbl['domaine_lk'];
$requete_ajout = ' AND B_I_IDITEM = B_DL_IDITEM AND B_DL_IDDOM = 1';
} else {
$from_ajout = '';
$requete_ajout = '';
}
if ((BB_ARGUMENT_REGROUPEMENT == 'media') && ($champ == 'B_I_TYPLOG')) {
$requete_ajout .= ' AND '.$GLOBALS['query_dom']['phy'];
}
$requete = 'SELECT COUNT(B_I_IDITEM) AS CPT '.
'FROM '.$tbl['item'].$plugin_store['count_add_table'].$from_ajout.' '.
'WHERE '.$champ.' = '.$id.' '.
$requete_ajout.' '.
$plugin_store['count_add_query'];
$resultat = $GLOBALS['db_bb']->query($requete);
(DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '';
$nbre_ligne = $resultat->numRows();
if ($nbre_ligne != 1) {
die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete, 'Erreur : '.$nbre_ligne.' résultat(s) au lieu d\'1.'));
$resultat->free();
return -1;
} else {
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT);
$nombre = $ligne->CPT;
$resultat->free();
return $nombre;
}
}
 
/**Fonction CreateNavigBiblio() - construit l'interface de navigation de la consultation avancée.
*
* Créée des boutons pour accéder à certains services spécifiques de Biblio Bota
* (listes,modifications...).
* Cette fonction utilise les constantes :
* - BB_URL_COURANTE_CONSULTATION
* - BB_IMG_PRECEDENT
* - BB_CLASS_IMG_PRECEDENT
*
* @param string la destination du bouton (goback ou goto).
* @param string le sujet de destination du bouton (coll, fasc ou art).
* @param array un tableau contenant les arguments des liens des boutons.
* @param string le texte du bouton qui remplacera l'image.
* @param bool booléen indiquant si on doit afficher une image ou pas.
*
* @return array les infos des "voir aussi".
*/
function CreateNavigBiblio($destination, $sujet, $tableau, $texte = '', $image = 0)
{
if (!isset($tableau['pass'])) {
$tableau['pass'] = '';
}
if (!isset($tableau['locusfasc'])) {
$tableau['locusfasc'] = '';
}
$retour = '';
switch ($destination) {
// GoBack permet de créer des retours aux pages précédentes (fasc->coll, art->fasc)
case 'goback':
switch ($sujet) {
case 'coll':
// Permet de retourner des fascicules aux collections
$action = BB_URL_COURANTE_CONSULTATION.'&amp;consultation=avancee&amp;page=1&amp;coll='.$tableau['pass'].$tableau['args'];
$retour = '<p class="bb_navigation">';
$retour .= '<a href="'.$action.'">';
if ($image == 1) {
$retour .= '<img class="'.BB_CLASS_IMG_PRECEDENT.'" src="'.BB_IMG_PRECEDENT.'" alt="'.$texte.'..."/>';
$retour .= ' '.$texte;
} else {
$retour .= ' '.$texte;
}
$retour .= '</a></p>'."\n";
break;
case 'fasc':
// Permet de retourner des articles aux fascicules
$action = BB_URL_COURANTE_CONSULTATION.'&amp;consultation=avancee&amp;page=1&amp;fasc='.$tableau['back'].$tableau['args'].
'&amp;locusfasc='.$tableau['locusfasc'];
$retour = '<p class="bb_navigation">';
$retour .= '<a href="'.$action.'">';
if ($image == 1) {
$retour .= '<img class="'.BB_CLASS_IMG_PRECEDENT.'" src="'.BB_IMG_PRECEDENT.'" alt="'.$texte.'..."/>';
$retour .= ' '.$texte;
} else {
$retour .= ' '.$texte;
}
$retour .= '</a></p>'."\n";
break;
}
break;
// GoTo permet de descendre d'un niveau (coll->fasc->art)
case 'goto':
switch ($sujet) {
case 'fasc':
// Permet de descendre des coll aux fasc
$action = BB_URL_COURANTE_CONSULTATION.'&amp;consultation=avancee&amp;page=1&amp;fasc='.$tableau['pass'].$tableau['args'];
$retour = '<p class="bb_navigation">';
$retour .= '<a href="'.$action.'">';
if ($image == 1) {
$retour .= '<img class="'.BB_CLASS_IMG_PRECEDENT.'" src="'.BB_IMG_PRECEDENT.'" alt="'.$texte.'..."/>';
$retour .= ' '.$texte;
} else {
$retour .= ' '.$texte;
}
$retour .= '</a></p>'."\n";
break;
case 'art':
// Permet de descendre des fasc aux art
$action = BB_URL_COURANTE_CONSULTATION.'&amp;consultation=avancee&amp;page=1&amp;art='.$tableau['pass'].$tableau['args'].
'&amp;locusfasc='.$tableau['locusfasc'];
$retour = ' - ';
$retour .= '<a href="'.$action.'">';
if ($image == 1) {
$retour .= '<img class="'.BB_CLASS_IMG_PRECEDENT.'" src="'.BB_IMG_PRECEDENT.'" alt="'.$texte.'..."/>';
$retour .= ' '.$texte;
} else {
$retour .= ' '.$texte;
}
$retour .= '</a>'."\n";
break;
}
break;
}
return $retour;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.6 2005/05/17 10:10:08 jpm
* Correction des bogues avant mise en ligne du site v4.
*
* Revision 1.5 2005/01/04 16:23:47 jpm
* Amélioration de la forme.
*
* Revision 1.4 2004/09/16 12:07:30 jpm
* Changement de noms de constantes.
*
* Revision 1.3 2004/09/14 10:18:17 jpm
* Mise en forme et amélioration du code.
* Passage au XHTML strict.
*
* Revision 1.2 2004/09/10 18:44:25 jpm
* Ajout de fonction et mise en forme.
*
* Revision 1.1 2004/09/10 09:45:37 jpm
* Ajout des fichiers BiblioBota configurer pour Papyrus.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/applications/bb_consultation/bibliotheque/bbc_affichage_structure.fonct.php
New file
0,0 → 1,165
<?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_affichage_structure.fonct.php,v 1.1 2005-11-23 10:22:25 jp_milcent Exp $
/**
* Fonctions de création de l'affichage des résultats d'une structure.
*
* Contient une fonction créant l'affichage des résultats pour le paramètre "structure".
*
*@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 |
// +------------------------------------------------------------------------------------------------------+
 
/** Fonction mkresu() - Traitement des requêtes.
*
* Fonction traitant la requête d'intérogation de la base de données pour le
* paramêtre "structure".
*
* @return string les résultats à afficher.
*/
function mkresu()
{
global $result_final;
global $nbr_final;
global $tbl;
global $TabFinder;
global $var_biblio;
$ret = '';
$ret .= '<ul id="bb_liste_resultat_structure">'."\n";
$i = 1;
while ($ligne = mysql_fetch_object($result_final)) {
$get_idstr = $ligne->B_S_IDSTR;
$get_name = $ligne->B_S_NOM;
$get_cp = $ligne->B_S_CODEPOSTAL;
$get_ville = $ligne->B_S_VILLE;
$get_pays = $ligne->GC_NAME;
$get_date = $ligne->B_S_MAJFICHE;
$get_categ = $ligne->B_S_TYPESTR;
$get_categ_nom = $ligne->B_TYPSTR_LABEL;
$ret .= '<li>'."\n";
$ret .= '<b>';
$ret .= ColorizeFound($get_name, stripslashes($TabFinder['chaine']));
$ret .= '</b> ';
$ret .= '(';
$ret .= ColorizeFound($get_ville, strtoupper($TabFinder['geo']));
if (($get_ville != '') && ($get_pays != '')) {
$ret .= ' - ';
}
if (($get_pays == 'France') && ($get_cp != '')) {
// Calcul du code département pour la France
if ($get_cp < 97000) {
$calc_dpt = floor($get_cp / 1000);
} else {
$calc_dpt = floor($get_cp / 100);
}
$dpt_qu = 'SELECT GFD_NAME '.
'FROM '.$tbl['dpt'].' '.
'WHERE GFD_ID = '.$calc_dpt;
$do_dpt = mysql_query($dpt_qu) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $dpt_qu));
$nbr_dpt = mysql_num_rows($do_dpt);
if ($nbr_dpt == 1) {
$resu_dpt = mysql_fetch_object($do_dpt);
$nom_dpt = $resu_dpt->GFD_NAME;
} else {
return '<b>Erreur lors de la recherche du département :</b> '.$nbr_dpt.' départements trouvés.';
}
$ret .= ColorizeFound($nom_dpt, ucFirst($TabFinder['geo'])) . ' - ';
}
if ($get_pays != '') {
if ($TabFinder['geo'] != '') {
$ret .= ColorizeFound($get_pays, ucFirst($TabFinder['geo']));
} else {
$ret .= $get_pays;
}
}
$ret .= ') - '."\n";
if ($get_categ != '') {
$ret .= $get_categ_nom;
}
// Vérification de l'accès à la consultation avancée transversale de Bilblio Bota.
if ($var_biblio['open_biblio_str'] == true) {
$ret .= ' - <a href="'.BB_URL_COURANTE_CONSULTATION_AVANCEE.'&amp;str='.$get_idstr.'&amp;arg_0=str%3D'.$get_idstr.'&amp;arg_1=coll%3D'.
$get_idstr.'&amp;arg_2=book%3D'.$get_idstr.'&amp;arg_3=media%3D'.$get_idstr.'">'.
'Plus d\'infos'.
'</a>';
}
if ($i < $nbr_final) {
$ret .= '<br /><br />';
}
$i++;
$ret .= '</li>'."\n";
}
$ret .= '</ul>'."\n";
// Vérification de l'accès à la proposition de nouvelles structures.
if ($var_biblio['open_proposer_str'] == true) {
$ret .= '<p class="bb_txt_centre">'.
'<hr size="1" />'.
'<a href="'.BB_URL_COURANTE_ADMIN.'&amp;action=new&ensemble=str">'.'Proposer un nouvel organisme'.'</a>'.
'<hr size="1" />'.
'</p>'."\n";
}
return $ret;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.3 2005/05/17 10:10:08 jpm
* Correction des bogues avant mise en ligne du site v4.
*
* Revision 1.2 2004/09/15 11:21:07 jpm
* Début mise en conformité avec la convention de codage et le standard XHTML Strict.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/applications/bb_consultation/bibliotheque/bbc_statistique.fonct.php
New file
0,0 → 1,137
<?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_statistique.fonct.php,v 1.1 2005-11-23 10:22:25 jp_milcent Exp $
/**
* Fonctions de statistique de Biblio Bota.
*
* Contient les fonctions permettant de faire les statistiques de Biblio Bota.
*
*@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 |
// +------------------------------------------------------------------------------------------------------+
 
/** Fonction spy_validated_finder() - Enregistrement des statistiques.
*
* Fonction insèrant dans la table biblio_spy des données concernant les requêtes
* faites par les utilisateurs de Biblio Botanica.
*
* @param string les arguments d'appel de la page de Biblio Bota.
* @return void les données sont enregistrées dans la base de données.
*/
function spy_validated_finder($page_arg, $nbres)
{
global $doc, $REMOTE_ADDR, $TabFinder, $TransTab;
if (isset($TransTab)) {
$TabFinder = FRAG_decoupageChaine($TransTab);
}
$moment = time();
if (!isset($TabFinder['plugin'])) {
$TabFinder['plugin'] = '';
}
if (!isset($TabFinder['geo'])) {
$TabFinder['geo'] = '';
}
if (!isset($TabFinder['chaine'])) {
$TabFinder['chaine'] = '';
}
if (!isset($TabFinder['sort'])) {
$TabFinder['sort'] = '';
}
if (!isset($TabFinder['auteur'])) {
$TabFinder['auteur'] = '';
}
if (!isset($TabFinder['categ'])) {
$TabFinder['categ'] = '';
}
if (!isset($TabFinder['pstart'])) {
$TabFinder['pstart'] = '';
}
if (!isset($TabFinder['pend'])) {
$TabFinder['pend'] = '';
}
if (!isset($TabFinder['step'])) {
$TabFinder['step'] = '';
}
if (!isset($TabFinder['valid'])) {
$TabFinder['valid'] = '';
}
if (!isset($TabFinder['typque'])) {
$TabFinder['typque'] = '';
}
if (!isset($TabFinder['categ_2'])) {
$TabFinder['categ_2'] = '';
}
if (!isset($TabFinder['categ_3'])) {
$TabFinder['categ_3'] = '';
}
if (!isset($TabFinder['since'])) {
$TabFinder['since'] = '';
}
if ($nbres > 0) {
$calc_pages = 'De '.$TabFinder['pstart'].' à '.$TabFinder['pend'].' sur '.$nbres;
} else {
$calc_pages = 'Pas de résultats';
}
$requete = 'INSERT INTO biblio_spy VALUES ("", "'.$doc.'.'.$TabFinder['plugin'].'", '.
'"'.$page_arg.'", "'.$REMOTE_ADDR.'", "'.$TabFinder['chaine'].'", '.
'"'.$TabFinder['geo'].'", "'.$TabFinder['auteur'].'", "'.$TabFinder['categ'].'", '.
'"'.$TabFinder['categ_2'].'", "'.$TabFinder['categ_3'].'", "'.$TabFinder['typque'].'", '.
'"'.$TabFinder['step'].'", "'.$TabFinder['sort'].'", "'.$TabFinder['since'].'", '.
'"'.$calc_pages.'", "'.$moment.'")';
mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.2 2005/05/17 10:10:08 jpm
* Correction des bogues avant mise en ligne du site v4.
*
* Revision 1.1 2004/09/10 18:43:31 jpm
* Ajout d'une bibliothèque de gestion de fonction de statistique de Biblio Bota.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/applications/bb_consultation/bibliotheque/bbc_requete_lien.fonct.php
New file
0,0 → 1,183
<?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_requete_lien.fonct.php,v 1.1 2005-11-23 10:22:25 jp_milcent Exp $
/**
* Fonctions de création de la requête sur un lien.
*
* Contient une fonction créant la requête d'intérogation de la base de données.
* 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 |
// +------------------------------------------------------------------------------------------------------+
/*Mettre ici les inclusions de fichiers*/
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
/*Mettre ici la liste de fonctions.*/
 
function mkquery()
{
global $TabFinder, $tbl;
// Initialisation
$order_query = '';
// Si la variable de catégorie vaut 0, il n'y a pas affinage de la requête par catégorie. Sinon, on affine.
if ($TabFinder['categ'] != 0) {
$add_to_from = $tbl['cat'].', '.$tbl['categlien'].', ';
$add_to_query = ' AND ('.$tbl['cat'].'.B_CAT_IDCAT = '.$TabFinder['categ'].')';
if ($TabFinder['chaine'] != '') {
$join_categ = ' AND ';
} else {
$join_categ = '';
}
$join_categ .= ' AND ('.$tbl['link'].'.B_L_IDLINK = '.$tbl['categlien'].'.B_LC_IDLINK) AND ('.$tbl['cat'].'.B_CAT_IDCAT = '.$tbl['categlien'].'.B_LC_IDCAT)';
} else {
$add_to_from = '';
$add_to_query = '';
$join_categ = '';
}
// Création du SELECT
$normal_query = 'SELECT '.$tbl['link'].'.*, '.$tbl['str'].'.B_S_NOM ';
// si le raffinement de catégorie vaut autre chose que 0, il faut ajouter les tables de catégories
if ($TabFinder['categ'] != 0) {
$normal_query .= ', '.$tbl['categlien'].'.*, '.$tbl['cat'].'.B_CAT_LABEL, '.$tbl['cat'].'.B_CAT_IDCAT ';
}
// Création du FROM
$normal_query .= 'FROM '.$add_to_from.$tbl['link'].' LEFT JOIN '.$tbl['str'].' ON '.$tbl['link'].'.B_L_LKSTR = '.$tbl['str'].'.B_S_IDSTR ';
// Création du WHERE
$normal_query .= 'WHERE B_L_CACHER = 0 ';
if (($TabFinder['typque'] == 0) && ($TabFinder['chaine'] != '')) {
$normal_query .= ' AND (';
$normal_query .= $tbl['link'].'.B_L_TITRE like "%'.$TabFinder['chaine'].'%" '.
'OR '.$tbl['link'].'.B_L_URL like "%'.$TabFinder['chaine'].'%" '.
'OR '.$tbl['link'].'.B_L_RESUMCLE like "%'.$TabFinder['chaine'].'%" ';
$normal_query .= ') ';
} else if ($TabFinder['chaine'] != '') {
$normal_query .= ' AND (';
// Si la variable de type de recherche vaut 1, il faut que le moteur recherche chaque motif
if ($TabFinder['typque'] == 1) {
$result_from_ex = explode (' ', $TabFinder['chaine']);
}
$i_ex = 0;
while ($i_ex < count($result_from_ex)) {
$normal_query .= $tbl['link'].'.B_L_TITRE LIKE "%';
if ($result_from_ex[$i_ex] != '') {
$normal_query .= $result_from_ex[$i_ex];
}
$normal_query .= '%" OR ';
$normal_query .= $tbl['link'].'.B_L_URL LIKE "%';
if ($result_from_ex[$i_ex] != '') {
$normal_query .= $result_from_ex[$i_ex];
}
$normal_query .= '%" OR ';
$normal_query .= $tbl['link'].'.B_L_RESUMCLE LIKE "%';
if ($result_from_ex[$i_ex] != '') {
$normal_query .= $result_from_ex[$i_ex];
}
$normal_query .= '%"';
if ($i_ex < (count($result_from_ex) - 1)) {
$normal_query .= ') AND (';
}
$i_ex++;
}
$normal_query .= ')';
}
// traitement du réducteur SINCE (fonction de la date)
if ($TabFinder['since'] != '') {
$since_var = explode('/', $TabFinder['since']);
if (empty($since_var[0])) {
$since_var[0] = '';
}
if (empty($since_var[1])) {
$since_var[1] = '';
}
if (empty($since_var[2])) {
$since_var[2] = '';
}
$timestamp = mktime(NULL, NULL, NULL, $since_var[1], $since_var[0], $since_var[2]);
if (!ereg('WHERE', $normal_query)) {
$normal_query .= ' WHERE ';
} else {
$normal_query .= ' AND ';
}
$normal_query .= 'B_L_MAJFICHE > '.$timestamp;
}
// Création de l'ordre de tri
$order_query = ' ORDER BY '.$TabFinder['sort'];
// Affectation de la requête à la variable qui va l'envoyer au moteur
$unreq = $normal_query.' '.$join_categ.' '.$add_to_query.' '.$order_query;
return $unreq;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.4 2005/06/20 17:32:14 jpm
* Correction erreur de construction de la requête sql.
*
* Revision 1.3 2005/05/17 10:10:08 jpm
* Correction des bogues avant mise en ligne du site v4.
*
* Revision 1.2 2004/09/14 11:49:52 jpm
* Ajout de l'entête au fichier.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/applications/bb_consultation/bibliotheque/bbc_moteur_lien.fonct.php
New file
0,0 → 1,203
<?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 ----------------------------------------------------------------------------------------+
*/
?>