Subversion Repositories Sites.obs-saisons.fr

Rev

Rev 45 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
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 stations.
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 StationDao extends Dao {
16
 
17
	const SERVICE_STATION = 'OdsStation';
18
 
19
    /**
20
     * Retourne l'ensemble des stations d'un participant.
21
     *
22
     * @return array un tableau contenant les informations sur les stations du participant.
23
     */
24
    public function getListeStations() {
25
 
26
	    $url = $this->url_jrest.self::SERVICE_STATION.'/'.AppControleur::getIdUtilisateur().'/*/';
27
        $json = $this->envoyerRequeteConsultation($url);
28
        $donnees = json_decode($json, true);
29
 
30
        return $donnees;
31
	}
32
 
33
	public function getInformationsStation($id_station) {
34
 
35
	    $url = $this->url_jrest.self::SERVICE_STATION.'/'.AppControleur::getIdUtilisateur().'/'.$id_station.'/';
36
        $json = $this->envoyerRequeteConsultation($url);
37
        $donnees = json_decode($json, true);
38
 
39
        return $donnees;
40
	}
41
 
42
	public function ajouterStation($valeurs_station_verifiees) {
43
 
44
		$donnees = $valeurs_station_verifiees;
45
		$donnees['id_participant'] = AppControleur::getIdUtilisateur();
46
 
47
        $url = $this->url_jrest.self::SERVICE_STATION."/";
48
        $json = $this->envoyerRequeteAjout($url, $donnees);
49
 
50
        $donnees = json_decode($json, true);
51
 
52
		if (true) {
53
             //TODO: verifier ajout
54
        }
55
 
56
		return true;
57
	}
58
 
59
	public function modifierStation($id_station, $valeurs_station_verifiees) {
60
 
61
		$donnees = $valeurs_station_verifiees;
62
		$donnees['id_participant'] = AppControleur::getIdUtilisateur();
63
 
64
        if (is_numeric($id_station)) {
65
            $url = $this->url_jrest.self::SERVICE_STATION."/$id_station";
66
            $json = $this->envoyerRequeteModif($url, $donnees);
67
            $donnees = json_decode($json, true);
68
            if (true) {
69
            	//TODO: verifier modification
70
            }
71
        }
72
 
73
		return true;
74
	}
75
}
76
?>