Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

<?php
// declare(encoding='UTF-8');
/**
 * Classe mère du module Liste.
 *
 * @category    PHP 5.2
 * @package             eflore-consultation
 * @author              Jean-Pascal MILCENT <jpm@tela-botanica.org>
 * @author              Delphine CAUQUIL <delphine@tela-botanica.org>
 * @copyright   2011 Tela-Botanica
 * @license             http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
 * @license             http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
 * @version             $Id$
 */
class Bibliographie extends aControleur {
                
        private $apiBiblioBota;
        private $conteneur;
        private $nomCourant;
        private $meta;
        private $appUrls;
        private $wikini;
        private $referentiel = 'bdtfx';
        private $donnees = array();
        
        public function __construct(Conteneur $conteneur) {
                $this->conteneur = $conteneur;
                $this->nomCourant = $this->conteneur->getNomCourant();
                $this->referentiel = $this->conteneur->getParametre('referentiel');
                $this->wikini = $this->conteneur->getApiWikini();
                $this->meta = $this->conteneur->getApiMetaDonnees();
                $this->appUrls = $this->conteneur->getAppUrls();
        }
        
        public function obtenirDonnees() {
                $this->donnees['bibliobota']['references'] = $this->getBiblioBota();
                $this->meta->setProjet('bibliobota');
                $meta = $this->meta->getMetaDonnees();
                $this->donnees['bibliobota']['meta'] = $meta[0];
                $this->donnees['bibliobota']['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('bibliobota');
                
                $this->donnees['wikini'] = $this->getWikini();
                return $this->donnees;
        }
        
        public function getBloc() {
                $references = $this->getBiblioBota();
                $this->donnees['references'] = array_slice($references, 0, 3);
                foreach ($this->donnees['references'] as $id=>$reference) {
                        preg_match('/.*<strong>(.*)<\/strong>.*/', $reference['reference_html'], $titre);
                        $this->donnees['references'][$id]['reference_html'] = $titre[1];
                }
                $this->donnees['autresReferences'] = count($references) - 3;
                if ($this->donnees['references'] == array()) {
                        $this->donnees['wikini'] = $this->getWikini();
                }
                return $this->donnees;
        }
        
        
        //Obtention des données issues de biblio_bota
        private function getBiblioBota() {
                $this->apiBiblioBota = $this->conteneur->getApiBiblioBota();
                $this->apiBiblioBota->setProjet('bibliobota');
                $interrogation = $this->nomCourant->getNomSelectionne()->get('nom_sci');
                $references = $this->apiBiblioBota->getReferences($interrogation);
                return $references['resultats'];
        }
        
        private function getWikini() {
                $wikini = array();
                $wikini['titre'] = 'Wikini';
                $referentiel = $this->conteneur->getParametre('referentiel');
                $num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
                $page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
                $wikini['biblio'] = $this->wikini->getTexteFormate($page_wiki, 'biblio');
                return $wikini;
        }
        


}
?>