Line 58... |
Line 58... |
58 |
|
58 |
|
59 |
$resultat = new ResultatService();
|
59 |
$resultat = new ResultatService();
|
60 |
if ($this->parametres['retour'] == self::MIME_JPEG) {
|
60 |
if ($this->parametres['retour'] == self::MIME_JPEG) {
|
61 |
if (@$this->parametres['retour.tri'] == 'date') { // recherche la plus vieille image du CEL
|
61 |
if (@$this->parametres['retour.tri'] == 'date') { // recherche la plus vieille image du CEL
|
62 |
$id_image_a_renvoyer = $this->obtenirIdPremiereImage();
|
62 |
$id_image_a_renvoyer = $this->obtenirIdPremiereImage();
|
63 |
} else {
|
63 |
} else {
|
64 |
$id_image_a_renvoyer = $this->obtenirIdImageAuHasard();
|
64 |
$id_image_a_renvoyer = $this->obtenirIdImageAuHasard();
|
65 |
}
|
65 |
}
|
66 |
$resultat->corps = $this->recupererImageBinaire($id_image_a_renvoyer);
|
66 |
$resultat->corps = $this->recupererImageBinaire($id_image_a_renvoyer);
|
67 |
} else if ($this->parametres['retour'] == self::MIME_JSON) {
|
67 |
} else if ($this->parametres['retour'] == self::MIME_JSON) {
|
Line 227... |
Line 227... |
227 |
private function obtenirIdImageAuHasard() {
|
227 |
private function obtenirIdImageAuHasard() {
|
228 |
$refTax = $this->parametres['referentiel'];
|
228 |
$refTax = $this->parametres['referentiel'];
|
229 |
$numNom = $this->Bdd->proteger($this->ref_tax_demande[$refTax][0]);
|
229 |
$numNom = $this->Bdd->proteger($this->ref_tax_demande[$refTax][0]);
|
Line 230... |
Line 230... |
230 |
|
230 |
|
231 |
$requete = 'SELECT ci.id_image AS id_image '.
|
231 |
$requete = 'SELECT ci.id_image AS id_image '.
|
232 |
'FROM cel_images AS ci '.
|
- |
|
233 |
' LEFT JOIN cel_obs AS co '.
|
- |
|
234 |
'ON (ci.ce_observation = co.id_observation) '.
|
- |
|
235 |
'WHERE co.transmission = 1 '.
|
232 |
' FROM cel_export AS co '.
|
236 |
" AND co.nom_ret_nn IN ($numNom)";
|
233 |
" WHERE co.nom_ret_nn IN ($numNom)";
|
Line 237... |
Line 234... |
237 |
" AND co.nom_referentiel = ".$this->Bdd->proteger($refTax) . ' -- ' . __FILE__ . ':' . __LINE__;
|
234 |
" AND co.nom_referentiel = ".$this->Bdd->proteger($refTax) . ' -- ' . __FILE__ . ':' . __LINE__;
|
Line 238... |
Line 235... |
238 |
|
235 |
|
Line 251... |
Line 248... |
251 |
private function obtenirIdPremiereImage() {
|
248 |
private function obtenirIdPremiereImage() {
|
252 |
$refTax = $this->parametres['referentiel'];
|
249 |
$refTax = $this->parametres['referentiel'];
|
253 |
$numNom = $this->Bdd->proteger($this->ref_tax_demande[$refTax][0]);
|
250 |
$numNom = $this->Bdd->proteger($this->ref_tax_demande[$refTax][0]);
|
254 |
$requete = 'SELECT ci.id_image AS id_image '.
|
251 |
$requete = 'SELECT ci.id_image AS id_image '.
|
255 |
'FROM cel_images AS ci'.
|
252 |
'FROM cel_images AS ci'.
|
256 |
' LEFT JOIN cel_obs AS co '.
|
253 |
' LEFT JOIN cel_export AS co '.
|
257 |
' ON (ci.ce_observation = co.id_observation) '.
|
254 |
' ON (ci.ce_observation = co.id_observation) '.
|
258 |
'WHERE co.transmission = 1 '.
|
- |
|
259 |
" AND co.nom_ret_nn IN ($numNom) ".
|
255 |
"WHERE co.nom_ret_nn IN ($numNom) ".
|
260 |
' AND ci.date_prise_de_vue != "0000-00-00" '.
|
256 |
' AND ci.date_prise_de_vue != "0000-00-00" '.
|
261 |
' AND co.nom_referentiel LIKE '.$this->Bdd->proteger($refTax.'%').' '.
|
257 |
' AND co.nom_referentiel LIKE '.$this->Bdd->proteger($refTax.'%').' '.
|
262 |
' ORDER BY ci.date_prise_de_vue ASC '.
|
258 |
' ORDER BY ci.date_prise_de_vue ASC '.
|
263 |
'LIMIT 1' . ' -- ' . __FILE__ . ':' . __LINE__;
|
259 |
'LIMIT 1' . ' -- ' . __FILE__ . ':' . __LINE__;
|
Line 280... |
Line 276... |
280 |
' co.id_observation AS id_obs, '.
|
276 |
' co.id_observation AS id_obs, '.
|
281 |
' ci.courriel_utilisateur AS utilisateur_courriel, '.
|
277 |
' ci.courriel_utilisateur AS utilisateur_courriel, '.
|
282 |
' nom_sel, nom_sel_nn, '.
|
278 |
' nom_sel, nom_sel_nn, '.
|
283 |
' zone_geo, ce_zone_geo, lieudit, station, milieu '.
|
279 |
' zone_geo, ce_zone_geo, lieudit, station, milieu '.
|
284 |
'FROM cel_images AS ci'.
|
280 |
'FROM cel_images AS ci'.
|
285 |
' LEFT JOIN cel_obs AS co '.
|
281 |
' LEFT JOIN cel_export AS co '.
|
286 |
' ON (ci.ce_observation = co.id_observation) '.
|
282 |
' ON (ci.ce_observation = co.id_observation) '.
|
287 |
'WHERE ci.id_image = '.$this->ressources[0].
|
283 |
'WHERE ci.id_image = '.$this->ressources[0].
|
288 |
' AND co.id_observation IS NOT NULL' . ' -- ' . __FILE__ . ':' . __LINE__;
|
284 |
' AND co.id_observation IS NOT NULL' . ' -- ' . __FILE__ . ':' . __LINE__;
|
Line 289... |
Line 285... |
289 |
|
285 |
|
Line 302... |
Line 298... |
302 |
' co.id_observation AS id_obs, co.courriel_utilisateur AS utilisateur_courriel, co.zone_geo, co.ce_zone_geo, '.
|
298 |
' co.id_observation AS id_obs, co.courriel_utilisateur AS utilisateur_courriel, co.zone_geo, co.ce_zone_geo, '.
|
303 |
' co.nom_sel, co.nom_sel_nn, '.
|
299 |
' co.nom_sel, co.nom_sel_nn, '.
|
304 |
' ci.id_image AS id_img, co.date_observation AS date '.
|
300 |
' ci.id_image AS id_img, co.date_observation AS date '.
|
305 |
(isset($this->parametres['retour.champs']) ? ', '.$this->parametres['retour.champs'] : '').
|
301 |
(isset($this->parametres['retour.champs']) ? ', '.$this->parametres['retour.champs'] : '').
|
306 |
'FROM cel_images AS ci'.
|
302 |
'FROM cel_images AS ci'.
|
307 |
' LEFT JOIN cel_obs AS co '.
|
303 |
' LEFT JOIN cel_export AS co '.
|
308 |
' ON (ci.ce_observation = co.id_observation) '.
|
304 |
' ON (ci.ce_observation = co.id_observation) '.
|
309 |
$this->formerRequeteConditions($numNomListe).' '.
|
305 |
$this->formerRequeteConditions($numNomListe).' '.
|
310 |
'GROUP BY id_img '.
|
306 |
'GROUP BY id_img '.
|
311 |
$this->formerRequeteTri().
|
307 |
$this->formerRequeteTri().
|
312 |
"LIMIT $depart,$limite " . ' -- ' . __FILE__ . ':' . __LINE__;
|
308 |
"LIMIT $depart,$limite " . ' -- ' . __FILE__ . ':' . __LINE__;
|
313 |
|
- |
|
- |
|
309 |
echo $requete;exit;
|
314 |
$this->infosImages = $this->Bdd->recupererTous($requete);
|
310 |
$this->infosImages = $this->Bdd->recupererTous($requete);
|
315 |
}
|
311 |
}
|
Line 316... |
Line 312... |
316 |
|
312 |
|
317 |
private function formerRequeteConditions($numNomListe) {
|
313 |
private function formerRequeteConditions($numNomListe) {
|
318 |
$refTax = $this->parametres['referentiel'];
|
314 |
$refTax = $this->parametres['referentiel'];
|
- |
|
315 |
$where[] = " co.nom_ret_nn IN ($numNomListe) ";
|
- |
|
316 |
// exclusion des noms à déterminer, douteux ou plantnet-mobile
|
319 |
$where[] = " co.transmission = 1 AND co.nom_ret_nn IN ($numNomListe) ";
|
317 |
$where[] = " (co.certitude not in ('aDeterminer', 'douteux', 'douteuse') OR certitude IS NULL) ";
|
Line 320... |
Line 318... |
320 |
$where[] = " co.nom_referentiel LIKE ".$this->Bdd->proteger($refTax."%").' ';
|
318 |
$where[] = " co.nom_referentiel LIKE ".$this->Bdd->proteger($refTax."%").' ';
|
321 |
|
319 |
|