Subversion Repositories eFlore/Applications.cel

Rev

Rev 2296 | Rev 2449 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2296 Rev 2446
Line 736... Line 736...
736
	 */
736
	 */
737
	private function obtenirObsLieesImg($type, $param) {
737
	private function obtenirObsLieesImg($type, $param) {
738
		// Construction de la requête
738
		// Construction de la requête
739
		$requete = 	'SELECT DISTINCT co.id_obs,  ci.ce_utilisateur AS utilisateur '.
739
		$requete = 	'SELECT DISTINCT co.id_obs, ci.ce_utilisateur AS utilisateur '.
740
			'FROM  cel_images '.
740
			'FROM cel_images '.
741
			'	LEFT JOIN cel_obs_images coi '.
-
 
742
			'		ON (ci.id_image = coi.id_image) '.
-
 
743
			'	LEFT JOIN cel_obs AS co '.
741
			'	LEFT JOIN cel_obs AS co '.
744
			'		ON (coi.id_observation = co.id_observation) '.
742
			'		ON (ci.ce_observation = co.id_observation) '.
745
			'	LEFT JOIN cel_zones_geo AS l '.
743
			'	LEFT JOIN cel_zones_geo AS l '.
746
			'		ON (l.nom = co.zone_geo AND l.id_zone_geo = co.ce_zone_geo) '.
744
			'		ON (l.nom = co.zone_geo AND l.id_zone_geo = co.ce_zone_geo) '.
747
			"WHERE  transmission = '1' ".
745
			"WHERE co.transmission = '1' ".
748
			($type == 'date.photo' ? " AND (ci_meta_date_time LIKE ".str_replace('-', ':', $param)." OR ci_meta_date LIKE $param) " : '').
746
			($type == 'date.photo' ? " AND (ci.date_prise_de_vue LIKE ".str_replace('-', ':', $param).' ' : '').
749
			($type == 'date.ajout' ? " AND ci_meta_date_ajout LIKE $param " : '').
747
			($type == 'date.creation' ? " AND ci.date_creation LIKE $param " : '').
750
			($type == 'date.liaison' ? " AND coi_date_liaison LIKE $param " : '').
748
			($type == 'date.liaison' ? " AND ci.date_liaison LIKE $param " : '').
751
			($type == 'commentaire.meta' ? " AND ci_meta_comment LIKE $param " : '').
749
			($type == 'commentaire.img' ? " AND ci.commentaire LIKE $param " : '').
752
			($type == 'commentaire.utilisateur' ? "	AND ci_meta_user_comment LIKE $param " : '').
750
			($type == 'commentaire.obs' ? "	AND co.commentaire LIKE $param " : '').
753
			($type == 'commentaire.*' ? " AND (ci_meta_comment LIKE $param OR ci_meta_user_comment LIKE $param) " : '').
751
			($type == 'commentaire.*' ? " AND (co.commentaire LIKE $param OR ci.commentaire LIKE $param) " : '').
754
			$this->construireWhereCoordonnees().
752
			$this->construireWhereCoordonnees().
755
			$this->construireWhereDept().
753
			$this->construireWhereDept().
756
			$this->construireWhereCommune().
754
			$this->construireWhereCommune().
757
			$this->construireWhereUtilisateur().
755
			$this->construireWhereUtilisateur().
758
			$this->construireWhereNumTaxon().
756
			$this->construireWhereNumTaxon().
Line 947... Line 945...
947
 
945
 
948
 
946
 
949
	private function construireWherePhotosSeulement() {
947
	private function construireWherePhotosSeulement() {
950
		$sql = '';
948
		$sql = '';
951
		if (isset($this->parametres['photos']) && $this->parametres['photos'] == 1) {
949
		if (isset($this->parametres['photos']) && $this->parametres['photos'] == 1) {
952
			$sql = 'AND co.id_observation IN (SELECT DISTINCT id_observation FROM cel_obs_images) ';
950
			$sql = 'AND co.id_observation IN (SELECT DISTINCT ce_observation FROM cel_images) ';
953
		}
951
		}
Line 954... Line 952...
954
		return $sql;
952
		return $sql;
Line 1094... Line 1092...
1094
	private function getSqlWhereObsAvecImagesTaguees($tag) {
1092
	private function getSqlWhereObsAvecImagesTaguees($tag) {
1095
		$sql = null;
1093
		$sql = null;
1096
		if (isset($tag) && !$this->etreNull($tag)) {
1094
		if (isset($tag) && !$this->etreNull($tag)) {
1097
			$tag_sql = $this->getSqlWhereMotsCles($tag);
1095
			$tag_sql = $this->getSqlWhereMotsCles($tag);
1098
			// Construction de la requête
1096
			// Construction de la requête
1099
			$requete = 	'SELECT DISTINCT coi.id_observation AS id_obs,  ci.ce_utilisateur AS utilisateur '.
1097
			$requete = 	'SELECT DISTINCT co.id_observation AS id_obs, ci.ce_utilisateur AS utilisateur '.
1100
						'FROM cel_images ci'.
1098
						'FROM cel_images ci'.
1101
						'	LEFT JOIN cel_obs_images coi'.
-
 
1102
						'		ON (ci.id_image = coi.id_image) '.
-
 
1103
						'	LEFT JOIN cel_obs AS co '.
1099
						'	INNER JOIN cel_obs AS co '.
1104
						'		ON (coi.id_observation = co.id_observation) '.
1100
						'		ON (ci.ce_observation = co.id_observation) '.
1105
						'	LEFT JOIN cel_zones_geo AS l '.
1101
						'	LEFT JOIN cel_zones_geo AS l '.
1106
						"		ON (l.nom = co.zone_geo AND l.id_zone_geo = co.ce_zone_geo) ".
1102
						"		ON (l.nom = co.zone_geo AND l.id_zone_geo = co.ce_zone_geo) ".
1107
						"WHERE transmission = '1' ".
1103
						"WHERE co.transmission = '1' ".
1108
						$this->construireWhereCoordonnees().
1104
						$this->construireWhereCoordonnees().
1109
						$this->construireWhereUtilisateur().
1105
						$this->construireWhereUtilisateur().
1110
						$this->construireWhereNumTaxon().
1106
						$this->construireWhereNumTaxon().
1111
						$this->construireWhereNomTaxon().
1107
						$this->construireWhereNomTaxon().
1112
						$this->construireWhereReferentiel().
1108
						$this->construireWhereReferentiel().