New file |
0,0 → 1,162 |
<?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 $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->getFloreProbable(); |
$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'); |
$nt = $this->nomCourant->getNt(); |
$this->cartes->setId("{$this->referentiel}.nt:$nt"); |
$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; |
} |
|
private function getFloreProbable() { |
$projetFloreProbable = Config::get($this->referentiel.'.baseFloreProbable'); |
if (! $projetFloreProbable) return; |
$this->cartes->setProjet($projetFloreProbable); |
$this->meta->setProjet($projetFloreProbable); |
$this->cartes->setId($this->referentiel.'.nt:'.$this->nomCourant->getNt()); |
// TODO: url téléchargement de la carte lorsqu'on sera sur que c'est possible |
// dans ['carte']['telechargement'] par exemple |
$this->donnees['flore_probable'] = array('carte' => array(), 'meta' => array()); |
$this->meta->setProjet($projetFloreProbable); |
$meta = $this->meta->getMetaDonnees(); |
$this->donnees['flore_probable']['meta'] = $meta[0]; |
$this->donnees['flore_probable']['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projetFloreProbable); |
$this->donnees['flore_probable']['carte']['url'] = $this->cartes->getUrlFloreProbablePng(); |
} |
|
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') { |
$nt = $this->nomCourant->getNt(); |
$idCarte = "{$this->referentiel}.nt:$nt"; |
$urlCarte = Config::get("{$this->referentiel}.baseRepartition"); |
|
$donnees['chorodep'] = Cartes::getCarteUrlPng($urlCarte, $idCarte, '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'); |
|
$nt = $this->nomCourant->getNt(); |
$this->cartes->setId("{$this->referentiel}.nt:$nt"); |
|
$url = $this->cartes->getUrlPng(); |
} |
return $url; |
} |
|
private function getMoissonnageMiniature() { |
$projetMoissonnage = Config::get($this->referentiel.'.baseMoissonnage'); |
$url = null; |
if ($projetMoissonnage != '') { |
$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; |
} |
} |
?> |
Property changes: |
Added: svnkit:entry:sha1-checksum |
+14e91034608691b894071e3f1724d66014a9373f |
\ No newline at end of property |