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;
|
151 |
jpm |
19 |
private $donneesTpl = array();
|
106 |
jpm |
20 |
|
84 |
jpm |
21 |
public function initialiser() {
|
146 |
jpm |
22 |
spl_autoload_register(array($this, 'chargerClassesResultat'));
|
|
|
23 |
$this->parametres = new ParametresResultats();
|
84 |
jpm |
24 |
$this->capturerParametres();
|
146 |
jpm |
25 |
$this->parametres->reftaxCourant = Registre::get('parametres.referentiel');
|
|
|
26 |
$this->parametres->projetImg = Config::get($this->parametres->reftaxCourant.'.referentielImages');
|
|
|
27 |
$this->resultats = Registre::get('resultats');
|
84 |
jpm |
28 |
}
|
106 |
jpm |
29 |
|
146 |
jpm |
30 |
private function chargerClassesResultat($classe) {
|
154 |
jpm |
31 |
$base = dirname(__FILE__).DS;
|
163 |
jpm |
32 |
$cheminFormateurs = $base.'formateurs'.DS;
|
|
|
33 |
$cheminFormateursNs = $cheminFormateurs.'nom_scientifique'.DS;
|
|
|
34 |
$cheminFormateursNv = $cheminFormateurs.'nom_vernaculaire'.DS;
|
|
|
35 |
$dossiers = array($base, $cheminFormateurs, $cheminFormateursNs, $cheminFormateursNv);
|
146 |
jpm |
36 |
foreach ($dossiers as $chemin) {
|
|
|
37 |
$fichierATester = $chemin.$classe.'.php';
|
|
|
38 |
if (file_exists($fichierATester)) {
|
|
|
39 |
include_once $fichierATester;
|
|
|
40 |
return null;
|
|
|
41 |
}
|
|
|
42 |
}
|
|
|
43 |
}
|
|
|
44 |
|
84 |
jpm |
45 |
private function capturerParametres() {
|
|
|
46 |
if (isset($_GET['resultat'])) {
|
162 |
jpm |
47 |
$this->parametres->typeResultat = $_GET['resultat'];
|
84 |
jpm |
48 |
}
|
135 |
jpm |
49 |
if (isset($_GET['nom'])) {
|
146 |
jpm |
50 |
$this->parametres->masqueRecherche = $_GET['nom'];
|
135 |
jpm |
51 |
}
|
162 |
jpm |
52 |
if (isset($_GET['type_nom'])) {
|
|
|
53 |
$this->parametres->typeNom = $_GET['type_nom'];
|
|
|
54 |
}
|
197 |
delphine |
55 |
|
|
|
56 |
if (isset($_GET['niveau'])) {
|
|
|
57 |
Registre::set('parametres.niveau', $_GET['niveau']);
|
|
|
58 |
}
|
84 |
jpm |
59 |
}
|
106 |
jpm |
60 |
|
76 |
delphine |
61 |
public function executerActionParDefaut() {
|
|
|
62 |
$this->executerResultat();
|
|
|
63 |
}
|
106 |
jpm |
64 |
|
76 |
delphine |
65 |
public function executerResultat() {
|
162 |
jpm |
66 |
$this->chargerOnglets();
|
151 |
jpm |
67 |
$this->chargerNbreDeTaxons();
|
|
|
68 |
$this->chargerNomsFormates();
|
106 |
jpm |
69 |
|
151 |
jpm |
70 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('resultat', $this->donneesTpl));
|
76 |
delphine |
71 |
}
|
106 |
jpm |
72 |
|
162 |
jpm |
73 |
private function chargerOnglets() {
|
|
|
74 |
$donnees = array();
|
|
|
75 |
$donnees['typeResultat'] = $this->parametres->typeResultat;
|
|
|
76 |
$donnees['typeNom'] = $this->parametres->typeNom;
|
|
|
77 |
$donnees['ongletsNs'] = array('determination', 'alphab', 'retenu', 'decompo');
|
|
|
78 |
$donnees['ongletsNv'] = array('determination', 'alphab');
|
|
|
79 |
$donnees['urls']['alphab'] = $this->urls->obtenirUrlResultatAlphab();
|
|
|
80 |
$donnees['urls']['retenu'] = $this->urls->obtenirUrlResultatRetenu();
|
|
|
81 |
$donnees['urls']['determination'] = $this->urls->obtenirUrlResultatDetermination();
|
|
|
82 |
$donnees['urls']['decompo'] = $this->urls->obtenirUrlResultatDecompo();
|
|
|
83 |
$donnees['i18n'] = I18n::get('Resultat-onglets');
|
|
|
84 |
$this->donneesTpl['ongletsHtml'] = $this->getVue('onglets', $donnees);
|
84 |
jpm |
85 |
}
|
151 |
jpm |
86 |
|
|
|
87 |
private function chargerNbreDeTaxons() {
|
|
|
88 |
$this->donneesTpl['nbreTaxons'] = $this->resultats['entete']['total'];
|
|
|
89 |
}
|
|
|
90 |
|
|
|
91 |
private function chargerNomsFormates() {
|
|
|
92 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt mise en forme des noms");
|
|
|
93 |
$formateur = ResultatFormateurFabrique::creer($this->parametres, $this->resultats);
|
|
|
94 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt formatage des noms");
|
|
|
95 |
$formateur->formater();
|
|
|
96 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt triage des noms");
|
|
|
97 |
$formateur->trier();
|
|
|
98 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt surlignage des noms");
|
|
|
99 |
$formateur->surligner();
|
|
|
100 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt création de la vue");
|
|
|
101 |
$this->donneesTpl['nomsHtml'] = $this->getVue($formateur->getTplNom(), $formateur->getTplInfos());
|
|
|
102 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Après mise en forme des noms");
|
|
|
103 |
}
|
76 |
delphine |
104 |
}
|
|
|
105 |
?>
|