Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 2446 Rev 2449
Line 105... Line 105...
105
								"wgs84_latitude, ".
105
								"wgs84_latitude, ".
106
								"longitude, ".
106
								"longitude, ".
107
								"wgs84_longitude, ".
107
								"wgs84_longitude, ".
108
								$concatenation_id." as id_coord ".
108
								$concatenation_id." as id_coord ".
109
					'FROM cel_obs AS co '.
109
					'FROM cel_obs AS co '.
110
                    '   LEFT JOIN cel_zones_geo AS l '.
110
                    '   LEFT JOIN cel_zones_geo AS zg '.
111
                    '       ON (l.nom = co.zone_geo AND l.id_zone_geo = co.ce_zone_geo) '.
111
                    '       ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) '.
112
                    "WHERE transmission = '1' ".
112
                    "WHERE transmission = '1' ".
113
					" AND (".
113
					" AND (".
114
					$this->construireWhereRectangleStationOR()." OR ".
114
					$this->construireWhereRectangleStationOR()." OR ".
115
					$this->construireWhereRectangleCommuneOR().") ".
115
					$this->construireWhereRectangleCommuneOR().") ".
116
					$this->construireWhereDept().
116
					$this->construireWhereDept().
Line 143... Line 143...
143
	private $nb_obs = 0;
143
	private $nb_obs = 0;
Line 144... Line 144...
144
 
144
 
145
	private function compterObservations($params) {
145
	private function compterObservations($params) {
146
		$requete =  'SELECT COUNT(*) as nb '.
146
		$requete =  'SELECT COUNT(*) as nb '.
147
					'FROM cel_obs AS co '.
147
					'FROM cel_obs AS co '.
148
                    '   LEFT JOIN cel_zones_geo AS l '.
148
                    '   LEFT JOIN cel_zones_geo AS zg '.
149
                    '       ON (l.nom = co.zone_geo AND l.id_zone_geo = co.ce_zone_geo) '.
149
                    '       ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) '.
150
                    "WHERE transmission = '1' ".
150
                    "WHERE transmission = '1' ".
151
					" AND (".
151
					" AND (".
152
					$this->construireWhereRectangleStationOR()." OR ".
152
					$this->construireWhereRectangleStationOR()." OR ".
153
					$this->construireWhereRectangleCommuneOR().") ".
153
					$this->construireWhereRectangleCommuneOR().") ".
Line 331... Line 331...
331
			$requete = 	'SELECT SQL_CALC_FOUND_ROWS id_observation, ce_utilisateur, courriel_utilisateur, nom_utilisateur, prenom_utilisateur, '.
331
			$requete = 	'SELECT SQL_CALC_FOUND_ROWS id_observation, ce_utilisateur, courriel_utilisateur, nom_utilisateur, prenom_utilisateur, '.
332
						'	nom_sel, nom_ret, nom_sel_nn, nom_ret_nn, nt, famille, '.
332
						'	nom_sel, nom_ret, nom_sel_nn, nom_ret_nn, nt, famille, '.
333
						'	lieudit, zone_geo, date_observation, milieu, commentaire, '.
333
						'	lieudit, zone_geo, date_observation, milieu, commentaire, '.
334
						'	utm_secteur, utm_x, utm_y, code, date_transmission, nom_referentiel '.
334
						'	utm_secteur, utm_x, utm_y, code, date_transmission, nom_referentiel '.
335
						'FROM cel_obs AS co '.
335
						'FROM cel_obs AS co '.
336
						'	LEFT JOIN cel_zones_geo AS l '.
336
						'	LEFT JOIN cel_zones_geo AS zg '.
337
						"		ON (l.nom = co.zone_geo AND l.id_zone_geo = co.ce_zone_geo) ".
337
						"		ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) ".
338
						"WHERE transmission = '1' ".
338
						"WHERE transmission = '1' ".
339
						(($this->communeEstDemandee()) ? $this->construireWhereCommuneSansCoordonneesAvecSensibles() : $this->construireWhereCoordonneesSansSensibles()).
339
						(($this->communeEstDemandee()) ? $this->construireWhereCommuneSansCoordonneesAvecSensibles() : $this->construireWhereCoordonneesSansSensibles()).
340
						$this->construireWhereDept().
340
						$this->construireWhereDept().
341
						$this->construireWhereUtilisateur().
341
						$this->construireWhereUtilisateur().
342
						$this->construireWhereNumTaxonAvecSousTaxons().
342
						$this->construireWhereNumTaxonAvecSousTaxons().
Line 477... Line 477...
477
	public function getTaxons($params) {
477
	public function getTaxons($params) {
478
		$json = null;
478
		$json = null;
Line 479... Line 479...
479
 
479
 
480
		$requete = 	'SELECT SQL_CALC_FOUND_ROWS DISTINCT nom_ret, nom_ret_nn, nt, famille '.
480
		$requete = 	'SELECT SQL_CALC_FOUND_ROWS DISTINCT nom_ret, nom_ret_nn, nt, famille '.
481
					'FROM cel_obs AS co '.
481
					'FROM cel_obs AS co '.
482
					'	LEFT JOIN cel_zones_geo AS l '.
482
					'	LEFT JOIN cel_zones_geo AS zg '.
483
					'		ON (l.nom = co.zone_geo AND l.id_zone_geo = co.ce_zone_geo) '.
483
					'		ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) '.
484
					"WHERE transmission = '1' ".
484
					"WHERE transmission = '1' ".
485
					"	AND nom_ret != '' ".
485
					"	AND nom_ret != '' ".
486
					$this->construireWhereDept().
486
					$this->construireWhereDept().
487
                    $this->construireWhereCommune().
487
                    $this->construireWhereCommune().
Line 735... Line 735...
735
	 * Retour sous forme de tableau : array[identifiant] = array(ordre, ordre...);
735
	 * Retour sous forme de tableau : array[identifiant] = array(ordre, ordre...);
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 AS ci '.
741
			'	LEFT JOIN cel_obs AS co '.
741
			'	LEFT JOIN cel_obs AS co '.
742
			'		ON (ci.ce_observation = co.id_observation) '.
742
			'		ON (ci.ce_observation = co.id_observation) '.
743
			'	LEFT JOIN cel_zones_geo AS l '.
743
			'	LEFT JOIN cel_zones_geo AS zg '.
744
			'		ON (l.nom = co.zone_geo AND l.id_zone_geo = co.ce_zone_geo) '.
744
			'		ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) '.
745
			"WHERE co.transmission = '1' ".
745
			"WHERE co.transmission = '1' ".
746
			($type == 'date.photo' ? " AND (ci.date_prise_de_vue LIKE ".str_replace('-', ':', $param).' ' : '').
746
			($type == 'date.photo' ? " AND (ci.date_prise_de_vue LIKE ".str_replace('-', ':', $param).' ' : '').
747
			($type == 'date.creation' ? " AND ci.date_creation LIKE $param " : '').
747
			($type == 'date.creation' ? " AND ci.date_creation LIKE $param " : '').
748
			($type == 'date.liaison' ? " AND ci.date_liaison LIKE $param " : '').
748
			($type == 'date.liaison' ? " AND ci.date_liaison LIKE $param " : '').
749
			($type == 'commentaire.img' ? " AND ci.commentaire LIKE $param " : '').
749
			($type == 'commentaire.img' ? " AND ci.commentaire LIKE $param " : '').
Line 1096... Line 1096...
1096
			// Construction de la requête
1096
			// Construction de la requête
1097
			$requete = 	'SELECT DISTINCT co.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 '.
1098
						'FROM cel_images ci'.
1098
						'FROM cel_images ci'.
1099
						'	INNER JOIN cel_obs AS co '.
1099
						'	INNER JOIN cel_obs AS co '.
1100
						'		ON (ci.ce_observation = co.id_observation) '.
1100
						'		ON (ci.ce_observation = co.id_observation) '.
1101
						'	LEFT JOIN cel_zones_geo AS l '.
1101
						'	LEFT JOIN cel_zones_geo AS zg '.
1102
						"		ON (l.nom = co.zone_geo AND l.id_zone_geo = co.ce_zone_geo) ".
1102
						"		ON (zg.nom = co.zone_geo AND zg.id_zone_geo = co.ce_zone_geo) ".
1103
						"WHERE co.transmission = '1' ".
1103
						"WHERE co.transmission = '1' ".
1104
						$this->construireWhereCoordonnees().
1104
						$this->construireWhereCoordonnees().
1105
						$this->construireWhereUtilisateur().
1105
						$this->construireWhereUtilisateur().
1106
						$this->construireWhereNumTaxon().
1106
						$this->construireWhereNumTaxon().
1107
						$this->construireWhereNomTaxon().
1107
						$this->construireWhereNomTaxon().