Subversion Repositories eFlore/Applications.eflore-consultation

Compare Revisions

Ignore whitespace Rev 954 → Rev 955

/trunk/modules/fiche/formateurs/Illustrations.php
19,10 → 19,13
private $images = null;
private $appUrls = null;
private $meta = null;
private $referentiel = 'bdtfx';
private $donnees = array();
 
public function __construct(Conteneur $conteneur) {
$this->conteneur = $conteneur;
$this->nomCourant = $this->conteneur->getNomCourant();
$this->referentiel = $this->conteneur->getParametre('referentiel');
$this->images = $this->conteneur->getApiImages();
$this->appUrls = $this->conteneur->getAppUrls();
$this->meta = $this->conteneur->getApiMetaDonnees();
29,37 → 32,32
}
 
public function obtenirDonnees() {
$donnees = array();
$donnees['nt'] = $this->nomCourant->getNt();
$donnees['nomSciRetenu'] = $this->nomCourant->getNomRetenu()->get('nom_sci_html');
$donnees['cel'] = $this->getCel();
$donnees['photoflora'] = $this->getPhotoFlora();
$donnees['coste'] = $this->getCoste();
return $donnees;
$this->donnees['nt'] = $this->nomCourant->getNt();
$this->donnees['nomSciRetenu'] = $this->nomCourant->getNomRetenu()->get('nom_sci_html');
$this->getPhotos();
$this->getDessin();
return $this->donnees;
}
public function obtenirDonneesExport() {
$donnees = array();
$donnees['nt'] = $this->nomCourant->getNt();
$donnees['nomSciRetenu'] = $this->nomCourant->getNomRetenu()->get('nom_sci_html');
$donnees['cel'] = $this->getCelExport();
$donnees['coste'] = $this->getCoste();
return $donnees;
$this->donnees['nt'] = $this->nomCourant->getNt();
$this->donnees['nomSciRetenu'] = $this->nomCourant->getNomRetenu()->get('nom_sci_html');
$this->donnees['cel'] = $this->getCelExport();
return $this->donnees;
}
 
public function getBloc() {
$donnees = array();
$donnees = $this->getPhoto('cel');
if (empty($donnees)) {
$infos_image = $this->getCoste();
$this->donnees = $this->getPhoto('cel');
if (empty($this->donnees)) {
$infos_image = $this->getDessin();
if (empty($infos_image) == false ){
$donnees['imageUrl'] = array_shift($infos_image['images']);
$this->donnees['imageUrl'] = array_shift($infos_image['images']);
}
}
if (empty($donnees)) {
$donnees = $this->getPhoto('photoflora');
if (empty($this->donnees)) {
$this->donnees = $this->getPhoto('photoflora');
}
return $donnees;
return $this->donnees;
}
75,50 → 73,70
return $donnees;
}
 
public function getCoste() {
$coste = array();
$tax = $this->nomCourant->getNomRetenu()->get('num_taxonomique');
$this->images->setProjet('coste');
$this->images->setNnTaxon($tax);
$costeImg = $this->images->getInfosImagesTaxons();
foreach ($costeImg as $infos) {
$coste['images'][] = $infos['binaire.href'];
public function getDessin() {
$projet = Config::get($this->referentiel.'.baseDessins');
if ($projet != "") {
$dessin = array();
$tax = $this->nomCourant->getNomRetenu()->get('num_taxonomique');
$this->images->setProjet($projet);
$this->images->setNnTaxon($tax);
$costeImg = $this->images->getInfosImagesTaxons();
foreach ($costeImg as $infos) {
$dessin['images'][] = $infos['binaire.href'];
}
$this->meta->setProjet('coste');
$meta = $this->meta->getMetaDonnees();
$dessin['meta']['titre']= $meta[0]['titre'];
$dessin['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projet);
$this->donnees['coste'] = $dessin;
}
}
public function getPhotos() {
$projets[] = Config::get($this->referentiel.'.baseImages');
$projets[] = Config::get($this->referentiel.'.baseImagesSupp');
foreach ($projets as $projet) {
if ($projet != "") {
$images = $this->initialiserPhotos($projet);
$this->formaterListePhotos($projet, $images);
$this->formaterMetaPhotos($projet);
}
$this->meta->setProjet('coste');
$meta = $this->meta->getMetaDonnees();
$coste['meta']['titre']= $meta[0]['titre'];
$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste');
return $coste;
}
}
public function getPhotoFlora() {
$photoflora = array();
$this->images->setProjet('photoflora');
private function initialiserPhotos($projet) {
$this->images->setProjet($projet);
$nnr = $this->nomCourant->getNnr();
$images = $this->images->getInfosImagesParIdsNoms(array($nnr));
foreach ($images as $idImg => $img) {
$infosImg = array();
$infosImg['src'] = $img['binaire.href'];
$infosImg['nomSci'] = $img['determination.nom_sci'];
$infosImg['station'] = $img['station.libelle'];
$infosImg['date'] = $this->formaterDateImg($img['date']);
$infosImg['auteur'] = $img['auteur.libelle'];
 
//$infosImg['urlDetailImg'] = $this->appUrls->obtenirUrlPopUpIllustrations($idImg);
//$infosImg['urlContact'] = $this->appUrls->obtenirUrlPopUpContact($img['auteur.id'], $idImg);
$photoflora['images'][$idImg] = $infosImg;
return $this->images->getInfosImagesParIdsNoms(array($nnr));
}
private function formaterListePhotos($projet, $images) {
foreach ($images as $idImg => $img) {
$infosImg = array();
$infosImg['src'] = $img['binaire.href'];
$infosImg['nomSci'] = $img['determination.nom_sci'];
$infosImg['station'] = $img['station.libelle'];
$infosImg['date'] = $this->formaterDateImg($img['date']);
$infosImg['auteur'] = $img['auteur.libelle'];
if ($projet == "cel") {
$infosImg['urlDetailImg'] = $this->appUrls->obtenirUrlPopUpIllustrations($idImg);
$infosImg['urlContact'] = $this->appUrls->obtenirUrlPopUpContact($img['auteur.id'], $idImg);
}
$this->donnees[$projet]['images'][$idImg] = $infosImg;
}
 
$this->meta->setProjet('photoflora');
}
private function formaterMetaPhotos($projet) {
$this->meta->setProjet($projet);
$meta = $this->meta->getMetaDonnees();
$titreMeta = $meta[0]['titre'];
$photoflora['meta']['titre'] = $titreMeta;
$photoflora['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('photoflora');
 
return $photoflora;
$this->donnees[$projet]['meta']['titre'] = $titreMeta;
$this->donnees[$projet]['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projet);
}
 
public function getCelExport() {
$cel = array();
$this->images->setProjet('cel');
140,34 → 158,6
return $cel;
}
 
public function getCel() {
$cel = array();
$this->images->setProjet('cel');
$nnr = $this->nomCourant->getNnr();
$images = $this->images->getInfosImagesParIdsNoms(array($nnr));
 
foreach ($images as $idImg => $img) {
$infosImg = array();
$infosImg['src'] = $img['binaire.href'];
$infosImg['nomSci'] = $img['determination.nom_sci'];
$infosImg['commune'] = $img['station.commune'];
$infosImg['date'] = $this->formaterDateImg($img['date']);
$infosImg['auteur'] = $img['auteur.libelle'];
 
$infosImg['urlDetailImg'] = $this->appUrls->obtenirUrlPopUpIllustrations($idImg);
$infosImg['urlContact'] = $this->appUrls->obtenirUrlPopUpContact($img['auteur.id'], $idImg);
$cel['images'][$idImg] = $infosImg;
}
 
$this->meta->setProjet('cel');
$meta = $this->meta->getMetaDonnees();
$titreMeta = $meta[0]['titre'];
$cel['meta']['titre'] = $titreMeta;
$cel['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('cel');
 
return $cel;
}
 
private function formaterDateImg($date) {
$dateFmt = $date;
if ($date == '0000-00-00' || $date == '1970-01-01 01:01:01') {
178,12 → 168,12
return $dateFmt;
}
 
private function formaterNomSci($nom) {
$nomFmt = $nom;
if (is_null($nom) || $nom == '') {
$nomFmt = 'inconnu';
}
return $nomFmt;
private function formaterNomSci($nom) {
$nomFmt = $nom;
if (is_null($nom) || $nom == '') {
$nomFmt = 'inconnu';
}
return $nomFmt;
}
}
?>