Subversion Repositories eFlore/Applications.bibliobota

Rev

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

<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1                                                                                      |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or                                        |
// | modify it under the terms of the GNU Lesser General Public                                           |
// | License as published by the Free Software Foundation; either                                         |
// | version 2.1 of the License, or (at your option) any later version.                                   |
// |                                                                                                      |
// | This library is distributed in the hope that it will be useful,                                      |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
// | Lesser General Public License for more details.                                                      |
// |                                                                                                      |
// | You should have received a copy of the GNU Lesser General Public                                     |
// | License along with this library; if not, write to the Free Software                                  |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bbc_info_article.inc.php,v 1.2 2006-05-29 17:21:17 jp_milcent Exp $
/**
* Appli bb_consultation : gestion des informations avancées "article" de Biblio Bota
*
* Ce fichier permet d'afficher les informations concernant les "articles" 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.2 $ $Date: 2006-05-29 17:21:17 $
// +------------------------------------------------------------------------------------------------------+
*/

// +------------------------------------------------------------------------------------------------------+
// |                                            ENTETE du PROGRAMME                                       |
// +------------------------------------------------------------------------------------------------------+


// +------------------------------------------------------------------------------------------------------+
// |                                            CORPS du PROGRAMME                                        |
// +------------------------------------------------------------------------------------------------------+

global $locusfasc;
if (!empty($locusfasc)) {
    $tableau['locusfasc'] = $locusfasc;
} else {
    $tableau['locusfasc'] = 0;
}

/*
$unex est composé de :
- [0] collection
- [1] serie
- [2] fascicule
- [3] point de départ de la requete
*/
$unex = explode ('-', $tableau['art']);

$requete =  'SELECT B_S_IDSTR, B_S_NOM, B_C_NOMCOMPLET, B_SER_SOUSTITRE, B_F_TITRE, B_F_DATE '.
            'FROM '.$tbl['str'].', '.$tbl['collection'].', '.$tbl['serie'].', '.$tbl['fascicule'].' '.
            'WHERE B_S_IDSTR = B_C_LKSTR '.
            'AND B_C_CRAI = B_SER_CRAICOLL '.
            'AND B_SER_CRAICOLL = B_F_CRAICOLL '.
            'AND B_SER_IDSERIE = B_F_CRAISERIE '.
            'AND B_F_CRAICOLL = "'.$unex[0].'" '.
            'AND B_F_CRAISERIE = "'.$unex[1].'" '.
            'AND B_F_NUMERO = "'.$unex[2].'"';
$resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
$num = mysql_num_rows($resultat);

if ($num != 1) {
    $sortie .=  '<p class="erreur"><strong>'.'Erreur de requête de sélection l\'en-tête articles :'.'</strong>'.
                ' nombre de résultats (= '.$num.') incohérent pour la requête : '.'<br />'.$requete.'</p>';
} else {
    $ligne = mysql_fetch_object($resultat);
    $le_numero = $ligne->B_S_IDSTR;
    $le_nom = $ligne->B_S_NOM;
    $la_coll = $ligne->B_C_NOMCOMPLET;
    $le_titre = $ligne->B_F_TITRE;
    $la_date = $ligne->B_F_DATE;
    mysql_free_result($resultat);
    
    $tableau['args'] = '&amp;art='.$tableau['art'].'&amp;arg_0=str%3D'.$le_numero.'&amp;arg_1=coll%3D'.$le_numero.'&amp;arg_2=book%3D'.$le_numero.'&amp;arg_3=media%3D'.$le_numero;
    $tableau['back'] = $unex[0].'-'.$unex[1];
    
    // Affichage de la navigation avancée : retour aux fascicules
    $sortie .= CreateNavigBiblio('goback', 'fasc', $tableau, 'Retour aux fascicules', 1);
    
    // Affichage du titre
    $sortie .= '<h1>'.$le_nom.' : articles'.'</h1>'."\n";
    $sortie .= '<h2>'.'du '.$le_titre.' du périodique '.$la_coll.'</h2>'."\n";
    
    // Comptage du total d'article
    $requete =  'SELECT COUNT(*) AS COMPTAGE '.
                'FROM '.$tbl['article'].', '.$tbl['item'].' '.
                'WHERE B_A_CRAICOLL = "'.$unex[0].'" '.
                'AND B_A_CRAISERIE = "'.$unex[1].'" '.
                'AND B_A_CRAIFASC = "'.$unex[2].'" '.
                'AND B_I_IDITEM = B_A_IDART '.
                'AND B_I_TYPLOG = 1 '.
                'AND B_I_TYPPHY = 2 '.
                'AND B_I_CACHER = 0';
    $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);
    
    // Liste des articles
    if (($tableau['locusfasc'] > 0) && ($tableau['locusfasc'] <= $num_c)) {
        $depart = $tableau['locusfasc'];
    } else {
        $depart = $tableau['pstart'];
    }
    if ($depart == '') {
        $depart = 0;
    }
    
    $requete =  'SELECT * '.
                'FROM '.$tbl['article'].', '.$tbl['item'].', '.$tbl['saisie'].', '.$tbl['domaine'].', '.$tbl['domaine_lk'].' '.
                'WHERE B_A_CRAICOLL = "'.$unex[0].'" '.
                'AND B_A_CRAISERIE = "'.$unex[1].'" '.
                'AND B_A_CRAIFASC = "'.$unex[2].'" '.
                'AND B_I_IDITEM = B_A_IDART '.
                'AND B_I_TYPLOG = 1 '.
                'AND B_I_TYPPHY = 2 '.
                'AND B_I_CACHER = 0 '.
                'AND B_I_AUTEURSAISIE = B_AS_ID '.
                'AND B_I_IDITEM = B_DL_IDITEM '.
                'AND B_DL_IDDOM = B_D_ID '.
                'ORDER BY B_A_PAGEDEBUT, B_I_AUTEURS '.
                'LIMIT '.$depart.', '.$var_biblio['how_bloc'];
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    $num_a = mysql_num_rows($resultat);
    
    // Récupération d'informations
    if ($tableau['pstart'] == '') {
        $tableau['pstart'] = 0;
    }
    $tableau['step'] = $var_biblio['how_bloc'];
    $tableau['pend'] = $num_c;
    $tableau['libelle'] = 'article';
    $tableau['feminin'] = 0;
    
    // Affichage du nbre de résultats
    $sortie .= '<p id="frag_nbre_resultat">';
    $sortie .= FRAG_afficherTxtNbreResultat('bbpopup', $tableau, $num_a, $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 articles
    $sortie .= '<ul id="bb_liste_article">'."\n";
    while ($row_a = mysql_fetch_object($resultat)) {
        $id_a = $row_a->B_I_IDITEM;
        $titre = $row_a->B_I_TITRE;
        $aut = $row_a->B_I_AUTEURS;
        $paged = $row_a->B_A_PAGEDEBUT;
        $pagef = $row_a->B_A_PAGEFIN;
        $geo = $row_a->B_I_GEO;
        $langue = $row_a->B_I_LANGUE;
        $resum = $row_a->B_I_RESUMCLE;
        $image = $row_a->B_I_IMAGE;
        $aut_s = $row_a->B_AS_LIBELLE;
        $domaine_id = $row_a->B_D_ID;
        $domaine_nom = $row_a->B_D_LABEL;
        $comment = $row_a->B_I_COMMENT;
        $maj = $row_a->B_I_MAJFICHE;
        
        $sortie .= '<li>'."\n";
        
        if (!empty($image)) {
            $sortie .=  '<img class="bb_img_article" src="'.BB_CHEMIN_IMAGES_ILLUSTRATION.$image.'" '.
                        'alt="'.'Illustration de l\'article : '.$titre.'" />';
        }
        
        if ($domaine_id != 1) {
            $sortie .= '<span class="texte_inactif">'.'['.$domaine_nom.']'.'</span>'."\n";
        }
        
        if (($aut == '') || ($aut == 'ANONYME')) {
            $sortie .= 'Inconnu ou Anonyme'; 
        } else {
            $sortie .= $aut;
        }
        
        $sortie .= ' - <strong>'.$titre.'</strong>'.' - '.FormateDateYYYYMMJJ($la_date);
        
        if (($paged > 0) && ($pagef > 0)) {
            $sortie .= ', p. '.$paged;
        }
        if ($pagef > $paged) {
            $sortie .= ' à '.$pagef;
        }
        
        if ($resum != '') {
            $sortie .= ' - '.'<em>'.$resum.'</em> ';
        }
        if ($comment != '') {
            $sortie .= ' - '.'<em>'.$comment.'</em>'."\n";
        }
        if ($geo != '') {
            $sortie .= ' - '.'Départ./Région : '.'<em>'.$geo.'</em>'."\n";
        }
        if ($langue != '') {
            $sortie .= ' - '.'Langue : '.$langue."\n";
        }
        if ($aut_s != '') {
            $sortie .= '<span class="texte_inactif">'.' - '.'Saisie : '.$aut_s.' Art. n°'.$id_a.'.</span>';
        }
        
        // Là on affiche les Voir Aussi Articles ... si y'en a 
        $UnVoirAussi = new VoirAussi($id_a,$tbl['article']);
        if ($UnVoirAussi->NbVA > 0) {
            $sortie .= ' '.'-'.' '.'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";
    
    if ($num_a > 0) {
        mysql_free_result($resultat);
    }
}
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.1  2005/11/23 10:22:25  jp_milcent
* Ajout au dépot de l'application BiblioBota.
* Elle doit à terme migrer dans eFlore.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>