Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 1130 | Rev 1477 | 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 Statut extends aControleur {
        private $conteneur = null;
        private $nomCourant = null;
        private $wikini = null;
        private $statuts = null;
        private $meta;
        private $referentiel = null;
        private $appUrls;
        
        public function __construct(Conteneur $conteneur) {
                $this->conteneur = $conteneur;
                $this->nomCourant = $this->conteneur->getNomCourant();
                $this->wikini = $this->conteneur->getApiWikini();
                $this->statuts = $this->conteneur->getApiStatuts();
                $this->meta = $this->conteneur->getApiMetaDonnees();
                $this->referentiel = $this->conteneur->getParametre('referentiel');
                $this->appUrls = $this->conteneur->getAppUrls();
        }
        
        public function getBloc() {
                $donnees = array();
                $donnees['statuts'] = $this->getStatutsZoneGeo();
                if(empty($donnees['statuts'])) {
                        $donnees['wikini'] = $this->getWikini();
                }
                $donnees['liste_rouge'] = $this->getCategorieListeRouge();
                return $donnees;
        }
        
        public function obtenirDonnees() {
                $donnees = array();
                $donnees['wikini'] = $this->getWikini();
                $donnees['statuts'] = $this->getStatuts();
                $donnees['liste_rouge'] = $this->getCategorieListeRouge();
                return $donnees;
        }
        
        private function getStatuts() {
                $statuts = "";
                $projet = Config::get($this->referentiel.'.baseStatuts');
                if ($projet != "") {
                        $nnr = $this->nomCourant->getNnr();
                        $statuts = $this->statuts->getStatuts($projet, $nnr);
                        $this->meta->setProjet($projet);
                        $meta = $this->meta->getMetaDonnees();
                        $statuts['meta'] = $meta[0];
                        $statuts['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projet);
                }
                return $statuts;
        }
        
        private function getStatutsZoneGeo() {
                $statuts = "";
                $projet = Config::get($this->referentiel.'.baseStatuts');
                if ($projet != "") {
                        $nnr = $this->nomCourant->getNnr();
                        $statuts = $this->statuts->getStatutsZoneGeo($projet, $nnr);
                        $this->meta->setProjet($projet);
                        $meta = $this->meta->getMetaDonnees();
                        $statuts['meta'] = $meta[0];
                        $statuts['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projet);
                }
                return $statuts;
        }
        
        private function getCategorieListeRouge() {
                $liste_rouge = "";
                $projet = Config::get($this->referentiel.'.baseListeRouge');
                if ($projet != "") {
                        $nnr = $this->nomCourant->getNnr();
                        $liste_rouge = $this->statuts->getCategorieListeRouge($projet, $nnr);
                        $this->meta->setProjet($projet);
                        $meta = $this->meta->getMetaDonnees();
                        $liste_rouge['meta'] = $meta[0];
                        $liste_rouge['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projet);
                }
                return $liste_rouge;
        }
        
        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['statuts_de_protection'] = $this->wikini->getTexteFormate($page_wiki, 'statuts de protection');
                return $wikini;
        }
}
?>