Subversion Repositories eFlore/Applications.coel-consultation

Rev

Rev 118 | 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 118 2010-06-28 10:40:13Z jpm $
13
 *
14
 */
15
class StructureDao extends ColModele {
71 jpm 16
	const ROLE_EQUIPE = 2027;
19 jpm 17
	const SERVICE_STRUCTURE = 'CoelStructure';
18
	const SERVICE_STRUCTURE_A_PERSONNE = 'CoelStructureAPersonne';
19
 
15 jpm 20
	/**
21
	 * Retourne l'ensemble des information sur une structure.
22
	 *
23
	 * @param integer l'id de la structure.
24
	 * @return array un tableau contenant les informations sur la structure.
25
	 */
118 jpm 26
	public function getStructure($id_structure) {
27
		$url = $this->url_jrest.self::SERVICE_STRUCTURE."/*/$id_structure/*";
19 jpm 28
		$json = file_get_contents($url);
15 jpm 29
		$donnees = json_decode($json, true);
31 jpm 30
		return $donnees['structures'];
15 jpm 31
	}
16 jpm 32
 
33
	/**
25 jpm 34
	 * Retourne le nombre de structure par zone géographique.
35
	 *
36
	 * @param integer le type de recherche à effectuée.
37
	 * @return array un tableau contenant les informations sur le nombre de structures par zone.
38
	 */
39
	public function getStructureParZoneGeo($type_recherche) {
40
		$url = $this->url_jrest.self::SERVICE_STRUCTURE."/ParZoneGeo/$type_recherche";
41
		$json = file_get_contents($url);
42
		$donnees = json_decode($json, true);
43
		return $donnees;
44
	}
45
 
46
	/**
16 jpm 47
	 * Retourne l'ensemble des informations du personnel d'une structure.
48
	 *
49
	 * @param integer l'id de la structure.
50
	 * @return array un tableau contenant les informations sur le personnel de la structure.
51
	 */
118 jpm 52
	public function getPersonnel($id_structure) {
53
		$url = $this->url_jrest.self::SERVICE_STRUCTURE_A_PERSONNE."/$id_structure";
19 jpm 54
		$json = file_get_contents($url);
16 jpm 55
		$donnees = json_decode($json, true);
71 jpm 56
		$personnes = $donnees['structuresAPersonne'];
57
 
58
		$personnel = array();
59
		foreach ($personnes as $personne) {
60
			if ($personne['csap_id_role'] == self::ROLE_EQUIPE) {
61
				$personnel[] = $personne;
62
			}
63
		}
64
		return $personnel;
16 jpm 65
	}
15 jpm 66
}
67
?>