Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 1301 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
/**
 * Cette classe est le contrôleur pour l'affichage de listes dans des fenêtre fancy box.(fenêtres phytosociologie)
 * 
 * @category    PHP 5.2
 * @package             eflore-consultation
 * @author              Mathilde Salthun-lassalle <mathilde@tela-botanica.org>
 * @copyright   2012 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 ListeFancyBoxPhytosocio extends aControleur {
        
        private $type = '';
        private $informations;
        private $appUrls;
        private $conteneur;
        private $referentiel;
        private $num_nom;
        private $catminat;
        
        
        public function __construct() {
                $this->capturerParametres();
                $this->conteneur = new Conteneur($this->parametres);
                $this->informations = $this->conteneur->getApiInformations();
                $this->syntaxons = $this->conteneur->getApiSyntaxons();
                $this->appUrls = $this->conteneur->getAppUrls();
        }
        
        
        private function capturerParametres() {
                if (isset($_GET['type'])) {
                        $this->type = $_GET['type'];
                }
                if (isset($_GET['referentiel'])) {
                        $this->referentiel = $_GET['referentiel'];
                }
                if (isset($_GET['num_nom'])) {
                        $this->num_nom = $_GET['num_nom'];
                }
                if (isset($_GET['catminat'])) {
                        $this->catminat= trim(urldecode($_GET['catminat']));
                }
        }
        
        public function executerActionParDefaut() {
                $this->executerLister();
        }
        
        public function executerLister($donnees) {
                header('Content-type: text/html');
                $html = $this->chargerListeHtml();
                echo $html;
                exit;
        }
        
        public function chargerListeHtml() {
                $donnees['liste'] = '';
                $html = '';
                $squelette = dirname(__FILE__).'/squelettes/liste-fancy-box';
                if ($this->type == 'catminat_taxons') {
                        $donnees = $this->getListeCatminatTaxons(); 
                        $squelette .= '-taxons';
                } elseif ($this->type == 'catminat_synonymes') {
                        $donnees = $this->getListeCatminatSynonymes();
                        $squelette .= '-synonymes';
                } elseif ($this->type == 'catminat_ref') {
                        $donnees = $this->getListeCatminatRef();
                        $squelette .= '-ref';
                } elseif ($this->type == 'catminat_taxons_sup') {
                        $donnees = $this->getListeCatminatTaxonsSup();
                        $squelette .= '-taxons';
                }
                if ($donnees['liste'] !== '') {
                        $donnees['urls'] = $this->appUrls;
                        $html = $this->getVue($squelette, $donnees);
                }
                return $html;
        }
        
        
        public function getListeCatminatTaxons() {
                $Catminat = array();
                $this->informations ->setProjet('baseflor');
                $this->informations ->setDepart(0);
                $this->informations ->setLimite('500');
                $this->informations ->setBdnt($this->referentiel);
                $this->informations ->setNum_nom($this->num_nom);
                $informations = $this->informations->getInformationsRelationCatminat();
                if($informations != ""){
                        $Catminat['liste'] = $informations['resultat'];
                        $Catminat['catminat'] = $informations['resultat'][0]['catminat_code'];
                }       
                return $Catminat;
        }
        
        public function getListeCatminatTaxonsSup() {
                $Catminat = array();
                $this->informations ->setProjet('baseflor');
                $this->informations ->setDepart(0);
                $this->informations ->setLimite('500');
                $this->informations ->setCatminat($this->catminat);
                $informations = $this->informations->getInformationsMasqueCatminat();
                if($informations != ""){
                        $Catminat['liste'] = $informations['resultats'];
                        $Catminat['catminat'] = str_replace('-','/',$this->catminat);
                }
                return $Catminat;
        }
        
        public function getListeCatminatSynonymes() {
                $Catminat = array();
                $this->syntaxons->setProjet('baseveg');
                $this->syntaxons->setCatminat($this->catminat);
                $syntaxons = $this->syntaxons->getSyntaxonsSynonymes();
                if (is_array($syntaxons)) {
                        $Catminat['liste'] = $syntaxons['resultat'];
                        $Catminat['catminat'] =  $syntaxons['resultat'][0]['code_catminat'];
                }
                return $Catminat;
        }
        
        public function getListeCatminatRef() {
                $ref = array();
                $this->syntaxons->setProjet('baseveg');
                $this->syntaxons->setCatminat($this->catminat);
                $syntaxons = $this->syntaxons->getSyntaxonsCatminat();
                if (is_array($syntaxons)) {
                        $ref['liste']['der'] = $syntaxons['resultat'][0]['ref_der_biblio'];
                        if ($syntaxons['resultat'][0]['ref_anteriorite_deux'] != '') {
                                $ref['liste']['anteriorites'][0] =  $syntaxons['resultat'][0]['ref_anteriorite_deux'];
                        }
                        if ($syntaxons['resultat'][0]['ref_anteriorite_trois'] != '') {
                                $ref['liste']['anteriorites'][1]= $syntaxons['resultat'][0]['ref_anteriorite_trois'];
                        }
                        if ($syntaxons['resultat'][0]['ref_anteriorite_quatre'] != '') {
                                $ref['liste']['anteriorites'][2] =  $syntaxons['resultat'][0]['ref_anteriorite_quatre'];
                        }               
                }
                return $ref;
        }
        
}
?>