62,6 → 62,7 |
|
// +-------------------------------------------------------------------------------------------------------------------+ |
public function consulter($ressources, $parametres) { |
$this->parametres = $parametres; |
$this->traiterVersionProjet($ressources); |
$this->traiterRessources($ressources); |
$resultat_formate = ''; |
110,7 → 111,7 |
public function assemblerLaRequete() { |
$requete = "SELECT ".$this->formerRequeteChamp(). |
" FROM ".$this->table.$this->formerRequeteCondition(). |
' LIMIT '.$this->limite_requete['depart'].', '.$this->limite_requete['limite']; |
' LIMIT '.$this->limite_requete['depart'].', '.$this->limite_requete['limite'];//echo $requete; |
return $requete; |
} |
|
305,7 → 306,7 |
$this->limite_requete['depart'] = 0; |
$this->limite_requete['dept'] = $d[1]; |
$requete_condition = (is_numeric($d[0])) ? '`num_nom` = '.$d[0] : '`nom_sci` like "'.urldecode($d[0]).'%"'; |
$requete = "SELECT id FROM $this->table WHERE ".$requete_condition; //echo $requete; |
$requete = "SELECT id FROM $this->table WHERE ".$requete_condition; |
$res = $this->getBdd()->recuperer($requete); |
if ($res == '') { //cas ou la requete comporte des erreurs |
$r = 'La requête SQL formée comporte une erreur !!'; |
337,6 → 338,7 |
$num = 0; // compte le nombre d'observations pour retourner le nombre d'obs indiqué |
$depart = false; //le depart du resultat est noté ss forme #ligne:#departement $depart indique le departement est correct |
//on remplit la table $table_retour_json['resultat'] |
//$this->table_retour = array(); |
foreach ($resultat as $tab) { |
foreach ($tab as $key => $valeur) { |
switch ($key) { |
350,21 → 352,25 |
case 'num_nom' : ($valeur == 'nc')? $num_nom = urlencode($tab['nom_sci']) : $num_nom = $valeur ; break; |
case 'nom_sci' : $this->table_retour['determination.nom_sci'] = $valeur; break; |
default : // pour les depts |
if ($depart == true && $valeur != '') { |
if (($this->presenceChorologie != '' && $valeur == $this->presenceChorologie) || ($this->presenceChorologie == '' && $valeur != $this->presenceChorologie)) { |
if (isset($this->parametres['masque.station'])) { |
if ($key == $this->parametres['masque.station']) { |
$id = $num_nom.":".$key; |
if ($this->retour_format == 'max' ) { |
$this->afficherDonneesMax($key, $valeur); |
$this->table_retour['href'] = $this->ajouterHref('observations',$id); |
} else { |
$this->table_retour['station.departement.code'] = 'INSEE-D.'.$key; |
$this->table_retour['valeur.code'] = $valeur; |
} |
$this->completerDonnees($key, $valeur, $id); |
$resultat_json[$id] = $this->table_retour; |
$num++; |
} |
} else { |
if ($depart == true && $valeur != '') { |
if (($this->presenceChorologie != '' && $valeur == $this->presenceChorologie) || |
($this->presenceChorologie == '' && $valeur != $this->presenceChorologie)) { |
$id = $num_nom.":".$key; |
$this->completerDonnees($key, $valeur, $id); |
$resultat_json[$id] = $this->table_retour; |
$num++; |
} |
} |
if ($key == $this->limite_requete['dept']) $depart = true; |
} |
if ($key == $this->limite_requete['dept']) $depart = true; |
break; |
} |
if ($num == $this->limite_requete['limite']) { |
385,8 → 391,18 |
$table_retour_json['entete'] = $this->table_entete; |
$table_retour_json['resultat'] = $resultat_json; |
return $table_retour_json; |
} |
} |
|
public function completerDonnees($key, $valeur, $id) { |
if ($this->retour_format == 'max' ) { |
$this->afficherDonneesMax($key, $valeur); |
$this->table_retour['href'] = $this->ajouterHref('observations',$id); |
} else { |
$this->table_retour['station.departement.code'] = 'INSEE-D.'.$key; |
$this->table_retour['valeur.code'] = $valeur; |
} |
} |
|
public function formaterObservationsId($resultat) { |
foreach ($resultat as $key => $valeur) { |
switch ($key) { |
414,9 → 430,13 |
if ($key != 20) { //à part la Corse |
$url_dep = $this->ajouterHrefAutreProjet('zone-geo','',$key, 'insee-d'); |
$dep = $this->consulterHref($url_dep); |
$this->table_retour['station.departement'] = $dep->nom; |
$this->table_retour['station.departement.code'] = 'INSEE-D.'.$key; |
$this->table_retour['station.departement.href'] = $url_dep; |
if (isset($dep)) { |
$this->table_retour['station.departement'] = $dep->nom; |
$this->table_retour['station.departement.code'] = 'INSEE-D.'.$key; |
$this->table_retour['station.departement.href'] = $url_dep; |
} else { |
$this->table_retour['station.departement.code'] = 'INSEE-D.'.$key; |
} |
} else { |
$this->table_retour['station.departement.code'] = 'INSEE-D.'.$key; |
} |