Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 2146 → Rev 2147

/trunk/services/modules/0.1/plantnet/Changements.php
94,7 → 94,7
private function getIdsObsImg() {
$date_debut = "'{$this->parametres['date']}'";
$limite = @min(intval($this->parametres['navigation.limite']), 1000);
$limite = $limite ? $limite : 10; // 0 => 10
$limite = $limite ? $limite : 100; // 0 => 10
$depart = intval(@$this->parametres['navigation.depart']);
$ordre = $this->parametres['ordre'];
 
102,39 → 102,25
'SELECT SQL_CALC_FOUND_ROWS p.id_observation, p.id_image, '.
'GROUP_CONCAT(iv.valeur) AS votes, '.
'GROUP_CONCAT(DISTINCT tag) AS tags, '.
'GREATEST('.
' IFNULL(p.date_creation, \''.$this->date_defaut.'\'), '.
' IFNULL(p.date_modification, \''.$this->date_defaut.'\'), '.
' IFNULL(MAX(it.date), \''.$this->date_defaut.'\'), '.
' IFNULL(MAX(it.date_modification), \''.$this->date_defaut.'\'), '.
' IFNULL(MAX(iv.date), \''.$this->date_defaut.'\'), '.
' IFNULL(MAX(c.date), \''.$this->date_defaut.'\'), '.
' IFNULL(MAX(cv.date), \''.$this->date_defaut.'\')) AS modif_date '.
'modif_date '.
 
'FROM del_plantnet AS p '.
' JOIN del_observation_modif_date '.
' ON (p.id_observation = del_observation_modif_date.id_observation '.
' AND modif_date >= '.$date_debut.') '.
' LEFT JOIN del_image_vote AS iv '.
' ON (id_image = iv.ce_image AND iv.ce_protocole = 3) '.
' LEFT JOIN del_image_tag AS it '.
' ON (id_image = it.ce_image AND it.actif = 1) '.
' LEFT JOIN del_commentaire AS c '.
' ON (id_observation = c.ce_observation) '.
' ON (p.id_observation = c.ce_observation) '.
' LEFT JOIN del_commentaire_vote AS cv '.
' ON (c.id_commentaire = cv.ce_proposition) '.
'GROUP BY id_image, id_observation '.
'HAVING MAX(p.date_creation) >= '.$date_debut.' '.
' OR MAX(p.date_modification) >= '.$date_debut.' '.
' OR MAX(it.date) >= '.$date_debut.' '.
' OR MAX(it.date_modification) >= '.$date_debut.' '.
' OR MAX(iv.date) >= '.$date_debut.' '.
' OR MAX(c.date) >= '.$date_debut.' '.
' OR MAX(cv.date) >= '.$date_debut.' '.
'GROUP BY id_image, p.id_observation '.
'ORDER BY modif_date ' . $ordre . ' '.
'LIMIT '.$depart.', '.$limite.
' -- '.__FILE__.':'.__LINE__;
//echo $requete; exit;
// GROUP BY (très couteux) car multiples observations associées à une image
// charlie est ici :-)
// eg: 16150,16185,16245,16246,118995,129989
 
return $this->bdd->recupererTous($requete);
}