Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

Rev 158 Rev 295
Line 383... Line 383...
383
	}
383
	}
Line 384... Line 384...
384
	
384
	
385
	public function formaterIdSuperieur($resultat, $version) {
385
	public function formaterIdSuperieur($resultat, $version) {
386
		$this->recupererTableSignification('correspondance_champs,champs_api,champs_comp');
386
		$this->recupererTableSignification('correspondance_champs,champs_api,champs_comp');
-
 
387
		$tab_relation = null; //si il n'existe aucune relation
387
		$tab_relation = null; //si il n'existe aucune relation
388
		$taxon_sup_traites = array();
388
		if (($resultat) != '' ) { 
389
		if (($resultat) != '' ) { 
389
			//on recupere d'abord les rangs supérieurs
390
			//on recupere d'abord les rangs supérieurs
390
			$sup = $resultat[0];
391
			$sup = $resultat[0];
391
			do {
392
			do {
-
 
393
				$sup = $this->recupererIdSuperieur($sup['num_tax_sup'], $version); 
-
 
394
				if(!in_array($sup['num_nom'], $taxon_sup_traites)) {
-
 
395
					$taxon_sup_traites[] = $sup['num_nom'];
-
 
396
				} else {
-
 
397
					$sup = null;
392
				$sup = $this->recupererIdSuperieur($sup['num_tax_sup'], $version); 
398
				}
393
				if ($sup['rang'] == '0') $sup['rang'] = '10'; //erreur dans la base
399
				if ($sup['rang'] == '0') $sup['rang'] = '10'; //erreur dans la base
394
				if (isset($sup)) $resultat[] = $sup;
400
				if (isset($sup)) $resultat[] = $sup;
395
			} while ($sup != null);
401
			} while ($sup != null);
396
			krsort($resultat);
402
			krsort($resultat);
Line 399... Line 405...
399
				$this->resultat_req = $tab;
405
				$this->resultat_req = $tab;
400
				$num = $tab['num_nom'];
406
				$num = $tab['num_nom'];
401
				$this->afficherNomHrefRetenu($tab, $num);
407
				$this->afficherNomHrefRetenu($tab, $num);
402
				$this->afficherDonnees('rang', $tab['rang']);	
408
				$this->afficherDonnees('rang', $tab['rang']);	
403
				$tab_inf[$num] = $this->table_retour;
409
				$tab_inf[$num] = $this->table_retour;
-
 
410
				$tab_inf[$num]['num_nom'] = $tab['num_nom'];
404
				$this->table_retour = array();
411
				$this->table_retour = array();
405
			}
412
			}
-
 
413
			
406
			$tab_relation[$this->num_nom_taxon] = $tab_inf;
414
			$tab_relation[$this->num_nom_taxon] = $tab_inf;
407
		} 
415
		}
408
		return $tab_relation;
416
		return $tab_relation;
409
	}
417
	}
Line 410... Line 418...
410
	
418
	
411
	
419
	
412
	public function recupererIdSuperieur($id, $version) {
420
	public function recupererIdSuperieur($id, $version) {
413
		$req = 'SELECT num_nom, num_nom_retenu, num_tax_sup, rang FROM '
421
		$req = 'SELECT num_nom, num_nom_retenu, num_tax_sup, rang, nom_sci FROM '
414
				.$version.' WHERE num_nom = '.$this->getBdd()->proteger($id); 	
422
				.$version.' WHERE num_nom = '.$this->getBdd()->proteger($id); 	
415
		$res = $this->getBdd()->recupererTous($req);
423
		$res = $this->getBdd()->recupererTous($req);
416
		if ($res) {
424
		if ($res) {
417
			$resultat = $res[0];
425
			$resultat = $res[0];
418
		} else {
426
		} else {
419
			$resultat = 'null'; //on return null si il n'y a pas de taxon superieur
427
			$resultat = null; //on return null si il n'y a pas de taxon superieur
420
		}
428
		}
Line 421... Line 429...
421
		return $resultat;
429
		return $resultat;
422
	}
430
	}
423
	
431
	
424
	public function formaterIdInferieur($resultat) {
432
	public function formaterIdInferieur($resultat) {
425
		$this->recupererTableSignification('champs_api,champs_comp,correspondance_champs');
-
 
426
		$tab_tax_inf = $this->recupererListeTaxonInf($resultat); 
433
		// Attention à l'ordre, on doit d'abord récupérer correpondance_champs avant champs_api
427
		$tab_relation = null;
434
		$this->recupererTableSignification('correspondance_champs,champs_api,champs_comp');
428
		//on commence le formatage
435
		$tab_relation = null;
-
 
436
		if (($resultat) != array()) { 
429
		if (($resultat) != '' ) { 
437
			foreach ($resultat as $tab) {
-
 
438
				$this->resultat_req = $tab;
430
			foreach ($resultat as $tab) {
439
				$num = $tab['num_nom'];
-
 
440
				$this->afficherNomHrefRetenu($tab, $num);
-
 
441
				$this->afficherDonnees('rang', $tab['rang']);
431
				$this->resultat_req = $tab;
442
				$tab_inf[$num] = $this->table_retour;
432
				$this->afficherNomHrefRetenu($tab, $num_nom);
443
				$tab_inf[$num]['nom_sci'] = $tab['nom_sci'];
433
				$tab_inf[$num] = $this->table_retour;
444
				$tab_inf[$num]['num_nom'] = $tab['num_nom'];
434
				$this->table_retour = array(); //on vide le tableau table_retour
445
				$this->table_retour = array();
435
			}
446
			}
436
			$tab_relation[$this->num_nom_taxon] = $tab_inf;
447
			$tab_relation[$this->num_nom_taxon] = $tab_inf;
Line 459... Line 470...
459
				.') AND num_nom = num_nom_retenu GROUP BY num_tax_sup';
470
				.') AND num_nom = num_nom_retenu GROUP BY num_tax_sup';
460
		$res = $this->getBdd()->recupererTous($req);
471
		$res = $this->getBdd()->recupererTous($req);
461
		if ($res) {
472
		if ($res) {
462
			$resultat = $res;
473
			$resultat = $res;
463
		} else {
474
		} else {
464
			$resultat = array(); //on return un tableau vide s'il n'y a pas de taxon inférieurs
475
			$resultat = array(); //on retourne un tableau vide s'il n'y a pas de taxon inférieurs
465
		}
476
		}
466
		return $resultat;
477
		return $resultat;
467
	}
478
	}
468
}
479
}