88,6 → 88,7 |
|
|
public function getBloc() { |
|
$donnees['titre'] = "Description de Coste"; |
$description = $this->getCoste(); |
if ($description['description'] == '') { |
135,11 → 136,8 |
$this->textes->setProjet('coste'); |
$this->textes->setId('bdtfx.nn:'.$this->nomCourant->getNnr()); |
$texte = $this->textes->getTexte(); |
if ($texte) { |
$coste['titre'] = $texte['titre']; |
$texte = $this->MettreEnFormeCoste($texte['texte']); |
$coste['description'] = $texte ; |
} |
$coste['titre'] = $texte['titre']; |
$coste['description'] = $texte['texte']; |
$this->meta->setProjet('coste'); |
$meta = $this->meta->getMetaDonnees(); |
$citation = $meta[0]['citation']; |
147,46 → 145,5 |
$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste'); |
return $coste; |
} |
|
public function MettreEnFormeCoste($texte){ |
$resultat = array(); |
if ( preg_match('/\*\*(.+)\*\*([^–]*)–/', $texte, $retour)){ |
|
/* !! attention on enlève un tiret cadratin – pas un trait d'union - !! */ |
$a_enlever = array('/–/','/[0-9]+/','/\./' ); |
$resultat['nom_scientifique'] = preg_replace($a_enlever,'',$retour[1]); |
$resultat['nom_scientifique'] .= $retour[2]; |
$texte = str_replace($retour[0],'',$texte); |
} |
/* !! attention il y a un espace avant les // du début !! */ |
if ( preg_match('/^ \/\/([^\/\/]+)\/\//', $texte, $retour)){ |
$a_enlever = array('/–/','/\./' ); |
$resultat['nom_commun'] = preg_replace($a_enlever,'',$retour[1]); |
$texte = str_replace($retour[0],'',$texte); |
} |
$texte = preg_replace('/\//','',$texte); |
if ( preg_match('/\.[ ]*([A-ZÉÀÈ].+)$/', $texte, $retour)){ |
$resultat['ecologie'] = $retour[1]; |
$texte = str_replace($retour[0],'.',$texte); |
if ( preg_match('/–(.+)/', $resultat['ecologie'] , $retour)){ |
$resultat['repartition'] = $retour[1]; |
$resultat['ecologie'] = str_replace($retour[0],'',$resultat['ecologie']); |
} |
if ( preg_match('/=(.+)$/', $resultat['repartition'], $retour)){ |
$resultat['floraison'] = $retour[1]; |
$resultat['repartition'] = str_replace($retour[0],'',$resultat['repartition']); |
} |
if ( preg_match('/–(.+)$/',$resultat['floraison'], $retour)){ |
$resultat['consommation'] = $retour[1]; |
$resultat['floraison'] = str_replace($retour[0],'.',$resultat['floraison']); |
} |
} |
$texte = str_replace(';','</br> -','- '.$texte); |
$texte = str_replace('–','',$texte); |
$resultat['texte'] = $texte; |
return $resultat; |
} |
|
|
} |
?> |