Subversion Repositories eFlore/Applications.cel

Rev

Rev 445 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 445 Rev 449
Line 27... Line 27...
27
// Resultat analyse ligne // TODO : Classe ?
27
// Resultat analyse ligne // TODO : Classe ?
28
define('LIGNE_VIDE',1); //  
28
define('LIGNE_VIDE',1); //  
29
define('LIGNE_NORMALE',2); //  
29
define('LIGNE_NORMALE',2); //  
30
define('LIGNE_IMAGE_SEULEMENT',3); //  
30
define('LIGNE_IMAGE_SEULEMENT',3); //  
Line -... Line 31...
-
 
31
 
-
 
32
include_once('Decoupage.class.php'); // TODO : Autoload
Line 31... Line 33...
31
 
33
include_once('DecoupageNomLatin.class.php');
Line 32... Line 34...
32
 
34
 
Line 312... Line 314...
312
function traiterDateObs($dateobs) { // verifier jj/mm/aaaa sinon date vide TODO 
314
function traiterDateObs($dateobs) { // verifier jj/mm/aaaa sinon date vide TODO 
313
	echo "traitement dateobs";
315
	echo "traitement dateobs";
314
	return ltrim($notes);
316
	return ltrim($notes);
315
}
317
}
Line 316... Line 318...
316
 
318
 
317
function traiterEspece($identifiant_espece) {  // texte libre, nom latin, ou code nomenclatural (format BDNFFnn999999)
319
function traiterEspece($identifiant_espece) {  // texte libre, nom scientifique , ou code nomenclatural (format BDNFFnn999999)
-
 
320
 
318
/*
321
	echo "traitement  espece";
Line 319... Line 322...
319
        $identifiant_espece=ltrim($identifiant_espece);
322
        $identifiant_espece=ltrim($identifiant_espece);
Line 320... Line 323...
320
 
323
 
321
        $identifiant_espece=utf8_encode($identifiant_espece); // FIXME : devrait deja etre en utf8 a ce niveau
-
 
Line -... Line 324...
-
 
324
        $identifiant_espece=utf8_encode($identifiant_espece); // FIXME : devrait deja etre en utf8 a ce niveau
-
 
325
 
-
 
326
	preg_match('/BDNFFnn([0-9][0-9]*)/',$identifiant_espece,$elements);
-
 
327
 
-
 
328
		if ($elements[1]) { // Numero nomenclatural 
-
 
329
 
-
 
330
	 	$DB=$this->connectDB($this->config);
-
 
331
 
-
 
332
                    $query = "SELECT DISTINCT en_nom_genre, en_epithete_espece, en_nom_supra_generique, en_epithete_infra_generique,".
-
 
333
                                        "   auteur_bex.enaia_intitule_abrege AS abreviation_auteur_basio_ex ".
-
 
334
                                        " , auteur_b.enaia_intitule_abrege AS abreviation_auteur_basio ".
-
 
335
                                        " , auteur_mex.enaia_intitule_abrege AS abreviation_auteur_modif_ex ".
-
 
336
                                        " , auteur_m.enaia_intitule_abrege AS abreviation_auteur_modif ".
-
 
337
                                        " , en_epithete_espece, en_epithete_infra_specifique, enrg_abreviation_rang, en_id_nom" .
-
 
338
                                        " FROM eflore_nom, eflore_nom_rang, eflore_selection_nom a,  " .
-
 
339
                                        "         eflore_naturaliste_intitule_abreviation AS auteur_bex ".
-
 
340
                                            "   , eflore_naturaliste_intitule_abreviation AS auteur_b ".
-
 
341
                                            "   , eflore_naturaliste_intitule_abreviation AS auteur_mex ".
-
 
342
                                            "   , eflore_naturaliste_intitule_abreviation AS auteur_m ".
-
 
343
                             " WHERE a.esn_id_nom= '".$elements[1]. "'".
-
 
344
                             " AND a.esn_id_version_projet_taxon = 25 ".
-
 
345
                             " AND en_ce_rang = enrg_id_rang" .
-
 
346
                             " AND en_id_nom = a.esn_id_nom" .
322
 
347
                             " AND en_ce_auteur_basio_ex = auteur_bex.enaia_id_intitule_naturaliste_abrege ".
-
 
348
	                     " AND en_ce_auteur_basio = auteur_b.enaia_id_intitule_naturaliste_abrege  ".
-
 
349
        	             " AND en_ce_auteur_modif_ex = auteur_mex.enaia_id_intitule_naturaliste_abrege ".
-
 
350
                	     " AND en_ce_auteur_modif = auteur_m.enaia_id_intitule_naturaliste_abrege ".
-
 
351
                             " AND a.esn_id_version_projet_taxon=en_id_version_projet_nom ";
-
 
352
		}
-
 
353
 
-
 
354
		else { // Nom scientifique
-
 
355
 
-
 
356
 
-
 
357
			$decoupageNomLatin=new DecoupageNomLatin();
-
 
358
			$nom_latin_decoupe=$decoupageNomLatin->decouper($identifiant_espece);
-
 
359
			print_r($nom_latin_decoupe);
-
 
360
			
-
 
361
/*
-
 
362
 
-
 
363
    [nom_genre] => Acer
-
 
364
    [nom_sp] => monspessulanum
-
 
365
    [auteur_sp] => 
-
 
366
    [nom_complement] => 
-
 
367
    [type_infrasp] => 
-
 
368
    [nom_infrasp] => 
-
 
369
    [num_nomenc] => 
-
 
370
    [num_taxo] => 
-
 
371
    [rang_taxonomique] => 250
-
 
372
    [nom_courant] => monspessulanum
-
 
373
    [nom_superieur] => Acer
-
 
374
    [agg] => 
-
 
375
    [nom_complet] => Acer monspessulanum
-
 
376
 
-
 
377
/*
-
 
378
 
-
 
379
  [nom_genre] => Acer
-
 
380
    [nom_sp] => monspessulanum
-
 
381
    [auteur_sp] => 
-
 
382
    [nom_complement] => 
-
 
383
    [type_infrasp] => subsp.
-
 
384
    [nom_infrasp] => monspessulanum
-
 
385
    [num_nomenc] => 
-
 
386
    [num_taxo] => 
-
 
387
    [rang_taxonomique] => 280
Line 323... Line -...
323
	preg_match('/B(.*)\((.*)\)/',$identifiant_commune,$elements);
-
 
-
 
388
    [nom_courant] => monspessulanum
-
 
389
    [nom_superieur] => monspessulanum
-
 
390
    [agg] => 
-
 
391
    [nom_complet] => Acer monspessulanum subsp. monspessulanum
324
	preg_match('/(.*)\((.*)\)/',$identifiant_commune,$elements);
392
 
325
 
393
*/
326
        $DB=$this->connectDB($this->config,'database_cel'); // FIXME regarder si opportun ici
394
/*
327
 
395
 
328
	if ($elements[1]) { // departeme
396
 
329
                      $query="SELECT DISTINCT en_nom_genre, en_epithete_espece, en_nom_supra_generique, en_epithete_infra_generique,".
397
                      	$query="SELECT DISTINCT en_nom_genre, en_epithete_espece, en_nom_supra_generique, en_epithete_infra_generique,".
Line 336... Line 404...
336
                                        "         eflore_naturaliste_intitule_abreviation AS auteur_bex ".
404
                                        "         eflore_naturaliste_intitule_abreviation AS auteur_bex ".
337
                                        "   , eflore_naturaliste_intitule_abreviation AS auteur_b ".
405
                                        "   , eflore_naturaliste_intitule_abreviation AS auteur_b ".
338
                                        "   , eflore_naturaliste_intitule_abreviation AS auteur_mex ".
406
                                        "   , eflore_naturaliste_intitule_abreviation AS auteur_mex ".
339
                                        "   , eflore_naturaliste_intitule_abreviation AS auteur_m ".
407
                                        "   , eflore_naturaliste_intitule_abreviation AS auteur_m ".
340
                                "   , eflore_selection_nom".
408
                                "   , eflore_selection_nom".
341
                                        " WHERE en_id_version_projet_nom = '25' AND en_nom_genre LIKE '".$DB->escapeSimple($genre)."%' " .
409
                                        " WHERE en_id_version_projet_nom = '25' AND en_nom_genre = '".$DB->escapeSimple($nom_latin_decoupe['nom_genre'])."' " .
342
                                        " AND en_ce_rang > 160 " .
410
                                        " AND en_ce_rang = '".$DB->escapeSimple($nom_latin_decoupe['rang_taxonomique'])."' " .
343
                                        " AND en_epithete_espece like '".$DB->escapeSimple($espece)."%' AND en_ce_rang = enrg_id_rang " .
411
                                        " AND en_epithete_espece =  '".$DB->escapeSimple($nom_latin_decoupe['nom_sp'])."' AND en_ce_rang = enrg_id_rang " .
344
                                        " AND en_ce_auteur_basio_ex = auteur_bex.enaia_id_intitule_naturaliste_abrege ".
412
                                        " AND en_ce_auteur_basio_ex = auteur_bex.enaia_id_intitule_naturaliste_abrege ".
345
                                        " AND en_ce_auteur_basio = auteur_b.enaia_id_intitule_naturaliste_abrege  ".
413
                                        " AND en_ce_auteur_basio = auteur_b.enaia_id_intitule_naturaliste_abrege  ".
346
                                        " AND en_ce_auteur_modif_ex = auteur_mex.enaia_id_intitule_naturaliste_abrege ".
414
                                        " AND en_ce_auteur_modif_ex = auteur_mex.enaia_id_intitule_naturaliste_abrege ".
347
                                        " AND en_ce_auteur_modif = auteur_m.enaia_id_intitule_naturaliste_abrege ".
415
                                        " AND en_ce_auteur_modif = auteur_m.enaia_id_intitule_naturaliste_abrege ".
348
                                        " AND esn_id_version_projet_taxon=en_id_version_projet_nom " .
416
                                        " AND esn_id_version_projet_taxon=en_id_version_projet_nom " .
349
                                        " AND esn_id_nom= en_id_nom ".
417
                                        " AND esn_id_nom= en_id_nom ".
350
                                        " ORDER BY esn_ce_statut, en_ce_rang, en_epithete_espece, en_nom_genre LIMIT 50";
418
                                        " ORDER BY esn_ce_statut, en_ce_rang, en_epithete_espece, en_nom_genre LIMIT 50";
Line 351... Line -...
351
 
-
 
352
 
-
 
353
 
-
 
354
	echo "traitement  espece";
419
 
-
 
420
*/
-
 
421
			}
355
*/
422
 
Line 356... Line 423...
356
}
423
}
357
 
424
 
358
 
425
 
Line -... Line 426...
-
 
426
 
-
 
427
function traiterImage($image) { // recherche id image de ce nom et creation table correspondance
-
 
428
	echo "traitement  image";
-
 
429
}
-
 
430
 
-
 
431
 
-
 
432
// utilitaire : FIXME mutualiser avec autres scripts
-
 
433
 
-
 
434
function formaterNom($rawnom) {
-
 
435
                // Constitution du nom:
-
 
436
                $nom = '';
-
 
437
 
-
 
438
                if ($rawnom['en_nom_supra_generique'] != '') {
-
 
439
                    $nom .= $rawnom['en_nom_supra_generique'];
-
 
440
                } else if ($rawnom['en_epithete_infra_generique'] != '') {
-
 
441
                    $nom .= $rawnom['en_epithete_infra_generique'];
-
 
442
                } else {
-
 
443
                        if ($rawnom['en_nom_genre'] != '') {
-
 
444
                            $nom .=  $rawnom['en_nom_genre'];
-
 
445
                        }
-
 
446
                        if ($rawnom['en_epithete_espece']!= '') {
-
 
447
                            $nom .= ' '.$rawnom['en_epithete_espece'];
-
 
448
                        }
-
 
449
                        if ($rawnom['en_epithete_infra_specifique'] != '') {
-
 
450
                                if (!empty($rawnom['enrg_abreviation_rang'])) {
-
 
451
                                        $nom .= ' '.$rawnom['enrg_abreviation_rang'].'';
-
 
452
                                }
-
 
453
                                $nom .= ' '.$rawnom['en_epithete_infra_specifique'];
-
 
454
                        }
-
 
455
 
-
 
456
                }
-
 
457
                return $nom.$this->retournerAuteur($rawnom) ;
-
 
458
}
-
 
459
 
-
 
460
function retournerAuteur($rawnom) {
-
 
461
	$auteurs = '';
-
 
462
	$auteur_basio = '';
-
 
463
	$auteur_modif = '';
-
 
464
	if (!empty($rawnom['abreviation_auteur_basio_ex']) && $rawnom['abreviation_auteur_basio_ex']!='-' )  {
-
 
465
	    $auteur_basio .= $rawnom['abreviation_auteur_basio_ex'];
-
 
466
	    if (!empty($rawnom['abreviation_auteur_basio']) && $rawnom['abreviation_auteur_basio']!='-') {
-
 
467
		$auteur_basio .= ' ex '.$rawnom['abreviation_auteur_basio'];
-
 
468
	    }
-
 
469
	} else if (!empty($rawnom['abreviation_auteur_basio']) && $rawnom['abreviation_auteur_basio']!='-') {
-
 
470
	    $auteur_basio .= $rawnom['abreviation_auteur_basio'];
-
 
471
	}
-
 
472
 
-
 
473
	if (!empty($rawnom['abreviation_auteur_modif_ex']) && $rawnom['abreviation_auteur_modif_ex']!='-') {
-
 
474
	    $auteur_modif .= $rawnom['abreviation_auteur_modif_ex'];
-
 
475
	    if (!empty($rawnom['abreviation_auteur_modif']) && $rawnom['abreviation_auteur_modif']!='-') {
-
 
476
		$auteur_modif .= ' ex '.$rawnom['abreviation_auteur_modif'];
-
 
477
	    }
-
 
478
	} else if (!empty($rawnom['abreviation_auteur_modif']) && $rawnom['abreviation_auteur_modif']!='-')  {
-
 
479
	    $auteur_modif .= $rawnom['abreviation_auteur_modif'];
-
 
480
	}
-
 
481
 
-
 
482
	if (!empty($auteur_modif)) {
-
 
483
	    $auteurs = ' ('.$auteur_basio.') '.$auteur_modif;
-
 
484
	} elseif (!empty($auteur_basio)) {
Line 359... Line 485...
359
 
485
	    $auteurs = ' '.$auteur_basio;