Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 957 | Rev 979 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 957 Rev 965
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Classe mère du module Liste.
4
 * Classe mère du module Liste.
5
 *
5
 *
6
 * @category	PHP 5.2
6
 * @category	PHP 5.2
7
 * @package		eflore-consultation
7
 * @package		eflore-consultation
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
10
 * @copyright	2011 Tela-Botanica
10
 * @copyright	2011 Tela-Botanica
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
12
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
12
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
13
 * @version		$Id$
13
 * @version		$Id$
14
 */
14
 */
15
class Description extends aControleur {
15
class Description extends aControleur {
16
 
16
 
17
	private $conteneur = null;
17
	private $conteneur = null;
18
	private $nomCourant = null;
18
	private $nomCourant = null;
19
	private $textes = null;
19
	private $textes = null;
20
	private $meta = null;
20
	private $meta = null;
21
	private $wikini = null;
21
	private $wikini = null;
22
	private $informations = null;
22
	private $informations = null;
23
	private $mois = array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août',
23
	private $mois = array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août',
24
						'septembre', 'octobre', 'novembre', 'décembre');
24
						'septembre', 'octobre', 'novembre', 'décembre');
25
	private $CosteFormate;
25
	private $CosteFormate;
26
	private $CosteTexte;
26
	private $CosteTexte;
27
	
27
	
28
	private $referentiel = 'bdtfx';
28
	private $referentiel = 'bdtfx';
29
	private $donnees = array();
29
	private $donnees = array();
30
 
30
 
31
	public function __construct(Conteneur $conteneur) {
31
	public function __construct(Conteneur $conteneur) {
32
		$this->conteneur = $conteneur;
32
		$this->conteneur = $conteneur;
33
		$this->nomCourant = $this->conteneur->getNomCourant();
33
		$this->nomCourant = $this->conteneur->getNomCourant();
34
		$this->referentiel = $this->conteneur->getParametre('referentiel');
34
		$this->referentiel = $this->conteneur->getParametre('referentiel');
35
		$this->textes = $this->conteneur->getApiTextes();
35
		$this->textes = $this->conteneur->getApiTextes();
36
		$this->wikini = $this->conteneur->getApiWikini();
36
		$this->wikini = $this->conteneur->getApiWikini();
37
		$this->meta = $this->conteneur->getApiMetaDonnees();
37
		$this->meta = $this->conteneur->getApiMetaDonnees();
38
		$this->informations = $this->conteneur->getApiInformations();
38
		$this->informations = $this->conteneur->getApiInformations();
39
		$this->appUrls = $this->conteneur->getAppUrls();
39
		$this->appUrls = $this->conteneur->getAppUrls();
40
	}
40
	}
41
 
41
 
42
	public function obtenirDonnees() {
42
	public function obtenirDonnees() {
43
		$donnees = array();
43
		$donnees = array();
44
		$this->getWikipedia();
44
		$this->getWikipedia();
45
		$this->getWikini();
45
		$this->getWikini();
46
		$this->getDescriptionsDependantesReferentiel();
46
		$this->getDescriptionsDependantesReferentiel();
47
		return $this->donnees;
47
		return $this->donnees;
48
	}
48
	}
49
	
49
	
50
	public function obtenirDonneesExport() {
50
	public function obtenirDonneesExport() {
51
		$donnees = array();
51
		$donnees = array();
52
		$this->getWikini();
52
		$this->getWikini();
53
		$this->getDescriptionsDependantesReferentiel();
53
		$this->getDescriptionsDependantesReferentiel();
54
		return $this->donnees;
54
		return $this->donnees;
55
	}
55
	}
56
	
56
	
57
	private function getDescriptionsDependantesReferentiel() {
57
	private function getDescriptionsDependantesReferentiel() {
58
		$bases_descriptions = Config::get($this->referentiel.'.baseDescription');
58
		$bases_descriptions = Config::get($this->referentiel.'.baseDescription');
59
		$bases_descriptions = explode(',',$bases_descriptions);
59
		$bases_descriptions = explode(',',$bases_descriptions);
60
		
60
		
61
		foreach ($bases_descriptions as $base) {
61
		foreach ($bases_descriptions as $base) {
62
			if($this->aMethodeDescription($base)) {
62
			if($this->aMethodeDescription($base)) {
63
				$fonction = 'get'.ucfirst($base);
63
				$fonction = 'get'.ucfirst($base);
64
				$this->$fonction();
64
				$this->$fonction();
65
			}
65
			}
66
		}
66
		}
67
	}
67
	}
68
	
68
	
69
	private function aMethodeDescription($base) {
69
	private function aMethodeDescription($base) {
70
		return method_exists($this, 'get'.$base);
70
		return method_exists($this, 'get'.$base);
71
	}
71
	}
72
	
72
	
73
	public function getBloc() {
73
	public function getBloc() {
74
		// prend la première description disponible dans l'ordre indiqué dans le fichier
74
		// prend la première description disponible dans l'ordre indiqué dans le fichier
75
		// de config, et prend la description wiki sinon	
75
		// de config, et prend la description wiki sinon	
76
		if(Config::get($this->referentiel.'.baseDescription') != "") {
76
		if(Config::get($this->referentiel.'.baseDescription') != "") {
77
			$bases_descriptions = Config::get($this->referentiel.'.baseDescription');
77
			$bases_descriptions = Config::get($this->referentiel.'.baseDescription');
78
			$bases_descriptions = explode(',',$bases_descriptions);
78
			$bases_descriptions = explode(',',$bases_descriptions);
79
			foreach($bases_descriptions as $base) {
79
			foreach($bases_descriptions as $base) {
80
				if($this->aMethodeDescription($base)) {
80
				if($this->aMethodeDescription($base)) {
81
					$fonction = 'get'.ucfirst($base);
81
					$fonction = 'get'.ucfirst($base);
82
					$this->$fonction();
82
					$this->$fonction();
83
					if(!empty($this->donnees[$base]['description'])) {
83
					if(!empty($this->donnees[$base]['description'])) {
84
						$this->donnees['titre'] = "Description de ".ucfirst($base);
84
						$this->donnees['titre'] = "Description de ".ucfirst($base);
85
						$this->donnees['description'] = $this->donnees[$base]['description'];
85
						$this->donnees['description'] = $this->donnees[$base]['description'];
86
						break;
86
						break;
87
					}
87
					}
88
				}
88
				}
89
			}
89
			}
90
		}
90
		}
91
	
91
	
92
		if (empty($this->donnees['description'])) {
92
		if (empty($this->donnees['description'])) {
93
			$description = $this->getWikini();
93
			$description = $this->getWikini();
94
			$this->donnees['description'] = $description['description'];
94
			$this->donnees['description'] = $description['description'];
95
			$this->donnees['titre'] = "Description collaborative";
95
			$this->donnees['titre'] = "Description collaborative";
96
		}
96
		}
97
	
97
	
98
		return $this->donnees;
98
		return $this->donnees;
99
	}
99
	}
100
 
100
 
101
	private function getBaseflor() {
101
	private function getBaseflor() {
102
		$baseflor = array();
102
		$baseflor = array();
103
		$this->informations ->setProjet('baseflor');
103
		$this->informations ->setProjet('baseflor');
104
		$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
104
		$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
105
		$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
105
		$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
106
		$informations = $this->informations->getInformationsDescription();
106
		$informations = $this->informations->getInformationsDescription();
107
		if ($informations){
107
		if ($informations){
108
			$baseflor['chorologie'] = isset($informations['chorologie']) ? $informations['chorologie'] : '';
108
			$baseflor['chorologie'] = isset($informations['chorologie']) ? $informations['chorologie'] : '';
109
			$baseflor['inflorescence'] = isset($informations['inflorescence']) ? $informations['inflorescence'] : '';
109
			$baseflor['inflorescence'] = isset($informations['inflorescence']) ? $informations['inflorescence'] : '';
110
			$baseflor['sexualite'] = isset($informations['sexualite']) ? $informations['sexualite'] : '';
110
			$baseflor['sexualite'] = isset($informations['sexualite']) ? $informations['sexualite'] : '';
111
			$baseflor['ordre_maturation'] = isset($informations['ordre_maturation']) ? $informations['ordre_maturation'] : '';
111
			$baseflor['ordre_maturation'] = isset($informations['ordre_maturation']) ? $informations['ordre_maturation'] : '';
112
			$baseflor['pollinisation'] = isset($informations['pollinisation']) ? $informations['pollinisation'] : '';
112
			$baseflor['pollinisation'] = isset($informations['pollinisation']) ? $informations['pollinisation'] : '';
113
			$baseflor['dissemination'] = isset($informations['dissemination']) ? $informations['dissemination'] : '';
113
			$baseflor['dissemination'] = isset($informations['dissemination']) ? $informations['dissemination'] : '';
114
			$baseflor['fruit'] = isset($informations['fruit']) ? $informations['fruit'] : '';
114
			$baseflor['fruit'] = isset($informations['fruit']) ? $informations['fruit'] : '';
115
			$baseflor['couleur_fleur'] = isset($informations['couleur_fleur']) ? $informations['couleur_fleur'] : '';
115
			$baseflor['couleur_fleur'] = isset($informations['couleur_fleur']) ? $informations['couleur_fleur'] : '';
116
			$baseflor['macule'] = isset($informations['macule']) ? $informations['macule'] : '';
116
			$baseflor['macule'] = isset($informations['macule']) ? $informations['macule'] : '';
117
			$baseflor['floraison'] = isset($informations['floraison']) ? $this->changerFloraisonEnChaine($informations['floraison']) : '';
117
			$baseflor['floraison'] = isset($informations['floraison']) ? $this->changerFloraisonEnChaine($informations['floraison']) : '';
118
			//récupérer dans ontologies
118
			//récupérer dans ontologies
119
			$baseflor['type_bio'] = isset($informations['type_bio']) ? $informations['type_bio'] : '';
119
			$baseflor['type_bio'] = isset($informations['type_bio']) ? $informations['type_bio'] : '';
120
			$baseflor['form_vegetale'] = isset($informations['form_vegetale']) ? $informations['form_vegetale'] : '';
120
			$baseflor['form_vegetale'] = isset($informations['form_vegetale']) ? $informations['form_vegetale'] : '';
121
			$baseflor['description']=$baseflor;
121
			$baseflor['description']=$baseflor;
122
			$this->meta->setProjet('baseflor');
122
			$this->meta->setProjet('baseflor');
123
			$meta = $this->meta->getMetaDonnees();
123
			$meta = $this->meta->getMetaDonnees();
124
			$citation = $meta[0]['citation'];
124
			$citation = $meta[0]['citation'];
125
			$baseflor['meta']['citation'] = $citation;
125
			$baseflor['meta']['citation'] = $citation;
126
			$baseflor['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseflor');
126
			$baseflor['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseflor');
127
		}
127
		}
128
		$this->donnees['baseflor'] = $baseflor;
128
		$this->donnees['baseflor'] = $baseflor;
129
	}
129
	}
130
 
130
 
131
	public function changerFloraisonEnChaine($floraison){
131
	public function changerFloraisonEnChaine($floraison){
132
		$chaine = "";
132
		$chaine = "";
133
		if ($floraison != ""){
133
		if ($floraison != ""){
134
			$mois_fleurs=preg_match('/-/',$floraison) ? preg_split('/-/',$floraison) : $floraison;
134
			$mois_fleurs=preg_match('/-/',$floraison) ? preg_split('/-/',$floraison) : $floraison;
135
			if (is_array($mois_fleurs)){
135
			if (is_array($mois_fleurs)){
136
				$chaine = "de ".$this->mois[(int)$mois_fleurs[0]]." à ".$this->mois[(int)$mois_fleurs[1]];
136
				$chaine = "de ".$this->mois[(int)$mois_fleurs[0]]." à ".$this->mois[(int)$mois_fleurs[1]];
137
 
137
 
138
			}else { $chaine = "en ".$this->mois[(int)$mois_fleurs];
138
			}else { $chaine = "en ".$this->mois[(int)$mois_fleurs];
139
			}
139
			}
140
		}
140
		}
141
		return $chaine;
141
		return $chaine;
142
	}
142
	}
-
 
143
	
-
 
144
	public function getUrlWikipedia() {
-
 
145
		if(!isset($this->donnees['wp'])) {
-
 
146
			$this->getWikipedia();
-
 
147
		}
-
 
148
		return $this->donnees['wp'];
-
 
149
	}
143
 
150
 
144
	public function getWikipedia() {
151
	public function getWikipedia() {
145
		$wp = array();
152
		$wp = array();
146
		$this->textes->setProjet('wikipedia');
153
		$this->textes->setProjet('wikipedia');
147
		$this->textes->setId($this->getIdWp());
154
		$this->textes->setId($this->getIdWp());
148
		$wp['titre'] = $donnees['titre'] = "Description de wikipedia";
155
		$wp['titre'] = $donnees['titre'] = "Description de wikipedia";
149
		$wp['lien'] = $this->textes->getPageUrl();
156
		$wp['lien'] = $this->textes->getPageUrl();
150
		$wp['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('wikipedia');
157
		$wp['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('wikipedia');
151
		$this->donnees['wp'] = $wp;
158
		$this->donnees['wp'] = $wp;
152
	}
159
	}
153
 
160
 
154
	private function getIdWp() {
161
	private function getIdWp() {
155
		$nomSci = $this->nomCourant->getNomRetenu()->get('nom_sci');
162
		$nomSci = $this->nomCourant->getNomRetenu()->get('nom_sci');
156
		$idWp = str_replace(' ', '_', $nomSci);
163
		$idWp = str_replace(' ', '_', $nomSci);
157
		$idWp = urlencode($idWp);
164
		$idWp = urlencode($idWp);
158
		return $idWp;
165
		return $idWp;
159
	}
166
	}
160
 
167
 
161
	private function getWikini() {
168
	private function getWikini() {
162
		$wikini = array();
169
		$wikini = array();
163
		$wikini['titre'] = 'Wikini';
170
		$wikini['titre'] = 'Wikini';
164
		$referentiel = $this->conteneur->getParametre('referentiel');
171
		$referentiel = $this->conteneur->getParametre('referentiel');
165
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
172
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
166
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
173
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
167
		$wikini['description'] = $this->wikini->getTexteFormate($page_wiki, 'description');
174
		$wikini['description'] = $this->wikini->getTexteFormate($page_wiki, 'description');
168
		$this->donnees['wikini'] = $wikini;
175
		$this->donnees['wikini'] = $wikini;
169
	}
176
	}
170
	
177
	
171
	public function getLienWikini() {
178
	public function getLienWikini() {
172
		$referentiel = $this->conteneur->getParametre('referentiel');
179
		$referentiel = $this->conteneur->getParametre('referentiel');
173
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
180
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
174
		return $this->wikini->getUrlPageWiki($referentiel, $num_tax);
181
		return $this->wikini->getUrlPageWiki($referentiel, $num_tax);
175
	}
182
	}
176
 
183
 
177
	private function getCoste() {
184
	private function getCoste() {
178
		$coste = array();
185
		$coste = array();
179
		$this->textes->setProjet('coste');
186
		$this->textes->setProjet('coste');
180
		$this->textes->setId('bdtfx.nn:'.$this->nomCourant->getNnr());
187
		$this->textes->setId('bdtfx.nn:'.$this->nomCourant->getNnr());
181
		$texte = $this->textes->getTexte();
188
		$texte = $this->textes->getTexte();
182
		if ($texte) {
189
		if ($texte) {
183
			$coste['titre'] = $texte['titre'];
190
			$coste['titre'] = $texte['titre'];
184
			$coste['description'] = $this->mettreEnFormeCoste($texte['texte']);
191
			$coste['description'] = $this->mettreEnFormeCoste($texte['texte']);
185
		}
192
		}
186
		$this->meta->setProjet('coste');
193
		$this->meta->setProjet('coste');
187
		$meta = $this->meta->getMetaDonnees();
194
		$meta = $this->meta->getMetaDonnees();
188
		$citation = $meta[0]['citation'];
195
		$citation = $meta[0]['citation'];
189
		$coste['meta']['citation'] = $citation;
196
		$coste['meta']['citation'] = $citation;
190
		$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste');
197
		$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste');
191
		$this->donnees['coste'] = $coste;
198
		$this->donnees['coste'] = $coste;
192
	}
199
	}
193
 
200
 
194
	public function mettreEnFormeCoste($texte){
201
	public function mettreEnFormeCoste($texte){
195
		$this->CosteFormate = array();
202
		$this->CosteFormate = array();
196
		$this->CosteTexte = $texte;
203
		$this->CosteTexte = $texte;
197
		//decouper elements remarquables avant le texte
204
		//decouper elements remarquables avant le texte
198
		$this->separerNomScientifique_a_NomCommun();
205
		$this->separerNomScientifique_a_NomCommun();
199
		$this->CosteTexte = preg_replace('/\//','',$this->CosteTexte);
206
		$this->CosteTexte = preg_replace('/\//','',$this->CosteTexte);
200
		//decouper elements remarquables  après le texte
207
		//decouper elements remarquables  après le texte
201
		$this-> separerEcologie_a_Usages();
208
		$this-> separerEcologie_a_Usages();
202
		//le morceau qui reste est le gros de la description
209
		//le morceau qui reste est le gros de la description
203
		$this->CosteTexte = str_replace(';','</br> -','- '.$this->CosteTexte);
210
		$this->CosteTexte = str_replace(';','</br> -','- '.$this->CosteTexte);
204
		$this->CosteTexte = str_replace('–','',$this->CosteTexte);
211
		$this->CosteTexte = str_replace('–','',$this->CosteTexte);
205
		$this->CosteFormate['texte'] = $this->CosteTexte;
212
		$this->CosteFormate['texte'] = $this->CosteTexte;
206
		return $this->CosteFormate;
213
		return $this->CosteFormate;
207
	}
214
	}
208
 
215
 
209
 
216
 
210
	public function separerNomScientifique_a_NomCommun(){
217
	public function separerNomScientifique_a_NomCommun(){
211
		if ( preg_match('/\*\*(.+)\*\*([^–]*)–/', $this->CosteTexte, $retour)){
218
		if ( preg_match('/\*\*(.+)\*\*([^–]*)–/', $this->CosteTexte, $retour)){
212
			/* !! attention on enlève un tiret cadratin – pas un trait d'union - !! */
219
			/* !! attention on enlève un tiret cadratin – pas un trait d'union - !! */
213
			$a_enlever  = array('/–/','/\./' );
220
			$a_enlever  = array('/–/','/\./' );
214
			$this->CosteFormate['nom_scientifique'] = preg_replace($a_enlever,'',$retour[1]);
221
			$this->CosteFormate['nom_scientifique'] = preg_replace($a_enlever,'',$retour[1]);
215
			if(preg_match('/\((.+)\)/',$retour[2],$synonymes)){
222
			if(preg_match('/\((.+)\)/',$retour[2],$synonymes)){
216
				$this->CosteFormate['synonymes'] = $synonymes[1];
223
				$this->CosteFormate['synonymes'] = $synonymes[1];
217
			} else {
224
			} else {
218
				$this->CosteFormate['nom_scientifique'] .=  $retour[2];
225
				$this->CosteFormate['nom_scientifique'] .=  $retour[2];
219
			}
226
			}
220
			$this->CosteTexte = str_replace($retour[0],'',$this->CosteTexte);
227
			$this->CosteTexte = str_replace($retour[0],'',$this->CosteTexte);
221
		}
228
		}
222
		/* !! attention il y a un espace avant les // du début !! */
229
		/* !! attention il y a un espace avant les // du début !! */
223
		if ( preg_match('/^ \/\/([^\/\/]+)\/\//', $this->CosteTexte, $retour)){
230
		if ( preg_match('/^ \/\/([^\/\/]+)\/\//', $this->CosteTexte, $retour)){
224
			$a_enlever = array('/–/','/\./' );
231
			$a_enlever = array('/–/','/\./' );
225
			$this->CosteFormate['nom_commun'] = preg_replace($a_enlever,'',$retour[1]);
232
			$this->CosteFormate['nom_commun'] = preg_replace($a_enlever,'',$retour[1]);
226
			$this->CosteTexte = str_replace($retour[0],'',$this->CosteTexte);
233
			$this->CosteTexte = str_replace($retour[0],'',$this->CosteTexte);
227
		}
234
		}
228
	}
235
	}
229
 
236
 
230
 
237
 
231
	public function separerEcologie_a_Usages(){
238
	public function separerEcologie_a_Usages(){
232
		if ( preg_match('/\.[ ]*([A-ZÉÀÈ].+)$/',$this->CosteTexte, $retour)){
239
		if ( preg_match('/\.[ ]*([A-ZÉÀÈ].+)$/',$this->CosteTexte, $retour)){
233
			$this->CosteFormate['ecologie'] = $retour[1];
240
			$this->CosteFormate['ecologie'] = $retour[1];
234
			$this->CosteTexte = str_replace($retour[0],'.',$this->CosteTexte);
241
			$this->CosteTexte = str_replace($retour[0],'.',$this->CosteTexte);
235
			if (isset($this->CosteFormate['ecologie']) && preg_match('/–(.+)/', $this->CosteFormate['ecologie'] , $retour)){
242
			if (isset($this->CosteFormate['ecologie']) && preg_match('/–(.+)/', $this->CosteFormate['ecologie'] , $retour)){
236
				$this->CosteFormate['repartition'] = $retour[1];
243
				$this->CosteFormate['repartition'] = $retour[1];
237
				$this->CosteFormate['ecologie'] = str_replace($retour[0],'',$this->CosteFormate['ecologie']);
244
				$this->CosteFormate['ecologie'] = str_replace($retour[0],'',$this->CosteFormate['ecologie']);
238
			}
245
			}
239
			if (isset($this->CosteFormate['repartition']) &&  preg_match('/=(.+)$/', $this->CosteFormate['repartition'], $retour)){
246
			if (isset($this->CosteFormate['repartition']) &&  preg_match('/=(.+)$/', $this->CosteFormate['repartition'], $retour)){
240
				$this->CosteFormate['floraison'] = $retour[1];
247
				$this->CosteFormate['floraison'] = $retour[1];
241
				$this->CosteFormate['repartition'] = str_replace($retour[0],'',$this->CosteFormate['repartition']);
248
				$this->CosteFormate['repartition'] = str_replace($retour[0],'',$this->CosteFormate['repartition']);
242
			}
249
			}
243
			if (isset($this->CosteFormate['floraison']) &&  preg_match('/–(.+)$|\n(.+)$/',$this->CosteFormate['floraison'], $retour)){
250
			if (isset($this->CosteFormate['floraison']) &&  preg_match('/–(.+)$|\n(.+)$/',$this->CosteFormate['floraison'], $retour)){
244
				$this->CosteFormate['usages'] = isset($retour[1]) ? $retour[1] : $retour[2];
251
				$this->CosteFormate['usages'] = isset($retour[1]) ? $retour[1] : $retour[2];
245
				$this->CosteFormate['floraison'] = str_replace($retour[0],'.',$this->CosteFormate['floraison']);
252
				$this->CosteFormate['floraison'] = str_replace($retour[0],'.',$this->CosteFormate['floraison']);
246
			}
253
			}
247
			if (isset($this->CosteFormate['floraison']) &&  preg_match('/([Ff]l\.) (.+)/',$this->CosteFormate['floraison'], $retour)){
254
			if (isset($this->CosteFormate['floraison']) &&  preg_match('/([Ff]l\.) (.+)/',$this->CosteFormate['floraison'], $retour)){
248
				$this->CosteFormate['floraison'] = $retour[2];
255
				$this->CosteFormate['floraison'] = $retour[2];
249
				$this->CosteFormate['floraison'] = str_replace($retour[1],'',$this->CosteFormate['floraison']);
256
				$this->CosteFormate['floraison'] = str_replace($retour[1],'',$this->CosteFormate['floraison']);
250
			}
257
			}
251
			if (isset($this->CosteFormate['floraison']) &&  preg_match('/([Ff]r\.) (.+)/',$this->CosteFormate['floraison'], $retour)){
258
			if (isset($this->CosteFormate['floraison']) &&  preg_match('/([Ff]r\.) (.+)/',$this->CosteFormate['floraison'], $retour)){
252
				$this->CosteFormate['fructification'] = $retour[2];
259
				$this->CosteFormate['fructification'] = $retour[2];
253
				$this->CosteFormate['floraison'] = str_replace($retour[0],'',$this->CosteFormate['floraison']);
260
				$this->CosteFormate['floraison'] = str_replace($retour[0],'',$this->CosteFormate['floraison']);
254
				$this->CosteFormate['floraison'] = str_replace(',','',$this->CosteFormate['floraison']);
261
				$this->CosteFormate['floraison'] = str_replace(',','',$this->CosteFormate['floraison']);
255
				$this->CosteFormate['fructification'] = str_replace($retour[1],'',$this->CosteFormate['fructification']);
262
				$this->CosteFormate['fructification'] = str_replace($retour[1],'',$this->CosteFormate['fructification']);
256
				$this->CosteFormate['fructification'] = str_replace('.','',$this->CosteFormate['fructification']);
263
				$this->CosteFormate['fructification'] = str_replace('.','',$this->CosteFormate['fructification']);
257
			}
264
			}
258
		}
265
		}
259
	}
266
	}
260
}
267
}
261
?>
268
?>