Subversion Repositories eFlore/Applications.bibliobota

Rev

Rev 26 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
// +------------------------------------------------------------------------------------------------------+
// | PHP version 5.1.1                                                                                    |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2006 Tela Botanica (accueil@tela-botanica.org)                                         |
// +------------------------------------------------------------------------------------------------------+
// | This file is part of eFlore.                                                                         |
// |                                                                                                      |
// | Foobar is free software; you can redistribute it and/or modify                                       |
// | it under the terms of the GNU General Public License as published by                                 |
// | the Free Software Foundation; either version 2 of the License, or                                    |
// | (at your option) any later version.                                                                  |
// |                                                                                                      |
// | Foobar 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 General Public License for more details.                                                         |
// |                                                                                                      |
// | You should have received a copy of the GNU General Public License                                    |
// | along with Foobar; if not, write to the Free Software                                                |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id$
/**
* Titre
*
* Description
*
*@package eFlore
*@subpackage ef_fiche
//Auteur original :
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
//Autres auteurs :
*@author        aucun
*@copyright     Tela-Botanica 2000-2006
*@version       $Revision$ $Date$
// +------------------------------------------------------------------------------------------------------+
*/

// +------------------------------------------------------------------------------------------------------+
// |                                            ENTETE du PROGRAMME                                       |
// +------------------------------------------------------------------------------------------------------+
/** Inclusion du fichier de configuration de l'application Revue. */
//require_once BB_CHEMIN_APPLI.'bb_revue/configuration/bbre_config.inc.php';

// +------------------------------------------------------------------------------------------------------+
// |                                            CORPS du PROGRAMME                                        |
// +------------------------------------------------------------------------------------------------------+
// Initialisation de la variable à retourner
$retour = '';
$retour .= '<!-- BiblioBota - Revue : DEBUT -->'."\n";
$retour .= '<div id="biblio_revue">';

$aso_revues = array();
$query =    'SELECT '.$GLOBALS['tbl']['collection'].'.* '.
            'FROM '.$GLOBALS['tbl']['collection'].' '.
            'WHERE B_C_CACHER = 0 '.
            'ORDER BY B_C_NOMCOMPLET ';
$do_query = mysql_query($query) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query));
$nbre_revues_total = mysql_num_rows($do_query);
$nbre_revues_avec_article = 0;

if ($nbre_revues_total == 0) {
        // Titre de la page
        $retour .= '<h1>'.'Revues indexées dans la base de données du projet BiblioBota.'.'</h1>';
        $retour .= '<p>'.'Pas encore de revues indexées...'.'</p>'."\n";
} else {
        while ($row = mysql_fetch_object($do_query)) {
                $aso_revue = array();
        $aso_revue['id'] = $row->B_C_CRAI;
        $aso_revue['idlink'] = $row->B_C_LKSTR;
        $aso_revue['nom_complet'] = $row->B_C_NOMCOMPLET;
        $aso_revue['abreviation'] = $row->B_C_ABREGE;
        $aso_revue['date_debut'] = $row->B_C_DATECREATION;
        $aso_revue['suite_de'] = $row->B_C_FAISUITE;
        $aso_revue['date_fin'] = $row->B_C_DATEFIN;
        $aso_revue['periodicite'] = $row->B_C_PERIODICITE;
        $aso_revue['contact_nom'] = $row->B_C_CONTACTNOM;
        $aso_revue['contact_mail'] = $row->B_C_CONTACTMAIL;
        $aso_revue['logo'] = $row->B_C_IMAGE;
        $aso_revue['commentaires'] = $row->B_C_COMMENT;
        $aso_revue['date_maj'] = $row->B_C_MAJFICHE;
                $aso_revue['fasc_nbre'] = 0;
                $aso_revue['fasc_date_premier'] = '';
                $aso_revue['fasc_date_dernier'] = '';
                $aso_revue['fasc_maj_dernier'] = '';
                $aso_revue['fasc_nom_dernier'] = '';
                
                // Construction de l'url de la page contenant les info sur l'organisme:
                $Url = clone $GLOBALS['_BIBLIOBOTA_']['url'];
                $Url->setId(BB_URL_APPLI_ORGA_ID);
                $Url->addQueryString('appli', 'bb_consultation');
                $Url->addQueryString('consultation', 'avancee');
                $Url->addQueryString('coll', $aso_revue['idlink']);
                $aso_revue['url'] = $Url->getUrl();
                
                $aso_fasc_serie = array();
                $query_fasc =   'SELECT '.$GLOBALS['tbl']['fascicule'].'.* '.
                                'FROM '.$GLOBALS['tbl']['fascicule'].' '.                               
                                                'WHERE  B_F_CRAICOLL = "'.$row->B_C_CRAI.'" '.
                                                'AND B_F_CACHER = 0 '.
                                                'ORDER BY B_F_CRAISERIE, B_F_NUMERO DESC';
                $do_query_fasc = mysql_query($query_fasc) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query_fasc));
                // Initialisation de la date
                $initialiser = true;            
                
                while ($row_fasc = mysql_fetch_object($do_query_fasc)) {
                        if (!isset($aso_fasc_serie[$row_fasc->B_F_CRAISERIE])) {
                                $aso_fasc = array();
                                $aso_fasc['nbre_fasc'] = 1;
                                $aso_fasc['nom_serie'] = $row_fasc->B_F_CRAISERIE;
                                $aso_fasc['nom_fin_serie'] = $row_fasc->B_SER_SOUSTITRE;
                                $aso_fasc['nom_fin_fasc'] = $row_fasc->B_F_TITRE;
                                $aso_fasc_serie[$row_fasc->B_F_CRAISERIE] = $aso_fasc;
                        } else {
                                $aso_fasc_serie[$row_fasc->B_F_CRAISERIE]['nbre_fasc']++;
                        }
                        // Nombre de fascicule dans la collection
                        $aso_revue['fasc_nbre']++;
                        // Calcule de la date du premier fascicule et de la date du dernier
                        if (preg_match('/^(\d{4})(?:\.(\d{2})|)$/', $row_fasc->B_F_DATE, $match)) {
                                if (isset($match[1]) && $match[1] != '') {
                                        $annee = $match[1];
                                        $mois = '00';
                                        if (isset($match[2]) && $match[2] != '') {
                                                $mois = $match[2];
                                        }
                                        $date = $annee.'-'.$mois;
                                        
                                        // Initialisation avec une date pour la série courrante
                                        if ($aso_fasc_serie[$row_fasc->B_F_CRAISERIE]['nbre_fasc'] == 1) {
                                                $aso_fasc['date_debut'] = $date;
                                                $aso_fasc['date_fin'] = $date;
                                        }
                                        // Initialisation avec une date pour la collection toute série confondue                                       
                                        if ($initialiser) {
                                                $initialiser = false;
                                                $aso_revue['fasc_date_premier'] = $date;
                                                $aso_revue['fasc_date_dernier'] = $date;
                                        }               
                                        // Date premier fascicule dans la série
                                        if (strcasecmp($date, $aso_fasc_serie[$row_fasc->B_F_CRAISERIE]['date_debut']) < 0) {
                                                $aso_fasc_serie[$row_fasc->B_F_CRAISERIE]['date_debut'] = $date;
                                        }
                                        // Date premier fascicule dans la collection
                                        //echo $date.'<'.$aso_revue['fasc_date_premier'].'/'.strcasecmp($date, $aso_revue['fasc_date_premier']).'<br>';
                                        if (strcasecmp($date, $aso_revue['fasc_date_premier']) < 0) {
                                                //echo $aso_revue['fasc_date_premier'].'<'.$date.'<br>';
                                                $aso_revue['fasc_date_premier'] = $date;
                                                 
                                        }
                                        // Date dernier fascicule dans la série
                                        if (strcasecmp($date, $aso_fasc_serie[$row_fasc->B_F_CRAISERIE]['date_fin']) > 0) {
                                                $aso_fasc_serie[$row_fasc->B_F_CRAISERIE]['date_fin'] = $date;
                                                $aso_revue['fasc_nom_dernier'] = $row_fasc->B_F_TITRE;
                                                $aso_revue['fasc_maj_dernier'] = $row_fasc->B_F_MAJFICHE;
                                        }
                                        // Date dernier fascicule dans la collection
                                        if (strcasecmp($date, $aso_revue['fasc_date_dernier']) > 0) {
                                                $aso_revue['fasc_date_dernier'] = $date;
                                        }
                                } 
                                
                        }
                }
                mysql_free_result($do_query_fasc);
                ksort($aso_fasc_serie, SORT_DESC);
                $aso_revue['aso_fasc_serie'] = $aso_fasc_serie;
                
                $query_art =    'SELECT COUNT('.$GLOBALS['tbl']['article'].'.B_A_IDART) AS nbre_article '.
                                'FROM '.$GLOBALS['tbl']['article'].' '.         
                                                'WHERE B_A_CRAICOLL = "'.$row->B_C_CRAI.'" '.
                                                'GROUP BY B_A_CRAICOLL';
                //echo $query_art.'<br/>';
                $resultat_art = mysql_query($query_art) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query_art));
                $ligne_article = mysql_fetch_assoc($resultat_art);
                //echo '<pre>'.print_r($ligne_article, true).'</pre>';
                $aso_revue['nbre_article'] = $ligne_article['nbre_article'];
                if ($aso_revue['nbre_article'] != 0) {
                        $nbre_revues_avec_article++;
                } 
                $aso_revues[] = $aso_revue;
        }
        mysql_free_result($do_query);
        
        if ($GLOBALS['_GEN_commun']['info_application']->affichage_type == 'tableau') { 
                // Titre de la page
                $retour .= '<h1>'.$nbre_revues_total.' revues indexées'.'</h1>';
                $retour .=      '<p>'.
                                                'Liste de toutes les revues indexées dans la base de données du projet BiblioBota. '.'<br />'.
                                                'Les revues ne possédant pas d\'articles indexés figurent dans ce tableau.'.
                                        '</p>';
                $o = 1;
                $retour .= '<table id="liste_biblio_revue" class="table_bordure" summary="Tableau résumant les informations sur les revues indexées dans la base de données du projet BiblioBota.">'."\n";
                $retour .= '<thead><tr>'.
                                '<th>Collection</th>'.
                                '<th>Date début (collection)</th>'.
                                '<th>Date début (indexation)</th>'.
                                '<th>Date fin (collection)</th>'.
                                '<th>Date fin (indexation)</th>'.
                                '<th title="Nombre de fascicules pour la collection, toutes séries confondues">Nombre fascicules</th>'.
                                '<th title="Nombre d\'articles pour la collection, toutes séries et fascicules confondues">Nombre d\'articles</th>'.
                                '<th>Périodicité</th>'.
                                '<th>Contact</th>'.
                                '<th title="Nom du dernier fascicule indexée dans la dernière série">Dernier fascicule</th>'.
                                '<th title="Date de publication du dernier fascicule indexée dans la dernière série">Date dernier fascicule</th>'.
                                '</tr></thead>'."\n";
                $retour .= '<tbody>';
                foreach ($aso_revues as $revue) {
                        $retour .= '<tr>';
                        $retour .= '<th>';
                    if ($revue['nom_complet'] != '') {
                    $retour .=  '<h5 class="bbre_titre">'.
                                                '<a href="'.$revue['url'].'">'.
                                                        $revue['nom_complet'].
                                                '</a>'.
                                                        '</h5>';
                    if ($revue['suite_de'] != '') {
                                        $retour .= '<p><span class="bb_intitule">Fait suite à : </span>'.$revue['suite_de'].'</p>';
                                }
                                if ($revue['abreviation'] != '') {
                                        $retour .= '<p><span class="bb_intitule">Abréviation : </span>'.$revue['abreviation'].'</p>';
                                }
                    if ($revue['commentaires'] != '') {
                        $retour .= '<p>'.$revue['commentaires'].'</p>';
                        }
                    if ($revue['logo'] != '') {
                        $retour .= '<img class="bbre_couverture" src="'.BB_CHEMIN_IMAGES_ILLUSTRATION.$revue['logo'].'" alt="Couverture de la revue '.$revue['nom_complet'].'"/>';
                        }
                        $retour .= '<p class="texte_inactif">Id. coll. : '.$revue['id'].' - Mise à jour : '.date('d/m/Y', $revue['date_maj']).'</p>';
                        } else {
                                $retour .= '?';
                        }
                $retour .= '</th>';
                        $retour .= '<td>';
                        if ($revue['date_debut'] != '') {
                                $retour .= $revue['date_debut'];
                        } else {
                                $retour .= '?';
                        }
                        $retour .= '</td>';
                        $retour .= '<td>';
                        if ($revue['fasc_date_premier'] != '') {
                                $retour .= donnerDateConviviale($revue['fasc_date_premier']);
                        } else {
                                $retour .= '?';
                        }
                        $retour .= '</td>';
                        $retour .= '<td>';
                        if ($revue['date_fin'] != '') {
                                $retour .= $revue['date_fin'];
                        } else {
                                $retour .= '?';
                        }
                        $retour .= '</td>';
                        $retour .= '<td>';
                        if ($revue['fasc_date_dernier'] != '') {
                                $retour .= donnerDateConviviale($revue['fasc_date_dernier']);
                        } else {
                                $retour .= '?';
                        }
                        $retour .= '</td>';
                        $retour .= '<td>';
                        if ($revue['fasc_nbre'] != '') {
                                $retour .= $revue['fasc_nbre'];
                        } else {
                                $retour .= 0;
                        }
                        $retour .= '</td>';
                        $retour .= '<td>';
                        if ($revue['nbre_article'] != '') {
                                $retour .= $revue['nbre_article'];
                        } else {
                                $retour .= 0;
                        }
                        $retour .= '</td>';
                        $retour .= '<td>';
                        if ($revue['periodicite'] != '') {
                                $retour .= $revue['periodicite'];
                        } else {
                                $retour .= '?';
                        }
                        $retour .= '</td>';
                        $retour .= '<td>';
                        if ($revue['contact_nom'] != '') {
                                if ($contact_mail != '') {
                                        $retour .= '<a href="mailto:'.$revue['contact_mail'].'">'.$revue['contact_nom'].'</a>';
                                } else {
                                        $retour .= $revue['contact_nom'];
                                }
                        } else {
                                $retour .= '?';
                        }
                        $retour .= '</td>';
                        $retour .= '<td>';
                        if ($revue['fasc_nom_dernier'] != '') {
                                $retour .= $revue['fasc_nom_dernier'];
                        } else {
                                $retour .= '?';
                        }
                        $retour .= '</td>';
                        $retour .= '<td>';
                        if ($revue['fasc_date_dernier'] != '') {
                                $retour .= '<p>'.donnerDateConviviale($revue['fasc_date_dernier']).'</p>';
                                $retour .= '<p class="texte_inactif">Mise à jour : '.date('d/m/Y', $revue['fasc_maj_dernier']).'</p>';
                                
                        } else {
                                $retour .= '?';
                        }
                        $retour .= '</td>';
                        $retour .= '</tr>'."\n";
                $o++;
                }
                $retour .= '</tbody>'."\n";
                $retour .= '</table>'."\n";
        } else {
                // Titre de la page
                $retour .= '<h1>'.$nbre_revues_avec_article.' revues indexées'.'</h1>';
                $retour .= '<p>'.'Liste des revues possédant des articles indexés dans la base de données du projet BiblioBota.'.'</p>';
                $o = 1;
                $retour .= '<ul id="liste_biblio_revue">'."\n";
                $nbre_revue_sans_article = 0;
                foreach ($aso_revues as $revue) {
                        if ($revue['nbre_article'] != '' && $revue['nbre_article'] > 0) {
                                $retour .= '<li>';
                                if ($revue['nom_complet'] != '') {
                            $retour .=  '<h5 class="bbre_titre">'.
                                                        '<a href="'.$revue['url'].'">'.
                                                                $revue['nom_complet'].
                                                        '</a>'.
                                                                '.</h5>';
                                }
                                if ($revue['periodicite'] != '') {
                                        $retour .= ' '.$revue['periodicite'].'.';
                                } else {
                                        $retour .= ' Périodicité inconnue';
                                }
                                $retour .= ' Indexation des fascicules de ';
                                if ($revue['fasc_date_premier'] != '') {
                                        $retour .= donnerDateConviviale($revue['fasc_date_premier']);
                                } else {
                                        $retour .= '?';
                                }
                                $retour .= ' à ';
                                if ($revue['fasc_date_dernier'] != '') {
                                        $retour .= donnerDateConviviale($revue['fasc_date_dernier']).'. ';
                                } else {
                                        $retour .= '?. ';
                                }
                                if ($revue['fasc_nbre'] != '') {
                                        $retour .= $revue['fasc_nbre'];
                                } else {
                                        $retour .= 0;
                                }
                                $retour .= ' fascicules et ';
                                if ($revue['nbre_article'] != '') {
                                        $retour .= $revue['nbre_article'];
                                } else {
                                        $retour .= 0;
                                }
                                $retour .= ' articles.';
                                $o++;
                                $retour .= '</li>'."\n";
                        } else {
                                $nbre_revue_sans_article++;
                        }
                }
                $retour .= '<li>';
                $retour .= 'Nombre de revue dont aucun article n\'est indexé dans la base : '.$nbre_revue_sans_article;
                $retour .= '</li>'."\n";
                $retour .= '</ul>'."\n";
        }
}
$retour .= '</div>';
$retour .= '<!-- BiblioBota - Revue : FIN -->'."\n";
$sortie .= $retour;


function fomaterDate($date) {
        
}
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log$
* Revision 1.7  2007/02/13 18:33:23  jp_milcent
* Modification des titres.
*
* Revision 1.6  2007/02/13 17:41:06  jp_milcent
* Amélioration et corrections de bogues.
*
* Revision 1.5  2007/01/02 17:45:16  jp_milcent
* Ajout d'un affichage simplifié.
*
* Revision 1.4  2006/09/12 16:13:05  jp_milcent
* Ajout de nouvelles informations à la liste des revues.
*
* Revision 1.3  2006/07/28 12:46:47  jp_milcent
* Début modification de l'interface de l'appli revue.
*
* Revision 1.2  2006/05/29 14:19:07  jp_milcent
* Ajout d'une classe css à l'image de la couverture de la revue.
* Correction du chemin d'accés à l'image.
*
* Revision 1.1  2006/05/23 16:20:50  jp_milcent
* Ajout de l'application affichant la liste des revues disponibles dans la base de données de BiblioBota.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>