31 |
aurelien |
1 |
<?php
|
|
|
2 |
// declare(encoding='UTF-8');
|
|
|
3 |
/**
|
|
|
4 |
* Classe de test des Controleurs.
|
|
|
5 |
*
|
|
|
6 |
* @package Collection
|
|
|
7 |
* @category Php 5.2
|
|
|
8 |
* @author Jean-Pascal MILCENT <jpm@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 Individu extends aControleur {
|
|
|
15 |
|
|
|
16 |
private $id_individu_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_individu_en_cours = $_GET['id_individu'];
|
|
|
27 |
$this->setNavigation();
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
public function executerActionParDefaut() {
|
|
|
31 |
return $this->afficherFormulaireAjoutIndividu();
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
public function afficherFormulaireAjoutIndividu() {
|
|
|
35 |
$donnees = array();
|
|
|
36 |
$formulaire = $this->getVue('formulaires/individu_saisie',$donnees);
|
|
|
37 |
$this->setSortie(self::RENDU_CORPS, $formulaire);
|
|
|
38 |
}
|
|
|
39 |
|
|
|
40 |
// +---------------------------------------------------------------------------------------------------------------+
|
|
|
41 |
// METHODES GENERIQUES
|
|
|
42 |
public function afficherListeIndividu($id_espece) {
|
|
|
43 |
|
|
|
44 |
$id_utilisateur = AppControleur::getUtilisateur()->getIdentifiantNumerique();
|
|
|
45 |
|
|
|
46 |
$espece = new Espece();
|
|
|
47 |
$evenements = $espece->getListeEvenementPourEspece($id_espece);
|
|
|
48 |
|
|
|
49 |
$individus = $this->getListeIndividus($id_utilisateur);
|
|
|
50 |
foreach($individus as &$individu) {
|
|
|
51 |
|
|
|
52 |
$observation = new Observation();
|
|
|
53 |
|
|
|
54 |
$individu['observations'] = $observation->getListeObservationsPourIndividu($individu['id']);
|
|
|
55 |
$individu['url'] = aControleur::getUrlConsultationFicheIndividu($individu['id'],$individu['id']);
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
$donnees['evenements'] = $evenements;
|
|
|
59 |
$donnees['individus'] = $individus;
|
|
|
60 |
$donnees['id_station'] = $_GET['id_station'];
|
|
|
61 |
$donnees['id_espece'] = $_GET['id_espece'];
|
|
|
62 |
|
|
|
63 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('listes/evenement_liste', $donnees));
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
public function afficherInformationsIndividu() {
|
|
|
67 |
|
|
|
68 |
$id_individu = $this->id_individu_en_cours;
|
|
|
69 |
$id_espece = $_GET['id_individu'];
|
|
|
70 |
|
|
|
71 |
$donnees['infos_individu'] = $this->getInformationsIndividu($id_individu);
|
|
|
72 |
|
|
|
73 |
$espece_dao = new EspeceDao();
|
|
|
74 |
$donnees['infos_espece'] = $espece_dao->getInformationsEspece($id_espece);
|
|
|
75 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('fiches/individu_fiche', $donnees));
|
|
|
76 |
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
// +---------------------------------------------------------------------------------------------------------------+
|
|
|
80 |
// METHODES POUR FABRIQUER LE MENU
|
|
|
81 |
public function setNavigation() {
|
|
|
82 |
|
|
|
83 |
$station = new Station();
|
|
|
84 |
$this->setSortie(self::RENDU_NAVIGATION, $station->construireMenuNavigation());
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
protected function getListeIndividus($id_utilisateur) {
|
|
|
88 |
|
|
|
89 |
$individu_dao = new IndividuDao();
|
|
|
90 |
return $individu_dao->getListeIndividusPourStation($id_utilisateur);
|
|
|
91 |
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
private function getInformationsIndividu($id_individu) {
|
|
|
95 |
|
|
|
96 |
$individu_dao = new IndividuDao();
|
|
|
97 |
$infos_individu = $individu_dao->getInformationsIndividu($id_individu);
|
|
|
98 |
|
|
|
99 |
return $infos_individu;
|
|
|
100 |
}
|
|
|
101 |
}
|