Line 92... |
Line 92... |
92 |
--------------------------------------------------------------------------------*/
|
92 |
--------------------------------------------------------------------------------*/
|
Line 93... |
Line 93... |
93 |
|
93 |
|
94 |
private function getIdsObsImg() {
|
94 |
private function getIdsObsImg() {
|
95 |
$date_debut = "'{$this->parametres['date']}'";
|
95 |
$date_debut = "'{$this->parametres['date']}'";
|
96 |
$limite = @min(intval($this->parametres['navigation.limite']), 1000);
|
96 |
$limite = @min(intval($this->parametres['navigation.limite']), 1000);
|
97 |
$limite = $limite ? $limite : 10; // 0 => 10
|
97 |
$limite = $limite ? $limite : 100; // 0 => 10
|
98 |
$depart = intval(@$this->parametres['navigation.depart']);
|
98 |
$depart = intval(@$this->parametres['navigation.depart']);
|
Line 99... |
Line 99... |
99 |
$ordre = $this->parametres['ordre'];
|
99 |
$ordre = $this->parametres['ordre'];
|
100 |
|
100 |
|
101 |
$requete =
|
101 |
$requete =
|
102 |
'SELECT SQL_CALC_FOUND_ROWS p.id_observation, p.id_image, '.
|
102 |
'SELECT SQL_CALC_FOUND_ROWS p.id_observation, p.id_image, '.
|
103 |
'GROUP_CONCAT(iv.valeur) AS votes, '.
|
103 |
'GROUP_CONCAT(iv.valeur) AS votes, '.
|
104 |
'GROUP_CONCAT(DISTINCT tag) AS tags, '.
|
- |
|
105 |
'GREATEST('.
|
- |
|
106 |
' IFNULL(p.date_creation, \''.$this->date_defaut.'\'), '.
|
- |
|
107 |
' IFNULL(p.date_modification, \''.$this->date_defaut.'\'), '.
|
- |
|
108 |
' IFNULL(MAX(it.date), \''.$this->date_defaut.'\'), '.
|
- |
|
109 |
' IFNULL(MAX(it.date_modification), \''.$this->date_defaut.'\'), '.
|
- |
|
110 |
' IFNULL(MAX(iv.date), \''.$this->date_defaut.'\'), '.
|
- |
|
Line 111... |
Line 104... |
111 |
' IFNULL(MAX(c.date), \''.$this->date_defaut.'\'), '.
|
104 |
'GROUP_CONCAT(DISTINCT tag) AS tags, '.
|
- |
|
105 |
'modif_date '.
|
- |
|
106 |
|
- |
|
107 |
'FROM del_plantnet AS p '.
|
112 |
' IFNULL(MAX(cv.date), \''.$this->date_defaut.'\')) AS modif_date '.
|
108 |
' JOIN del_observation_modif_date '.
|
113 |
|
109 |
' ON (p.id_observation = del_observation_modif_date.id_observation '.
|
114 |
'FROM del_plantnet AS p '.
|
110 |
' AND modif_date >= '.$date_debut.') '.
|
115 |
' LEFT JOIN del_image_vote AS iv '.
|
111 |
' LEFT JOIN del_image_vote AS iv '.
|
116 |
' ON (id_image = iv.ce_image AND iv.ce_protocole = 3) '.
|
112 |
' ON (id_image = iv.ce_image AND iv.ce_protocole = 3) '.
|
117 |
' LEFT JOIN del_image_tag AS it '.
|
113 |
' LEFT JOIN del_image_tag AS it '.
|
118 |
' ON (id_image = it.ce_image AND it.actif = 1) '.
|
114 |
' ON (id_image = it.ce_image AND it.actif = 1) '.
|
119 |
' LEFT JOIN del_commentaire AS c '.
|
115 |
' LEFT JOIN del_commentaire AS c '.
|
120 |
' ON (id_observation = c.ce_observation) '.
|
116 |
' ON (p.id_observation = c.ce_observation) '.
|
121 |
' LEFT JOIN del_commentaire_vote AS cv '.
|
- |
|
122 |
' ON (c.id_commentaire = cv.ce_proposition) '.
|
- |
|
123 |
'GROUP BY id_image, id_observation '.
|
- |
|
124 |
'HAVING MAX(p.date_creation) >= '.$date_debut.' '.
|
- |
|
125 |
' OR MAX(p.date_modification) >= '.$date_debut.' '.
|
- |
|
126 |
' OR MAX(it.date) >= '.$date_debut.' '.
|
- |
|
127 |
' OR MAX(it.date_modification) >= '.$date_debut.' '.
|
- |
|
128 |
' OR MAX(iv.date) >= '.$date_debut.' '.
|
117 |
' LEFT JOIN del_commentaire_vote AS cv '.
|
129 |
' OR MAX(c.date) >= '.$date_debut.' '.
|
118 |
' ON (c.id_commentaire = cv.ce_proposition) '.
|
130 |
' OR MAX(cv.date) >= '.$date_debut.' '.
|
119 |
'GROUP BY id_image, p.id_observation '.
|
131 |
'ORDER BY modif_date ' . $ordre . ' '.
|
- |
|
132 |
'LIMIT '.$depart.', '.$limite.
|
- |
|
133 |
' -- '.__FILE__.':'.__LINE__;
|
- |
|
134 |
//echo $requete; exit;
|
- |
|
- |
|
120 |
'ORDER BY modif_date ' . $ordre . ' '.
|
135 |
// GROUP BY (très couteux) car multiples observations associées à une image
|
121 |
'LIMIT '.$depart.', '.$limite.
|
136 |
// charlie est ici :-)
|
122 |
' -- '.__FILE__.':'.__LINE__;
|
Line 137... |
Line 123... |
137 |
// eg: 16150,16185,16245,16246,118995,129989
|
123 |
|
138 |
return $this->bdd->recupererTous($requete);
|
124 |
return $this->bdd->recupererTous($requete);
|