Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 137 | Rev 151 | 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 Resultat extends aControleur {

        private $parametres = null;
        private $resultats = null;

        public function initialiser() {
                spl_autoload_register(array($this, 'chargerClassesResultat'));
                $this->parametres = new ParametresResultats();
                $this->capturerParametres();
                $this->parametres->reftaxCourant = Registre::get('parametres.referentiel');
                $this->parametres->projetImg = Config::get($this->parametres->reftaxCourant.'.referentielImages');
                $this->resultats = Registre::get('resultats');
        }

        private function chargerClassesResultat($classe) {
                $dossiers = array(dirname(__FILE__).DS);
                foreach ($dossiers as $chemin) {
                        $fichierATester = $chemin.$classe.'.php';
                        if (file_exists($fichierATester)) {
                                include_once $fichierATester;
                                return null;
                        }
                }
        }

        private function capturerParametres() {
                if (isset($_GET['resultat'])) {
                        $this->parametres->type = $_GET['resultat'];
                }
                if (isset($_GET['nom'])) {
                        $this->parametres->masqueRecherche = $_GET['nom'];
                }
        }

        public function executerActionParDefaut() {
                $this->executerResultat();
        }

        public function executerResultat() {
                $donnees = array();
                $donnees['typeResultat'] = $this->parametres->type;
                $donnees['urlResAlphab'] = $this->obtenirUrlResultatAlphab();
                $donnees['urlResRetenu'] = $this->obtenirUrlResultatRetenu();
                $donnees['urlResDetermination'] = $this->obtenirUrlResultatDetermination();
                $donnees['urlResDecompo'] = $this->obtenirUrlResultatDecompo();
                $donnees['nbreTaxons'] = $this->resultats['entete']['total'];
                $donnees['nomsHtml'] = $this->getNomsFormates();

                $this->setSortie(self::RENDU_CORPS, $this->getVue('resultat', $donnees));
        }

        private function getNomsFormates() {
                $resultatFormateur = ResultatFormateurFabrique::creer($this->parametres, $this->resultats);
                $resultatFormateur->formater();
                $resultatFormateur->trier();
                $resultatFormateur->surligner();
                $html = $this->getVue($resultatFormateur->getTplNom(), $resultatFormateur->getTplInfos());
                return $html;
        }
}
?>