Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 1294 Rev 1318
Line 159... Line 159...
159
		$resultat_infos_complementaires = $this->requeter($requete_infos_complementaires);
159
		$resultat_infos_complementaires = $this->requeter($requete_infos_complementaires);
Line 160... Line 160...
160
		
160
		
161
		return $resultat_infos_complementaires;
161
		return $resultat_infos_complementaires;
Line -... Line 162...
-
 
162
	}
-
 
163
	
-
 
164
	public function effectuerRequeteInfosComplementairesSurNumTax($numTax) {
-
 
165
		
-
 
166
		$requete_infos_complementaires = "SELECT DISTINCT en_nom_genre, en_epithete_espece, en_nom_supra_generique, en_epithete_infra_generique,".
-
 
167
                    "   auteur_bex.enaia_intitule_abrege AS abreviation_auteur_basio_ex ".
-
 
168
                    " , auteur_b.enaia_intitule_abrege AS abreviation_auteur_basio ".
-
 
169
                    " , auteur_mex.enaia_intitule_abrege AS abreviation_auteur_modif_ex ".
-
 
170
                    " , auteur_m.enaia_intitule_abrege AS abreviation_auteur_modif ".
-
 
171
                    " , en_epithete_espece, en_epithete_infra_specifique, enrg_abreviation_rang, en_id_nom" .
-
 
172
                    " FROM eflore_nom, eflore_nom_rang," .
-
 
173
                    "     eflore_naturaliste_intitule_abreviation AS auteur_bex ".
-
 
174
                    "   , eflore_naturaliste_intitule_abreviation AS auteur_b ".
-
 
175
                    "   , eflore_naturaliste_intitule_abreviation AS auteur_mex ".
-
 
176
                    "   , eflore_naturaliste_intitule_abreviation AS auteur_m ".
-
 
177
                    " , eflore_selection_nom ".
-
 
178
                    " WHERE esn_id_taxon = '".$numTax. "'".
-
 
179
                    " AND esn_id_version_projet_taxon = 25 ".
-
 
180
                    " AND esn_ce_statut=3 ".
-
 
181
                    " AND en_id_nom = esn_id_nom" .
-
 
182
                    " AND en_ce_rang = enrg_id_rang" .
-
 
183
                    " AND en_ce_auteur_basio_ex = auteur_bex.enaia_id_intitule_naturaliste_abrege ".
-
 
184
                    " AND en_ce_auteur_basio = auteur_b.enaia_id_intitule_naturaliste_abrege  ".
-
 
185
                    " AND en_ce_auteur_modif_ex = auteur_mex.enaia_id_intitule_naturaliste_abrege ".
-
 
186
                    " AND en_ce_auteur_modif = auteur_m.enaia_id_intitule_naturaliste_abrege ".
-
 
187
                    " AND esn_id_version_projet_taxon=en_id_version_projet_nom ";
-
 
188
		
-
 
189
		$resultat_infos_complementaires = $this->requeter($requete_infos_complementaires);
-
 
190
		
-
 
191
		return $resultat_infos_complementaires;
162
	}
192
	}
Line 163... Line 193...
163
	
193
	
Line 164... Line 194...
164
	public function rechercherInformationsComplementairesSurNom($nom_saisi) {
194
	public function rechercherInformationsComplementairesSurNom($nom_saisi) {
Line 252... Line 282...
252
		$presence_taxon = (is_array($resultat_presence_taxon) && count($resultat_presence_taxon) > 0);
282
		$presence_taxon = (is_array($resultat_presence_taxon) && count($resultat_presence_taxon) > 0);
Line 253... Line 283...
253
		
283
		
254
		return $presence_taxon;
284
		return $presence_taxon;
Line -... Line 285...
-
 
285
	}
-
 
286
	
-
 
287
	private function decouperNomEtRechercheEspeceOuSousEspece($identifiant_espece) {
-
 
288
		$nameparser=new NameParser();
-
 
289
		$nom_latin_decoupe=$nameparser->parse($identifiant_espece);
-
 
290
		
-
 
291
		// requete sous espece (on privilegie les noms retenu cf tri par esn_ce_statut)
-
 
292
		if (isset($nom_latin_decoupe['infra']) && $nom_latin_decoupe['infra']!="") {
-
 
293
			$requete="SELECT DISTINCT en_id_nom, esn_ce_statut" .
-
 
294
            	" FROM eflore_nom, eflore_nom_rang, eflore_selection_nom " .
-
 
295
            	" WHERE en_id_version_projet_nom = '25' AND en_nom_genre = '".$this->proteger($nom_latin_decoupe['genus'])."' " .
-
 
296
                " AND enrg_abreviation_rang = '".$this->proteger($nom_latin_decoupe['infra_type'])."' " .
-
 
297
                " AND en_epithete_infra_specifique = '".$this->proteger($nom_latin_decoupe['infra'])."' " .
-
 
298
                " AND esn_id_nom= en_id_nom ".
-
 
299
                " AND esn_id_version_projet_taxon=en_id_version_projet_nom " .
-
 
300
                " AND en_epithete_espece =  '".$this->proteger($nom_latin_decoupe['species'])."' AND en_ce_rang = enrg_id_rang " .
-
 
301
                " ORDER BY esn_ce_statut ".
-
 
302
                " LIMIT 1";
-
 
303
		}
-
 
304
		else { // espece  (on privilegie les noms retenu cf tri par esn_ce_statut)
-
 
305
			$requete="SELECT DISTINCT en_id_nom, esn_ce_statut" .
-
 
306
				" FROM eflore_nom, eflore_nom_rang, eflore_selection_nom " .
-
 
307
				" WHERE en_id_version_projet_nom = '25' AND en_nom_genre = '".$this->proteger($nom_latin_decoupe['genus'])."' " .
-
 
308
				" AND enrg_abreviation_rang = 'sp.' " .
-
 
309
				" AND esn_id_nom= en_id_nom ".
-
 
310
				" AND esn_id_version_projet_taxon=en_id_version_projet_nom " .
-
 
311
				" AND en_epithete_espece =  '".$this->proteger($nom_latin_decoupe['species'])."' AND en_ce_rang = enrg_id_rang " .
-
 
312
				" ORDER BY esn_ce_statut ".
-
 
313
				" LIMIT 1";
-
 
314
		
-
 
315
		}
-
 
316
		
-
 
317
		$resultat = $this->requeter($requete);
-
 
318
		
-
 
319
		$retour = array();
-
 
320
		if (is_array($resultat) && count($resultat) > 0) {
-
 
321
			$retour = $resultat[0];
-
 
322
		}
-
 
323
		
-
 
324
		return $resultat;
255
	}
325
	}
Line 256... Line 326...
256
	
326
	
257
	private function formaterNom($rawnom) {
327
	private function formaterNom($rawnom) {
Line 309... Line 379...
309
		    $auteurs = ' '.$auteur_basio;
379
		    $auteurs = ' '.$auteur_basio;
310
		}
380
		}
Line 311... Line 381...
311
 
381
 
312
		return $auteurs ;
382
		return $auteurs ;
-
 
383
	}
-
 
384
	
-
 
385
	function rechercherInfosSurTexteCodeOuNumTax($identifiant_espece) {
-
 
386
		// texte libre, nom scientifique, 
-
 
387
		// ou code nomenclatural (format BDNFFnn999999) 
-
 
388
		// ou code taxonomique (format BDNFFnt999999)
-
 
389
		$identifiant_espece=trim($identifiant_espece);
-
 
390
		$identifiant_espece=utf8_encode($identifiant_espece);
-
 
391
	
-
 
392
		$retour = array();
-
 
393
		
-
 
394
		preg_match('/BDNFFnn([0-9][0-9]*)/',$identifiant_espece, $elements);
-
 
395
		if (isset($elements[1])) {
-
 
396
			// Numero nomenclatural
-
 
397
			$infos_taxon = $this->rechercherInformationsComplementairesSurNumNom($elements[1]);
-
 
398
			$retour = array("nom_sel" => $this->formaterNom($infos_taxon), "en_id_nom" => $elements[1]);
-
 
399
		} else { 
-
 
400
			//  Numero taxonomique ou nom scientifique
-
 
401
			preg_match('/BDNFFnt([0-9][0-9]*)/', $identifiant_espece, $elements);
-
 
402
	
-
 
403
			if (isset($elements[1])) {
-
 
404
				// Numero taxonomique
-
 
405
				$infos_taxon = $this->effectuerRequeteInfosComplementairesSurNumTax($elements[1]);
-
 
406
				$retour = array("nom_sel" => $this->formaterNom($infos_taxon), "en_id_nom" => $infos_taxon['en_id_nom']);
-
 
407
			} else { 
-
 
408
				// Nom scientifique
-
 
409
				$id_nom = $this->decouperNomEtRechercheEspeceOuSousEspece($identifiant_espece);	
-
 
410
				// Recherche du nom associe
-
 
411
				$infos_nom = $this->effectuerRequeteInfosComplementairesSurNumNom($id_nom['en_id_nom']);
-
 
412
				if (is_array($infos_nom) && !empty($infos_nom)) {
-
 
413
					$retour = array("nom_sel" => $this->formaterNom($infos_nom), "en_id_nom" => $id_nom['en_id_nom']);
-
 
414
				} else {
-
 
415
					$retour = array("nom_sel" => $identifiant_espece);
-
 
416
				}
-
 
417
			}
-
 
418
		}
-
 
419
		return $retour;
313
	}
420
	}
314
}
421
}
315
?>
422
?>