Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 585 | Rev 617 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 585 Rev 592
Line 165... Line 165...
165
	function definirParametresRequeteRelations($ref, $id){
165
	function definirParametresRequeteRelations($ref, $id){
166
		if ($this->ressources[1] == 'relations'){
166
		if ($this->ressources[1] == 'relations'){
167
			switch ($this->ressources[2]) {
167
			switch ($this->ressources[2]) {
168
				case 'catminat' :
168
				case 'catminat' :
169
					$this->requete_condition[] = "catminat_code = ( SELECT catminat_code from ".$this->table_version[0]." WHERE "
169
					$this->requete_condition[] = "catminat_code = ( SELECT catminat_code from ".$this->table_version[0]." WHERE "
170
					." num_nomen = ".$id." AND BDNT = '".$ref. "' ) ";
170
					." num_nomen = ".$id." AND BDNT = '".$ref. "' ) AND num_nomen != ".$id." ";
171
					$this->champs_recherches = " catminat_code, num_nomen, BDNT, idiotaxon ";
171
					$this->champs_recherches = " catminat_code, num_nomen, BDNT, idiotaxon ";
172
					break;
172
					break;
173
				default :
173
				default :
174
					$e = 'Erreur dans l\'url de votre requête : </br> Le type de relation " '
174
					$e = 'Erreur dans l\'url de votre requête : </br> Le type de relation " '
175
				.$this->ressources[2].' " n\'existe pas.';
175
				.$this->ressources[2].' " n\'existe pas.';
Line 251... Line 251...
251
	public function ajouterEnteteResultat($id) {
251
	public function ajouterEnteteResultat($id) {
252
		$entete['depart'] = $this->limite_requete['depart'];
252
		$entete['depart'] = $this->limite_requete['depart'];
253
		$entete['limite'] = $this->limite_requete['limite'];
253
		$entete['limite'] = $this->limite_requete['limite'];
254
		$entete['total']  =  $this->total_resultat;
254
		$entete['total']  =  $this->total_resultat;
255
		$entete['version']  = $this->version_projet;
255
		$entete['version']  = $this->version_projet;
-
 
256
		if ($this->limite_requete['limite'] != '*') {
256
		$url = $this->formulerUrl($this->total_resultat, '/informations/'.$this->ressources[0].'/relations/catminat');
257
			$url = $this->formulerUrl($this->total_resultat, '/informations/'.$this->ressources[0].'/relations/catminat');
257
		if (isset($url['precedent']) && $url['precedent'] != '') {
258
			if (isset($url['precedent']) && $url['precedent'] != '') {
258
			$entete['href.precedent'] = $url['precedent'];
259
				$entete['href.precedent'] = $url['precedent'];
259
		}
260
			}
260
		if (isset($url['suivant']) && $url['suivant'] != '') {
261
			if (isset($url['suivant']) && $url['suivant'] != '') {
261
			$entete['href.suivant']   = $url['suivant'];
262
				$entete['href.suivant']   = $url['suivant'];
262
		}
263
			}
-
 
264
		}
263
		return $entete;
265
		return $entete;
264
	}
266
	}
Line 265... Line 267...
265
 
267
 
266
	public function formaterResultatsTousChamps($resultat) {
268
	public function formaterResultatsTousChamps($resultat) {
Line 467... Line 469...
467
	}
469
	}
Line 468... Line 470...
468
	
470
	
469
	public function delimiterResultatsRequete() {
471
	public function delimiterResultatsRequete() {
470
		$this->calculerTotalResultat();
472
		$this->calculerTotalResultat();
-
 
473
		$requete_limite = '';
471
		$requete_limite = '';
474
		if ($this->limite_requete['limite'] != '*') {
472
		if (($this->limite_requete['depart'] <=  $this->total_resultat) ){
475
			if ( ($this->limite_requete['depart'] <=  $this->total_resultat)){
473
			if (($this->limite_requete['limite'] + $this->limite_requete['depart'] )
476
				if (($this->limite_requete['limite'] + $this->limite_requete['depart'] )
474
			< $this->total_resultat  ){
477
				< $this->total_resultat  ){
475
				$requete_limite = 'LIMIT '.$this->limite_requete['depart'].', '
478
					$requete_limite = 'LIMIT '.$this->limite_requete['depart'].', '
Line 478... Line 481...
478
		} else {
481
			} else {
479
			$e = "Erreur : la valeur pour le paramètre navigation.départ est supérieure".
482
				$e = "Erreur : la valeur pour le paramètre navigation.départ est supérieure".
480
						" au nombre total de résultats.";
483
									" au nombre total de résultats.";
481
			throw new Exception($e, RestServeur::HTTP_CODE_RESSOURCE_INTROUVABLE);
484
				throw new Exception($e, RestServeur::HTTP_CODE_RESSOURCE_INTROUVABLE);
482
		}
485
			}
-
 
486
		}
483
		return $requete_limite;
487
		return $requete_limite;
484
	}
488
	}