Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 1062 Rev 1092
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['type'] = $base;
84
						$this->donnees['type'] = $base;
85
						$this->donnees['titre'] = "Description de ".ucfirst($base);
85
						$this->donnees['titre'] = "Description de ".ucfirst($base);
86
						$this->donnees['description'] = $this->donnees[$base]['description'];
86
						$this->donnees['description'] = $this->donnees[$base]['description'];
87
						unset($this->donnees[$base]);
87
						unset($this->donnees[$base]);
88
						break;
88
						break;
89
					}
89
					}
90
				}
90
				}
91
			}
91
			}
92
		}
92
		}
93
	
93
	
94
		if (empty($this->donnees['description'])) {
94
		if (empty($this->donnees['description'])) {
95
			$this->getWikini();
95
			$this->getWikini();
96
			$this->donnees['description'] = $this->donnees['wikini']['description'];
96
			$this->donnees['description'] = $this->donnees['wikini']['description'];
97
			$this->donnees['titre'] = "Description collaborative";
97
			$this->donnees['titre'] = "Description collaborative";
98
		}
98
		}
99
	
99
	
100
		return $this->donnees;
100
		return $this->donnees;
101
	}
101
	}
102
 
102
 
103
	private function getBaseflor() {
103
	private function getBaseflor() {
104
		$baseflor = array();
104
		$baseflor = array();
105
		$this->informations ->setProjet('baseflor');
105
		$this->informations ->setProjet('baseflor');
106
		$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
106
		$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
107
		$this->informations ->setNum_nom($this->nomCourant->getNnr());
107
		$this->informations ->setNum_nom($this->nomCourant->getNnr());
108
		$informations = $this->informations->getInformationsDescription();
108
		$informations = $this->informations->getInformationsDescription();
109
		if ($informations){
109
		if ($informations){
110
			$baseflor['chorologie'] = isset($informations['chorologie']) ? $informations['chorologie'] : '';
110
			$baseflor['chorologie'] = isset($informations['chorologie']) ? $informations['chorologie'] : '';
111
			$baseflor['inflorescence'] = isset($informations['inflorescence']) ? $informations['inflorescence'] : '';
111
			$baseflor['inflorescence'] = isset($informations['inflorescence']) ? $informations['inflorescence'] : '';
112
			$baseflor['sexualite'] = isset($informations['sexualite']) ? $informations['sexualite'] : '';
112
			$baseflor['sexualite'] = isset($informations['sexualite']) ? $informations['sexualite'] : '';
113
			$baseflor['ordre_maturation'] = isset($informations['ordre_maturation']) ? $informations['ordre_maturation'] : '';
113
			$baseflor['ordre_maturation'] = isset($informations['ordre_maturation']) ? $informations['ordre_maturation'] : '';
114
			$baseflor['pollinisation'] = isset($informations['pollinisation']) ? $informations['pollinisation'] : '';
114
			$baseflor['pollinisation'] = isset($informations['pollinisation']) ? $informations['pollinisation'] : '';
115
			$baseflor['dissemination'] = isset($informations['dissemination']) ? $informations['dissemination'] : '';
115
			$baseflor['dissemination'] = isset($informations['dissemination']) ? $informations['dissemination'] : '';
116
			$baseflor['fruit'] = isset($informations['fruit']) ? $informations['fruit'] : '';
116
			$baseflor['fruit'] = isset($informations['fruit']) ? $informations['fruit'] : '';
117
			$baseflor['couleur_fleur'] = isset($informations['couleur_fleur']) ? $informations['couleur_fleur'] : '';
117
			$baseflor['couleur_fleur'] = isset($informations['couleur_fleur']) ? $informations['couleur_fleur'] : '';
118
			$baseflor['macule'] = isset($informations['macule']) ? $informations['macule'] : '';
118
			$baseflor['macule'] = isset($informations['macule']) ? $informations['macule'] : '';
119
			$baseflor['floraison'] = isset($informations['floraison']) ? $this->changerFloraisonEnChaine($informations['floraison']) : '';
119
			$baseflor['floraison'] = isset($informations['floraison']) ? $this->changerFloraisonEnChaine($informations['floraison']) : '';
120
			//récupérer dans ontologies
120
			//récupérer dans ontologies
121
			$baseflor['type_bio'] = isset($informations['type_bio']) ? $informations['type_bio'] : '';
121
			$baseflor['type_bio'] = isset($informations['type_bio']) ? $informations['type_bio'] : '';
122
			$baseflor['form_vegetale'] = isset($informations['form_vegetale']) ? $informations['form_vegetale'] : '';
122
			$baseflor['form_vegetale'] = isset($informations['form_vegetale']) ? $informations['form_vegetale'] : '';
123
			$baseflor['description']=$baseflor;
123
			$baseflor['description']=$baseflor;
124
			$this->meta->setProjet('baseflor');
124
			$this->meta->setProjet('baseflor');
125
			$meta = $this->meta->getMetaDonnees();
125
			$meta = $this->meta->getMetaDonnees();
126
			$citation = $meta[0]['citation'];
126
			$citation = $meta[0]['citation'];
127
			$baseflor['meta']['citation'] = $citation;
127
			$baseflor['meta']['citation'] = $citation;
128
			$baseflor['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseflor');
128
			$baseflor['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseflor');
129
		}
129
		}
130
		$this->donnees['baseflor'] = $baseflor;
130
		$this->donnees['baseflor'] = $baseflor;
131
	}
131
	}
132
 
132
 
133
	public function changerFloraisonEnChaine($floraison){
133
	public function changerFloraisonEnChaine($floraison){
134
		$chaine = "";
134
		$chaine = "";
135
		if ($floraison != ""){
135
		if ($floraison != ""){
136
			$mois_fleurs=preg_match('/-/',$floraison) ? preg_split('/-/',$floraison) : $floraison;
136
			$mois_fleurs=preg_match('/-/',$floraison) ? preg_split('/-/',$floraison) : $floraison;
137
			if (is_array($mois_fleurs)){
137
			if (is_array($mois_fleurs)){
138
				$chaine = "de ".$this->mois[(int)$mois_fleurs[0]]." à ".$this->mois[(int)$mois_fleurs[1]];
138
				$chaine = "de ".$this->mois[(int)$mois_fleurs[0]]." à ".$this->mois[(int)$mois_fleurs[1]];
139
 
139
 
140
			}else { $chaine = "en ".$this->mois[(int)$mois_fleurs];
140
			}else { $chaine = "en ".$this->mois[(int)$mois_fleurs];
141
			}
141
			}
142
		}
142
		}
143
		return $chaine;
143
		return $chaine;
144
	}
144
	}
145
	
145
	
146
	public function getUrlWikipedia() {
146
	public function getUrlWikipedia() {
147
		if(!isset($this->donnees['wp'])) {
147
		if(!isset($this->donnees['wp'])) {
148
			$this->getWikipedia();
148
			$this->getWikipedia();
149
		}
149
		}
150
		return $this->donnees['wp'];
150
		return $this->donnees['wp'];
151
	}
151
	}
152
 
152
 
153
	public function getWikipedia() {
153
	public function getWikipedia() {
154
		$wp = array();
154
		$wp = array();
155
		$this->textes->setProjet('wikipedia');
155
		$this->textes->setProjet('wikipedia');
156
		$this->textes->setId($this->getIdWp());
156
		$this->textes->setId($this->getIdWp());
157
		$wp['titre'] = $donnees['titre'] = "Description de wikipedia";
157
		$wp['titre'] = $donnees['titre'] = "Description de wikipedia";
158
		$wp['lien'] = $this->textes->getPageUrl();
158
		$wp['lien'] = $this->textes->getPageUrl();
159
		$wp['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('wikipedia');
159
		$wp['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('wikipedia');
160
		$this->donnees['wp'] = $wp;
160
		$this->donnees['wp'] = $wp;
161
	}
161
	}
162
 
162
 
163
	private function getIdWp() {
163
	private function getIdWp() {
164
		$nomSci = $this->nomCourant->getNomRetenu()->get('nom_sci');
164
		$nomSci = $this->nomCourant->getNomRetenu()->get('nom_sci');
165
		$idWp = str_replace(' ', '_', $nomSci);
165
		$idWp = str_replace(' ', '_', $nomSci);
166
		$idWp = urlencode($idWp);
166
		$idWp = urlencode($idWp);
167
		return $idWp;
167
		return $idWp;
168
	}
168
	}
169
 
169
 
170
	private function getWikini() {
170
	private function getWikini() {
171
		$wikini = array();
171
		$wikini = array();
172
		$wikini['titre'] = 'Wikini';
172
		$wikini['titre'] = 'Wikini';
173
		$referentiel = $this->conteneur->getParametre('referentiel');
173
		$referentiel = $this->conteneur->getParametre('referentiel');
174
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
174
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
175
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
175
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
176
		$wikini['description'] = $this->wikini->getTexteFormate($page_wiki, 'description');
176
		$wikini['description'] = $this->wikini->getTexteFormate($page_wiki, 'description');
177
		$this->donnees['wikini'] = $wikini;
177
		$this->donnees['wikini'] = $wikini;
178
	}
178
	}
179
	
179
	
180
	public function getLienWikini() {
180
	public function getLienWikini() {
181
		$referentiel = $this->conteneur->getParametre('referentiel');
181
		$referentiel = $this->conteneur->getParametre('referentiel');
182
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
182
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
183
		return $this->wikini->getUrlPageWiki($referentiel, $num_tax);
183
		return $this->wikini->getUrlPageWiki($referentiel, $num_tax);
184
	}
184
	}
185
 
185
 
186
	private function getCoste() {
186
	private function getCoste() {
187
		$coste = array();
187
		$coste = array();
188
		$this->textes->setProjet('coste');
188
		$this->textes->setProjet('coste');
189
		$this->textes->setId('bdtfx.nn:'.$this->nomCourant->getNnr());
189
		$this->textes->setId('bdtfx.nn:'.$this->nomCourant->getNnr());
190
		$texte = $this->textes->getTexte();
190
		$texte = $this->textes->getTexte();
-
 
191
		$texte = array_pop($texte['resultats']);
191
		if ($texte) {
192
		if ($texte) {
192
			$coste['titre'] = $texte['titre'];
193
			$coste['titre'] = $texte['titre'];
193
			$coste['description'] = $this->mettreEnFormeCoste($texte['texte']);
194
			$coste['description'] = $this->mettreEnFormeCoste($texte['texte']);
194
		}
195
		}
195
		$this->meta->setProjet('coste');
196
		$this->meta->setProjet('coste');
196
		$meta = $this->meta->getMetaDonnees();
197
		$meta = $this->meta->getMetaDonnees();
197
		$citation = $meta[0]['citation'];
198
		$citation = $meta[0]['citation'];
198
		$coste['meta']['citation'] = $citation;
199
		$coste['meta']['citation'] = $citation;
199
		$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste');
200
		$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste');
200
		$this->donnees['coste'] = $coste;
201
		$this->donnees['coste'] = $coste;
201
	}
202
	}
202
 
203
 
203
	public function mettreEnFormeCoste($texte){
204
	public function mettreEnFormeCoste($texte){
204
		$this->CosteFormate = array();
205
		$this->CosteFormate = array();
205
		$this->CosteTexte = $texte;
206
		$this->CosteTexte = $texte;
206
		//decouper elements remarquables avant le texte
207
		//decouper elements remarquables avant le texte
207
		$this->separerNomScientifique_a_NomCommun();
208
		$this->separerNomScientifique_a_NomCommun();
208
		$this->CosteTexte = preg_replace('/\//','',$this->CosteTexte);
209
		$this->CosteTexte = preg_replace('/\//','',$this->CosteTexte);
209
		//decouper elements remarquables  après le texte
210
		//decouper elements remarquables  après le texte
210
		$this-> separerEcologie_a_Usages();
211
		$this-> separerEcologie_a_Usages();
211
		//le morceau qui reste est le gros de la description
212
		//le morceau qui reste est le gros de la description
212
		$this->CosteTexte = str_replace(';','</br> -','- '.$this->CosteTexte);
213
		$this->CosteTexte = str_replace(';','</br> -','- '.$this->CosteTexte);
213
		$this->CosteTexte = str_replace('–','',$this->CosteTexte);
214
		$this->CosteTexte = str_replace('–','',$this->CosteTexte);
214
		$this->CosteFormate['texte'] = $this->CosteTexte;
215
		$this->CosteFormate['texte'] = $this->CosteTexte;
215
		return $this->CosteFormate;
216
		return $this->CosteFormate;
216
	}
217
	}
217
 
218
 
218
 
219
 
219
	public function separerNomScientifique_a_NomCommun(){
220
	public function separerNomScientifique_a_NomCommun(){
220
		if ( preg_match('/\*\*(.+)\*\*([^–]*)–/', $this->CosteTexte, $retour)){
221
		if ( preg_match('/\*\*(.+)\*\*([^–]*)–/', $this->CosteTexte, $retour)){
221
			/* !! attention on enlève un tiret cadratin – pas un trait d'union - !! */
222
			/* !! attention on enlève un tiret cadratin – pas un trait d'union - !! */
222
			$a_enlever  = array('/–/','/\./' );
223
			$a_enlever  = array('/–/','/\./' );
223
			$this->CosteFormate['nom_scientifique'] = preg_replace($a_enlever,'',$retour[1]);
224
			$this->CosteFormate['nom_scientifique'] = preg_replace($a_enlever,'',$retour[1]);
224
			if(preg_match('/\((.+)\)/',$retour[2],$synonymes)){
225
			if(preg_match('/\((.+)\)/',$retour[2],$synonymes)){
225
				$this->CosteFormate['synonymes'] = $synonymes[1];
226
				$this->CosteFormate['synonymes'] = $synonymes[1];
226
			} else {
227
			} else {
227
				$this->CosteFormate['nom_scientifique'] .=  $retour[2];
228
				$this->CosteFormate['nom_scientifique'] .=  $retour[2];
228
			}
229
			}
229
			$this->CosteTexte = str_replace($retour[0],'',$this->CosteTexte);
230
			$this->CosteTexte = str_replace($retour[0],'',$this->CosteTexte);
230
		}
231
		}
231
		/* !! attention il y a un espace avant les // du début !! */
232
		/* !! attention il y a un espace avant les // du début !! */
232
		if ( preg_match('/^ \/\/([^\/\/]+)\/\//', $this->CosteTexte, $retour)){
233
		if ( preg_match('/^ \/\/([^\/\/]+)\/\//', $this->CosteTexte, $retour)){
233
			$a_enlever = array('/–/','/\./' );
234
			$a_enlever = array('/–/','/\./' );
234
			$this->CosteFormate['nom_commun'] = preg_replace($a_enlever,'',$retour[1]);
235
			$this->CosteFormate['nom_commun'] = preg_replace($a_enlever,'',$retour[1]);
235
			$this->CosteTexte = str_replace($retour[0],'',$this->CosteTexte);
236
			$this->CosteTexte = str_replace($retour[0],'',$this->CosteTexte);
236
		}
237
		}
237
	}
238
	}
238
 
239
 
239
 
240
 
240
	public function separerEcologie_a_Usages(){
241
	public function separerEcologie_a_Usages(){
241
		if ( preg_match('/\.[ ]*([A-ZÉÀÈ].+)$/',$this->CosteTexte, $retour)){
242
		if ( preg_match('/\.\s*([A-ZÉÀÈ].+)$/',$this->CosteTexte, $retour)){
242
			$this->CosteFormate['ecologie'] = $retour[1];
243
			$this->CosteFormate['ecologie'] = $retour[1];
243
			$this->CosteTexte = str_replace($retour[0],'.',$this->CosteTexte);
244
			$this->CosteTexte = str_replace($retour[0],'.',$this->CosteTexte);
244
			if (isset($this->CosteFormate['ecologie']) && preg_match('/–(.+)/', $this->CosteFormate['ecologie'] , $retour)){
245
			if (isset($this->CosteFormate['ecologie']) && preg_match('/–(.+)/', $this->CosteFormate['ecologie'] , $retour)){
245
				$this->CosteFormate['repartition'] = $retour[1];
246
				$this->CosteFormate['repartition'] = $retour[1];
246
				$this->CosteFormate['ecologie'] = str_replace($retour[0],'',$this->CosteFormate['ecologie']);
247
				$this->CosteFormate['ecologie'] = str_replace($retour[0],'',$this->CosteFormate['ecologie']);
247
			}
248
			}
248
			if (isset($this->CosteFormate['repartition']) &&  preg_match('/=(.+)$/', $this->CosteFormate['repartition'], $retour)){
249
			if (isset($this->CosteFormate['repartition']) &&  preg_match('/=(.+)$/', $this->CosteFormate['repartition'], $retour)){
249
				$this->CosteFormate['floraison'] = $retour[1];
250
				$this->CosteFormate['floraison'] = $retour[1];
250
				$this->CosteFormate['repartition'] = str_replace($retour[0],'',$this->CosteFormate['repartition']);
251
				$this->CosteFormate['repartition'] = str_replace($retour[0],'',$this->CosteFormate['repartition']);
251
			}
252
			}
252
			if (isset($this->CosteFormate['floraison']) &&  preg_match('/–(.+)$|\n(.+)$/',$this->CosteFormate['floraison'], $retour)){
253
			if (isset($this->CosteFormate['floraison']) &&  preg_match('/–(.+)$|\n(.+)$/',$this->CosteFormate['floraison'], $retour)){
253
				$this->CosteFormate['usages'] = isset($retour[1]) ? $retour[1] : $retour[2];
254
				$this->CosteFormate['usages'] = isset($retour[1]) ? $retour[1] : $retour[2];
254
				$this->CosteFormate['floraison'] = str_replace($retour[0],'.',$this->CosteFormate['floraison']);
255
				$this->CosteFormate['floraison'] = str_replace($retour[0],'.',$this->CosteFormate['floraison']);
255
			}
256
			}
256
			if (isset($this->CosteFormate['floraison']) &&  preg_match('/([Ff]l\.) (.+)/',$this->CosteFormate['floraison'], $retour)){
257
			if (isset($this->CosteFormate['floraison']) &&  preg_match('/([Ff]l\.) (.+)/',$this->CosteFormate['floraison'], $retour)){
257
				$this->CosteFormate['floraison'] = $retour[2];
258
				$this->CosteFormate['floraison'] = $retour[2];
258
				$this->CosteFormate['floraison'] = str_replace($retour[1],'',$this->CosteFormate['floraison']);
259
				$this->CosteFormate['floraison'] = str_replace($retour[1],'',$this->CosteFormate['floraison']);
259
			}
260
			}
260
			if (isset($this->CosteFormate['floraison']) &&  preg_match('/([Ff]r\.) (.+)/',$this->CosteFormate['floraison'], $retour)){
261
			if (isset($this->CosteFormate['floraison']) &&  preg_match('/([Ff]r\.) (.+)/',$this->CosteFormate['floraison'], $retour)){
261
				$this->CosteFormate['fructification'] = $retour[2];
262
				$this->CosteFormate['fructification'] = $retour[2];
262
				$this->CosteFormate['floraison'] = str_replace($retour[0],'',$this->CosteFormate['floraison']);
263
				$this->CosteFormate['floraison'] = str_replace($retour[0],'',$this->CosteFormate['floraison']);
263
				$this->CosteFormate['floraison'] = str_replace(',','',$this->CosteFormate['floraison']);
264
				$this->CosteFormate['floraison'] = str_replace(',','',$this->CosteFormate['floraison']);
264
				$this->CosteFormate['fructification'] = str_replace($retour[1],'',$this->CosteFormate['fructification']);
265
				$this->CosteFormate['fructification'] = str_replace($retour[1],'',$this->CosteFormate['fructification']);
265
				$this->CosteFormate['fructification'] = str_replace('.','',$this->CosteFormate['fructification']);
266
				$this->CosteFormate['fructification'] = str_replace('.','',$this->CosteFormate['fructification']);
266
			}
267
			}
267
		}
268
		}
268
	}
269
	}
269
}
270
}
270
?>
271
?>