Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 197 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 197 Rev 725
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Classe mère du module Liste.
4
 * Classe mère du module Liste.
5
 *
5
 *
6
 * @category	PHP 5.2
6
 * @category	PHP 5.2
7
 * @package		eflore-consultation
7
 * @package		eflore-consultation
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
10
 * @copyright	2011 Tela-Botanica
10
 * @copyright	2011 Tela-Botanica
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
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
12
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
13
 * @version		$Id$
13
 * @version		$Id$
14
 */
14
 */
15
class Resultat extends aControleur {
15
class Resultat extends aControleur {
16
 
16
 
17
	private $parametres = null;
17
	private $parametres = null;
18
	private $resultats = null;
18
	private $resultats = null;
19
	private $donneesTpl = array();
19
	private $donneesTpl = array();
-
 
20
	private $i18n =  array();
20
 
21
 
21
	public function initialiser() {
22
	public function initialiser() {
22
		spl_autoload_register(array($this, 'chargerClassesResultat'));
23
		spl_autoload_register(array($this, 'chargerClassesResultat'));
23
		$this->parametres = new ParametresResultats();
24
		$this->parametres = new ParametresResultats();
24
		$this->capturerParametres();
25
		$this->capturerParametres();
-
 
26
		$this->capturerParametresAvances();
25
		$this->parametres->reftaxCourant = Registre::get('parametres.referentiel');
27
		$this->parametres->reftaxCourant = Registre::get('parametres.referentiel');
26
		$this->parametres->projetImg = Config::get($this->parametres->reftaxCourant.'.referentielImages');
28
		$this->parametres->projetImg = Config::get($this->parametres->reftaxCourant.'.referentielImages');
27
		$this->resultats = Registre::get('resultats');
29
		$this->resultats = Registre::get('resultats');
-
 
30
		$this->i18n = I18n::get('Recherche-form-avancee');
28
	}
31
	}
29
 
32
 
30
	private function chargerClassesResultat($classe) {
33
	private function chargerClassesResultat($classe) {
31
		$base = dirname(__FILE__).DS;
34
		$base = dirname(__FILE__).DS;
32
		$cheminFormateurs = $base.'formateurs'.DS;
35
		$cheminFormateurs = $base.'formateurs'.DS;
33
		$cheminFormateursNs = $cheminFormateurs.'nom_scientifique'.DS;
36
		$cheminFormateursNs = $cheminFormateurs.'nom_scientifique'.DS;
34
		$cheminFormateursNv = $cheminFormateurs.'nom_vernaculaire'.DS;
37
		$cheminFormateursNv = $cheminFormateurs.'nom_vernaculaire'.DS;
35
		$dossiers = array($base, $cheminFormateurs, $cheminFormateursNs, $cheminFormateursNv);
38
		$dossiers = array($base, $cheminFormateurs, $cheminFormateursNs, $cheminFormateursNv);
36
		foreach ($dossiers as $chemin) {
39
		foreach ($dossiers as $chemin) {
37
			$fichierATester = $chemin.$classe.'.php';
40
			$fichierATester = $chemin.$classe.'.php';
38
			if (file_exists($fichierATester)) {
41
			if (file_exists($fichierATester)) {
39
				include_once $fichierATester;
42
				include_once $fichierATester;
40
				return null;
43
				return null;
41
			}
44
			}
42
		}
45
		}
43
	}
46
	}
44
 
47
 
45
	private function capturerParametres() {
48
	private function capturerParametres() {
46
		if (isset($_GET['resultat'])) {
49
		if (isset($_GET['resultat'])) {
47
			$this->parametres->typeResultat = $_GET['resultat'];
50
			$this->parametres->typeResultat = $_GET['resultat'];
48
		}
51
		}
49
		if (isset($_GET['nom'])) {
52
		if (isset($_GET['nom'])) {
50
			$this->parametres->masqueRecherche = $_GET['nom'];
53
			$this->parametres->masqueRecherche = $_GET['nom'];
51
		}
54
		}
52
		if (isset($_GET['type_nom'])) {
55
		if (isset($_GET['type_nom'])) {
53
			$this->parametres->typeNom = $_GET['type_nom'];
56
			$this->parametres->typeNom = $_GET['type_nom'];
54
		}
57
		}
55
		
58
		
56
		if (isset($_GET['niveau'])) {
59
		if (isset($_GET['niveau'])) {
57
			Registre::set('parametres.niveau', $_GET['niveau']);
60
			Registre::set('parametres.niveau', $_GET['niveau']);
58
		}
61
		}
59
	}
62
	}
-
 
63
	
-
 
64
	private function capturerParametresAvances() {
-
 
65
		if (isset($_GET['gen']) && $_GET['gen'] != '') {
-
 
66
			$this->param['gen'] = urldecode($_GET['gen']);
-
 
67
		}
-
 
68
		if (isset($_GET['fam']) && $_GET['fam'] != '') {
-
 
69
			$this->param['fam'] = urldecode($_GET['fam']);
-
 
70
		}
-
 
71
		if (isset($_GET['au']) && $_GET['au'] != '' 
-
 
72
			&& $_GET['au'] != urlencode($this->i18n['valeur-form-auteur'])) {
-
 
73
			$this->param['au'] = urldecode($_GET['au']);
-
 
74
		}
-
 
75
		if (isset($_GET['bib']) && $_GET['bib'] != ''
-
 
76
			&& $_GET['bib'] != urlencode($this->i18n['valeur-form-bib'])) {
-
 
77
			$this->param['bib'] = urldecode($_GET['bib']);
-
 
78
		}
-
 
79
		if (isset($_GET['nn']) && $_GET['nn'] != '') {
-
 
80
			$this->param['nn'] = urldecode($_GET['nn']);
-
 
81
		}
-
 
82
		if (isset($_GET['nt']) && $_GET['nt'] != '') {
-
 
83
			$this->param['nt'] = urldecode($_GET['nt']);
-
 
84
		}
-
 
85
		if (isset($_GET['sp']) && $_GET['sp'] != '') {
-
 
86
			$this->param['sp'] = urldecode($_GET['sp']);
-
 
87
		}
-
 
88
		if (isset($_GET['ssp']) && $_GET['ssp'] != '') {
-
 
89
			$this->param['ssp'] = urldecode($_GET['ssp']);
-
 
90
		}
-
 
91
		if (isset($_GET['type']) && $_GET['type'] != '') {
-
 
92
			$this->param['type'] = urldecode($_GET['type']);
-
 
93
		}
-
 
94
		if (isset($_GET['and']) && $_GET['and'] != ''
-
 
95
			&& $_GET['and'] != urlencode($this->i18n['valeur-form-date'])) {
-
 
96
			$this->param['and'] = urldecode($_GET['and']);
-
 
97
		}
-
 
98
		if (isset($_GET['anf']) && $_GET['anf'] != ''
-
 
99
			&& $_GET['anf'] != urlencode($this->i18n['valeur-form-date'])) {
-
 
100
			$this->param['anf'] = urldecode($_GET['anf']);
-
 
101
		}
-
 
102
		if (isset($_GET['prga']) && $_GET['prga'] != '') {
-
 
103
			$this->param['prga'] = urldecode($_GET['prga']);
-
 
104
		}
-
 
105
		if (isset($_GET['prco']) && $_GET['prco'] != '') {
-
 
106
			$this->param['prco'] = urldecode($_GET['prco']);
-
 
107
		}
-
 
108
		if (isset($_GET['sto']) && $_GET['sto'] != '') {
-
 
109
			$this->param['sto'] = urldecode($_GET['sto']);
-
 
110
		}
-
 
111
		if (isset($_GET['sti']) && $_GET['sti'] != '') {
-
 
112
			$this->param['sti'] = urldecode($_GET['sti']);
-
 
113
		}
-
 
114
		if (isset($_GET['stc']) && $_GET['stc'] != '') {
-
 
115
			$this->param['stc'] = urldecode($_GET['stc']);
-
 
116
		}
-
 
117
	}
-
 
118
	
60
 
119
 
61
	public function executerActionParDefaut() {
120
	public function executerActionParDefaut() {
62
		$this->executerResultat();
121
		$this->executerResultat();
63
	}
122
	}
64
 
123
 
65
	public function executerResultat() {
124
	public function executerResultat() {
66
		$this->chargerOnglets();
125
		$this->chargerOnglets();
67
		$this->chargerNbreDeTaxons();
126
		$this->chargerNbreDeTaxons();
68
		$this->chargerNomsFormates();
127
		$this->chargerNomsFormates();
69
 
-
 
70
		$this->setSortie(self::RENDU_CORPS, $this->getVue('resultat', $this->donneesTpl));
128
		$this->setSortie(self::RENDU_CORPS, $this->getVue('resultat', $this->donneesTpl));
71
	}
129
	}
-
 
130
	
72
 
131
 
73
	private function chargerOnglets() {
132
	private function chargerOnglets() {
74
		$donnees = array();
133
		$donnees = array();
75
		$donnees['typeResultat'] = $this->parametres->typeResultat;
134
		$donnees['typeResultat'] = $this->parametres->typeResultat;
76
		$donnees['typeNom'] = $this->parametres->typeNom;
135
		$donnees['typeNom'] = $this->parametres->typeNom;
77
		$donnees['ongletsNs'] = array('determination', 'alphab', 'retenu', 'decompo');
136
		$donnees['ongletsNs'] = array('determination', 'alphab', 'retenu', 'decompo');
-
 
137
		if (($_GET['action']) == 'rechercheAvancee') {
-
 
138
			$donnees['urls']['alphab'] = $this->urls->obtenirUrlResultatAvanceOnglets('alphab', $this->param);
-
 
139
			$donnees['urls']['retenu'] = $this->urls->obtenirUrlResultatAvanceOnglets('retenu', $this->param);
-
 
140
			$donnees['urls']['determination'] = $this->urls->obtenirUrlResultatAvanceOnglets('determination',$this->param);
-
 
141
			$donnees['urls']['decompo'] = $this->urls->obtenirUrlResultatAvanceOnglets('decompo',$this->param);
-
 
142
		} else {
78
		$donnees['ongletsNv'] = array('determination', 'alphab');
143
			$donnees['ongletsNv'] = array('determination', 'alphab');
79
		$donnees['urls']['alphab'] = $this->urls->obtenirUrlResultatAlphab();
144
			$donnees['urls']['alphab'] = $this->urls->obtenirUrlResultatAlphab();
80
		$donnees['urls']['retenu'] = $this->urls->obtenirUrlResultatRetenu();
145
			$donnees['urls']['retenu'] = $this->urls->obtenirUrlResultatRetenu();
81
		$donnees['urls']['determination'] = $this->urls->obtenirUrlResultatDetermination();
146
			$donnees['urls']['determination'] = $this->urls->obtenirUrlResultatDetermination();
82
		$donnees['urls']['decompo'] = $this->urls->obtenirUrlResultatDecompo();
147
			$donnees['urls']['decompo'] = $this->urls->obtenirUrlResultatDecompo();
-
 
148
		}
83
		$donnees['i18n'] = I18n::get('Resultat-onglets');
149
		$donnees['i18n'] = I18n::get('Resultat-onglets');
84
		$this->donneesTpl['ongletsHtml'] = $this->getVue('onglets', $donnees);
150
		$this->donneesTpl['ongletsHtml'] = $this->getVue('onglets', $donnees);
85
	}
151
	}
86
 
152
 
87
	private function chargerNbreDeTaxons() {
153
	private function chargerNbreDeTaxons() {
88
		$this->donneesTpl['nbreTaxons'] = $this->resultats['entete']['total'];
154
		$this->donneesTpl['nbreTaxons'] = $this->resultats['entete']['total'];
89
	}
155
	}
90
 
156
 
91
	private function chargerNomsFormates() {
157
	private function chargerNomsFormates() {
92
		if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt mise en forme des noms");
158
		if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt mise en forme des noms");
93
		$formateur = ResultatFormateurFabrique::creer($this->parametres, $this->resultats);
159
		$formateur = ResultatFormateurFabrique::creer($this->parametres, $this->resultats);
94
		if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt formatage des noms");
160
		if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt formatage des noms");
95
		$formateur->formater();
161
		$formateur->formater();
96
		if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt triage des noms");
162
		if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt triage des noms");
97
		$formateur->trier();
163
		$formateur->trier();
98
		if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt surlignage des noms");
164
		if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt surlignage des noms");
99
		$formateur->surligner();
165
		$formateur->surligner();
100
		if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt création de la vue");
166
		if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt création de la vue");
101
		$this->donneesTpl['nomsHtml'] = $this->getVue($formateur->getTplNom(), $formateur->getTplInfos());
167
		$this->donneesTpl['nomsHtml'] = $this->getVue($formateur->getTplNom(), $formateur->getTplInfos());
102
		if (Config::get('benchmark_chrono')) Chronometre::chrono("Après mise en forme des noms");
168
		if (Config::get('benchmark_chrono')) Chronometre::chrono("Après mise en forme des noms");
103
	}
169
	}
104
}
170
}
105
?>
171
?>