Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

Rev 1266 Rev 1269
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 229... Line 229...
229
	private function obtenirIdImageAuHasard() {
229
	private function obtenirIdImageAuHasard() {
230
		$refTax = $this->parametres['referentiel'];
230
		$refTax = $this->parametres['referentiel'];
231
		$numNom = $this->Bdd->proteger($this->ref_tax_demande[$refTax][0]);
231
		$numNom = $this->Bdd->proteger($this->ref_tax_demande[$refTax][0]);
Line 232... Line 232...
232
 
232
 
233
		$requete = 'SELECT  ci.id_image AS id_image '.
233
		$requete = 'SELECT  ci.id_image AS id_image '.
-
 
234
			'FROM cel_images AS ci '.
-
 
235
			'	LEFT JOIN cel_obs AS co '.
-
 
236
					'ON (ci.ce_observation = co.id_observation) '.
234
			' FROM cel_export AS co '.
237
			'WHERE co.transmission = 1 '.
235
			" WHERE co.nom_ret_nn IN ($numNom)";
238
			"	AND co.nom_ret_nn IN ($numNom)";
Line 236... Line 239...
236
			"	AND co.nom_referentiel = ".$this->Bdd->proteger($refTax) . ' -- ' . __FILE__ . ':' . __LINE__;
239
			"	AND co.nom_referentiel = ".$this->Bdd->proteger($refTax) . ' -- ' . __FILE__ . ':' . __LINE__;
Line 237... Line 240...
237
 
240
 
Line 250... Line 253...
250
	private function obtenirIdPremiereImage() {
253
	private function obtenirIdPremiereImage() {
251
		$refTax = $this->parametres['referentiel'];
254
		$refTax = $this->parametres['referentiel'];
252
		$numNom = $this->Bdd->proteger($this->ref_tax_demande[$refTax][0]);
255
		$numNom = $this->Bdd->proteger($this->ref_tax_demande[$refTax][0]);
253
		$requete = 	'SELECT ci.id_image AS id_image '.
256
		$requete = 	'SELECT ci.id_image AS id_image '.
254
					'FROM cel_images AS ci'.
257
					'FROM cel_images AS ci'.
255
					'	LEFT JOIN cel_export AS co '.
258
					'	LEFT JOIN cel_obs AS co '.
256
					'		ON (ci.ce_observation = co.id_observation) '.
259
					'		ON (ci.ce_observation = co.id_observation) '.
-
 
260
					'WHERE co.transmission = 1 '.
257
					"WHERE co.nom_ret_nn IN ($numNom) ".
261
					"	AND co.nom_ret_nn IN ($numNom) ".
258
					'	AND ci.date_prise_de_vue != "0000-00-00" '.
262
					'	AND ci.date_prise_de_vue != "0000-00-00" '.
259
					'	AND co.nom_referentiel LIKE '.$this->Bdd->proteger($refTax.'%').' '.
263
					'	AND co.nom_referentiel LIKE '.$this->Bdd->proteger($refTax.'%').' '.
260
					'	ORDER BY ci.date_prise_de_vue ASC '.
264
					'	ORDER BY ci.date_prise_de_vue ASC '.
261
					'LIMIT 1' . ' -- ' . __FILE__ . ':' . __LINE__;
265
					'LIMIT 1' . ' -- ' . __FILE__ . ':' . __LINE__;
Line 278... Line 282...
278
				'	co.id_observation AS id_obs, '.
282
				'	co.id_observation AS id_obs, '.
279
				'	ci.courriel_utilisateur AS utilisateur_courriel, '.
283
				'	ci.courriel_utilisateur AS utilisateur_courriel, '.
280
				'	nom_sel, nom_sel_nn, '.
284
				'	nom_sel, nom_sel_nn, '.
281
				'	zone_geo, ce_zone_geo, lieudit, station, milieu '.
285
				'	zone_geo, ce_zone_geo, lieudit, station, milieu '.
282
				'FROM cel_images AS ci'.
286
				'FROM cel_images AS ci'.
283
				'	LEFT JOIN cel_export AS co '.
287
				'	LEFT JOIN cel_obs AS co '.
284
				'		ON (ci.ce_observation = co.id_observation) '.
288
				'		ON (ci.ce_observation = co.id_observation) '.
285
				'WHERE ci.id_image = '.$this->ressources[0].
289
				'WHERE ci.id_image = '.$this->ressources[0].
286
				' AND co.id_observation IS NOT NULL' . ' -- ' . __FILE__ . ':' . __LINE__;
290
				' AND co.id_observation IS NOT NULL' . ' -- ' . __FILE__ . ':' . __LINE__;
Line 287... Line 291...
287
 
291
 
Line 300... Line 304...
300
			'	co.id_observation AS id_obs, co.courriel_utilisateur AS utilisateur_courriel, co.zone_geo, co.ce_zone_geo, '.
304
			'	co.id_observation AS id_obs, co.courriel_utilisateur AS utilisateur_courriel, co.zone_geo, co.ce_zone_geo, '.
301
			'	co.nom_sel, co.nom_sel_nn, '.
305
			'	co.nom_sel, co.nom_sel_nn, '.
302
			'	ci.id_image AS id_img, co.date_observation AS date '.
306
			'	ci.id_image AS id_img, co.date_observation AS date '.
303
			(isset($this->parametres['retour.champs']) ? ', '.$this->parametres['retour.champs'] : '').
307
			(isset($this->parametres['retour.champs']) ? ', '.$this->parametres['retour.champs'] : '').
304
			'FROM cel_images AS ci'.
308
			'FROM cel_images AS ci'.
305
			'	LEFT JOIN cel_export AS co '.
309
			'	LEFT JOIN cel_obs AS co '.
306
			'		ON (ci.ce_observation = co.id_observation) '.
310
			'		ON (ci.ce_observation = co.id_observation) '.
307
			$this->formerRequeteConditions($numNomListe).' '.
311
			$this->formerRequeteConditions($numNomListe).' '.
308
			'GROUP BY id_img '.
312
			'GROUP BY id_img '.
309
			$this->formerRequeteTri().
313
			$this->formerRequeteTri().
310
			"LIMIT $depart,$limite " . ' -- ' . __FILE__ . ':' . __LINE__;
314
			"LIMIT $depart,$limite " . ' -- ' . __FILE__ . ':' . __LINE__;
-
 
315
 
311
		$this->infosImages = $this->Bdd->recupererTous($requete);
316
		$this->infosImages = $this->Bdd->recupererTous($requete);
312
	}
317
	}
Line 313... Line 318...
313
 
318
 
314
	private function formerRequeteConditions($numNomListe) {
319
	private function formerRequeteConditions($numNomListe) {
315
		$refTax = $this->parametres['referentiel'];
320
		$refTax = $this->parametres['referentiel'];
316
		$where[] = " co.nom_ret_nn IN ($numNomListe) ";
321
		$where[] = " co.transmission = 1 AND co.nom_ret_nn IN ($numNomListe) ";
-
 
322
		// exclusion des noms à déterminer, douteux ou plantnet-mobile
317
		// exclusion des noms à déterminer, douteux ou plantnet-mobile
323
		$where[] = " ((co.mots_cles_texte not like '%aDeterminer%' AND co.mots_cles_texte not like '%plantnet-mobile%') OR co.mots_cles_texte IS null) ";
318
		$where[] = " (co.certitude not in ('aDeterminer', 'douteux', 'douteuse') OR certitude IS NULL) ";
324
		$where[] = " (co.certitude not in ('aDeterminer', 'douteux', 'douteuse') OR certitude IS NULL) ";
Line 319... Line 325...
319
		$where[] = " co.nom_referentiel LIKE ".$this->Bdd->proteger($refTax."%").' ';
325
		$where[] = " co.nom_referentiel LIKE ".$this->Bdd->proteger($refTax."%").' ';
320
		
326
		
Line 541... Line 547...
541
	}
547
	}
Line 542... Line 548...
542
 
548
 
543
/* autres fonctions */
549
/* autres fonctions */
544
	private function chargerTopImages() {
550
	private function chargerTopImages() {
-
 
551
		$nn = substr($this->parametres['masque.nn'], strpos($this->parametres['masque.nn'], ':') + 1);
-
 
552
		$referentiel = isset($this->parametres['masque.referentiel']) ? $this->parametres['masque.referentiel'] : '';
-
 
553
		$and = $referentiel ? ' AND referentiel = ' . $this->Bdd->proteger($referentiel) : '';
545
		$nn = substr($this->parametres['masque.nn'], strpos($this->parametres['masque.nn'], ':') + 1);
554
 
546
		$requete =  'SELECT ce_image as id_img, organe '.
555
		$requete =  'SELECT referentiel, ce_image as id_img, organe '.
547
			'FROM tb_del.del_image_top '.
556
			'FROM tb_del.del_image_top '.
Line 548... Line 557...
548
			'WHERE nn = '. $this->Bdd->proteger($nn) . ' -- ' . __FILE__ . ':' . __LINE__;
557
			'WHERE nn = '. $this->Bdd->proteger($nn) . $and . ' -- ' . __FILE__ . ':' . __LINE__;
Line 549... Line 558...
549
 
558
 
550
		$this->infosImages = $this->Bdd->recupererTous($requete);
559
		$this->infosImages = $this->Bdd->recupererTous($requete);
551
 
560
 
552
		$resultat = array();
561
		$resultat = array();
Line 553... Line 562...
553
		foreach ($this->infosImages as $image) {
562
		foreach ($this->infosImages as $image) {
554
			$resultat[$image['organe']] = $this->formaterUrlImage($image);
563
			$resultat[$image['referentiel']][$image['organe']] = $this->formaterUrlImage($image);
555
		}
564
		}