Subversion Repositories eFlore/Applications.bibliobota

Compare Revisions

Ignore whitespace Rev 29 → Rev 30

/trunk/applications/bb_consultation/bibliotheque/bbc_requete_media.fonct.php
1,57 → 1,57
<?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 |
// +------------------------------------------------------------------------------------------------------+
<?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.3 2004/09/15 10:32:30 jpm 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.3 $ $Date: 2004/09/15 10:32:30 $
// +------------------------------------------------------------------------------------------------------+
*/
 
/** 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.
// +------------------------------------------------------------------------------------------------------+
// | 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()
{
67,14 → 67,14
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)';
$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'];
$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)';
$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)';
}
105,18 → 105,18
$special_join .= ' AND ('.$tbl['item'].'.B_I_IDITEM = '.$tbl['article'].'.B_A_IDART)';
// réducteur de catégorie (collections) categ
if ($TabFinder['categ'] != '') {
if ($TabFinder['categ'] != '') {
$add_to_query = ' AND ('.$tbl['article'].'.B_A_CRAICOLL like "'.$TabFinder['categ'].'%")';
} else {
$add_to_query = '';
} else {
$add_to_query = '';
}
} else {
// On demande ici les livres et médias
$add_select = $tbl['media'].'.*, '.$tbl['monnaie'].'.*, ';
// Ajout du FROM
// 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 -- 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
126,23 → 126,23
// 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 = '';
if ((!empty($query_dom['log']))) {
$create_log = $query_dom['log'];
} else {
$create_log = '';
}
} else {
$create_log = 'B_I_TYPLOG = '.$TabFinder['categ_3'];
} else {
$create_log = 'B_I_TYPLOG = '.$TabFinder['categ_3'];
}
if ($TabFinder['categ_2'] == '') {
if ((!empty($query_dom['phy']))) {
if ((!empty($query_dom['phy']))) {
$create_phy = $query_dom['phy'];
} else {
$create_phy = '';
} else {
$create_phy = '';
}
} else {
$create_phy = 'B_I_TYPPHY = '.$TabFinder['categ_2'];
} else {
$create_phy = 'B_I_TYPPHY = '.$TabFinder['categ_2'];
}
if (($create_phy != "")&&($create_log != "")) {
239,10 → 239,10
/* ajout, si nécessaire, de la contrainte categ */
if (($TabFinder['categ'] != '') && (BB_ARGUMENT_REGROUPEMENT == 'media')) {
if ($TabFinder['categ'] == 'VIDE') {
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'].'%")';
} else {
$normal_query .= ' AND (B_M_EDITEUR like "%'.$TabFinder['categ'].'%")';
}
}
263,8 → 263,8
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 ';
if ( $tmp < (count($tmp_auteur) - 1) ) {
$normal_query .= ' AND ';
}
}
$normal_query .= ')';
275,7 → 275,7
// 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'
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']);
296,21 → 296,21
$tmp_stock = $row->GFD_ID;
if ($tmp_stock != '') {
if ($tmp_stock == '1' || $tmp_stock == '2' || $tmp_stock == '3' || $tmp_stock == '4' ||
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 (';
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 .= ' OR ';
}
if ($i == $comp_num) {
$normal_query .= ') ';
if ($i == $comp_num) {
$normal_query .= ') ';
}
$i++;
}
325,14 → 325,14
if ($TabFinder['since'] != '') {
$since_var = explode('/', $TabFinder['since']);
if (empty($since_var[0])) {
$since_var[0] = '';
if (empty($since_var[0])) {
$since_var[0] = '';
}
if (empty($since_var[1])) {
$since_var[1] = '';
if (empty($since_var[1])) {
$since_var[1] = '';
}
if (empty($since_var[2])) {
$since_var[2] = '';
if (empty($since_var[2])) {
$since_var[2] = '';
}
$timestamp = mktime (NULL,NULL,NULL,$since_var[1],$since_var[0],$since_var[2]);
343,35 → 343,33
// 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'] = '';
// 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";
// Débogage de la requête
//trigger_error($unreq, E_USER_WARNING);
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 ----------------------------------------------------------------------------------------+
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
* $Log: bbc_requete_media.fonct.php,v $
* 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 ----------------------------------------------------------------------------------------+
*/
?>