New file |
0,0 → 1,160 |
<?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> |
* @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 Repartition extends aControleur { |
|
private $conteneur = null; |
private $nomCourant = null; |
private $referentiel = 'bdtfx'; |
private $donnees = array(); |
private $tailleBloc = "190x178"; |
private $serviceChorodep = null; |
private $cartes; |
private $meta; |
private $appUrls; |
|
public function __construct(Conteneur $conteneur) { |
$this->conteneur = $conteneur; |
$this->nomCourant = $this->conteneur->getNomCourant(); |
$this->referentiel = $this->conteneur->getParametre('referentiel'); |
$this->cartes = $this->conteneur->getApiCartes(); |
$this->meta = $this->conteneur->getApiMetaDonnees(); |
$this->appUrls = $this->conteneur->getAppUrls(); |
} |
|
public function obtenirDonnees() { |
$this->getRepartition(); |
$this->getMoissonnage(); |
$this->donnees['widget']['nt'] = $this->nomCourant->getNt(); |
$this->donnees['widget']['nn'] = $this->nomCourant->getNnr(); |
$this->donnees['widget']['referentiel'] = $this->referentiel; |
return $this->donnees; |
} |
|
public function obtenirDonneesExport() { |
$this->getRepartition(); |
$donnees['chorodep'] = $this->donnees['repartition']; |
$this->getMoissonnageExport(); |
// TODO: renommer l'index "eflore" en moissonnage |
// et renommer dans pdf_export/squelettes/pdf_repartition.tpl.html |
$donnees['eflore'] = $this->donnees['moissonnage']; |
return $donnees; |
} |
|
private function getRepartition() { |
$projetRepartition = Config::get($this->referentiel.'.baseRepartition'); |
// eg: eflore ou chorodep |
// cf: bdtfx.ini, bdtxa.ini |
if ($projetRepartition != "") { |
$this->cartes->setProjet($projetRepartition); |
$this->cartes->setLargeur('630'); |
|
//TODO: démochir ce code |
// Chargement des nn des synonymes pour obtenir une carte plus complète |
$noms = $this->conteneur->getApiNoms(); |
$syns = $noms->getSynonymes($this->nomCourant->getNnr()); |
$nns_syns = array_keys($syns['resultat']); |
$nns_syns[] = $this->nomCourant->getNnr(); |
$id = 'nn:'.implode(',', $nns_syns); |
|
$this->cartes->setId($id); |
$repartition['svgUrl'] = $this->cartes->getUrlDataSvg(); |
$repartition['pngUrl'] = $this->cartes->getUrlPng(); |
$repartition['legende'] = $this->cartes->getLegendeId(); |
$this->meta->setProjet($projetRepartition); |
$meta = $this->meta->getMetaDonnees(); |
$repartition['meta'] = $meta[0]; |
$repartition['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projetRepartition); |
$this->donnees['repartition'] = $repartition; |
} |
} |
|
private function getMoissonnage() { |
$projetMoissonnage = Config::get($this->referentiel.'.baseMoissonnage'); |
if (! $projetMoissonnage) return; |
$this->cartes->setProjet('moissonnage'); |
$this->cartes->setLargeur('600'); |
$this->cartes->setInfoNom($this->nomCourant->getNt()); |
$this->cartes->setInfoReferentiel($this->referentiel); |
$eflore['mapUrl'] = $this->cartes->getUrlMapSvg(); |
$eflore['mapTelechargementUrls'] = array('png' => $this->cartes->getUrlTelechargementMapPng(), |
'html' => $this->cartes->getUrlTelechargementMapHtml()); |
$eflore['legende'] = $this->cartes->getLegende(); |
$this->donnees['moissonnage'] = $eflore; |
} |
|
private function getMoissonnageExport() { |
$projetMoissonnage = Config::get($this->referentiel.'.baseMoissonnage'); |
if (! $projetMoissonnage) return; |
$this->cartes->setProjet($projetMoissonnage); |
$this->cartes->setLargeur('min'); |
$this->cartes->setInfoNom($this->nomCourant->getNomRetenu()); |
$eflore['min'] = $this->cartes->getUrlEflorePng(); |
$eflore['legende'] = $this->cartes->getLegende(); |
$this->donnees['moissonnage'] = $eflore; |
} |
|
public function getBloc() { |
$donnees['chorodep'] = $this->getChorodepMiniature(); |
$donnees['eflore'] = $this->getMoissonnageMiniature(); |
|
// TODO: moche, comment gérer le fait que l'onglet "synthèse", en "bdtxa", doive |
// afficher la carte chorologie, et non la carte chorodep. |
// workaround: écrasement de l'URL dans ['répartition']['chorodep']: |
if($this->referentiel == 'bdtxa') { |
$syns = $this->conteneur->getApiNoms()->getSynonymes($this->nomCourant->getNnr()); |
$nns_syns = array_keys($syns['resultat']); |
$nns_syns[] = $this->nomCourant->getNnr(); |
$donnees['chorodep'] = Cartes::getCarteUrlPng(Config::get($this->referentiel.'.baseRepartition'), |
'nn:'.implode(',', $nns_syns), |
'190x178'); |
} |
|
return $donnees; |
} |
|
private function getChorodepMiniature() { |
$projetRepartition = Config::get($this->referentiel.'.baseRepartition'); |
$url = null; |
if ($projetRepartition != "") { |
$this->cartes->setProjet($projetRepartition); |
$this->cartes->setProjet('chorodep'); |
$this->cartes->setLargeur('190x178'); |
//TODO: démochir ce code |
// Chargement des nn des synonymes pour obtenir une carte plus complète |
$noms = $this->conteneur->getApiNoms(); |
$syns = $noms->getSynonymes($this->nomCourant->getNnr()); |
$nns_syns = array_keys($syns['resultat']); |
$nns_syns[] = $this->nomCourant->getNnr(); |
$id = 'nn:'.implode(',', $nns_syns); |
$this->cartes->setId($id); |
$url = $this->cartes->getUrlPng(); |
} |
return $url; |
} |
|
private function getMoissonnageMiniature() { |
$projetMoissonnage = Config::get($this->referentiel.'.baseMoissonnage'); |
$url = null; |
if ($projetRepartition != "") { |
$this->cartes->setProjet('moissonnage'); |
$this->cartes->setLargeur('190'); |
$this->cartes->setInfoReferentiel($this->referentiel); |
$this->cartes->setInfoNom($this->nomCourant->getNt()); |
$url = $this->cartes->getUrlMapPng(); |
} |
return $url; |
} |
} |
?> |