Rev 824 | Rev 840 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
// declare(encoding='UTF-8');
/**
* Classe mère du module Liste.
*
* @category PHP 5.2
* @package eflore-consultation
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Delphine CAUQUIL <delphine@tela-botanica.org>
* @author Mathilde Salthun-lassalle <mathilde@tela-botanica.org>
* @copyright 2011 Tela-Botanica
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
* @version $Id$
*/
class Ecologie extends aControleur {
public function __construct(Conteneur $conteneur) {
$this->conteneur = $conteneur;
$this->nomCourant = $this->conteneur->getNomCourant();
$this->informations = $this->conteneur->getApiInformations();
$this->meta = $this->conteneur->getApiMetaDonnees();
$this->wikini = $this->conteneur->getApiWikini();
$this->appUrls = $this->conteneur->getAppUrls();
$this->graphique = $this->conteneur->getApiGraphiques();
$this->syntaxons = $this->conteneur->getApiSyntaxons();
parent::__construct();
}
public function obtenirDonnees() {
$donnees = array();
$donnees['wikini'] = $this->getWikini();
$donnees['baseflor'] = $this->getBaseflor();
$donnees['baseveg'] = $this->getBaseveg();
$donnees['urls'] = $this->appUrls;
return $donnees;
}
public function obtenirDonneesExport() {
$donnees = array();
$donnees['wikini'] = $this->getWikini();
$donnees['baseflor'] = $this->getBaseflorExport();
$donnees['baseveg'] = $this->getBaseveg();
return $donnees;
}
public function getBaseflorCatminat($depart, $limite) {
$baseflorCatminat = array();
$this->informations ->setProjet('baseflor');
$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
$this->informations ->setDepart($depart);
$this->informations ->setLimite($limite);
$informations = $this->informations->getInformationsRelationCatminat();
if($informations != ""){
$baseflorCatminat['catminat'] = $informations['resultat'][0]['catminat_code'];
$baseflorCatminat['lien-liste-fancy'] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_taxons',$this->conteneur->getParametre('referentiel'),$this->conteneur->getParametre('num_nom'),$baseflorCatminat['catminat']);
}else {
$baseflorCatminat['aucune'] = 'Aucunes données';
}
return $baseflorCatminat;
}
private function getBaseveg() {
$baseveg = array();
$baseflor = $this->getBaseflorCatminat(0,500);
$baseveg['baseflor'] = $baseflor;
if (isset($baseflor['catminat'])) {
$this->syntaxons->setProjet('baseveg');
$catminat = str_replace('/','-',$baseflor['catminat']);
$this->syntaxons->setCatminat($catminat);
$syntaxonsSup = $this->syntaxons->getSyntaxonsSuperieurs();
$baseveg['syntaxons-sup'] = $syntaxonsSup['resultat'];
$syntaxonsCourant = $this->syntaxons->getSyntaxonsCatminat();
$baseveg['syntaxon-courant'] = $syntaxonsCourant['resultat'];
foreach ($baseveg['syntaxons-sup'] as $cle => $valeurs) {
$catminat_sup = str_replace('/','-',$valeurs['code_catminat']);
$baseveg['synonymes']['lien-liste-fancy'][$valeurs['code_catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_synonymes',$this->conteneur->getParametre('referentiel'),$this->conteneur->getParametre('num_nom'),$catminat_sup);
$baseveg['ref']['lien-liste-fancy'][$valeurs['code_catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_ref',$this->conteneur->getParametre('referentiel'),$this->conteneur->getParametre('num_nom'),$catminat_sup);
$baseveg['taxons']['lien-liste-fancy'][$valeurs['code_catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_taxons_sup',$this->conteneur->getParametre('referentiel'),$this->conteneur->getParametre('num_nom'),$catminat_sup);
}
$baseveg['synonymes']['lien-liste-fancy'][$baseflor['catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_synonymes',$this->conteneur->getParametre('referentiel'),$this->conteneur->getParametre('num_nom'),$catminat);
$baseveg['ref']['lien-liste-fancy'][$baseflor['catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_ref',$this->conteneur->getParametre('referentiel'),$this->conteneur->getParametre('num_nom'),$catminat);
$this->meta->setProjet('baseveg');
$meta = $this->meta->getMetaDonnees();
$citation = $meta[0]['citation'];
$baseveg['meta']['citation'] = $citation;
$baseveg['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseveg');
}else {
$baseveg['aucune'] = 'Aucunes données';
}
return $baseveg;
}
private function getBasevegSyntaxonCourant() {
$baseveg = array();
$baseflor = $this->getBaseflorCatminat(0,500);
if (isset($baseflor['catminat'])) {
$this->syntaxons->setProjet('baseveg');
$catminat = str_replace('/','-',$baseflor['catminat']);
$this->syntaxons->setCatminat($catminat);
$syntaxonsCourant = $this->syntaxons->getSyntaxonsCatminat();
$baseveg['description'] = $syntaxonsCourant['resultat'];
}
return $baseveg;
}
private function getWikini() {
$wikini = array();
$wikini['titre'] = 'Wikini';
$referentiel = $this->conteneur->getParametre('referentiel');
$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
$wikini['ecologie'] = $this->wikini->getTexteFormate($page_wiki, 'ecologie');
return $wikini;
}
public function getBloc() {
$donnees = array();
$donnees['graph'] = $this->getBaseflor(false);
$donnees['graph']['titre'] = 'Optimum écologique';
$donnees['phytosocio'] = $this->getBasevegSyntaxonCourant();
return $donnees;
}
private function getBaseflorExport() {
$baseflor = array();
$this->informations ->setProjet('baseflor');
$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
$informations = $this->informations->getInformationsEcologie();
if($informations != ""){
$baseflor['climat_url'] = $informations['graphique_climat']['href']."?retour.format=500";
$baseflor['sol_url'] = $informations['graphique_sol']['href']."?retour.format=500";
$baseflor['climat_url_png'] = $informations['graphique_climat']['href']."?retour=image/png";
$baseflor['sol_url_png'] = $informations['graphique_sol']['href']."?retour=image/png";
$this->graphique -> setProjet('baseflor');
$baseflor['legende_eco'] = Config::get('chemin_images').'legende_formes.png';
$this->meta->setProjet('baseflor');
$meta = $this->meta->getMetaDonnees();
$citation = $meta[0]['citation'];
$baseflor['meta']['citation'] = $citation;
}else {
$baseflor['aucune'] = 'Aucunes données';
}
return $baseflor;
}
private function getBaseflor($inclure_legende = true) {
$num_nom = $this->nomCourant->getNns();
$cache = $this->obtenirCache('baseflor_graphique_'.$num_nom);
if($cache != null) {
$baseflor = $cache;
$this->graphique ->setProjet('baseflor');
$graphique = $this->graphique->getLegendeGraphique();
$baseflor['legende'] = $graphique ;
} else {
$baseflor = array();
$this->informations ->setProjet('baseflor');
$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
$informations = $this->informations->getInformationsEcologie();
if($informations != ""){
$baseflor['climat_url'] = $informations['graphique_climat']['href']."?retour.format=500";
$baseflor['sol_url'] = $informations['graphique_sol']['href']."?retour.format=500";
$baseflor['climat_url_png'] = $informations['graphique_climat']['href']."?retour=image/png";
$baseflor['sol_url_png'] = $informations['graphique_sol']['href']."?retour=image/png";
if($inclure_legende) {
$this->graphique ->setProjet('baseflor');
$graphique = $this->graphique->getLegendeGraphique();
$baseflor['legende'] = $graphique ;
}
$this->meta->setProjet('baseflor');
$meta = $this->meta->getMetaDonnees();
$citation = $meta[0]['citation'];
$baseflor['meta']['citation'] = $citation;
$baseflor['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseflor');
$baseflor['description']['climat_url'] = $informations['graphique_climat']['href']."?retour.format=420";
$baseflor['description']['sol_url'] = $informations['graphique_sol']['href']."?retour.format=420";
$baseflor['description']['climat_url_png'] = $informations['graphique_climat']['href']."?retour.format=420&retour=image/png";
$baseflor['description']['sol_url_png'] = $informations['graphique_sol']['href']."?retour.format=420&retour=image/png";
$this->mettreEnCache('baseflor_graphique_'.$num_nom, $baseflor);
}else {
$baseflor['aucune'] = 'Aucunes données';
}
}
return $baseflor;
}
}
?>