Subversion Repositories eFlore/Applications.eflore-consultation

Compare Revisions

Ignore whitespace Rev 953 → Rev 954

/trunk/modules/fiche/formateurs/Description.php
24,10 → 24,14
'septembre', 'octobre', 'novembre', 'décembre');
private $CosteFormate;
private $CosteTexte;
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->textes = $this->conteneur->getApiTextes();
$this->wikini = $this->conteneur->getApiWikini();
$this->meta = $this->conteneur->getApiMetaDonnees();
37,20 → 41,34
 
public function obtenirDonnees() {
$donnees = array();
$donnees['wp'] = $this->getWikipedia();
$donnees['coste'] = $this->getCoste();
$donnees['wikini'] = $this->getWikini();
$donnees['baseflor'] = $this->getBaseflor();
return $donnees;
$this->getWikipedia();
$this->getWikini();
$this->getDescriptionsDependantesReferentiel();
return $this->donnees;
}
public function obtenirDonneesExport() {
$donnees = array();
$donnees['coste'] = $this->getCoste();
$donnees['wikini'] = $this->getWikini();
$donnees['baseflor'] = $this->getBaseflor();
return $donnees;
$this->getWikini();
$this->getDescriptionsDependantesReferentiel();
return $this->donnees;
}
private function getDescriptionsDependantesReferentiel() {
$bases_descriptions = Config::get($this->referentiel.'.baseDescription');
$bases_descriptions = explode(',',$bases_descriptions);
foreach ($bases_descriptions as $base) {
if($this->aMethodeDescription($base)) {
$fonction = 'get'.ucfirst($base);
$this->$fonction();
}
}
}
private function aMethodeDescription($base) {
return method_exists($this, 'get'.$base);
}
 
private function getBaseflor() {
$baseflor = array();
59,19 → 77,19
$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
$informations = $this->informations->getInformationsDescription();
if ($informations){
$baseflor['chorologie'] = $informations['chorologie'];
$baseflor['inflorescence'] = $informations['inflorescence'];
$baseflor['sexualite'] = $informations['sexualite'];
$baseflor['ordre_maturation'] = $informations['ordre_maturation'];
$baseflor['pollinisation'] = $informations['pollinisation'];
$baseflor['dissemination'] = $informations['dissemination'];
$baseflor['fruit'] = $informations['fruit'];
$baseflor['couleur_fleur'] = $informations['couleur_fleur'];
$baseflor['macule'] = $informations['macule'];
$baseflor['floraison'] = $this->changerFloraisonEnChaine($informations['floraison']);
$baseflor['chorologie'] = isset($informations['chorologie']) ? $informations['chorologie'] : '';
$baseflor['inflorescence'] = isset($informations['inflorescence']) ? $informations['inflorescence'] : '';
$baseflor['sexualite'] = isset($informations['sexualite']) ? $informations['sexualite'] : '';
$baseflor['ordre_maturation'] = isset($informations['ordre_maturation']) ? $informations['ordre_maturation'] : '';
$baseflor['pollinisation'] = isset($informations['pollinisation']) ? $informations['pollinisation'] : '';
$baseflor['dissemination'] = isset($informations['dissemination']) ? $informations['dissemination'] : '';
$baseflor['fruit'] = isset($informations['fruit']) ? $informations['fruit'] : '';
$baseflor['couleur_fleur'] = isset($informations['couleur_fleur']) ? $informations['couleur_fleur'] : '';
$baseflor['macule'] = isset($informations['macule']) ? $informations['macule'] : '';
$baseflor['floraison'] = isset($informations['floraison']) ? $this->changerFloraisonEnChaine($informations['floraison']) : '';
//récupérer dans ontologies
$baseflor['type_bio'] = $informations['type_bio.libelle'];
$baseflor['form_vegetale'] = $informations['form_vegetale'];
$baseflor['type_bio'] = isset($informations['type_bio']) ? $informations['type_bio'] : '';
$baseflor['form_vegetale'] = isset($informations['form_vegetale']) ? $informations['form_vegetale'] : '';
$baseflor['description']=$baseflor;
$this->meta->setProjet('baseflor');
$meta = $this->meta->getMetaDonnees();
79,7 → 97,7
$baseflor['meta']['citation'] = $citation;
$baseflor['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseflor');
}
return $baseflor;
$this->donnees['baseflor'] = $baseflor;
}
 
public function changerFloraisonEnChaine($floraison){
118,8 → 136,7
$wp['titre'] = $donnees['titre'] = "Description de wikipedia";
$wp['lien'] = $this->textes->getPageUrl();
$wp['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('wikipedia');
 
return $wp;
$this->donnees['wp'] = $wp;
}
 
private function getIdWp() {
136,7 → 153,7
$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
$wikini['description'] = $this->wikini->getTexteFormate($page_wiki, 'description');
return $wikini;
$this->donnees['wikini'] = $wikini;
}
public function getLienWikini() {
159,7 → 176,7
$citation = $meta[0]['citation'];
$coste['meta']['citation'] = $citation;
$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste');
return $coste;
$this->donnees['coste'] = $coste;
}
 
public function mettreEnFormeCoste($texte){
203,23 → 220,23
if ( preg_match('/\.[ ]*([A-ZÉÀÈ].+)$/',$this->CosteTexte, $retour)){
$this->CosteFormate['ecologie'] = $retour[1];
$this->CosteTexte = str_replace($retour[0],'.',$this->CosteTexte);
if ( preg_match('/–(.+)/', $this->CosteFormate['ecologie'] , $retour)){
if (isset($this->CosteFormate['ecologie']) && preg_match('/–(.+)/', $this->CosteFormate['ecologie'] , $retour)){
$this->CosteFormate['repartition'] = $retour[1];
$this->CosteFormate['ecologie'] = str_replace($retour[0],'',$this->CosteFormate['ecologie']);
}
if ( preg_match('/=(.+)$/', $this->CosteFormate['repartition'], $retour)){
if (isset($this->CosteFormate['repartition']) && preg_match('/=(.+)$/', $this->CosteFormate['repartition'], $retour)){
$this->CosteFormate['floraison'] = $retour[1];
$this->CosteFormate['repartition'] = str_replace($retour[0],'',$this->CosteFormate['repartition']);
}
if ( preg_match('/–(.+)$|\n(.+)$/',$this->CosteFormate['floraison'], $retour)){
if (isset($this->CosteFormate['floraison']) && preg_match('/–(.+)$|\n(.+)$/',$this->CosteFormate['floraison'], $retour)){
$this->CosteFormate['usages'] = isset($retour[1]) ? $retour[1] : $retour[2];
$this->CosteFormate['floraison'] = str_replace($retour[0],'.',$this->CosteFormate['floraison']);
}
if ( preg_match('/([Ff]l\.) (.+)/',$this->CosteFormate['floraison'], $retour)){
if (isset($this->CosteFormate['floraison']) && preg_match('/([Ff]l\.) (.+)/',$this->CosteFormate['floraison'], $retour)){
$this->CosteFormate['floraison'] = $retour[2];
$this->CosteFormate['floraison'] = str_replace($retour[1],'',$this->CosteFormate['floraison']);
}
if ( preg_match('/([Ff]r\.) (.+)/',$this->CosteFormate['floraison'], $retour)){
if (isset($this->CosteFormate['floraison']) && preg_match('/([Ff]r\.) (.+)/',$this->CosteFormate['floraison'], $retour)){
$this->CosteFormate['fructification'] = $retour[2];
$this->CosteFormate['floraison'] = str_replace($retour[0],'',$this->CosteFormate['floraison']);
$this->CosteFormate['floraison'] = str_replace(',','',$this->CosteFormate['floraison']);