Rev 169 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php// declare(encoding='UTF-8');/*** Modèle d'accès à la base de données des Collections pour le module Structure.** @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: StructureDao.php 169 2011-03-11 09:15:42Z jpm $**/class StructureDao extends Dao {const ROLE_EQUIPE = 2027;const SERVICE_STRUCTURE = 'CoelStructure';const SERVICE_STRUCTURE_A_PERSONNE = 'CoelStructureAPersonne';/*** Retourne l'ensemble des information sur une structure.** @param integer l'id de la structure.* @return array un tableau contenant les informations sur la structure.*/public function getStructure($id_structure) {$url = $this->url_jrest.self::SERVICE_STRUCTURE."/*/$id_structure/*";$json = $this->envoyerRequeteConsultation($url);$donnees = json_decode($json, true);return $donnees['structures'];}/*** Retourne le nombre de structure par zone géographique.** @param integer le type de recherche à effectuée.* @return array un tableau contenant les informations sur le nombre de structures par zone.*/public function getStructureParZoneGeo($type_recherche) {$url = $this->url_jrest.self::SERVICE_STRUCTURE."/ParZoneGeo/$type_recherche";$url = $this->limiterParProjets($url);$json = $this->envoyerRequeteConsultation($url);$donnees = json_decode($json, true);return $donnees;}private function limiterParProjets($url) {if (Config::get('projets') != '') {$url .= '/'.Config::get('projets');}return $url;}/*** Retourne l'ensemble des informations du personnel d'une structure.** @param integer l'id de la structure.* @return array un tableau contenant les informations sur le personnel de la structure.*/public function getPersonnel($id_structure) {$donnees = $this->getStructureAPersonne($id_structure);$personnel = $this->filtrerRoleEquipe($donnees['structuresAPersonne']);return $personnel;}/*** Retourne le nombre de personnel d'une structure.** @param integer l'id de la structure.* @return integer le nombre de personnel de la structure.*/public function getNbrePersonnel($id_structure) {$donnees = $this->getStructureAPersonne($id_structure);$personnel = $this->filtrerRoleEquipe($donnees['structuresAPersonne']);$nbre_personnel = count($personnel);return $nbre_personnel;}private function getStructureAPersonne($id_structure) {$url = $this->url_jrest.self::SERVICE_STRUCTURE_A_PERSONNE."/$id_structure";$json = $this->envoyerRequeteConsultation($url);$donnees = json_decode($json, true);return $donnees;}private function filtrerRoleEquipe($personnes) {$personnel = array();foreach ($personnes as $personne) {if ($personne['csap_id_role'] == self::ROLE_EQUIPE) {$personnel[] = $personne;}}return $personnel;}}?>