Subversion Repositories eFlore/Applications.bibliobota

Compare Revisions

Ignore whitespace Rev 1 → Rev 2

/trunk/applications/bb_consultation/bbc_info_livre.inc.php
New file
0,0 → 1,274
<?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_info_livre.inc.php,v 1.1 2005-11-23 10:22:25 jp_milcent Exp $
/**
* Appli bb_consultation : gestion des informations avancées "livre" de Biblio Bota
*
* Ce fichier permet d'afficher les informations concernant les "livres" d'un organisme lié à la botanique.
*
*@package BiblioBota-Consultation
//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 |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
if ($tableau['pstart']== '') {
$tableau['pstart'] = 0;
}
 
// Ligne de proposition d'édition
if ($var_biblio['open_proposer_media'] == 1) {
$sortie .= CreateNavigBiblio('add', 'book', 'Proposer un nouveau livre', $tableau['book'], 1, $tableau);
} else {
$sortie .= '&nbsp;';
}
*/
 
// Ligne de titre
$requete = 'SELECT B_S_NOM '.
'FROM '.$tbl['str'].' '.
'WHERE B_S_IDSTR = '.$tableau['book'];
$resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
$num_s = mysql_num_rows($resultat);
 
if ($num_s != 1) {
$sortie .= '<p class="erreur"><strong>'.'Erreur de requête LIVRE !'.'</strong>'.
' nombre de résultats (= '.$num_s.') incohérent pour la requête : '.'<br />'.$requete.'</p>';
} else {
// Récupération des infos sur la structure
$ligne = mysql_fetch_object($resultat);
$la_structure = $ligne->B_S_NOM;
mysql_free_result($resultat);
$tableau['args'] = '&amp;book='.$tableau['book'];
// Comptage du nombre de livres
$requete = 'SELECT COUNT(*) AS COMPTAGE '.
'FROM '.$tbl['item'].', '.$tbl['media'].' '.
'WHERE '.$tbl['media'].'.B_M_LKSTR = '.$tableau['book'].' '.
'AND '.$tbl['item'].'.B_I_TYPPHY = '.$def_livre.' '.
'AND '.$tbl['item'].'.B_I_IDITEM = '.$tbl['media'].'.B_M_IDMEDIA';
$resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
$ligne = mysql_fetch_object($resultat);
$num_c = $ligne->COMPTAGE;
mysql_free_result($resultat);
global $def_livre;
$requete = 'select '.$tbl['item'].'.*, '.$tbl['media'].'.*, GEN_MON_SYMBOLE, B_AS_LIBELLE, GEN_MON_VAL1EURO, '.$tbl['domaine'].'.* '.
'FROM '.$tbl['item'].', '.$tbl['media'].', '.$tbl['monnaie'].', '.$tbl['saisie'].', '.$tbl['domaine'].', '.$tbl['domaine_lk'].' '.
'WHERE B_M_LKSTR = '.$tableau['book'].' '.
'AND B_I_TYPPHY = '.$def_livre.' '.
'AND B_I_IDITEM = B_M_IDMEDIA '.
'AND GEN_MON_IDMONNAIE = B_M_LKMONNAIE '.
'AND B_I_AUTEURSAISIE = B_AS_ID '.
'AND B_I_IDITEM = B_DL_IDITEM '.
'AND B_DL_IDDOM = B_D_ID '.
'ORDER BY B_I_AUTEURS '.
'LIMIT '.$tableau['pstart'].', '.$var_biblio['how_book'];
$resultat = mysql_query($requete) or die (BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
$nb_m = mysql_num_rows($resultat);
// Titre de la page
$sortie .= '<h1>'.$la_structure.' : livres'.'</h1>'."\n";
// Récupération d'informations
if (empty($tableau['step'])) {
$tableau['step'] = $var_biblio['how_book'];
}
if (empty($tableau['how_bloc'])) {
$tableau['step'] = $var_biblio['how_book'];
}
if (empty($tableau['pend'])) {
$tableau['pend'] = $num_c;
}
if (empty($tableau['libelle'])) {
$tableau['libelle'] = 'livre';
}
if (empty($tableau['feminin'])) {
$tableau['feminin'] = 0;
}
// Affichage du nbre de résultats
$sortie .= '<p id="frag_nbre_resultat">';
$sortie .= FRAG_afficherTxtNbreResultat('bbpopup', $tableau, $nb_m, $num_c);
$sortie .= '</p>'."\n";
// Ici on fragmente en pages, pour une navigation plus facile
$frag = new fragmenteur(' - ', 10, BB_URL_COURANTE_CONSULTATION_AVANCEE);
$frag_txt = $frag->fragmente($tableau, $num_c);
if (($frag->nb_pages) > 1) {
$sortie .= '<p class="frag_navigation">'.$frag_txt.'</p>'."\n";
}
// Affichage des livres
if ($num_c == 0) {
$sortie .= '<p class="information">'.'Aucun livre indexé.'.'</p>';
} else {
$sortie .= '<ul id="bb_liste_livre">'."\n";
while ($ligne = mysql_fetch_object($resultat)) {
$id_a = $ligne->B_I_IDITEM;
$titre = $ligne->B_I_TITRE;
$auteurs = $ligne->B_I_AUTEURS;
$geo = $ligne->B_I_GEO;
$langue = $ligne->B_I_LANGUE;
$resum = $ligne->B_I_RESUMCLE;
$image = $ligne->B_I_IMAGE;
$saisie = $ligne->B_AS_LIBELLE;
$comment = $ligne->B_I_COMMENT;
$date = $ligne->B_M_DATE;
$prix = $ligne->B_M_PRIX;
$idmonnaie = $ligne->B_M_LKMONNAIE;
$monnaie = $ligne->GEN_MON_SYMBOLE;
$converter = $ligne->GEN_MON_VAL1EURO;
$volume = $ligne->B_M_VOLUME;
$edite = $ligne->B_M_EDITE;
$vendu = $ligne->B_M_VEND;
$editeur = $ligne->B_M_EDITEUR;
$collection_book = $ligne->B_M_COLLECTION;
$numcoll_book = $ligne->B_M_NUMCOLL;
$get_domaine_id = $ligne->B_D_ID;
$get_domaine_nom = $ligne->B_D_LABEL;
$sortie .= '<li>'."\n";
if ($image != '') {
$sortie .= '<img class="bb_img_livre" src="'.BB_CHEMIN_IMAGES_ILLUSTRATION.$image.'" '.
'alt="'.'Illustration du livre : '.$titre.'" />';
}
if ($get_domaine_id != 1) {
$sortie .= '<span class="texte_inactif">'.'['.$get_domaine_nom.']'.'</span>'."\n";
}
if (($auteurs == '') || ($auteurs == 'ANONYME')) {
$sortie .= 'Inconnu ou Anonyme'.' - ';
} else {
$sortie .= $auteurs.' - ';
}
$sortie .= '<strong>'.$titre.'</strong>'.' -'."\n";
$sortie .= ' Éditeur : ';
if ($editeur != '') {
$sortie .= $editeur;
} else {
$sortie .= 'inconnu';
}
$sortie .= ' - ';
if (($collection_book != '') || ($numcoll_book != '')) {
$sortie .= 'Collection : '.$collection_book.' '.$numcoll_book.' - ';
}
if ($geo != '') {
$sortie .= 'Départ./Région : '.'<em>'.$geo.'</em>'.' -';
}
if ($date > 0) {
$sortie .= ' '.DAT_formaterDateYYYYMMJJ($date).', ';
}
if ($volume != '') {
$sortie .= $volume.', ';
}
if ($prix > 0) {
$sortie .= $prix.' '.$monnaie;
}
if (($def_euro != $idmonnaie) && ($converter > 0)) {
$sortie .= ' (env. '.round($prix/$converter, 2).' &euro;)';
}
if ($langue != '') {
$sortie .= ' ('.$langue.')';
}
if (($resum != '') || ($comment != '')) {
$sortie .= ' - '.'<em>'.$comment;
if (($resum != '') && ($comment != '')) {
$sortie .= ' - ';
}
$sortie .= $resum.'</em>';
}
if ($vendu == -1) {
$sortie .= ' - '.'<img class="'.BB_CLASS_IMG_EPUISE.'" src="'.BB_IMG_EPUISE.'" alt="'.'Épuisé'.'" />';
}
if (($edite == 1) || ($vendu == 1)) {
$sortie .= ' - '.'Organisme ';
if ($edite == 1) {
$sortie .= 'éditeur';
}
if (($edite == 1) && ($vendu == 1)) {
$sortie .= ' et ';
}
if ($vendu == 1) {
$sortie .= 'vendeur';
}
$sortie .= ' de l\'article';
}
if ($saisie != '') {
$sortie .= '<span class="texte_inactif">'.' - '.'Saisie : '.$saisie.' - Art. n°'.$id_a.'.'.'</span>';
}
// Là on affiche les Voir Aussi Livres ... si y'en a
$UnVoirAussi = new VoirAussi($id_a, $tbl['article']);
if ($UnVoirAussi->NbVA > 0) {
$sortie .= '<br />'.'Consulter : ';
$liste_va = $UnVoirAussi->ListerVoirAussi();
for ($i = 0; $i == (($UnVoirAussi->NbVA) - 1); $i++) {
$sortie .= '<img class="'.BB_CLASS_IMG_ICONE.'" src="'.$liste_va[$i]['icon_src'].'" alt="'.$liste_va[$i]['icon_alt'].'" /> ';
$sortie .= '<a '.$liste_va[$i]['target'].'>'.$liste_va[$i]['texte'].'</a>';
if ($liste_va[$i]['desc'] != '') {
$ret .= ' - '.'<em>'.$liste_va[$i]['desc'].'</em>';
}
}
}
$sortie .= '</li>'."\n";
}
$sortie .= '</ul>'."\n";
}
mysql_free_result($resultat);
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>