Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

Rev 718 Rev 740
Line 118... Line 118...
118
	public function recupererNumNomTaxon() {
118
	public function recupererNumNomTaxon() {
119
		$identifiant = '';
119
		$identifiant = '';
120
		if ($this->entete_http == '') {
120
		if ($this->entete_http == '') {
121
			//on récupere l'identifiant du taxon correspondant au num_nom ou num_taxonomique demandé pour pouvoir l'afficher
121
			//on récupere l'identifiant du taxon correspondant au num_nom ou num_taxonomique demandé pour pouvoir l'afficher
122
			$req_tax = 'SELECT num_nom_retenu FROM '.$this->table.' WHERE '.$this->requete_condition[0]; 
122
			$req_tax = 'SELECT num_nom_retenu FROM '.$this->table.' WHERE '.$this->requete_condition[0]; 
123
			$res_tax = $this->getBdd()->recuperer($req_tax);
123
			$res_tax = $this->getBdd()->recuperer($req_tax . ' -- ' . __FILE__ . ':' . __LINE__ );
124
			//on recherche ensuite les identifiants des taxons supérieurs ou inférieurs
124
			//on recherche ensuite les identifiants des taxons supérieurs ou inférieurs
125
			if ($res_tax && $res_tax != '') {
125
			if ($res_tax && $res_tax != '') {
126
				$identifiant = $res_tax['num_nom_retenu'];
126
				$identifiant = $res_tax['num_nom_retenu'];
127
			} else {
127
			} else {
128
				$e = 'Le numéro de taxon ou l\'identifiant de nom correspondant au num_nom '
128
				$e = 'Le numéro de taxon ou l\'identifiant de nom correspondant au num_nom '
Line 213... Line 213...
213
				'(SELECT hierarchie FROM '.
213
				'(SELECT hierarchie FROM '.
214
					$this->table.' '.
214
					$this->table.' '.
215
					'WHERE num_nom = '.$this->getBdd()->proteger($this->num_nom_taxon).')'.
215
					'WHERE num_nom = '.$this->getBdd()->proteger($this->num_nom_taxon).')'.
216
					', '.$this->getBdd()->proteger($this->num_nom_taxon.'-%').
216
					', '.$this->getBdd()->proteger($this->num_nom_taxon.'-%').
217
				')';
217
				')';
218
		$res_relation = $this->getBdd()->recupererTous($req_relation);
218
		$res_relation = $this->getBdd()->recupererTous($req_relation . ' -- ' . __FILE__ . ':' . __LINE__ );
219
		return $res_relation;
219
		return $res_relation;
220
	}
220
	}
Line 221... Line 221...
221
	
221
	
222
	public function recupererIdInf() {
222
	public function recupererIdInf() {
223
		//SELECT num_nom FROM bfdtx_v2_00 WHERE num_tax_sup = (SELECT num_nom FROM bdtfx_v2_00 WHERE num_nom = X);
223
		//SELECT num_nom FROM bfdtx_v2_00 WHERE num_tax_sup = (SELECT num_nom FROM bdtfx_v2_00 WHERE num_nom = X);
224
		$req_relation = 'SELECT num_nom FROM '.$this->table
224
		$req_relation = 'SELECT num_nom FROM '.$this->table
225
							.' WHERE num_tax_sup = (SELECT num_nom FROM '
225
							.' WHERE num_tax_sup = (SELECT num_nom FROM '
226
							.$this->table
226
							.$this->table
227
							.' WHERE '.implode(' AND ', $this->requete_condition).')';
227
							.' WHERE '.implode(' AND ', $this->requete_condition).')';
228
		$res_relation = $this->getBdd()->recupererTous($req_relation);
228
		$res_relation = $this->getBdd()->recupererTous($req_relation . ' -- ' . __FILE__ . ':' . __LINE__ );
229
		return $res_relation;
229
		return $res_relation;
Line 230... Line 230...
230
	}
230
	}
231
	
231
	
232
	
232
	
233
	public function recupererIdSup() {
233
	public function recupererIdSup() {
234
		//SELECT num_nom FROM bfdtx_v2_00 WHERE num_nom = (SELECT num_tax_sup FROM bdtfx_v2_00 WHERE num_nom = X);
234
		//SELECT num_nom FROM bfdtx_v2_00 WHERE num_nom = (SELECT num_tax_sup FROM bdtfx_v2_00 WHERE num_nom = X);
235
		$req_relation = 'SELECT num_tax_sup as num_nom FROM '.$this->table
235
		$req_relation = 'SELECT num_tax_sup as num_nom FROM '.$this->table
236
							.' WHERE '.implode(' AND ', $this->requete_condition);
236
							.' WHERE '.implode(' AND ', $this->requete_condition);
Line 237... Line 237...
237
		$res_relation = $this->getBdd()->recupererTous($req_relation);
237
		$res_relation = $this->getBdd()->recupererTous($req_relation . ' -- ' . __FILE__ . ':' . __LINE__ );
Line 261... Line 261...
261
	}
261
	}
Line 262... Line 262...
262
	
262
	
Line 263... Line 263...
263
	
263
	
264
//-----------------------------FONCTIONS DASSEMBLAGE DE LA REQUETE-----------------------------------------------------
264
//-----------------------------FONCTIONS DASSEMBLAGE DE LA REQUETE-----------------------------------------------------
265
	
265
	
266
	public function assemblerLaRequete() {	
266
	public function assemblerLaRequete() {
267
		if ($this->format_reponse != 'taxons/stats/initiales') {
267
		if ($this->format_reponse != 'taxons/stats/initiales') {
268
			$this->mettreAuFormat(); //on remplace les nom_sci par les nom_sci_html
268
			$this->mettreAuFormat(); //on remplace les nom_sci par les nom_sci_html
269
		}
269
		}
270
		$requete = 	' SELECT '.$this->requete_champ.
270
		$requete = 	' SELECT '.$this->requete_champ.
271
						' FROM '.$this->table
271
						' FROM '.$this->table
-
 
272
							.$this->retournerRequeteCondition()
272
							.$this->retournerRequeteCondition()
273
							.$this->requete_group_by
273
							.$this->requete_group_by
274
			.$this->formerRequeteLimite() .
Line 274... Line 275...
274
							.$this->formerRequeteLimite(); 
275
			' -- ' . __FILE__ . ':' . __LINE__ ;
275
		return $requete; 
276
		return $requete; 
Line 456... Line 457...
456
	}
457
	}
Line 457... Line 458...
457
	
458
	
458
	
459
	
459
	public function recupererIdSuperieur($id, $version) {
460
	public function recupererIdSuperieur($id, $version) {
460
		$req = 'SELECT num_nom, num_nom_retenu, num_tax_sup, rang, nom_sci FROM '
461
		$req = 'SELECT num_nom, num_nom_retenu, num_tax_sup, rang, nom_sci FROM '
461
				.$version.' WHERE num_nom = '.$this->getBdd()->proteger($id); 	
462
				.$version.' WHERE num_nom = '.$this->getBdd()->proteger($id);
462
		$res = $this->getBdd()->recupererTous($req);
463
		$res = $this->getBdd()->recupererTous($req . ' -- ' . __FILE__ . ':' . __LINE__ );
463
		if ($res) {
464
		if ($res) {
464
			$resultat = $res[0];
465
			$resultat = $res[0];
465
		} else {
466
		} else {
Line 507... Line 508...
507
			$tab_num[] = $tab['num_nom']; //on regroupe ici les id des taxons dont on cherche le nb de taxon inf
508
			$tab_num[] = $tab['num_nom']; //on regroupe ici les id des taxons dont on cherche le nb de taxon inf
508
		}
509
		}
509
		$req = 'SELECT num_tax_sup, count(*) as nb FROM '.$this->table
510
		$req = 'SELECT num_tax_sup, count(*) as nb FROM '.$this->table
510
				.' WHERE num_tax_sup IN ('.implode(',',$tab_num)
511
				.' WHERE num_tax_sup IN ('.implode(',',$tab_num)
511
				.') AND num_nom = num_nom_retenu GROUP BY num_tax_sup';
512
				.') AND num_nom = num_nom_retenu GROUP BY num_tax_sup';
512
		$res = $this->getBdd()->recupererTous($req);
513
		$res = $this->getBdd()->recupererTous($req . ' -- ' . __FILE__ . ':' . __LINE__ );
513
		if ($res) {
514
		if ($res) {
514
			$resultat = $res;
515
			$resultat = $res;
515
		} else {
516
		} else {
516
			$resultat = array(); //on retourne un tableau vide s'il n'y a pas de taxon inférieurs
517
			$resultat = array(); //on retourne un tableau vide s'il n'y a pas de taxon inférieurs
517
		}
518
		}