206 |
aurelien |
1 |
<?php
|
|
|
2 |
// declare(encoding='UTF-8');
|
|
|
3 |
/**
|
|
|
4 |
* Classe de gestion des epeces.
|
|
|
5 |
*
|
|
|
6 |
* @package Collection
|
|
|
7 |
* @category Php 5.2
|
|
|
8 |
* @author Aurélien PERONNET <aurelien@tela-botanica.org>
|
|
|
9 |
* @copyright 2010 Tela-Botanica
|
|
|
10 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
|
|
|
11 |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
|
|
|
12 |
* @version SVN: $Id: Espece.php 152 2010-09-06 16:19:12Z jpm $
|
|
|
13 |
*/
|
|
|
14 |
class Rendu extends aControleur {
|
|
|
15 |
|
|
|
16 |
public function __construct() {
|
|
|
17 |
|
|
|
18 |
parent::__construct();
|
|
|
19 |
$this->initialiser();
|
|
|
20 |
}
|
|
|
21 |
|
|
|
22 |
public function executerActionParDefaut() {
|
|
|
23 |
return $this->afficherCarte();
|
|
|
24 |
}
|
|
|
25 |
|
|
|
26 |
private function initialiser() {
|
|
|
27 |
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
private function afficherCarte() {
|
|
|
31 |
|
237 |
aurelien |
32 |
$carte = $this->getCarteDemandee();
|
|
|
33 |
|
206 |
aurelien |
34 |
$espece_dao = new EspeceDao();
|
|
|
35 |
$especes = $espece_dao->getListeEspecesParType();
|
|
|
36 |
|
|
|
37 |
$evenements_dao = new EvenementDao();
|
|
|
38 |
$evenements = $evenements_dao->getListeEvenements();
|
|
|
39 |
|
|
|
40 |
$chaine_variables_script = '<script type="text/javascript" language="javascript">';
|
|
|
41 |
|
|
|
42 |
$chaine_variables_script .= ' var tableau_especes = new Array(); ';
|
|
|
43 |
$chaine_variables_script .= ' var tableau_evenements_especes = new Array(); ';
|
|
|
44 |
$chaine_variables_script .= ' var tableau_evenements = new Array(); ';
|
|
|
45 |
|
|
|
46 |
foreach($especes as $id_type_espece => $type_espece) {
|
|
|
47 |
|
|
|
48 |
$chaine_variables_script .= 'tableau_especes['.$id_type_espece.'] = new Array();';
|
|
|
49 |
|
|
|
50 |
foreach($type_espece['especes'] as $id_espece => $espece) {
|
|
|
51 |
$chaine_variables_script .= 'tableau_especes['.$id_type_espece.']['.$id_espece.'] = "'.$espece['nom_vernaculaire'].'";';
|
|
|
52 |
$chaine_variables_script .= 'tableau_evenements_especes['.$id_espece.'] = "'.$espece['evenements'].'";';
|
|
|
53 |
}
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
foreach($evenements as $id_evenement => $evenement) {
|
|
|
57 |
$nom_evenement = $evenement['nom'];
|
|
|
58 |
if(trim($evenement['nom']) != '') {
|
|
|
59 |
$nom_evenement .= ' stade '.$evenement['code'];
|
|
|
60 |
}
|
|
|
61 |
$chaine_variables_script .= 'tableau_evenements['.$id_evenement.'] = "'.$nom_evenement.'";';
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
$chaine_variables_script .= '</script> ';
|
237 |
aurelien |
65 |
$chaine_variables_script .= '<script type="text/javascript" src="'.Liens::getUrlScript().'rendu_'.$carte.'.js"></script>';
|
206 |
aurelien |
66 |
|
|
|
67 |
$donnees = array();
|
237 |
aurelien |
68 |
$donnees['url'] = Liens::getUrlBaseComplete().'rendu_widget.php?carte='.$carte;
|
206 |
aurelien |
69 |
$donnees['script'] = $chaine_variables_script;
|
|
|
70 |
$donnees['especes'] = $especes;
|
|
|
71 |
$donnees['evenements'] = $evenements;
|
|
|
72 |
|
237 |
aurelien |
73 |
$formulaire = $this->getVue('cartes/observations_'.$carte,$donnees);
|
206 |
aurelien |
74 |
$this->setSortie(self::RENDU_CORPS, $formulaire);
|
|
|
75 |
}
|
|
|
76 |
|
237 |
aurelien |
77 |
private function getCarteDemandee() {
|
|
|
78 |
|
|
|
79 |
$carte = 'especes';
|
|
|
80 |
|
|
|
81 |
if(isset($_GET['carte'])) {
|
|
|
82 |
$carte = $_GET['carte'];
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
return $carte;
|
|
|
86 |
}
|
|
|
87 |
|
206 |
aurelien |
88 |
}
|