Subversion Repositories Sites.obs-saisons.fr

Rev

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

Rev 31 Rev 34
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 individus.
4
 * Modèle d'accès à la base de données de saisies pour le module individus.
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 IndividuDao extends Dao {
15
class IndividuDao extends Dao {
16
	
16
	
17
	const SERVICE_INDIVIDU = 'OdsIndividu';
17
	const SERVICE_INDIVIDU = 'OdsIndividu';
-
 
18
	const METHODE_INDIVIDUS_STATION = 'IndividusPourStation';
-
 
19
	const METHODE_INDIVIDUS_STATION_ESPECE = 'IndividusPourStationPourEspece';
18
	
20
	
19
    /**
21
    /**
20
     * Retourne l'ensemble des informations d'un individu.
22
     * Retourne l'ensemble des informations d'un individu.
21
     *
23
     *
22
     * @param integer l'id d'une station.
24
     * @param integer l'id d'une station.
23
     * @return array un tableau contenant les informations sur les individus de cette station.
25
     * @return array un tableau contenant les informations sur les individus de cette station.
24
     */
26
     */
25
    public function getListeIndividusPourStation($id_station) {
27
    public function getListeIndividusPourStation($id_station) {
26
		
28
		
27
	    $url = $this->url_jrest.self::SERVICE_INDIVIDU."/*/";
29
	    $url = $this->url_jrest.self::SERVICE_INDIVIDU.'/'.self::METHODE_INDIVIDUS_STATION.'/'.$id_station;
28
        $json = $this->envoyerRequeteConsultation($url);
30
        $json = $this->envoyerRequeteConsultation($url);
-
 
31
        $donnees = json_decode($json, true);   
-
 
32
        return $donnees;
-
 
33
	}
-
 
34
	
-
 
35
	public function getListeIndividusPourStationPourEspece($id_station, $id_espece) {
-
 
36
		
-
 
37
		$url = $this->url_jrest.self::SERVICE_INDIVIDU.'/'.self::METHODE_INDIVIDUS_STATION_ESPECE.'/'.$id_station.'/'.$id_espece;
-
 
38
        $json = $this->envoyerRequeteConsultation($url);
-
 
39
        $donnees = json_decode($json, true);   
29
        $donnees = json_decode($json, true);
40
        
30
        return $donnees;
41
        return $donnees;
31
	}
42
	}
32
	    
43
	    
33
	public function getInformationsIndividu($id_individu) {
44
	public function getInformationsIndividu($id_individu) {
34
	    	    
45
	    	    
35
	    if (is_numeric($id_individu)) {
46
	    if (is_numeric($id_individu)) {
36
		    $url = $this->url_jrest.self::SERVICE_INDIVIDU."/$id_individu";
47
		    $url = $this->url_jrest.self::SERVICE_INDIVIDU."/$id_individu";
37
	        $json = $this->envoyerRequeteConsultation($url);
48
	        $json = $this->envoyerRequeteConsultation($url);
38
	        $donnees = json_decode($json, true);
49
	        $donnees = json_decode($json, true);
39
	        return $donnees;
50
	        return $donnees;
40
	    }
51
	    }
41
	}
52
	}
42
	
53
	
43
	public function ajouterIndividu($valeurs_individu_verifiees) {
54
	public function ajouterIndividu($valeurs_individu_verifiees) {
44
		
55
		
45
		$donnees = $valeurs_individu_verifiees;
56
		$donnees = $valeurs_individu_verifiees;
46
		
57
		
47
        $url = $this->url_jrest.self::SERVICE_INDIVIDU."/";
58
        $url = $this->url_jrest.self::SERVICE_INDIVIDU."/";
48
        $json = $this->envoyerRequeteAjout($url, $donnees);
59
        $json = $this->envoyerRequeteAjout($url, $donnees);
49
        $donnees = json_decode($json, true);
60
        $donnees = json_decode($json, true);
50
        
61
        
51
		if (true) {
62
		if (true) {
52
             //TODO: verifier ajout   
63
             //TODO: verifier ajout   
53
        }
64
        }
54
		
65
		
55
		return true;
66
		return true;
56
	}
67
	}
57
	
68
	
58
	public function modifierIndividu($id_individu, $valeurs_individu_verifiees) {
69
	public function modifierIndividu($id_individu, $valeurs_individu_verifiees) {
59
		
70
		
60
		$donnees = $valeurs_individu_verifiees;
71
		$donnees = $valeurs_individu_verifiees;
61
		
72
		
62
        if (is_numeric($id_individu)) {
73
        if (is_numeric($id_individu)) {
63
            $url = $this->url_jrest.self::SERVICE_INDIVIDU."/$id_individu";
74
            $url = $this->url_jrest.self::SERVICE_INDIVIDU."/$id_individu";
64
            $json = $this->envoyerRequeteModif($url, $donnees);
75
            $json = $this->envoyerRequeteModif($url, $donnees);
65
            $donnees = json_decode($json, true);
76
            $donnees = json_decode($json, true);
66
            if (true) {
77
            if (true) {
67
            	//TODO: verifier modification   
78
            	//TODO: verifier modification   
68
            }
79
            }
69
        }
80
        }
70
		
81
		
71
		return true;
82
		return true;
72
	}
83
	}
73
}
84
}
74
?> 
85
?>