Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 606 | Rev 752 | 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>
 * @author              Mathilde Salthun-lassalle <mathilde@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 Ecologie extends aControleur {
        
        public function __construct(Conteneur $conteneur) {
                $this->conteneur = $conteneur;
                $this->nomCourant = $this->conteneur->getNomCourant();
                $this->informations = $this->conteneur->getApiInformations();
                $this->meta = $this->conteneur->getApiMetaDonnees();
                $this->wikini = $this->conteneur->getApiWikini();
                $this->appUrls = $this->conteneur->getAppUrls();
                $this->graphique = $this->conteneur->getApiGraphiques();
                
        }
        
        public function obtenirDonnees() {
                $donnees = array();
                $donnees['wikini'] = $this->getWikini();
                $donnees['baseflor'] = $this->getBaseflor();
                return $donnees;
        }
        
        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['ecologie'] = $this->wikini->getTexteFormate($page_wiki, 'ecologie');
                return $wikini;
        }
        
        public function getBloc() {
                $donnees = array();
                $donnees = $this->getBaseflor();
                $donnees['titre'] = 'Optimum écologique';
                return $donnees;
        }
        
        private function getBaseflor() {
                $baseflor = array();
                $this->informations ->setProjet('baseflor');
                $this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
                $this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
                $informations = $this->informations->getInformationsEcologie();
                if($informations != ""){
                        $baseflor['climat_url'] = $informations['graphique_climat']['href']."?retour.format=500";
                        $baseflor['sol_url'] = $informations['graphique_sol']['href']."?retour.format=500";
                        $baseflor['climat_url_png'] = $informations['graphique_climat']['href']."?retour=image/png";
                        $baseflor['sol_url_png'] = $informations['graphique_sol']['href']."?retour=image/png";
                        $this->graphique -> setProjet('baseflor');
                        $graphique = $this->graphique->getLegendeGraphique();
                        $baseflor['legende'] =  $graphique ;
                        $this->meta->setProjet('baseflor');
                        $meta = $this->meta->getMetaDonnees();
                        $citation = $meta[0]['citation'];
                        $baseflor['meta']['citation'] = $citation;
                        $baseflor['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseflor');
                        $baseflor['description']['climat_url'] = $informations['graphique_climat']['href']."?retour.format=420";
                        $baseflor['description']['sol_url'] = $informations['graphique_sol']['href']."?retour.format=420";
                        $baseflor['description']['climat_url_png'] = $informations['graphique_climat']['href']."?retour.format=420&retour=image/png";
                        $baseflor['description']['sol_url_png'] = $informations['graphique_sol']['href']."?retour.format=420&retour=image/png";
                }else {
                        $baseflor['aucune'] = 'Aucunes données';
                }
                return $baseflor;
        }
}
?>