Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 379 | Go to most recent revision | Blame | 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 Classification extends aControleur {
        
        private $conteneur = null;
        private $nomCourant = null;
        private $taxons = null;

        public function __construct(Conteneur $conteneur) {
                $this->conteneur = $conteneur;
                $this->nomCourant = $this->conteneur->getNomCourant();
                $this->taxons = $this->conteneur->getApiTaxons();
                $this->meta = $this->conteneur->getApiMetaDonnees();
                $this->appUrls = $this->conteneur->getAppUrls();
        }
        
        public function getBloc() {
                $donnees['taxons_sup'] = $this->getTaxonsSuperieurs();
                $donnees['taxons_inf'] = $this->getTaxonsInferieurs();
                
                $donnees['taxons_sup'] = is_array($donnees['taxons_sup']) ? array_slice($donnees['taxons_sup'], 0 , 3) : array();
                $donnees['taxons_inf'] = is_array($donnees['taxons_inf']) ? array_slice($donnees['taxons_inf'], 0 , 3) : array();
                
                return $donnees;
        }

        public function obtenirDonnees() {
                $donnees['taxons_sup'] = $this->nomCourant->taxons_sup;
                $donnees['taxons_inf'] = $this->getTaxonsInferieurs();
                $this->meta->setProjet('bdtfx');
                $meta = $this->meta->getMetaDonnees();
                $titreMeta = $meta[0]['titre'];
                $donnees['meta']['titre'] = $titreMeta;
                $donnees['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('bdtfx');
                $donnees['urls'] = $this->appUrls;
                
                return $donnees;
        }
        
        private function getTaxonsInferieurs() {
                $num_nom = $this->nomCourant->getNomRetenu()->get('id');
                $resultat = $this->taxons->getTaxonsInf($num_nom);
                
                return $resultat[$num_nom];
        }
        
        private function getTaxonsSuperieurs() {
                $num_nom = $this->nomCourant->getNomRetenu()->get('id');
                $resultat = $this->nomCourant->getNomRetenu()->get('taxonsSup');
                
                return $resultat[$num_nom];
        }
}
?>