738,19 → 738,17 |
// Construction de la requête |
$requete = 'SELECT DISTINCT co.id_obs, ci.ce_utilisateur AS utilisateur '. |
'FROM cel_images '. |
' LEFT JOIN cel_obs_images coi '. |
' ON (ci.id_image = coi.id_image) '. |
' LEFT JOIN cel_obs AS co '. |
' ON (coi.id_observation = co.id_observation) '. |
' ON (ci.ce_observation = co.id_observation) '. |
' LEFT JOIN cel_zones_geo AS l '. |
' ON (l.nom = co.zone_geo AND l.id_zone_geo = co.ce_zone_geo) '. |
"WHERE transmission = '1' ". |
($type == 'date.photo' ? " AND (ci_meta_date_time LIKE ".str_replace('-', ':', $param)." OR ci_meta_date LIKE $param) " : ''). |
($type == 'date.ajout' ? " AND ci_meta_date_ajout LIKE $param " : ''). |
($type == 'date.liaison' ? " AND coi_date_liaison LIKE $param " : ''). |
($type == 'commentaire.meta' ? " AND ci_meta_comment LIKE $param " : ''). |
($type == 'commentaire.utilisateur' ? " AND ci_meta_user_comment LIKE $param " : ''). |
($type == 'commentaire.*' ? " AND (ci_meta_comment LIKE $param OR ci_meta_user_comment LIKE $param) " : ''). |
"WHERE co.transmission = '1' ". |
($type == 'date.photo' ? " AND (ci.date_prise_de_vue LIKE ".str_replace('-', ':', $param).' ' : ''). |
($type == 'date.creation' ? " AND ci.date_creation LIKE $param " : ''). |
($type == 'date.liaison' ? " AND ci.date_liaison LIKE $param " : ''). |
($type == 'commentaire.img' ? " AND ci.commentaire LIKE $param " : ''). |
($type == 'commentaire.obs' ? " AND co.commentaire LIKE $param " : ''). |
($type == 'commentaire.*' ? " AND (co.commentaire LIKE $param OR ci.commentaire LIKE $param) " : ''). |
$this->construireWhereCoordonnees(). |
$this->construireWhereDept(). |
$this->construireWhereCommune(). |
949,7 → 947,7 |
private function construireWherePhotosSeulement() { |
$sql = ''; |
if (isset($this->parametres['photos']) && $this->parametres['photos'] == 1) { |
$sql = 'AND co.id_observation IN (SELECT DISTINCT id_observation FROM cel_obs_images) '; |
$sql = 'AND co.id_observation IN (SELECT DISTINCT ce_observation FROM cel_images) '; |
} |
return $sql; |
} |
1096,15 → 1094,13 |
if (isset($tag) && !$this->etreNull($tag)) { |
$tag_sql = $this->getSqlWhereMotsCles($tag); |
// Construction de la requête |
$requete = 'SELECT DISTINCT coi.id_observation AS id_obs, ci.ce_utilisateur AS utilisateur '. |
$requete = 'SELECT DISTINCT co.id_observation AS id_obs, ci.ce_utilisateur AS utilisateur '. |
'FROM cel_images ci'. |
' LEFT JOIN cel_obs_images coi'. |
' ON (ci.id_image = coi.id_image) '. |
' LEFT JOIN cel_obs AS co '. |
' ON (coi.id_observation = co.id_observation) '. |
' INNER JOIN cel_obs AS co '. |
' ON (ci.ce_observation = co.id_observation) '. |
' LEFT JOIN cel_zones_geo AS l '. |
" ON (l.nom = co.zone_geo AND l.id_zone_geo = co.ce_zone_geo) ". |
"WHERE transmission = '1' ". |
"WHERE co.transmission = '1' ". |
$this->construireWhereCoordonnees(). |
$this->construireWhereUtilisateur(). |
$this->construireWhereNumTaxon(). |