Subversion Repositories eFlore/Applications.coel-consultation

Rev

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

Rev Author Line No. Line
17 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 Collections.
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: CollectionDao.php 34 2010-04-23 13:58:21Z jpm $
13
 *
14
 */
15
class CollectionDao extends ColModele {
19 jpm 16
	const SERVICE_COLLECTION = 'CoelCollection';
17
	const SERVICE_COLLECTION_A_PERSONNE = 'CoelCollectionAPersonne';
18
	const SERVICE_COLLECTION_A_PUBLICATION = 'CoelCollectionAPublication';
19
	const SERVICE_COLLECTION_A_COMMENTAIRE = 'CoelCollectionACommentaire';
20 jpm 20
 
17 jpm 21
	/**
22
	 * Retourne l'ensemble des information sur une collection.
23
	 *
24
	 * @param integer l'id de la collection.
25
	 * @return array un tableau contenant les informations sur la collection.
26
	 */
27
	public function getCollection($id) {
28
		$json = file_get_contents("http://www.tela-botanica.org/eflore/coel/jrest/CoelCollection/*/$id/*");
29
		$donnees = json_decode($json, true);
34 jpm 30
		return $donnees['collections'];
17 jpm 31
	}
32
 
33
	/**
18 jpm 34
	 * Retourne les collection correspondant à un id strucutre précis.
35
	 *
36
	 * @param integer l'id d'une structure.
37
	 * @return array un tableau contenant les collections correspondant à l'id structure.
38
	 */
39
	public function getParIdStructure($id_structure) {
19 jpm 40
		$url = $this->url_jrest.self::SERVICE_COLLECTION."/ParIdStructure/$id_structure";
41
		$json = file_get_contents($url);
18 jpm 42
		$donnees = json_decode($json, true);
43
		$this->nettoyerTableauDeTableauxAssoc($donnees);
44
		return $donnees;
45
	}
46
 
47
	/**
17 jpm 48
	 * Retourne l'ensemble des personnes liées à une collection.
49
	 *
50
	 * @param integer l'id de la collection.
51
	 * @return array un tableau contenant les informations sur les personnes liées à la collection.
52
	 */
53
	public function getCollectionAPersonne($id_collection) {
19 jpm 54
		$url = $this->url_jrest.self::SERVICE_COLLECTION_A_PERSONNE."/$id_collection";
55
		$json = file_get_contents($url);
17 jpm 56
		$donnees = json_decode($json, true);
57
		$this->nettoyerTableauDeTableauxAssoc($donnees);
58
		return $donnees;
59
	}
60
 
61
	/**
62
	 * Retourne l'ensemble des publications liées à une collection.
63
	 *
64
	 * @param integer l'id de la collection.
65
	 * @return array un tableau contenant les informations sur les publications liées à la collection.
66
	 */
67
	public function getCollectionAPublication($id_collection) {
19 jpm 68
		$url = $this->url_jrest.self::SERVICE_COLLECTION_A_PUBLICATION."/$id_collection";
69
		$json = file_get_contents($url);
17 jpm 70
		$donnees = json_decode($json, true);
71
		$this->nettoyerTableauDeTableauxAssoc($donnees);
72
		return $donnees;
73
	}
19 jpm 74
 
75
	/**
76
	 * Retourne l'ensemble des commentaires publics liés à une collection.
77
	 *
78
	 * @param integer l'id de la collection.
79
	 * @return array un tableau contenant les informations sur les publications liées à la collection.
80
	 */
81
	public function getCollectionACommentaire($id_collection) {
82
		$commentaire_public = '1';
83
		$url = $this->url_jrest.self::SERVICE_COLLECTION_A_COMMENTAIRE."/$id_collection/$commentaire_public";
84
		$json = file_get_contents($url);
85
		$donnees = json_decode($json, true);
86
		$this->nettoyerTableauDeTableauxAssoc($donnees);
87
		return $donnees;
88
	}
17 jpm 89
}
90
?>