Subversion Repositories eFlore/Applications.coel-consultation

Compare Revisions

No changes between revisions

Ignore whitespace Rev 143 → Rev 144

/trunk/bibliotheque/dao/CollectionDao.php
New file
0,0 → 1,104
<?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 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) {
$url = $this->url_jrest.self::SERVICE_COLLECTION_A_PUBLICATION."/$id_collection";
$json = $this->envoyerRequeteConsultation($url);
$donnees = json_decode($json, true);
return $donnees['collectionsAPublication'];
}
/**
* 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) {
$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['collectionsACommentaire'];
}
}
?>
Property changes:
Added: svn:keywords
+Id Author Date Revision HeadURL
\ No newline at end of property