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