Subversion Repositories Sites.obs-saisons.fr

Rev

Rev 31 | Rev 91 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 31 Rev 45
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Modèle d'accès à la base de données de saisies pour le module stations.
4
 * Modèle d'accès à la base de données de saisies pour le module stations.
5
 *
5
 *
6
 * @package ODS_saisie
6
 * @package ODS_saisie
7
 * @category    php 5.2
7
 * @category    php 5.2
8
 * @author      Aurélien Peronnet <aurelien@tela-botanica.org>
8
 * @author      Aurélien Peronnet <aurelien@tela-botanica.org>
9
 * @copyright   2010 Tela-Botanica
9
 * @copyright   2010 Tela-Botanica
10
 * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
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
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 $
12
 * @version SVN: $Id: StationDao.php 154 2010-09-13 12:15:11Z aurelien $
13
 *
13
 *
14
 */
14
 */
15
class StationDao extends Dao {
15
class StationDao extends Dao {
16
	
16
	
17
	const SERVICE_STATION = 'OdsStation';
17
	const SERVICE_STATION = 'OdsStation';
18
 
18
 
19
    /**
19
    /**
20
     * Retourne l'ensemble des stations d'un participant.
20
     * Retourne l'ensemble des stations d'un participant.
21
     *
21
     *
22
     * @return array un tableau contenant les informations sur les stations du participant.
22
     * @return array un tableau contenant les informations sur les stations du participant.
23
     */
23
     */
24
    public function getListeStations() {
24
    public function getListeStations() {
25
       	    	
25
       	    	
26
	    $url = $this->url_jrest.self::SERVICE_STATION.'/'.AppControleur::getIdUtilisateur().'/*/';
26
	    $url = $this->url_jrest.self::SERVICE_STATION.'/'.AppControleur::getIdUtilisateur().'/*/';
27
        $json = $this->envoyerRequeteConsultation($url);
27
        $json = $this->envoyerRequeteConsultation($url);
28
        $donnees = json_decode($json, true);
28
        $donnees = json_decode($json, true);
29
        
29
        
30
        return $donnees;
30
        return $donnees;
31
	}
31
	}
32
	
32
	
33
	public function getInformationsStation($id_station) {
33
	public function getInformationsStation($id_station) {
34
		
34
		
35
	    $url = $this->url_jrest.self::SERVICE_STATION.'/'.AppControleur::getIdUtilisateur().'/'.$id_station.'/';
35
	    $url = $this->url_jrest.self::SERVICE_STATION.'/'.AppControleur::getIdUtilisateur().'/'.$id_station.'/';
36
        $json = $this->envoyerRequeteConsultation($url);
36
        $json = $this->envoyerRequeteConsultation($url);
37
        $donnees = json_decode($json, true);
37
        $donnees = json_decode($json, true);
38
        
38
        
39
        return $donnees;
39
        return $donnees;
40
	}
40
	}
41
	
41
	
42
	public function ajouterStation($valeurs_station_verifiees) {
42
	public function ajouterStation($valeurs_station_verifiees) {
43
		
43
		
44
		$donnees = $valeurs_station_verifiees;
44
		$donnees = $valeurs_station_verifiees;
45
		$donnees['id_participant'] = AppControleur::getIdUtilisateur();
45
		$donnees['id_participant'] = AppControleur::getIdUtilisateur();
46
		
46
		
47
        $url = $this->url_jrest.self::SERVICE_STATION."/";
47
        $url = $this->url_jrest.self::SERVICE_STATION."/";
48
        $json = $this->envoyerRequeteAjout($url, $donnees);
48
        $json = $this->envoyerRequeteAjout($url, $donnees);
49
        
49
        
50
        $donnees = json_decode($json, true);
-
 
51
        
-
 
52
		if (true) {
-
 
53
             //TODO: verifier ajout   
-
 
54
        }
50
        $donnees_retour = json_decode($json, true);
55
		
51
		
56
		return true;
52
		return $donnees_retour;
57
	}
53
	}
58
	
54
	
59
	public function modifierStation($id_station, $valeurs_station_verifiees) {
55
	public function modifierStation($id_station, $valeurs_station_verifiees) {
60
		
56
		
61
		$donnees = $valeurs_station_verifiees;
57
		$donnees = $valeurs_station_verifiees;
62
		$donnees['id_participant'] = AppControleur::getIdUtilisateur();
58
		$donnees['id_participant'] = AppControleur::getIdUtilisateur();
63
		
59
		
64
        if (is_numeric($id_station)) {
60
        if (is_numeric($id_station)) {
65
            $url = $this->url_jrest.self::SERVICE_STATION."/$id_station";
61
            $url = $this->url_jrest.self::SERVICE_STATION."/$id_station";
66
            $json = $this->envoyerRequeteModif($url, $donnees);
62
            $json = $this->envoyerRequeteModif($url, $donnees);
67
            $donnees = json_decode($json, true);
63
            $donnees = json_decode($json, true);
68
            if (true) {
64
            if (true) {
69
            	//TODO: verifier modification   
65
            	//TODO: verifier modification   
70
            }
66
            }
71
        }
67
        }
72
		
68
		
73
		return true;
69
		return true;
74
	}
70
	}
75
}
71
}
76
?> 
72
?>