Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 560 | Rev 580 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 560 Rev 570
Line 86... Line 86...
86
		return $chaine;
86
		return $chaine;
87
	}
87
	}
Line 88... Line 88...
88
 
88
 
89
 
-
 
90
	public function getBloc() {
89
 
91
		
90
	public function getBloc() {
92
		$donnees['titre'] = "Description de Coste";
91
		$donnees['titre'] = "Description de Coste";
93
		$description = $this->getCoste();
92
		$description = $this->getCoste();
94
		if ($description['description'] == '') {
93
		if ($description['description'] == '') {
Line 134... Line 133...
134
	private function getCoste() {
133
	private function getCoste() {
135
		$coste = array();
134
		$coste = array();
136
		$this->textes->setProjet('coste');
135
		$this->textes->setProjet('coste');
137
		$this->textes->setId('bdtfx.nn:'.$this->nomCourant->getNnr());
136
		$this->textes->setId('bdtfx.nn:'.$this->nomCourant->getNnr());
138
		$texte = $this->textes->getTexte();
137
		$texte = $this->textes->getTexte();
-
 
138
		if ($texte) {
139
		$coste['titre'] = $texte['titre'];
139
			$coste['titre'] = $texte['titre'];
-
 
140
			$texte = $this->MettreEnFormeCoste($texte['texte']);
140
		$coste['description'] = $texte['texte'];
141
			$coste['description'] = $texte ;
-
 
142
		}
141
		$this->meta->setProjet('coste');
143
		$this->meta->setProjet('coste');
142
		$meta = $this->meta->getMetaDonnees();
144
		$meta = $this->meta->getMetaDonnees();
143
		$citation = $meta[0]['citation'];
145
		$citation = $meta[0]['citation'];
144
		$coste['meta']['citation'] = $citation;
146
		$coste['meta']['citation'] = $citation;
145
		$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste');
147
		$coste['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('coste');
146
		return $coste;
148
		return $coste;
147
	}
149
	}
-
 
150
	
-
 
151
	public function MettreEnFormeCoste($texte){
-
 
152
		$resultat = array();
-
 
153
		if ( preg_match('/\*\*(.+)\*\*([^–]*)–/', $texte, $retour)){
-
 
154
		
-
 
155
			/* !! attention on enlève un tiret cadratin – pas un trait d'union - !! */
-
 
156
			$a_enlever  = array('/–/','/[0-9]+/','/\./' );
-
 
157
			$resultat['nom_scientifique'] = preg_replace($a_enlever,'',$retour[1]);
-
 
158
			$resultat['nom_scientifique'] .= $retour[2];
-
 
159
			$texte = str_replace($retour[0],'',$texte);
-
 
160
		}
-
 
161
		/* !! attention il y a un espace avant les // du début !! */
-
 
162
		if ( preg_match('/^ \/\/([^\/\/]+)\/\//', $texte, $retour)){
-
 
163
			$a_enlever = array('/–/','/\./' );
-
 
164
			$resultat['nom_commun'] = preg_replace($a_enlever,'',$retour[1]);
-
 
165
			$texte = str_replace($retour[0],'',$texte);
-
 
166
		}
-
 
167
		$texte = preg_replace('/\//','',$texte);
-
 
168
		if ( preg_match('/\.[ ]*([A-ZÉÀÈ].+)$/', $texte, $retour)){
-
 
169
			$resultat['ecologie'] = $retour[1];
-
 
170
			$texte = str_replace($retour[0],'.',$texte);
-
 
171
			if ( preg_match('/–(.+)/', $resultat['ecologie'] , $retour)){
-
 
172
				$resultat['repartition'] = $retour[1];
-
 
173
				$resultat['ecologie'] = str_replace($retour[0],'',$resultat['ecologie']);
-
 
174
			}
-
 
175
			if ( preg_match('/=(.+)$/', $resultat['repartition'], $retour)){
-
 
176
				$resultat['floraison'] = $retour[1];
-
 
177
				$resultat['repartition'] = str_replace($retour[0],'',$resultat['repartition']);
-
 
178
			}
-
 
179
			if ( preg_match('/–(.+)$/',$resultat['floraison'], $retour)){
-
 
180
				$resultat['consommation'] = $retour[1];
-
 
181
				$resultat['floraison'] = str_replace($retour[0],'.',$resultat['floraison']);
-
 
182
			}
-
 
183
		}
-
 
184
		$texte = str_replace(';','</br> -','- '.$texte);
-
 
185
		$texte = str_replace('–','',$texte);
-
 
186
		$resultat['texte'] = $texte;
-
 
187
		return $resultat;
-
 
188
	}
-
 
189
	
-
 
190
	
148
}
191
}
149
?>
192
?>
150
193