/trunk/bibliotheque/dao/CollectionDao.php |
---|
File deleted |
\ No newline at end of file |
/trunk/bibliotheque/dao/Dao.php |
---|
File deleted |
\ No newline at end of file |
/trunk/controleurs/FicheCollection.php |
---|
13,9 → 13,6 |
*/ |
class FicheCollection extends Fiche { |
private $donnees = array(); |
protected $collectionDao = null; |
//+----------------------------------------------------------------------------------------------------------------+ |
// Méthodes |
/** |
28,6 → 25,8 |
// +---------------------------------------------------------------------------------------------------------------+ |
// FICHE COLLECTION |
public function afficherCollection() { |
$donnees = array(); |
// Gestion des actions par défaut |
$this->executerAction('Recherche', 'chargerMoteurRecherche'); |
36,62 → 35,39 |
} else { |
// Récupération des données |
$this->donnees['id'] = $_GET['id']; |
$this->collectionDao = new CollectionDao(); |
$this->donnees['info'] = $this->collectionDao->getCollection($this->donnees['id']); |
$this->creerPaginationPersonnes($this->donnees['id']); |
$this->donnees['publications'] = $this->collectionDao->getPublicationsLiees($this->donnees['id']); |
$this->donnees['commentaires'] = $this->collectionDao->getCommentairesLies($this->donnees['id']); |
$donnees['id'] = $_GET['id']; |
$collectionDao = $this->getModele('CollectionDao'); |
$donnees['info'] = $collectionDao->getCollection($donnees['id']); |
$donnees['personnes'] = $collectionDao->getCollectionAPersonne($donnees['id']); |
$donnees['publications'] = $collectionDao->getCollectionAPublication($donnees['id']); |
$donnees['commentaires'] = $collectionDao->getCollectionACommentaire($donnees['id']); |
// Traitements des données |
$this->traiterDonneesCollection($this->donnees['info']); |
$this->traiterDonneesCollectionAPersonne($this->donnees['personnes']); |
$this->traiterDonneesElementAPublication($this->donnees['publications']); |
$this->traiterDonneesCollectionDescription($this->donnees['info']); |
$this->traiterDonneesCollectionContenu($this->donnees['info']); |
$this->traiterDonneesCollectionInventaire($this->donnees['info']); |
$this->traiterDonneesCollectionACommentaire($this->donnees['commentaires']); |
$this->postraiterDonnees($this->donnees); |
$this->donnees['metadonnees'] = $this->traiterMetaDonnees($this->donnees['info']); |
$this->traiterDonneesCollection($donnees['info']); |
$this->traiterDonneesCollectionAPersonne($donnees['personnes']); |
$this->traiterDonneesElementAPublication($donnees['publications']); |
$this->traiterDonneesCollectionDescription($donnees['info']); |
$this->traiterDonneesCollectionContenu($donnees['info']); |
$this->traiterDonneesCollectionInventaire($donnees['info']); |
$this->traiterDonneesCollectionACommentaire($donnees['commentaires']); |
$this->postraiterDonnees($donnees); |
$donnees['metadonnees'] = $this->traiterMetaDonnees($donnees['info']); |
// Création des méta-données de la page |
$titre = $this->donnees['info']['cc_nom']; |
$description = $this->donnees['info']['cc_description']; |
$tags = "Collection, id:{$this->donnees['id']}, {$this->donnees['info']['_guid_']}"; |
$titre = $donnees['info']['cc_nom']; |
$description = $donnees['info']['cc_description']; |
$tags = "Collection, id:{$donnees['id']}, {$donnees['info']['_guid_']}"; |
// Envoie à la sortie |
//Debug::printr($this->donnees); |
//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_collection', $this->donnees)); |
$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_collection', $donnees)); |
$this->chargerPiedDePage(); |
} |
} |
private function creerPaginationPersonnes($id_collection) { |
// Gestion du nombre de résultats |
$donnees_total = $this->collectionDao->getNbrePersonnesLiees($id_collection); |
// Gestion du fragmenteur |
$urlFiche = $this->obtenirObjetUrlFicheCollection($id_collection); |
$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['personnesFrag'] = $fragmenteur->executer(); |
list($de, $a) = $fragmenteur->getDeplacementParPageId(); |
$this->url->unsetVariablesRequete(array('recherche', 'page')); |
// Gestion de l'accès aux données |
$this->collectionDao->setLimitation(($de - 1), $fragmenteur->getDonneesParPage()); |
$this->collectionDao->setDistinction(1); |
$this->donnees['personnes'] = $this->collectionDao->getPersonnesLiees($id_collection); |
} |
private function traiterDonneesCollection(&$donnees) { |
// liste 29 : Liste des types de collection dans le standard NCD |
Ontologie::chargerListe(1032); |
/trunk/controleurs/aControleur.php |
---|
388,15 → 388,10 |
} |
protected function obtenirUrlFicheCollection($id_collection) { |
$url = $this->obtenirObjetUrlFicheCollection($id_collection); |
return $url->getURL(); |
} |
protected function obtenirObjetUrlFicheCollection($id_collection) { |
$this->url->setRequete(false); |
$this->url->setVariableRequete('module', 'FicheCollection'); |
$this->url->setVariableRequete('id', $id_collection); |
$url = clone $this->url; |
$url = $this->url->getURL(); |
$this->url->unsetVariablesRequete(array('module', 'id')); |
return $url; |
} |
423,7 → 418,7 |
if ($valeur == '') { |
$valeur = ' '; |
} else if (is_string($valeur)) { |
$valeur = $this->remplacerEsperluette($valeur); |
$valeur = preg_replace('/&(?!amp;)/i', '&', $valeur, -1); |
} else if (is_array($valeur)) { |
$this->postraiterDonnees($valeur); |
} |
431,11 → 426,6 |
} |
} |
private function remplacerEsperluette($txt) { |
$txt = preg_replace('/&(?!([a-z]+|#[0-9]+|#x[0-9a-f]+);)/i', '&', $txt, -1); |
return $txt; |
} |
protected function chargerPiedDePage() { |
$donnees['appli'] = Application::getInfo(); |
$this->setSortie(self::RENDU_PIED, $this->getVue('pied', $donnees)); |
/trunk/modeles/CollectionDao.php |
---|
New file |
0,0 → 1,90 |
<?php |
// declare(encoding='UTF-8'); |
/** |
* Modèle d'accès à la base de données 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 ColModele { |
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) { |
$json = file_get_contents("http://www.tela-botanica.org/eflore/coel/jrest/CoelCollection/*/$id/*"); |
$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 = file_get_contents($url); |
$donnees = json_decode($json, true); |
$this->nettoyerTableauDeTableauxAssoc($donnees); |
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 getCollectionAPersonne($id_collection) { |
$url = $this->url_jrest.self::SERVICE_COLLECTION_A_PERSONNE."/$id_collection"; |
$json = file_get_contents($url); |
$donnees = json_decode($json, true); |
$this->nettoyerTableauDeTableauxAssoc($donnees['collectionsAPersonne']); |
return $donnees['collectionsAPersonne']; |
} |
/** |
* 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 getCollectionAPublication($id_collection) { |
$url = $this->url_jrest.self::SERVICE_COLLECTION_A_PUBLICATION."/$id_collection"; |
$json = file_get_contents($url); |
$donnees = json_decode($json, true); |
$this->nettoyerTableauDeTableauxAssoc($donnees['collectionsAPublication']); |
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 getCollectionACommentaire($id_collection) { |
$commentaire_public = '1'; |
$url = $this->url_jrest.self::SERVICE_COLLECTION_A_COMMENTAIRE."/$id_collection/$commentaire_public"; |
$json = file_get_contents($url); |
$donnees = json_decode($json, true); |
$this->nettoyerTableauDeTableauxAssoc($donnees['collectionsACommentaire']); |
return $donnees['collectionsACommentaire']; |
} |
} |
?> |
Property changes: |
Added: svn:keywords |
+Id Author Date Revision HeadURL |
\ No newline at end of property |
/trunk/squelettes/fiche_collection.tpl.html |
---|
65,7 → 65,6 |
<h2>Personnes</h2> |
<h3>Personne(s) liées à la collection</h3> |
<?php if (count($personnes) > 0) : ?> |
<?=$personnesFrag;?> |
<table> |
<thead> |
<tr> |