31 |
aurelien |
1 |
<?php
|
|
|
2 |
// declare(encoding='UTF-8');
|
|
|
3 |
/**
|
|
|
4 |
* Classe de gestion des observations.
|
|
|
5 |
*
|
|
|
6 |
* @package ODS_saisie
|
|
|
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: Fiche.php 152 2010-09-06 16:19:12Z jpm $
|
|
|
13 |
*/
|
|
|
14 |
class Observation extends aControleur {
|
|
|
15 |
|
|
|
16 |
private $id_observation_en_cours = null;
|
|
|
17 |
|
|
|
18 |
public function __construct() {
|
|
|
19 |
|
|
|
20 |
parent::__construct();
|
|
|
21 |
$this->initialiser();
|
|
|
22 |
}
|
|
|
23 |
|
|
|
24 |
public function initialiser() {
|
|
|
25 |
|
|
|
26 |
$this->id_observation_en_cours = $_GET['id_observation'];
|
43 |
aurelien |
27 |
$this->setNavigation();
|
31 |
aurelien |
28 |
}
|
|
|
29 |
|
|
|
30 |
public function executerActionParDefaut() {
|
|
|
31 |
return $this->afficherFormulaireAjoutIndividu();
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
public function afficherFormulaireAjoutObservation($id_individu) {
|
|
|
36 |
$donnees = array();
|
|
|
37 |
$formulaire = $this->getVue('formulaires/observation_saisie',$donnees);
|
|
|
38 |
$this->setSortie(self::RENDU_CORPS, $formulaire);
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
public function afficherFormulaireModificationObservation() {
|
|
|
42 |
|
|
|
43 |
$id_individu_a_modifier_observation = $_GET['id_individu'];
|
|
|
44 |
|
|
|
45 |
$id_espece = $_GET['id_espece'];
|
|
|
46 |
$id_station = $_GET['id_station'];
|
|
|
47 |
|
|
|
48 |
$id_utilisateur = AppControleur::getUtilisateur()->getIdentifiantNumerique();
|
|
|
49 |
|
|
|
50 |
$espece = new Espece();
|
|
|
51 |
$evenements = $espece->getListeEvenementPourEspece($id_espece);
|
|
|
52 |
|
|
|
53 |
$station = new Station();
|
|
|
54 |
|
43 |
aurelien |
55 |
$individus = $station->getIndividusStationPourEspece($id_station,$id_espece);
|
31 |
aurelien |
56 |
foreach($individus as &$individu) {
|
|
|
57 |
|
|
|
58 |
$observation = new Observation();
|
|
|
59 |
$individu['observations'] = $observation->getListeObservationsPourIndividu($individu['id']);
|
|
|
60 |
$individu['url'] = aControleur::getUrlConsultationFicheIndividu($individu['id'],$individu['id']);
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
$donnees['evenements'] = $evenements;
|
|
|
64 |
$donnees['individus'] = $individus;
|
|
|
65 |
$donnees['id_station'] = $_GET['id_station'];
|
|
|
66 |
$donnees['id_espece'] = $_GET['id_espece'];
|
|
|
67 |
$donnees['id_individu_a_modifier_observation'] = $id_individu_a_modifier_observation;
|
|
|
68 |
|
|
|
69 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('formulaires/evenement_modification', $donnees));
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
// +---------------------------------------------------------------------------------------------------------------+
|
43 |
aurelien |
73 |
// METHODES POUR FABRIQUER LE MENU
|
|
|
74 |
public function setNavigation() {
|
|
|
75 |
|
|
|
76 |
$station = new Station();
|
|
|
77 |
$this->setSortie(self::RENDU_NAVIGATION, $station->construireMenuNavigation());
|
|
|
78 |
}
|
|
|
79 |
|
|
|
80 |
// +---------------------------------------------------------------------------------------------------------------+
|
31 |
aurelien |
81 |
// METHODES APPELEES LORS DE LA VALIDATION D'UN FORMULAIRE
|
|
|
82 |
public function validerFormulaireAjoutObservation() {
|
|
|
83 |
|
43 |
aurelien |
84 |
$valeurs_formulaires = $_POST;
|
31 |
aurelien |
85 |
|
|
|
86 |
$valeurs_verifiees = array();
|
|
|
87 |
|
|
|
88 |
$observation_dao = new ObservationDao();
|
|
|
89 |
$observation_dao->ajouterObservation($valeurs_verifiees);
|
|
|
90 |
}
|
|
|
91 |
|
|
|
92 |
public function validerFormulaireModificationObservation() {
|
|
|
93 |
|
43 |
aurelien |
94 |
$valeurs_formulaires = $_POST;
|
31 |
aurelien |
95 |
|
43 |
aurelien |
96 |
Debug::printr($valeurs_formulaires);
|
|
|
97 |
exit;
|
|
|
98 |
|
31 |
aurelien |
99 |
$valeurs_verifiees = array();
|
|
|
100 |
|
|
|
101 |
$observation_dao = new ObservationDao();
|
|
|
102 |
$observation_dao->modifierObservation($valeurs_verifiees);
|
|
|
103 |
|
|
|
104 |
}
|
|
|
105 |
|
|
|
106 |
// +---------------------------------------------------------------------------------------------------------------+
|
|
|
107 |
// METHODES DE RECHERCHE DE DONNEES
|
|
|
108 |
public function getListeObservationsPourIndividu($id_individu, $annee = null) {
|
|
|
109 |
|
|
|
110 |
$observation_dao = new ObservationDao();
|
|
|
111 |
$observations_pour_individu = $observation_dao->getListeObservationsPourIndividu($id_individu, $annee);
|
|
|
112 |
|
|
|
113 |
return $observations_pour_individu;
|
|
|
114 |
}
|
|
|
115 |
}
|