Subversion Repositories eFlore/Applications.coel-consultation

Compare Revisions

Ignore whitespace Rev 153 → Rev 154

/trunk/squelettes/fiche_personne.tpl.html
138,6 → 138,7
<div id="col-per-collection">
<h2>Collections liées</h2>
<?php if (count($collections) > 0) : ?>
<?=$collectionsFrag?>
<table>
<thead>
<tr>
163,6 → 164,7
<div id="col-per-institution">
<h2>Institution liées</h2>
<?php if (count($structures) > 0) : ?>
<?=$structuresFrag?>
<table>
<thead>
<tr>
/trunk/bibliotheque/dao/PersonneDao.php
17,6 → 17,8
const SERVICE_PERSONNE_A_PUBLICATION = 'CoelPublicationAPersonne';
const SERVICE_PERSONNE_A_COLLECTION = 'CoelCollectionAPersonne';
const SERVICE_PERSONNE_A_STRUCTURE = 'CoelStructureAPersonne';
private $cache = array();
 
/**
* Retourne l'ensemble des information d'une personne.
60,9 → 62,15
}
private function getPersonneAPublication($id_personne) {
$url = $this->url_jrest.self::SERVICE_PERSONNE_A_PUBLICATION."/*/$id_personne/2361,2362,2363";
$json = $this->envoyerRequeteConsultation($url);
$donnees = json_decode($json, true);
$cache =& $this->cache['PersonneAPublication'];
if (isset($cache[$id_personne])) {
$donnees = $cache[$id_personne];
} else {
$url = $this->url_jrest.self::SERVICE_PERSONNE_A_PUBLICATION."/*/$id_personne/2361,2362,2363";
$json = $this->envoyerRequeteConsultation($url);
$donnees = json_decode($json, true);
$cache[$id_personne] = $donnees;
}
return $donnees;
}
72,28 → 80,78
* @param integer l'id de la personne.
* @return array un tableau contenant les informations sur les collections liées à la personne.
*/
public function getPersonneACollection($id_personne) {
$url = $this->url_jrest.self::SERVICE_PERSONNE_A_COLLECTION."/*/*/$id_personne";
$this->addOrdre('cc_nom', self::ORDRE_ASCENDANT);
$json = $this->envoyerRequeteConsultation($url);
$donnees = json_decode($json, true);
public function getCollectionsLiees($id_personne) {
$donnees = $this->getPersonneACollection($id_personne);
return $donnees['collectionsAPersonne'];
}
/**
* Retourne le nombre de collections liées à une personne.
*
* @param integer l'id de la personne.
* @return integer le nombre de collections liées à la personne.
*/
public function getNbreCollectionsLiees($id_personne) {
$donnees = $this->getPersonneACollection($id_personne);
return $donnees['nbElements'];
}
private function getPersonneACollection($id_personne) {
$cache =& $this->cache['PersonneACollection'];
if (isset($cache[$id_personne])) {
$donnees = $cache[$id_personne];
} else {
$url = $this->url_jrest.self::SERVICE_PERSONNE_A_COLLECTION."/*/*/$id_personne";
$this->addOrdre('cc_nom', self::ORDRE_ASCENDANT);
$json = $this->envoyerRequeteConsultation($url);
$donnees = json_decode($json, true);
$cache[$id_personne] = $donnees;
}
return $donnees;
}
/**
* Retourne l'ensemble des structures liées à une personne.
*
* @param integer l'id de la personne.
* @return array un tableau contenant les informations sur les structures liées à la personne.
*/
public function getPersonneAStructure($id_personne) {
$url = $this->url_jrest.self::SERVICE_PERSONNE_A_STRUCTURE."/*/*/$id_personne";
$this->addOrdre('cs_nom', self::ORDRE_ASCENDANT);
$json = $this->envoyerRequeteConsultation($url);
$donnees = json_decode($json, true);
public function getStructuresLiees($id_personne) {
$donnees = $this->getPersonneAStructure($id_personne);
return $donnees['structuresAPersonne'];
}
/**
* Retourne le nombre de structures liées à une personne.
*
* @param integer l'id de la personne.
* @return integer le nombre de structures liées à la personne.
*/
public function getNbreStructuresLiees($id_personne) {
$donnees = $this->getPersonneAStructure($id_personne);
return $donnees['nbElements'];
}
private function getPersonneAStructure($id_personne) {
$cache =& $this->cache['PersonneAStructure'];
if (isset($cache[$id_personne])) {
$donnees = $cache[$id_personne];
} else {
$url = $this->url_jrest.self::SERVICE_PERSONNE_A_STRUCTURE."/*/*/$id_personne";
$this->addOrdre('cp_nom', self::ORDRE_ASCENDANT);
$json = $this->envoyerRequeteConsultation($url);
$donnees = json_decode($json, true);
$cache[$id_personne] = $donnees;
}
return $donnees;
}
/**
* Retourne le nom complet d'une personne.
*
* @param integer l'id de la personne.
* @return string le nom complet de la personne.
*/
public function getPersonneNomComplet($id) {
$nom_complet = '';
$donnees = $this->getPersonne($id);
105,6 → 163,12
return $nom_complet;
}
/**
* Retourne la chaine "truk" des courriels d'une personne.
*
* @param integer l'id de la personne.
* @return string la chaine "truk" des courriels de la personne.
*/
public function getPersonneCourriels($id) {
$courriels = '';
$donnees = $this->getPersonne($id);
/trunk/controleurs/FichePersonne.php
37,11 → 37,12
// Récupération des données
$this->donnees['id'] = $_GET['id'];
$this->donnees['info'] = $this->personneDao->getPersonne($this->donnees['id']);
// Création des paginations
$this->creerPaginationPublications($this->donnees['id']);
$this->creerPaginationCollections($this->donnees['id']);
$this->creerPaginationStructures($this->donnees['id']);
$this->donnees['collections'] = $this->personneDao->getPersonneACollection($this->donnees['id']);
$this->donnees['structures'] = $this->personneDao->getPersonneAStructure($this->donnees['id']);
// Traitement des données
$this->traiterDonneesPersonne($this->donnees['info']);
$this->traiterDonneesPersonneAPublication($this->donnees['publications']);
51,15 → 52,10
$this->donnees['metadonnees'] = $this->traiterMetaDonnees($this->donnees['info']);
// Création des méta-données de la page
$titre = $this->donnees['info']['cp_fmt_nom_complet'];
$description = $this->donnees['info']['cp_description'];
$tags = "Botaniste, naturaliste, personne, id:{$this->donnees['id']}, {$this->donnees['info']['_guid_']}";
$this->definirMetadonneesPageWeb();
// Envoie à la sortie
//Debug::printr($donnees);
$this->setSortie(self::META_TITRE, $titre);
$this->setSortie(self::META_DESCRIPTION, $description);
$this->setSortie(self::META_TAGS, $tags);
$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_personne', $this->donnees));
$this->chargerPiedDePage();
}
88,6 → 84,52
$this->donnees['publications'] = $this->personneDao->getPublicationsLiees($id_personne);
}
private function creerPaginationCollections($id_personne) {
// Gestion du nombre de résultats
$donnees_total = $this->personneDao->getNbreCollectionsLiees($id_personne);
// Gestion du fragmenteur
$urlFiche = $this->obtenirObjetUrlFichePersonne($id_personne);
$options = array(
'url' => $urlFiche,
'donnees_total' => $donnees_total,
'donnees_par_page' => Config::get('resultat_par_page_defaut'),
'donnees_par_page_choix' => Config::get('resultat_par_page_choix'),
);
$fragmenteur = Composant::fabrique('fragmenteur', $options);
$this->donnees['collectionsFrag'] = $fragmenteur->executer();
list($de, $a) = $fragmenteur->getDeplacementParPageId();
$this->url->unsetVariablesRequete(array('page'));
 
// Gestion de l'accès aux données
$this->personneDao->setLimitation(($de - 1), $fragmenteur->getDonneesParPage());
$this->personneDao->setDistinction(1);
$this->donnees['collections'] = $this->personneDao->getCollectionsLiees($id_personne);
}
private function creerPaginationStructures($id_personne) {
// Gestion du nombre de résultats
$donnees_total = $this->personneDao->getNbreStructuresLiees($id_personne);
// Gestion du fragmenteur
$urlFiche = $this->obtenirObjetUrlFichePersonne($id_personne);
$options = array(
'url' => $urlFiche,
'donnees_total' => $donnees_total,
'donnees_par_page' => Config::get('resultat_par_page_defaut'),
'donnees_par_page_choix' => Config::get('resultat_par_page_choix'),
);
$fragmenteur = Composant::fabrique('fragmenteur', $options);
$this->donnees['structuresFrag'] = $fragmenteur->executer();
list($de, $a) = $fragmenteur->getDeplacementParPageId();
$this->url->unsetVariablesRequete(array('page'));
 
// Gestion de l'accès aux données
$this->personneDao->setLimitation(($de - 1), $fragmenteur->getDonneesParPage());
$this->personneDao->setDistinction(1);
$this->donnees['structures'] = $this->personneDao->getStructuresLiees($id_personne);
}
private function traiterDonneesPersonne(&$donnees) {
// Liste des préfixes
Ontologie::chargerListe(1004);
159,4 → 201,15
$structure['_url_'] = $this->obtenirUrlFicheStructure($structure['csap_id_structure']);
}
}
private function definirMetadonneesPageWeb() {
$titre = $this->donnees['info']['cp_fmt_nom_complet'];
$description = $this->donnees['info']['cp_description'];
$tags = "Botaniste, naturaliste, personne, id:{$this->donnees['id']}, {$this->donnees['info']['_guid_']}";
// Envoie à la sortie
$this->setSortie(self::META_TITRE, $titre);
$this->setSortie(self::META_DESCRIPTION, $description);
$this->setSortie(self::META_TAGS, $tags);
}
}