Subversion Repositories eFlore/Applications.del

Rev

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

Rev 1990 Rev 2122
Line 25... Line 25...
25
	private $bdd;
25
	private $bdd;
Line 26... Line 26...
26
 
26
 
27
	private $parametres = array();
27
	private $parametres = array();
28
	private $ressources = array();
28
	private $ressources = array();
-
 
29
	private $date_defaut = '1900-01-01';
29
	private $date_defaut = '1900-01-01';
30
	private $ordre_defaut = 'ASC';
30
	private $idsObsImg = array();
31
	private $idsObsImg = array();
Line 31... Line 32...
31
	private $infosObsImg = array();
32
	private $infosObsImg = array();
Line 55... Line 56...
55
 
56
 
56
		if (!isset($parametres['date'])) {
57
		if (!isset($parametres['date'])) {
57
			$this->parametres['date'] = $this->date_defaut;
58
			$this->parametres['date'] = $this->date_defaut;
Line -... Line 59...
-
 
59
		}
-
 
60
 
-
 
61
		if (!isset($parametres['ordre']) || !in_array($parametres['ordre'], array('asc','ASC','desc','DESC'))) {
-
 
62
			$this->parametres['ordre'] = $this->ordre_defaut;
58
		}
63
		}
59
 
64
 
60
		// Lancement du service
65
		// Lancement du service
61
		$this->idsObsImg = $this->getIdsObsImg();
66
		$this->idsObsImg = $this->getIdsObsImg();
62
		$infos = array();
67
		$infos = array();
Line 84... Line 89...
84
	private function getIdsObsImg() {
89
	private function getIdsObsImg() {
85
		$date_debut = "'{$this->parametres['date']}'";
90
		$date_debut = "'{$this->parametres['date']}'";
86
		$limite = @min(intval($this->parametres['navigation.limite']), 1000);
91
		$limite = @min(intval($this->parametres['navigation.limite']), 1000);
87
		$limite = $limite ? $limite : 10; // 0 => 10
92
		$limite = $limite ? $limite : 10; // 0 => 10
88
		$depart = intval(@$this->parametres['navigation.depart']);
93
		$depart = intval(@$this->parametres['navigation.depart']);
-
 
94
		$ordre = $this->parametres['ordre'];
Line 89... Line 95...
89
 
95
 
90
		$requete =
96
		$requete =
91
			'SELECT SQL_CALC_FOUND_ROWS p.id_observation, p.id_image, '.
97
			'SELECT SQL_CALC_FOUND_ROWS p.id_observation, p.id_image, '.
92
			'GROUP_CONCAT(iv.valeur) AS votes, '.
98
			'GROUP_CONCAT(iv.valeur) AS votes, '.
Line 115... Line 121...
115
			'	OR MAX(it.date) >= '.$date_debut.' '.
121
			'	OR MAX(it.date) >= '.$date_debut.' '.
116
			'	OR MAX(it.date_modification) >= '.$date_debut.' '.
122
			'	OR MAX(it.date_modification) >= '.$date_debut.' '.
117
			'	OR MAX(iv.date) >= '.$date_debut.' '.
123
			'	OR MAX(iv.date) >= '.$date_debut.' '.
118
			'	OR MAX(c.date) >= '.$date_debut.' '.
124
			'	OR MAX(c.date) >= '.$date_debut.' '.
119
			'	OR MAX(cv.date) >= '.$date_debut.' '.
125
			'	OR MAX(cv.date) >= '.$date_debut.' '.
120
			'ORDER BY modif_date DESC '.
126
			'ORDER BY modif_date ' . $ordre . ' '.
121
			'LIMIT '.$depart.', '.$limite.
127
			'LIMIT '.$depart.', '.$limite.
122
			' -- '.__FILE__.':'.__LINE__;
128
			' -- '.__FILE__.':'.__LINE__;
123
		//echo $requete; exit;
129
		//echo $requete; exit;
124
		// GROUP BY (très couteux) car multiples observations associées à une image
130
		// GROUP BY (très couteux) car multiples observations associées à une image
125
		// charlie est ici :-)
131
		// charlie est ici :-)