Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 697 | 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 Repartition extends aControleur {

        private $conteneur = null;
        private $nomCourant = null;
        private $tailleBloc = "190x178";
        private $serviceChorodep = null;
        private $cartes;
        private $meta;
        private $appUrls;
        
        public function __construct(Conteneur $conteneur) {
                $this->conteneur = $conteneur;
                $this->nomCourant = $this->conteneur->getNomCourant();
                $this->cartes = $this->conteneur->getApiCartes();
                $this->meta = $this->conteneur->getApiMetaDonnees();
                $this->appUrls = $this->conteneur->getAppUrls();
        }

        public function obtenirDonnees() {
                $donnees['chorodep'] = $this->getChorodep();
                $donnees['eflore'] = $this->getEflore();
                $donnees['widget']['nt'] = $this->nomCourant->getNt();
                $donnees['widget']['nn'] = $this->nomCourant->getNnr();
                return $donnees;
        }

        public function obtenirDonneesExport() {
                $donnees['chorodep'] = $this->getChorodep();
                $donnees['eflore'] = $this->getEfloreExport();
                return $donnees;
        }
        
        private function getChorodep() {
                $this->cartes->setProjet('chorodep');
                $this->cartes->setLargeur('630');
                $id = 'nn:'.$this->nomCourant->getNnr();
                $this->cartes->setId($id);
                $chorodep['svgUrl'] = $this->cartes->getUrlDataSvg();
                $chorodep['pngUrl'] = $this->cartes->getUrlPng();
                $chorodep['legende'] = $this->cartes->getLegendeId();
                $this->meta->setProjet('chorodep');
                $meta = $this->meta->getMetaDonnees();
                $citation = $meta[0]['citation'];
                $chorodep['meta']['citation'] = $citation;
                $chorodep['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('chorodep');
                return $chorodep;
        }
        
        private function getEflore() {
                $this->cartes->setProjet('eflore');
                $this->cartes->setLargeur('max');
                $this->cartes->setInfoNom($this->nomCourant->getNomRetenu());
                $eflore['mapUrl'] = $this->cartes->getUrlMap();
                $eflore['legende'] = $this->cartes->getLegende();
                return $eflore;
        }
        
        private function getEfloreExport() {
                $this->cartes->setProjet('eflore');
                $this->cartes->setLargeur('min');
                $this->cartes->setInfoNom($this->nomCourant->getNomRetenu());
                $eflore['min'] = $this->cartes->getUrlEflorePng();
                $eflore['legende'] = $this->cartes->getLegende();
                return $eflore;
        }

        public function getBloc() {
                $donnees['chorodep'] = $this->getChorodepMiniature();
                $donnees['eflore'] = $this->getEfloreMiniature();
                return $donnees;
        }
        
        private function getChorodepMiniature() {
                $this->cartes->setProjet('chorodep');
                $this->cartes->setLargeur('190x178');
                $id = 'nn:'.$this->nomCourant->getNnr();
                $this->cartes->setId($id);
                return $this->cartes->getUrlPng();
        }
        
        private function getEfloreMiniature() {
                $this->cartes->setProjet('eflore');
                $this->cartes->setLargeur('min');
                $this->cartes->setInfoNom($this->nomCourant->getNomRetenu());
                return $this->cartes->getUrlEflorePng();
        }
}
?>