Subversion Repositories eFlore/Applications.coel-consultation

Rev

Rev 19 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
15 jpm 1
<?php
2
// declare(encoding='UTF-8');
3
/**
4
 * Modèle d'accès à la base de données des Collections pour le module Structure.
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: StructureDao.php 22 2010-03-30 10:50:03Z jpm $
13
 *
14
 */
15
class StructureDao extends ColModele {
19 jpm 16
	const SERVICE_STRUCTURE = 'CoelStructure';
17
	const SERVICE_STRUCTURE_A_PERSONNE = 'CoelStructureAPersonne';
18
 
15 jpm 19
	/**
20
	 * Retourne l'ensemble des information sur une structure.
21
	 *
22
	 * @param integer l'id de la structure.
23
	 * @return array un tableau contenant les informations sur la structure.
24
	 */
16 jpm 25
	public function getStructure($id) {
19 jpm 26
		$url = $this->url_jrest.self::SERVICE_STRUCTURE."/*/$id/*";
27
		$json = file_get_contents($url);
15 jpm 28
		$donnees = json_decode($json, true);
29
		return $donnees[1];
30
	}
16 jpm 31
 
32
	/**
33
	 * Retourne l'ensemble des informations du personnel d'une structure.
34
	 *
35
	 * @param integer l'id de la structure.
36
	 * @return array un tableau contenant les informations sur le personnel de la structure.
37
	 */
38
	public function getPersonnel($id) {
19 jpm 39
		$url = $this->url_jrest.self::SERVICE_STRUCTURE_A_PERSONNE."/$id";
40
		$json = file_get_contents($url);
16 jpm 41
		$donnees = json_decode($json, true);
42
		$this->nettoyerTableauDeTableauxAssoc($donnees);
43
		return $donnees;
44
	}
15 jpm 45
}
46
?>