Subversion Repositories eFlore/Applications.coel-consultation

Rev

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

Rev 144 Rev 150
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * DAO des Collections pour le module Collections.
4
 * DAO des Collections pour le module Collections.
5
 *
5
 *
6
 * @package	Collection
6
 * @package	Collection
7
 * @category	php 5.2
7
 * @category	php 5.2
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
8
 * @author		Jean-Pascal MILCENT <jpm@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: CollectionDao.php 144 2010-08-30 16:22:52Z jpm $
12
 * @version	SVN: $Id: CollectionDao.php 150 2010-09-06 15:24:03Z jpm $
13
 *
13
 *
14
 */
14
 */
15
class CollectionDao extends Dao {
15
class CollectionDao extends Dao {
16
	const SERVICE_COLLECTION = 'CoelCollection';
16
	const SERVICE_COLLECTION = 'CoelCollection';
17
	const SERVICE_COLLECTION_A_PERSONNE = 'CoelCollectionAPersonne';
17
	const SERVICE_COLLECTION_A_PERSONNE = 'CoelCollectionAPersonne';
18
	const SERVICE_COLLECTION_A_PUBLICATION = 'CoelCollectionAPublication';
18
	const SERVICE_COLLECTION_A_PUBLICATION = 'CoelCollectionAPublication';
19
	const SERVICE_COLLECTION_A_COMMENTAIRE = 'CoelCollectionACommentaire';
19
	const SERVICE_COLLECTION_A_COMMENTAIRE = 'CoelCollectionACommentaire';
20
	
20
	
21
	/**
21
	/**
22
	 * Retourne l'ensemble des information sur une collection.
22
	 * Retourne l'ensemble des information sur une collection.
23
	 * 
23
	 * 
24
	 * @param integer l'id de la collection.
24
	 * @param integer l'id de la collection.
25
	 * @return array un tableau contenant les informations sur la collection.
25
	 * @return array un tableau contenant les informations sur la collection.
26
	 */
26
	 */
27
	public function getCollection($id) {
27
	public function getCollection($id) {
28
		$url = $this->url_jrest.self::SERVICE_COLLECTION."/*/$id/*";
28
		$url = $this->url_jrest.self::SERVICE_COLLECTION."/*/$id/*";
29
		$json = $this->envoyerRequeteConsultation($url);
29
		$json = $this->envoyerRequeteConsultation($url);
30
		$donnees = json_decode($json, true);
30
		$donnees = json_decode($json, true);
31
		return $donnees['collections'];
31
		return $donnees['collections'];
32
	}
32
	}
-
 
33
	
-
 
34
	/**
-
 
35
	 * Retourne le nombre de collections correspondant à un id strucutre précis.
-
 
36
	 * 
-
 
37
	 * @param integer l'id d'une structure.
-
 
38
	 * @return array un tableau contenant les collections correspondant à l'id structure.
-
 
39
	 */
-
 
40
	public function getNbreParIdStructure($id_structure) {
-
 
41
		$url = $this->url_jrest.self::SERVICE_COLLECTION."/NbreParIdStructure/$id_structure";
-
 
42
		$json = $this->envoyerRequeteConsultation($url);
-
 
43
		$donnees = json_decode($json, true);
-
 
44
		return $donnees;
-
 
45
	}
33
	
46
	
34
	/**
47
	/**
35
	 * Retourne les collection correspondant à un id strucutre précis.
48
	 * Retourne les collection correspondant à un id strucutre précis.
36
	 * 
49
	 * 
37
	 * @param integer l'id d'une structure.
50
	 * @param integer l'id d'une structure.
38
	 * @return array un tableau contenant les collections correspondant à l'id structure.
51
	 * @return array un tableau contenant les collections correspondant à l'id structure.
39
	 */
52
	 */
40
	public function getParIdStructure($id_structure) {
53
	public function getParIdStructure($id_structure) {
41
		$url = $this->url_jrest.self::SERVICE_COLLECTION."/ParIdStructure/$id_structure";
54
		$url = $this->url_jrest.self::SERVICE_COLLECTION."/ParIdStructure/$id_structure";
42
		$json = $this->envoyerRequeteConsultation($url);
55
		$json = $this->envoyerRequeteConsultation($url);
43
		$donnees = json_decode($json, true);
56
		$donnees = json_decode($json, true);
44
		return $donnees;
57
		return $donnees;
45
	}
58
	}
46
	
59
	
47
	/**
60
	/**
48
	 * Retourne l'ensemble des personnes liées à une collection.
61
	 * Retourne l'ensemble des personnes liées à une collection.
49
	 * 
62
	 * 
50
	 * @param integer l'id de la collection.
63
	 * @param integer l'id de la collection.
51
	 * @return array un tableau contenant les informations sur les personnes liées à la collection.
64
	 * @return array un tableau contenant les informations sur les personnes liées à la collection.
52
	 */
65
	 */
53
	public function getPersonnesLiees($id_collection) {
66
	public function getPersonnesLiees($id_collection) {
54
		$this->addOrdre('cp_nom');
67
		$this->addOrdre('cp_nom');
55
		$donnees = $this->getCollectionAPersonne($id_collection);
68
		$donnees = $this->getCollectionAPersonne($id_collection);
56
		return $donnees['collectionsAPersonne'];
69
		return $donnees['collectionsAPersonne'];
57
	}
70
	}
58
	
71
	
59
	/**
72
	/**
60
	 * Retourne le nombre de personnes liées à une collection.
73
	 * Retourne le nombre de personnes liées à une collection.
61
	 * 
74
	 * 
62
	 * @param integer l'id de la collection.
75
	 * @param integer l'id de la collection.
63
	 * @return integer le nombre de personnes liées à la collection.
76
	 * @return integer le nombre de personnes liées à la collection.
64
	 */
77
	 */
65
	public function getNbrePersonnesLiees($id_collection) {
78
	public function getNbrePersonnesLiees($id_collection) {
66
		$donnees = $this->getCollectionAPersonne($id_collection);
79
		$donnees = $this->getCollectionAPersonne($id_collection);
67
		return $donnees['nbElements'];
80
		return $donnees['nbElements'];
68
	}
81
	}
69
	
82
	
70
	private function getCollectionAPersonne($id_collection) {
83
	private function getCollectionAPersonne($id_collection) {
71
		$url = $this->url_jrest.self::SERVICE_COLLECTION_A_PERSONNE."/$id_collection";
84
		$url = $this->url_jrest.self::SERVICE_COLLECTION_A_PERSONNE."/$id_collection";
72
		$json = $this->envoyerRequeteConsultation($url);
85
		$json = $this->envoyerRequeteConsultation($url);
73
		$donnees = json_decode($json, true);
86
		$donnees = json_decode($json, true);
74
		return $donnees;
87
		return $donnees;
75
	}
88
	}
76
	
89
	
77
	/**
90
	/**
78
	 * Retourne l'ensemble des publications liées à une collection.
91
	 * Retourne l'ensemble des publications liées à une collection.
79
	 * 
92
	 * 
80
	 * @param integer l'id de la collection.
93
	 * @param integer l'id de la collection.
81
	 * @return array un tableau contenant les informations sur les publications liées à la collection.
94
	 * @return array un tableau contenant les informations sur les publications liées à la collection.
82
	 */
95
	 */
83
	public function getPublicationsLiees($id_collection) {
96
	public function getPublicationsLiees($id_collection) {
84
		$url = $this->url_jrest.self::SERVICE_COLLECTION_A_PUBLICATION."/$id_collection";
97
		$url = $this->url_jrest.self::SERVICE_COLLECTION_A_PUBLICATION."/$id_collection";
85
		$json = $this->envoyerRequeteConsultation($url);
98
		$json = $this->envoyerRequeteConsultation($url);
86
		$donnees = json_decode($json, true);
99
		$donnees = json_decode($json, true);
87
		return $donnees['collectionsAPublication'];
100
		return $donnees['collectionsAPublication'];
88
	}
101
	}
89
	
102
	
90
	/**
103
	/**
91
	 * Retourne l'ensemble des commentaires publics liés à une collection.
104
	 * Retourne l'ensemble des commentaires publics liés à une collection.
92
	 * 
105
	 * 
93
	 * @param integer l'id de la collection.
106
	 * @param integer l'id de la collection.
94
	 * @return array un tableau contenant les informations sur les publications liées à la collection.
107
	 * @return array un tableau contenant les informations sur les publications liées à la collection.
95
	 */
108
	 */
96
	public function getCommentairesLies($id_collection) {
109
	public function getCommentairesLies($id_collection) {
97
		$commentaire_public = '1';
110
		$commentaire_public = '1';
98
		$url = $this->url_jrest.self::SERVICE_COLLECTION_A_COMMENTAIRE."/$id_collection/$commentaire_public";
111
		$url = $this->url_jrest.self::SERVICE_COLLECTION_A_COMMENTAIRE."/$id_collection/$commentaire_public";
99
		$json = $this->envoyerRequeteConsultation($url);
112
		$json = $this->envoyerRequeteConsultation($url);
100
		$donnees = json_decode($json, true);
113
		$donnees = json_decode($json, true);
101
		return $donnees['collectionsACommentaire'];
114
		return $donnees['collectionsACommentaire'];
102
	}
115
	}
103
}
116
}
104
?>
117
?>