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 |
private $i18n = array();
|
21 |
|
21 |
|
22 |
public function initialiser() {
|
22 |
public function initialiser() {
|
23 |
spl_autoload_register(array($this, 'chargerClassesResultat'));
|
23 |
spl_autoload_register(array($this, 'chargerClassesResultat'));
|
24 |
$this->parametres = new ParametresResultats();
|
24 |
$this->parametres = new ParametresResultats();
|
25 |
$this->capturerParametres();
|
25 |
$this->capturerParametres();
|
26 |
$this->capturerParametresAvances();
|
26 |
$this->capturerParametresAvances();
|
27 |
$this->parametres->reftaxCourant = Registre::get('parametres.referentiel');
|
27 |
$this->parametres->referentielCourant = Registre::get('parametres.referentiel');
|
28 |
$this->parametres->projetImg = Config::get($this->parametres->reftaxCourant.'.referentielImages');
|
28 |
$this->parametres->projetImg = Config::get($this->parametres->referentielCourant.'.baseImages');
|
29 |
$this->resultats = Registre::get('resultats');
|
29 |
$this->resultats = Registre::get('resultats');
|
30 |
$this->i18n = I18n::get('Recherche-form-avancee');
|
30 |
$this->i18n = I18n::get('Recherche-form-avancee');
|
31 |
}
|
31 |
}
|
32 |
|
32 |
|
33 |
private function chargerClassesResultat($classe) {
|
33 |
private function chargerClassesResultat($classe) {
|
34 |
$base = dirname(__FILE__).DS;
|
34 |
$base = dirname(__FILE__).DS;
|
35 |
$cheminFormateurs = $base.'formateurs'.DS;
|
35 |
$cheminFormateurs = $base.'formateurs'.DS;
|
36 |
$cheminFormateursNs = $cheminFormateurs.'nom_scientifique'.DS;
|
36 |
$cheminFormateursNs = $cheminFormateurs.'nom_scientifique'.DS;
|
37 |
$cheminFormateursNv = $cheminFormateurs.'nom_vernaculaire'.DS;
|
37 |
$cheminFormateursNv = $cheminFormateurs.'nom_vernaculaire'.DS;
|
38 |
$dossiers = array($base, $cheminFormateurs, $cheminFormateursNs, $cheminFormateursNv);
|
38 |
$dossiers = array($base, $cheminFormateurs, $cheminFormateursNs, $cheminFormateursNv);
|
39 |
foreach ($dossiers as $chemin) {
|
39 |
foreach ($dossiers as $chemin) {
|
40 |
$fichierATester = $chemin.$classe.'.php';
|
40 |
$fichierATester = $chemin.$classe.'.php';
|
41 |
if (file_exists($fichierATester)) {
|
41 |
if (file_exists($fichierATester)) {
|
42 |
include_once $fichierATester;
|
42 |
include_once $fichierATester;
|
43 |
return null;
|
43 |
return null;
|
44 |
}
|
44 |
}
|
45 |
}
|
45 |
}
|
46 |
}
|
46 |
}
|
47 |
|
47 |
|
48 |
private function capturerParametres() {
|
48 |
private function capturerParametres() {
|
49 |
if (isset($_GET['resultat'])) {
|
49 |
if (isset($_GET['resultat'])) {
|
50 |
$this->parametres->typeResultat = $_GET['resultat'];
|
50 |
$this->parametres->typeResultat = $_GET['resultat'];
|
51 |
}
|
51 |
}
|
52 |
if (isset($_GET['nom'])) {
|
52 |
if (isset($_GET['nom'])) {
|
53 |
$this->parametres->masqueRecherche = trim($_GET['nom']);
|
53 |
$this->parametres->masqueRecherche = trim($_GET['nom']);
|
54 |
}
|
54 |
}
|
55 |
if (isset($_GET['type_nom'])) {
|
55 |
if (isset($_GET['type_nom'])) {
|
56 |
$this->parametres->typeNom = $_GET['type_nom'];
|
56 |
$this->parametres->typeNom = $_GET['type_nom'];
|
57 |
}
|
57 |
}
|
58 |
|
58 |
|
59 |
if (isset($_GET['niveau'])) {
|
59 |
if (isset($_GET['niveau'])) {
|
60 |
Registre::set('parametres.niveau', $_GET['niveau']);
|
60 |
Registre::set('parametres.niveau', $_GET['niveau']);
|
61 |
}
|
61 |
}
|
62 |
}
|
62 |
}
|
63 |
|
63 |
|
64 |
private function capturerParametresAvances() {
|
64 |
private function capturerParametresAvances() {
|
65 |
if (isset($_GET['gen']) && $_GET['gen'] != '') {
|
65 |
if (isset($_GET['gen']) && $_GET['gen'] != '') {
|
66 |
$this->param['gen'] = urldecode($_GET['gen']);
|
66 |
$this->param['gen'] = urldecode($_GET['gen']);
|
67 |
}
|
67 |
}
|
68 |
if (isset($_GET['fam']) && $_GET['fam'] != '') {
|
68 |
if (isset($_GET['fam']) && $_GET['fam'] != '') {
|
69 |
$this->param['fam'] = urldecode($_GET['fam']);
|
69 |
$this->param['fam'] = urldecode($_GET['fam']);
|
70 |
}
|
70 |
}
|
71 |
if (isset($_GET['au']) && $_GET['au'] != ''
|
71 |
if (isset($_GET['au']) && $_GET['au'] != ''
|
72 |
&& $_GET['au'] != urlencode($this->i18n['valeur-form-auteur'])) {
|
72 |
&& $_GET['au'] != urlencode($this->i18n['valeur-form-auteur'])) {
|
73 |
$this->param['au'] = urldecode($_GET['au']);
|
73 |
$this->param['au'] = urldecode($_GET['au']);
|
74 |
}
|
74 |
}
|
75 |
if (isset($_GET['bib']) && $_GET['bib'] != ''
|
75 |
if (isset($_GET['bib']) && $_GET['bib'] != ''
|
76 |
&& $_GET['bib'] != urlencode($this->i18n['valeur-form-bib'])) {
|
76 |
&& $_GET['bib'] != urlencode($this->i18n['valeur-form-bib'])) {
|
77 |
$this->param['bib'] = urldecode($_GET['bib']);
|
77 |
$this->param['bib'] = urldecode($_GET['bib']);
|
78 |
}
|
78 |
}
|
79 |
if (isset($_GET['nn']) && $_GET['nn'] != '') {
|
79 |
if (isset($_GET['nn']) && $_GET['nn'] != '') {
|
80 |
$this->param['nn'] = urldecode($_GET['nn']);
|
80 |
$this->param['nn'] = urldecode($_GET['nn']);
|
81 |
}
|
81 |
}
|
82 |
if (isset($_GET['nt']) && $_GET['nt'] != '') {
|
82 |
if (isset($_GET['nt']) && $_GET['nt'] != '') {
|
83 |
$this->param['nt'] = urldecode($_GET['nt']);
|
83 |
$this->param['nt'] = urldecode($_GET['nt']);
|
84 |
}
|
84 |
}
|
85 |
if (isset($_GET['sp']) && $_GET['sp'] != '') {
|
85 |
if (isset($_GET['sp']) && $_GET['sp'] != '') {
|
86 |
$this->param['sp'] = urldecode($_GET['sp']);
|
86 |
$this->param['sp'] = urldecode($_GET['sp']);
|
87 |
}
|
87 |
}
|
88 |
if (isset($_GET['ssp']) && $_GET['ssp'] != '') {
|
88 |
if (isset($_GET['ssp']) && $_GET['ssp'] != '') {
|
89 |
$this->param['ssp'] = urldecode($_GET['ssp']);
|
89 |
$this->param['ssp'] = urldecode($_GET['ssp']);
|
90 |
}
|
90 |
}
|
91 |
if (isset($_GET['type']) && $_GET['type'] != '') {
|
91 |
if (isset($_GET['type']) && $_GET['type'] != '') {
|
92 |
$this->param['type'] = urldecode($_GET['type']);
|
92 |
$this->param['type'] = urldecode($_GET['type']);
|
93 |
}
|
93 |
}
|
94 |
if (isset($_GET['and']) && $_GET['and'] != ''
|
94 |
if (isset($_GET['and']) && $_GET['and'] != ''
|
95 |
&& $_GET['and'] != urlencode($this->i18n['valeur-form-date'])) {
|
95 |
&& $_GET['and'] != urlencode($this->i18n['valeur-form-date'])) {
|
96 |
$this->param['and'] = urldecode($_GET['and']);
|
96 |
$this->param['and'] = urldecode($_GET['and']);
|
97 |
}
|
97 |
}
|
98 |
if (isset($_GET['anf']) && $_GET['anf'] != ''
|
98 |
if (isset($_GET['anf']) && $_GET['anf'] != ''
|
99 |
&& $_GET['anf'] != urlencode($this->i18n['valeur-form-date'])) {
|
99 |
&& $_GET['anf'] != urlencode($this->i18n['valeur-form-date'])) {
|
100 |
$this->param['anf'] = urldecode($_GET['anf']);
|
100 |
$this->param['anf'] = urldecode($_GET['anf']);
|
101 |
}
|
101 |
}
|
102 |
if (isset($_GET['prga']) && $_GET['prga'] != '') {
|
102 |
if (isset($_GET['prga']) && $_GET['prga'] != '') {
|
103 |
$this->param['prga'] = urldecode($_GET['prga']);
|
103 |
$this->param['prga'] = urldecode($_GET['prga']);
|
104 |
}
|
104 |
}
|
105 |
if (isset($_GET['prco']) && $_GET['prco'] != '') {
|
105 |
if (isset($_GET['prco']) && $_GET['prco'] != '') {
|
106 |
$this->param['prco'] = urldecode($_GET['prco']);
|
106 |
$this->param['prco'] = urldecode($_GET['prco']);
|
107 |
}
|
107 |
}
|
108 |
if (isset($_GET['sto']) && $_GET['sto'] != '') {
|
108 |
if (isset($_GET['sto']) && $_GET['sto'] != '') {
|
109 |
$this->param['sto'] = urldecode($_GET['sto']);
|
109 |
$this->param['sto'] = urldecode($_GET['sto']);
|
110 |
}
|
110 |
}
|
111 |
if (isset($_GET['sti']) && $_GET['sti'] != '') {
|
111 |
if (isset($_GET['sti']) && $_GET['sti'] != '') {
|
112 |
$this->param['sti'] = urldecode($_GET['sti']);
|
112 |
$this->param['sti'] = urldecode($_GET['sti']);
|
113 |
}
|
113 |
}
|
114 |
if (isset($_GET['stc']) && $_GET['stc'] != '') {
|
114 |
if (isset($_GET['stc']) && $_GET['stc'] != '') {
|
115 |
$this->param['stc'] = urldecode($_GET['stc']);
|
115 |
$this->param['stc'] = urldecode($_GET['stc']);
|
116 |
}
|
116 |
}
|
117 |
}
|
117 |
}
|
118 |
|
118 |
|
119 |
|
119 |
|
120 |
public function executerActionParDefaut() {
|
120 |
public function executerActionParDefaut() {
|
121 |
$this->executerResultat();
|
121 |
$this->executerResultat();
|
122 |
}
|
122 |
}
|
123 |
|
123 |
|
124 |
public function executerResultat() {
|
124 |
public function executerResultat() {
|
125 |
$this->chargerOnglets();
|
125 |
$this->chargerOnglets();
|
126 |
$this->chargerNbreDeTaxons();
|
126 |
$this->chargerNbreDeTaxons();
|
127 |
$this->chargerNomsFormates();
|
127 |
$this->chargerNomsFormates();
|
128 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('resultat', $this->donneesTpl));
|
128 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('resultat', $this->donneesTpl));
|
129 |
}
|
129 |
}
|
130 |
|
130 |
|
131 |
|
131 |
|
132 |
private function chargerOnglets() {
|
132 |
private function chargerOnglets() {
|
133 |
$donnees = array();
|
133 |
$donnees = array();
|
134 |
$donnees['typeResultat'] = $this->parametres->typeResultat;
|
134 |
$donnees['typeResultat'] = $this->parametres->typeResultat;
|
135 |
$donnees['typeNom'] = $this->parametres->typeNom;
|
135 |
$donnees['typeNom'] = $this->parametres->typeNom;
|
136 |
$donnees['ongletsNs'] = array('determination', 'retenu', 'decompo');
|
136 |
$donnees['ongletsNs'] = array('determination', 'retenu', 'decompo');
|
137 |
$donnees['ongletsNv'] = array('determination', 'alphab');
|
137 |
$donnees['ongletsNv'] = array('determination', 'alphab');
|
138 |
if (($_GET['action']) == 'rechercheAvancee') {
|
138 |
if (($_GET['action']) == 'rechercheAvancee') {
|
139 |
$donnees['urls']['alphab'] = $this->urls->obtenirUrlResultatAvanceOnglets('alphab', $this->param);
|
139 |
$donnees['urls']['alphab'] = $this->urls->obtenirUrlResultatAvanceOnglets('alphab', $this->param);
|
140 |
$donnees['urls']['retenu'] = $this->urls->obtenirUrlResultatAvanceOnglets('retenu', $this->param);
|
140 |
$donnees['urls']['retenu'] = $this->urls->obtenirUrlResultatAvanceOnglets('retenu', $this->param);
|
141 |
$donnees['urls']['determination'] = $this->urls->obtenirUrlResultatAvanceOnglets('determination',$this->param);
|
141 |
$donnees['urls']['determination'] = $this->urls->obtenirUrlResultatAvanceOnglets('determination',$this->param);
|
142 |
$donnees['urls']['decompo'] = $this->urls->obtenirUrlResultatAvanceOnglets('decompo',$this->param);
|
142 |
$donnees['urls']['decompo'] = $this->urls->obtenirUrlResultatAvanceOnglets('decompo',$this->param);
|
143 |
} else {
|
143 |
} else {
|
144 |
|
144 |
|
145 |
$donnees['urls']['alphab'] = $this->urls->obtenirUrlResultatAlphab();
|
145 |
$donnees['urls']['alphab'] = $this->urls->obtenirUrlResultatAlphab();
|
146 |
$donnees['urls']['retenu'] = $this->urls->obtenirUrlResultatRetenu();
|
146 |
$donnees['urls']['retenu'] = $this->urls->obtenirUrlResultatRetenu();
|
147 |
$donnees['urls']['determination'] = $this->urls->obtenirUrlResultatDetermination();
|
147 |
$donnees['urls']['determination'] = $this->urls->obtenirUrlResultatDetermination();
|
148 |
$donnees['urls']['decompo'] = $this->urls->obtenirUrlResultatDecompo();
|
148 |
$donnees['urls']['decompo'] = $this->urls->obtenirUrlResultatDecompo();
|
149 |
}
|
149 |
}
|
150 |
$donnees['i18n']['nv'] = I18n::get('Resultat-onglets-nv');
|
150 |
$donnees['i18n']['nv'] = I18n::get('Resultat-onglets-nv');
|
151 |
$donnees['i18n']['ns'] = I18n::get('Resultat-onglets-ns');
|
151 |
$donnees['i18n']['ns'] = I18n::get('Resultat-onglets-ns');
|
152 |
$this->donneesTpl['ongletsHtml'] = $this->getVue('onglets', $donnees);
|
152 |
$this->donneesTpl['ongletsHtml'] = $this->getVue('onglets', $donnees);
|
153 |
}
|
153 |
}
|
154 |
|
154 |
|
155 |
private function chargerNbreDeTaxons() {
|
155 |
private function chargerNbreDeTaxons() {
|
156 |
$this->donneesTpl['nbreTaxons'] = $this->resultats['entete']['total'];
|
156 |
$this->donneesTpl['nbreTaxons'] = $this->resultats['entete']['total'];
|
157 |
}
|
157 |
}
|
158 |
|
158 |
|
159 |
private function chargerNomsFormates() {
|
159 |
private function chargerNomsFormates() {
|
160 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt mise en forme des noms");
|
160 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt mise en forme des noms");
|
161 |
$formateur = ResultatFormateurFabrique::creer($this->parametres, $this->resultats);
|
161 |
$formateur = ResultatFormateurFabrique::creer($this->parametres, $this->resultats);
|
162 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt formatage des noms");
|
162 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt formatage des noms");
|
163 |
$formateur->formater();
|
163 |
$formateur->formater();
|
164 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt triage des noms");
|
164 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt triage des noms");
|
165 |
$formateur->trier();
|
165 |
$formateur->trier();
|
166 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt surlignage des noms");
|
166 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt surlignage des noms");
|
167 |
$formateur->surligner();
|
167 |
$formateur->surligner();
|
168 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt création de la vue");
|
168 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt création de la vue");
|
169 |
$this->donneesTpl['nomsHtml'] = $this->getVue($formateur->getTplNom(), $formateur->getTplInfos());
|
169 |
$this->donneesTpl['nomsHtml'] = $this->getVue($formateur->getTplNom(), $formateur->getTplInfos());
|
170 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Après mise en forme des noms");
|
170 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Après mise en forme des noms");
|
171 |
}
|
171 |
}
|
172 |
}
|
172 |
}
|
173 |
?>
|
173 |
?>
|