New file |
0,0 → 1,149 |
<?php |
// declare(encoding='UTF-8'); |
/** |
* DAO des Collections pour le module Collections. |
* |
* @package Collection |
* @category php 5.2 |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
* @copyright 2010 Tela-Botanica |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL |
* @version SVN: $Id$ |
* |
*/ |
class CollectionDao extends Dao { |
const SERVICE_COLLECTION = 'CoelCollection'; |
const SERVICE_COLLECTION_A_PERSONNE = 'CoelCollectionAPersonne'; |
const SERVICE_COLLECTION_A_PUBLICATION = 'CoelCollectionAPublication'; |
const SERVICE_COLLECTION_A_COMMENTAIRE = 'CoelCollectionACommentaire'; |
|
/** |
* Retourne l'ensemble des information sur une collection. |
* |
* @param integer l'id de la collection. |
* @return array un tableau contenant les informations sur la collection. |
*/ |
public function getCollection($id) { |
$url = $this->url_jrest.self::SERVICE_COLLECTION."/$id/*"; |
$json = $this->envoyerRequeteConsultation($url); |
$donnees = json_decode($json, true); |
return $donnees['collections']; |
} |
|
/** |
* Retourne le nombre de collections correspondant à un id strucutre précis. |
* |
* @param integer l'id d'une structure. |
* @return array un tableau contenant les collections correspondant à l'id structure. |
*/ |
public function getNbreParIdStructure($id_structure) { |
$url = $this->url_jrest.self::SERVICE_COLLECTION."/NbreParIdStructure/$id_structure"; |
$json = $this->envoyerRequeteConsultation($url); |
$donnees = json_decode($json, true); |
return $donnees; |
} |
|
/** |
* Retourne les collection correspondant à un id strucutre précis. |
* |
* @param integer l'id d'une structure. |
* @return array un tableau contenant les collections correspondant à l'id structure. |
*/ |
public function getParIdStructure($id_structure) { |
$url = $this->url_jrest.self::SERVICE_COLLECTION."/ParIdStructure/$id_structure"; |
$json = $this->envoyerRequeteConsultation($url); |
$donnees = json_decode($json, true); |
return $donnees; |
} |
|
/** |
* Retourne l'ensemble des personnes liées à une collection. |
* |
* @param integer l'id de la collection. |
* @return array un tableau contenant les informations sur les personnes liées à la collection. |
*/ |
public function getPersonnesLiees($id_collection) { |
$this->addOrdre('cp_nom'); |
$donnees = $this->getCollectionAPersonne($id_collection); |
return $donnees['collectionsAPersonne']; |
} |
|
/** |
* Retourne le nombre de personnes liées à une collection. |
* |
* @param integer l'id de la collection. |
* @return integer le nombre de personnes liées à la collection. |
*/ |
public function getNbrePersonnesLiees($id_collection) { |
$donnees = $this->getCollectionAPersonne($id_collection); |
return $donnees['nbElements']; |
} |
|
private function getCollectionAPersonne($id_collection) { |
$url = $this->url_jrest.self::SERVICE_COLLECTION_A_PERSONNE."/$id_collection"; |
$json = $this->envoyerRequeteConsultation($url); |
$donnees = json_decode($json, true); |
return $donnees; |
} |
|
/** |
* Retourne l'ensemble des publications liées à une collection. |
* |
* @param integer l'id de la collection. |
* @return array un tableau contenant les informations sur les publications liées à la collection. |
*/ |
public function getPublicationsLiees($id_collection) { |
$donnees = $this->getCollectionAPublication($id_collection); |
return $donnees['collectionsAPublication']; |
} |
|
/** |
* Retourne le nombre de publications liées à une collection. |
* |
* @param integer l'id de la collection. |
* @return integer le nombre de publications liées à la collection. |
*/ |
public function getNbrePublicationsLiees($id_collection) { |
$donnees = $this->getCollectionAPublication($id_collection); |
return $donnees['nbElements']; |
} |
|
private function getCollectionAPublication($id_collection) { |
$url = $this->url_jrest.self::SERVICE_COLLECTION_A_PUBLICATION."/$id_collection"; |
$json = $this->envoyerRequeteConsultation($url); |
$donnees = json_decode($json, true); |
return $donnees; |
} |
|
/** |
* Retourne l'ensemble des commentaires publics liés à une collection. |
* |
* @param integer l'id de la collection. |
* @return array un tableau contenant les informations sur les publications liées à la collection. |
*/ |
public function getCommentairesLies($id_collection) { |
$donnees = $this->getCollectionACommentaire($id_collection); |
return $donnees['collectionsACommentaire']; |
} |
|
/** |
* Retourne le nombre de commentaires publics liés à une collection. |
* |
* @param integer l'id de la collection. |
* @return integer le nombre de commentaires publics liés à la collection. |
*/ |
public function getNbreCommentairesLies($id_collection) { |
$donnees = $this->getCollectionACommentaire($id_collection); |
return $donnees['nbElements']; |
} |
|
private function getCollectionACommentaire($id_collection) { |
$commentaire_public = '1'; |
$url = $this->url_jrest.self::SERVICE_COLLECTION_A_COMMENTAIRE."/$id_collection/$commentaire_public"; |
$json = $this->envoyerRequeteConsultation($url); |
$donnees = json_decode($json, true); |
return $donnees; |
} |
} |
?> |
Property changes: |
Added: svn:keywords |
+Id Author Date Revision HeadURL |
\ No newline at end of property |