Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

<?php
// declare(encoding='UTF-8');
/**
 * Classe Onglet Synthese.
 *
 * @category    PHP 5.2
 * @package             eflore-consultation
 * @author              Jean-Pascal MILCENT <jpm@tela-botanica.org>
 * @author              Delphine CAUQUIL <delphine@tela-botanica.org>
 * @author              Grégoire DUCHÉ <gregoire@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 Synthese extends aControleur {

        private $conteneur = null;
        private $nomCourant = null;

        public function __construct(Conteneur $conteneur) {
                $this->conteneur = $conteneur;
                $this->nomCourant = $this->conteneur->getNomCourant();
                
                parent::__construct();
        }

        public function obtenirDonnees() {
                $donnees = array();
                $num_nom = $this->nomCourant->getNns();
                
                $blocs = array('illustrations','repartition','nomenclature','description',
                                'ethnobotanique','bibliographie','statut','ecologie');
                $cache = array();
                
                $nt = $this->conteneur->getNomCourant()->getNomRetenu()->get('num_taxonomique');
                $donnees['infos'] = array('referentiel' => $this->conteneur->getParametre('referentiel'), 'num_tax' => $nt);
                foreach ($blocs as $bloc) {
                        $cache_bloc = Config::get('cache') ? $this->obtenirCache($bloc.'_bloc_'.$num_nom) : null;
                        if($cache_bloc != null) {
                                $donnees[$bloc] = $cache_bloc;
                        } else {
                                $nom_classe = ucfirst($bloc);
                                $classe = new $nom_classe($this->conteneur);
                                $donnees[$bloc] = $classe->getBloc();
                                if(!empty($donnees[$bloc])) {
                                        $this->mettreEnCache($bloc.'_bloc_'.$num_nom, $donnees[$bloc]);
                                }
                        }
                }
                return $donnees;
        }
}
?>