31 |
aurelien |
1 |
<?php
|
|
|
2 |
// declare(encoding='UTF-8');
|
|
|
3 |
/**
|
|
|
4 |
* Modèle d'accès à la base de données de saisies pour le module observation.
|
|
|
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: StationDao.php 154 2010-09-13 12:15:11Z aurelien $
|
|
|
13 |
*
|
|
|
14 |
*/
|
|
|
15 |
class ObservationDao extends Dao {
|
|
|
16 |
|
|
|
17 |
const SERVICE_OBSERVATION = 'OdsObservation';
|
|
|
18 |
const METHODE_OBSERVATION_INDIVIDU= 'ObservationsPourIndividu';
|
|
|
19 |
|
|
|
20 |
/**
|
|
|
21 |
* Retourne l'ensemble des observations d'une station.
|
|
|
22 |
*
|
|
|
23 |
* @param integer l'id d'une station.
|
|
|
24 |
* @return array un tableau contenant les informations sur les observations de cette station.
|
|
|
25 |
*/
|
|
|
26 |
public function getListeObservationsPourStation($id_station) {
|
|
|
27 |
|
|
|
28 |
$url = $this->url_jrest.self::SERVICE_OBSERVATION."/*/";
|
|
|
29 |
$json = $this->envoyerRequeteConsultation($url);
|
|
|
30 |
$donnees = json_decode($json, true);
|
|
|
31 |
return $donnees;
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
public function getListeObservationsPourIndividu($id_individu, $annee = null) {
|
|
|
35 |
|
|
|
36 |
if (is_numeric($id_individu)) {
|
|
|
37 |
$url = $this->url_jrest.self::SERVICE_OBSERVATION.'/'.self::METHODE_OBSERVATION_INDIVIDU.'/'.$id_individu;
|
|
|
38 |
$json = $this->envoyerRequeteConsultation($url);
|
|
|
39 |
$donnees = json_decode($json, true);
|
|
|
40 |
return $donnees;
|
|
|
41 |
}
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
public function ajouterObservation($valeurs_observation_verifiees) {
|
|
|
45 |
|
|
|
46 |
$donnees = $valeurs_individu_verifiees;
|
|
|
47 |
|
|
|
48 |
$url = $this->url_jrest.self::SERVICE_OBSERVATION."/";
|
|
|
49 |
$json = $this->envoyerRequeteAjout($url, $donnees);
|
|
|
50 |
$donnees = json_decode($json, true);
|
|
|
51 |
|
|
|
52 |
if (true) {
|
|
|
53 |
//TODO: verifier ajout
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
return true;
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
public function modifierObservation($id_observation, $valeurs_observation_verifiees) {
|
|
|
60 |
|
|
|
61 |
$donnees = observation;
|
|
|
62 |
|
|
|
63 |
if (is_numeric($id_individu)) {
|
|
|
64 |
$url = $this->url_jrest.self::SERVICE_OBSERVATION."/$id_observation";
|
|
|
65 |
$json = $this->envoyerRequeteModif($url, $donnees);
|
|
|
66 |
$donnees = json_decode($json, true);
|
|
|
67 |
if (true) {
|
|
|
68 |
//TODO: verifier modification
|
|
|
69 |
}
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
return true;
|
|
|
73 |
}
|
|
|
74 |
}
|
|
|
75 |
?>
|