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 |
}
|
84 |
jpm |
55 |
}
|
106 |
jpm |
56 |
|
76 |
delphine |
57 |
public function executerActionParDefaut() {
|
|
|
58 |
$this->executerResultat();
|
|
|
59 |
}
|
106 |
jpm |
60 |
|
76 |
delphine |
61 |
public function executerResultat() {
|
162 |
jpm |
62 |
$this->chargerOnglets();
|
151 |
jpm |
63 |
$this->chargerNbreDeTaxons();
|
|
|
64 |
$this->chargerNomsFormates();
|
106 |
jpm |
65 |
|
151 |
jpm |
66 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('resultat', $this->donneesTpl));
|
76 |
delphine |
67 |
}
|
106 |
jpm |
68 |
|
162 |
jpm |
69 |
private function chargerOnglets() {
|
|
|
70 |
$donnees = array();
|
|
|
71 |
$donnees['typeResultat'] = $this->parametres->typeResultat;
|
|
|
72 |
$donnees['typeNom'] = $this->parametres->typeNom;
|
|
|
73 |
$donnees['ongletsNs'] = array('determination', 'alphab', 'retenu', 'decompo');
|
|
|
74 |
$donnees['ongletsNv'] = array('determination', 'alphab');
|
|
|
75 |
$donnees['urls']['alphab'] = $this->urls->obtenirUrlResultatAlphab();
|
|
|
76 |
$donnees['urls']['retenu'] = $this->urls->obtenirUrlResultatRetenu();
|
|
|
77 |
$donnees['urls']['determination'] = $this->urls->obtenirUrlResultatDetermination();
|
|
|
78 |
$donnees['urls']['decompo'] = $this->urls->obtenirUrlResultatDecompo();
|
|
|
79 |
$donnees['i18n'] = I18n::get('Resultat-onglets');
|
|
|
80 |
$this->donneesTpl['ongletsHtml'] = $this->getVue('onglets', $donnees);
|
84 |
jpm |
81 |
}
|
151 |
jpm |
82 |
|
|
|
83 |
private function chargerNbreDeTaxons() {
|
|
|
84 |
$this->donneesTpl['nbreTaxons'] = $this->resultats['entete']['total'];
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
private function chargerNomsFormates() {
|
|
|
88 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt mise en forme des noms");
|
|
|
89 |
$formateur = ResultatFormateurFabrique::creer($this->parametres, $this->resultats);
|
|
|
90 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt formatage des noms");
|
|
|
91 |
$formateur->formater();
|
|
|
92 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt triage des noms");
|
|
|
93 |
$formateur->trier();
|
|
|
94 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt surlignage des noms");
|
|
|
95 |
$formateur->surligner();
|
|
|
96 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt création de la vue");
|
|
|
97 |
$this->donneesTpl['nomsHtml'] = $this->getVue($formateur->getTplNom(), $formateur->getTplInfos());
|
|
|
98 |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Après mise en forme des noms");
|
|
|
99 |
}
|
76 |
delphine |
100 |
}
|
|
|
101 |
?>
|