Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 137 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
76 delphine 1
<?php
2
// declare(encoding='UTF-8');
3
/**
4
 * Classe mère du module Liste.
5
 *
6
 * @category	PHP 5.2
7
 * @package		eflore-consultation
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
10
 * @copyright	2011 Tela-Botanica
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
12
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
13
 * @version		$Id$
14
 */
15
class Resultat extends aControleur {
106 jpm 16
 
146 jpm 17
	private $parametres = null;
18
	private $resultats = null;
106 jpm 19
 
84 jpm 20
	public function initialiser() {
146 jpm 21
		spl_autoload_register(array($this, 'chargerClassesResultat'));
22
		$this->parametres = new ParametresResultats();
84 jpm 23
		$this->capturerParametres();
146 jpm 24
		$this->parametres->reftaxCourant = Registre::get('parametres.referentiel');
25
		$this->parametres->projetImg = Config::get($this->parametres->reftaxCourant.'.referentielImages');
26
		$this->resultats = Registre::get('resultats');
84 jpm 27
	}
106 jpm 28
 
146 jpm 29
	private function chargerClassesResultat($classe) {
30
		$dossiers = array(dirname(__FILE__).DS);
31
		foreach ($dossiers as $chemin) {
32
			$fichierATester = $chemin.$classe.'.php';
33
			if (file_exists($fichierATester)) {
34
				include_once $fichierATester;
35
				return null;
36
			}
37
		}
38
	}
39
 
84 jpm 40
	private function capturerParametres() {
41
		if (isset($_GET['resultat'])) {
146 jpm 42
			$this->parametres->type = $_GET['resultat'];
84 jpm 43
		}
135 jpm 44
		if (isset($_GET['nom'])) {
146 jpm 45
			$this->parametres->masqueRecherche = $_GET['nom'];
135 jpm 46
		}
84 jpm 47
	}
106 jpm 48
 
76 delphine 49
	public function executerActionParDefaut() {
50
		$this->executerResultat();
51
	}
106 jpm 52
 
76 delphine 53
	public function executerResultat() {
106 jpm 54
		$donnees = array();
146 jpm 55
		$donnees['typeResultat'] = $this->parametres->type;
106 jpm 56
		$donnees['urlResAlphab'] = $this->obtenirUrlResultatAlphab();
84 jpm 57
		$donnees['urlResRetenu'] = $this->obtenirUrlResultatRetenu();
95 delphine 58
		$donnees['urlResDetermination'] = $this->obtenirUrlResultatDetermination();
106 jpm 59
		$donnees['urlResDecompo'] = $this->obtenirUrlResultatDecompo();
146 jpm 60
		$donnees['nbreTaxons'] = $this->resultats['entete']['total'];
61
		$donnees['nomsHtml'] = $this->getNomsFormates();
106 jpm 62
 
76 delphine 63
		$this->setSortie(self::RENDU_CORPS, $this->getVue('resultat', $donnees));
64
	}
106 jpm 65
 
146 jpm 66
	private function getNomsFormates() {
67
		$resultatFormateur = ResultatFormateurFabrique::creer($this->parametres, $this->resultats);
68
		$resultatFormateur->formater();
69
		$resultatFormateur->trier();
70
		$resultatFormateur->surligner();
71
		$html = $this->getVue($resultatFormateur->getTplNom(), $resultatFormateur->getTplInfos());
72
		return $html;
84 jpm 73
	}
76 delphine 74
}
75
?>