Subversion Repositories eFlore/Applications.del

Rev

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

Rev 1907 Rev 1922
Line 56... Line 56...
56
		$this->parametres = $parametres;
56
		$this->parametres = $parametres;
57
		$this->verifierParametres();
57
		$this->verifierParametres();
Line 58... Line 58...
58
 
58
 
59
		// Lancement du service
59
		// Lancement du service
60
		$this->idsImagesOrdonnees = $this->getIdsImages();
-
 
61
		$infos = $this->chargerInfos();
60
		$this->idsImagesOrdonnees = $this->getIdsImages();
-
 
61
		$this->modifierEnteteTotal();
62
		$this->modifierEnteteTotal();
62
		$infos = $this->chargerInfos();
63
		if ($infos) {
63
		if ($infos) {
64
			$this->traiterResultats($infos);
64
			$this->traiterResultats($infos);
65
			$this->completerResutlats();
65
			$this->completerResutlats();
Line 110... Line 110...
110
 
110
 
111
		$requete = 'SELECT SQL_CALC_FOUND_ROWS di.id_image '.
111
		$requete = 'SELECT SQL_CALC_FOUND_ROWS di.id_image '.
112
			'FROM del_image AS di '.
112
			'FROM del_image AS di '.
113
			'	LEFT JOIN del_image_stat AS ds ON (di.id_image = ds.ce_image) '.
113
			'	LEFT JOIN del_image_stat AS ds ON (di.id_image = ds.ce_image) '.
114
			"$whereClause ".
114
			"$whereClause ".
115
			'ORDER BY moyenne DESC '.
115
			'ORDER BY moyenne DESC, id_image DESC '.
116
			"LIMIT $depart, $limite ".
116
			"LIMIT $depart, $limite ".
117
			' -- '.__FILE__.' : '.__LINE__;
117
			' -- '.__FILE__.' : '.__LINE__;
118
		//Debug::printr($requete);
118
		//Debug::printr($requete);
119
		$resultats = $this->bdd->recupererTous($requete);
119
		$resultats = $this->bdd->recupererTous($requete);
Line 151... Line 151...
151
			'FROM del_image AS di '.
151
			'FROM del_image AS di '.
152
			'	INNER JOIN del_observation AS do ON (di.ce_observation = do.id_observation) '.
152
			'	INNER JOIN del_observation AS do ON (di.ce_observation = do.id_observation) '.
153
			'	LEFT JOIN del_utilisateur AS du ON (di.ce_utilisateur = du.id_utilisateur) '.
153
			'	LEFT JOIN del_utilisateur AS du ON (di.ce_utilisateur = du.id_utilisateur) '.
154
			'	LEFT JOIN del_image_stat AS ds ON (di.id_image = ds.ce_image) '.
154
			'	LEFT JOIN del_image_stat AS ds ON (di.id_image = ds.ce_image) '.
155
			"WHERE di.id_image IN ($idImgsConcat) ".
155
			"WHERE di.id_image IN ($idImgsConcat) ".
156
			'ORDER BY moyenne DESC '.
156
			'ORDER BY moyenne DESC, id_image DESC '.
157
			' -- '.__FILE__.' : '.__LINE__;
157
			' -- '.__FILE__.' : '.__LINE__;
-
 
158
		//Debug::printr($requete);
158
		return $this->bdd->recupererTous($requete);
159
		return $this->bdd->recupererTous($requete);
159
	}
160
	}
Line 160... Line 161...
160
 
161
 
161
	private function modifierEnteteTotal() {
162
	private function modifierEnteteTotal() {
Line 255... Line 256...
255
				$id_obs = $infos['id_observation'];
256
				$id_obs = $infos['id_observation'];
256
				$this->resultats[$index]['determination.famille'] = $this->propositions[$id_obs]['famille'];
257
				$this->resultats[$index]['determination.famille'] = $this->propositions[$id_obs]['famille'];
257
				$this->resultats[$index]['determination.ns'] = $this->propositions[$id_obs]['nom_sel'];
258
				$this->resultats[$index]['determination.ns'] = $this->propositions[$id_obs]['nom_sel'];
258
				$this->resultats[$index]['determination.nn'] = $this->propositions[$id_obs]['nom_sel_nn'];
259
				$this->resultats[$index]['determination.nn'] = $this->propositions[$id_obs]['nom_sel_nn'];
259
				$this->resultats[$index]['determination.nt'] = $this->propositions[$id_obs]['nt'];
260
				$this->resultats[$index]['determination.nt'] = $this->propositions[$id_obs]['nt'];
-
 
261
				$this->resultats[$index]['determination.referentiel'] = $this->propositions[$id_obs]['nom_referentiel'];
260
			}
262
			}
261
			$this->completerUrlFicheEflore($index);
263
			$this->completerUrlFicheEflore($index);
262
		}
264
		}
263
	}
265
	}
Line 336... Line 338...
336
	}
338
	}
Line 337... Line 339...
337
 
339
 
338
	private function completerUrlFicheEflore($index) {
340
	private function completerUrlFicheEflore($index) {
339
		if (isset($this->resultats[$index]['determination.nn'])) {
341
		if (isset($this->resultats[$index]['determination.nn'])) {
340
			$urlTpl = $this->conteneur->getParametre('determinations.url_fiche_eflore_tpl');
342
			$urlTpl = $this->conteneur->getParametre('determinations.url_fiche_eflore_tpl');
-
 
343
			$nn = (int) $this->resultats[$index]['determination.nn'];
-
 
344
			$ref = $this->resultats[$index]['determination.referentiel'];
-
 
345
			$code_ref = $this->getCodeReferentiel($ref);
-
 
346
			if (is_int($nn) && ! isset($code_ref)) {
-
 
347
				$code_ref = 'bdtfx';
-
 
348
			}
-
 
349
			$this->resultats[$index]['url_fiche_eflore'] = sprintf($urlTpl, $code_ref, $nn);
-
 
350
		}
Line -... Line 351...
-
 
351
	}
-
 
352
 
-
 
353
	private function getCodeReferentiel($ref) {
-
 
354
		$code = $ref;
341
			$nn = $this->resultats[$index]['determination.nn'];
355
		if ($position = strpos($ref, '_')) {
-
 
356
			$code = substr($ref, 0, $position);
342
 
357
		} else if ($position = strpos($ref, ':')) {
-
 
358
			$code = substr($ref, 0, $position);
343
			$this->resultats[$index]['url_fiche_eflore'] = sprintf($urlTpl, $nn);
359
		}
344
		}
360
		return $code;
345
	}
361
	}