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'];
|
- |
|
263 |
}
|
262 |
}
|
264 |
}
|
263 |
return $entete;
|
265 |
return $entete;
|
264 |
}
|
266 |
}
|
Line 265... |
Line 267... |
265 |
|
267 |
|
Line 446... |
Line 448... |
446 |
//+--------------------------FONCTIONS D'ASSEMBLAGE DE LA REQUETE-------------------------------------------+
|
448 |
//+--------------------------FONCTIONS D'ASSEMBLAGE DE LA REQUETE-------------------------------------------+
|
Line 447... |
Line 449... |
447 |
|
449 |
|
448 |
public function assemblerLaRequete() {
|
450 |
public function assemblerLaRequete() {
|
449 |
$requete = ' SELECT '.$this->champs_recherches.' FROM '.$this->table.' '
|
451 |
$requete = ' SELECT '.$this->champs_recherches.' FROM '.$this->table.' '
|
450 |
.$this->retournerRequeteCondition().' ';
|
452 |
.$this->retournerRequeteCondition().' ';
|
451 |
if ($this->nb_ressources != 1) {
|
453 |
if ($this->nb_ressources != 1 ) {
|
452 |
$requete .= $this->delimiterResultatsRequete();
|
454 |
$requete .= $this->delimiterResultatsRequete();
|
453 |
}
|
455 |
}
|
454 |
return $requete;
|
456 |
return $requete;
|
Line 455... |
Line 457... |
455 |
}
|
457 |
}
|
456 |
|
458 |
|
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'].', '
|
- |
|
479 |
.$this->limite_requete['limite'];
|
- |
|
480 |
}
|
- |
|
481 |
} else {
|
- |
|
482 |
$e = "Erreur : la valeur pour le paramètre navigation.départ est supérieure".
|
- |
|
483 |
" au nombre total de résultats.";
|
476 |
.$this->limite_requete['limite'];
|
484 |
throw new Exception($e, RestServeur::HTTP_CODE_RESSOURCE_INTROUVABLE);
|
477 |
}
|
- |
|
478 |
} else {
|
- |
|
479 |
$e = "Erreur : la valeur pour le paramètre navigation.départ est supérieure".
|
- |
|
480 |
" au nombre total de résultats.";
|
- |
|
481 |
throw new Exception($e, RestServeur::HTTP_CODE_RESSOURCE_INTROUVABLE);
|
485 |
}
|
482 |
}
|
486 |
}
|
483 |
return $requete_limite;
|
487 |
return $requete_limite;
|