Subversion Repositories eFlore/Applications.eflore-consultation

Compare Revisions

Regard whitespace Rev 1488 → Rev 1489

/trunk/modules/fiche/formateurs/Description.php
13,7 → 13,6
* @version $Id$
*/
class Description extends aControleur {
 
private $conteneur = null;
private $nomCourant = null;
private $textes = null;
21,14 → 20,23
private $wikini = null;
private $informations = null;
static $mois = array(
'janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet',
'août', 'septembre', 'octobre', 'novembre', 'décembre');
'janvier',
'février',
'mars',
'avril',
'mai',
'juin',
'juillet',
'août',
'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();
39,7 → 47,6
$this->informations = $this->conteneur->getApiInformations();
$this->appUrls = $this->conteneur->getAppUrls();
}
 
public function obtenirDonnees() {
$donnees = array();
$this->getWikipedia();
50,7 → 57,6
}
return $this->donnees;
}
 
public function obtenirDonneesExport() {
$donnees = array();
$this->getWikini();
57,7 → 63,6
$this->getDescriptionsDependantesReferentiel($this->referentiel);
return $this->donnees;
}
 
private function getDescriptionsDependantesReferentiel($ref) {
if(trim(Config::get($ref . '.baseDescription')) != "") {
// eg: [bdtfx]baseDescription = coste,baseflor dans bdtfx.ini
68,7 → 73,6
}
}
}
 
public function getBloc() {
// prend la première description disponible dans l'ordre indiqué dans le fichier
// de config, et prend la description wiki sinon
100,7 → 104,6
 
return $this->donnees;
}
 
private function getBaseflor() {
$baseflor = array();
$this->informations ->setProjet('baseflor');
129,7 → 132,6
}
$this->donnees['baseflor'] = $baseflor;
}
 
static function changerFloraisonEnChaine($floraison){
$chaine = "";
if ($floraison != ""){
136,13 → 138,12
$mois_fleurs=preg_match('/-/',$floraison) ? preg_split('/-/',$floraison) : $floraison;
if (is_array($mois_fleurs)){
$chaine = "de ".self::$mois[(int)$mois_fleurs[0]-1]." à ".self::$mois[(int)$mois_fleurs[1]-1];
 
}else { $chaine = "en ".self::$mois[(int)$mois_fleurs];
} else {
$chaine = "en " . self::$mois [( int ) $mois_fleurs - 1];
}
}
return $chaine;
}
 
public function getUrlWikipedia() {
if(!isset($this->donnees['wp'])) {
$this->getWikipedia();
149,7 → 150,6
}
return $this->donnees['wp'];
}
 
public function getWikipedia() {
$wp = array();
$this->textes->setProjet('wikipedia');
159,11 → 159,9
$wp['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('wikipedia');
$this->donnees['wp'] = $wp;
}
 
private static function getIdWp($nomSci) {
return urlencode(str_replace(' ', '_', $nomSci));
}
 
private function getWikini() {
$wikini = array();
$wikini['titre'] = 'Wikini';
173,13 → 171,11
$wikini['description'] = $this->wikini->getTexteFormate($page_wiki, 'description');
$this->donnees['wikini'] = $wikini;
}
 
public function getLienWikini() {
$referentiel = $this->conteneur->getParametre('referentiel');
$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
return $this->wikini->getUrlPageWiki($referentiel, $num_tax);
}
 
private function getCoste() {
$coste = array();
$this->textes->setProjet('coste');
198,7 → 194,6
$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste');
$this->donnees['coste'] = $coste;
}
 
static function mettreEnFormeCoste($texte) {
$txt_fmt = array();
//decouper elements remarquables avant le texte
212,12 → 207,13
$txt_fmt['texte'] = $texte;
return $txt_fmt;
}
 
 
static function separerNomScientifique_a_NomCommun(&$txt, &$txt_fmt){
if ( preg_match('/\*\*(.+)\*\*([^–]*)–/', $txt, $retour)){
/* !! attention on enlève un tiret cadratin – pas un trait d'union - !! */
$a_enlever = array('/–/','/\./' );
$a_enlever = array (
'/–/',
'/\./'
);
$txt_fmt['nom_scientifique'] = preg_replace($a_enlever,'',$retour[1]);
if(preg_match('/\((.+)\)/',$retour[2],$synonymes)){
$txt_fmt['synonymes'] = $synonymes[1];
228,13 → 224,14
}
/* !! attention il y a un espace avant les // du début !! */
if ( preg_match('/^ \/\/([^\/\/]+)\/\//', $txt, $retour)){
$a_enlever = array('/–/','/\./' );
$a_enlever = array (
'/–/',
'/\./'
);
$txt_fmt['nom_commun'] = preg_replace($a_enlever,'',$retour[1]);
$txt = str_replace($retour[0],'',$txt);
}
}
 
 
static function separerEcologie_a_Usages(&$txt, &$txt_fmt) {
if (preg_match('/\.\s*([A-ZÉÀÈ].+)$/',$txt, $retour)) {
$txt_fmt['ecologie'] = $retour[1];