Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 2446 Rev 2449
Line 61... Line 61...
61
	 */
61
	 */
62
	public function getStations($params) {
62
	public function getStations($params) {
63
		$json = null;
63
		$json = null;
64
		$requete =  'SELECT utm_secteur, utm_x, utm_y, wgs84_latitude AS latitude, wgs84_longitude AS longitude '.
64
		$requete =  'SELECT utm_secteur, utm_x, utm_y, wgs84_latitude AS latitude, wgs84_longitude AS longitude '.
65
			'FROM cel_obs AS co '.
65
			'FROM cel_obs AS co '.
66
			'	LEFT JOIN cel_zones_geo AS l '.
66
			'	LEFT JOIN cel_zones_geo AS zg '.
67
			'		ON (l.id_zone_geo = co.ce_zone_geo) '.
67
			'		ON (zg.id_zone_geo = co.ce_zone_geo) '.
68
			"WHERE transmission = '1' ".
68
			"WHERE transmission = '1' ".
69
					$this->construireWhereDept().
69
					$this->construireWhereDept().
70
					$this->construireWhereCommune().
70
					$this->construireWhereCommune().
71
					$this->construireWherePhotosSeulement().
71
					$this->construireWherePhotosSeulement().
72
					$this->construireWhereUtilisateur().
72
					$this->construireWhereUtilisateur().
Line 135... Line 135...
135
			$requete = 	'SELECT SQL_CALC_FOUND_ROWS id_observation, ce_utilisateur, courriel_utilisateur, '.
135
			$requete = 	'SELECT SQL_CALC_FOUND_ROWS id_observation, ce_utilisateur, courriel_utilisateur, '.
136
				'	nom_sel, nom_ret, nom_sel_nn, nom_ret_nn, nt, famille, '.
136
				'	nom_sel, nom_ret, nom_sel_nn, nom_ret_nn, nt, famille, '.
137
				'	lieudit, zone_geo, date_observation, milieu, commentaire, '.
137
				'	lieudit, zone_geo, date_observation, milieu, commentaire, '.
138
				'	utm_secteur, utm_x, utm_y, id_zone_geo, date_transmission, nom_referentiel '.
138
				'	utm_secteur, utm_x, utm_y, id_zone_geo, date_transmission, nom_referentiel '.
139
				'FROM cel_obs AS co '.
139
				'FROM cel_obs AS co '.
140
				'	LEFT JOIN cel_zones_geo AS l '.
140
				'	LEFT JOIN cel_zones_geo AS zg '.
141
				"		ON (l.id_zone_geo = co.ce_zone_geo) ".
141
				"		ON (zg.id_zone_geo = co.ce_zone_geo) ".
142
				"WHERE transmission = '1' ".
142
				"WHERE transmission = '1' ".
143
				$this->construireWhereCoordonnees().
143
				$this->construireWhereCoordonnees().
144
				$this->construireWherePhotosSeulement().
144
				$this->construireWherePhotosSeulement().
145
				$this->construireWhereUtilisateur().
145
				$this->construireWhereUtilisateur().
146
				$this->construireWhereNumTaxon().
146
				$this->construireWhereNumTaxon().
Line 274... Line 274...
274
	public function getTaxons($params) {
274
	public function getTaxons($params) {
275
		$json = null;
275
		$json = null;
Line 276... Line 276...
276
 
276
 
277
		$requete = 	'SELECT SQL_CALC_FOUND_ROWS DISTINCT nom_ret, nom_ret_nn, nt, famille '.
277
		$requete = 	'SELECT SQL_CALC_FOUND_ROWS DISTINCT nom_ret, nom_ret_nn, nt, famille '.
278
					'FROM cel_obs AS co '.
278
					'FROM cel_obs AS co '.
279
					'	LEFT JOIN cel_zones_geo AS l '.
279
					'	LEFT JOIN cel_zones_geo AS zg '.
280
					'		ON (l.id_zone_geo = co.ce_zone_geo) '.
280
					'		ON (zg.id_zone_geo = co.ce_zone_geo) '.
281
					"WHERE transmission = '1' ".
281
					"WHERE transmission = '1' ".
282
					"	AND nom_ret != '' ".
282
					"	AND nom_ret != '' ".
283
					$this->construireWhereDept().
283
					$this->construireWhereDept().
284
                    $this->construireWhereCommune().
284
                    $this->construireWhereCommune().
Line 504... Line 504...
504
	 * Retour sous forme de tableau : array[identifiant] = array(ordre, ordre...);
504
	 * Retour sous forme de tableau : array[identifiant] = array(ordre, ordre...);
505
	 */
505
	 */
506
	private function obtenirObsLieesImg($type, $param) {
506
	private function obtenirObsLieesImg($type, $param) {
507
		// Construction de la requête
507
		// Construction de la requête
508
		$requete = 	'SELECT DISTINCT id_observation AS id_obs, co.ce_utilisateur AS utilisateur '.
508
		$requete = 	'SELECT DISTINCT id_observation AS id_obs, co.ce_utilisateur AS utilisateur '.
509
			'FROM cel_images ci'.
509
			'FROM cel_images AS ci'.
510
			'	INNER JOIN cel_obs AS co '.
510
			'	INNER JOIN cel_obs AS co '.
511
			'		ON ci.ce_observation = co.id_observation '.
511
			'		ON ci.ce_observation = co.id_observation '.
512
			'	LEFT JOIN locations AS l '.
512
			'	LEFT JOIN cel_zones_geo AS zg '.
513
			'		ON (l.id_zone_geo = co.ce_zone_geo) '.
513
			'		ON (zg.id_zone_geo = co.ce_zone_geo) '.
514
			"WHERE co.transmission = '1' ".
514
			"WHERE co.transmission = '1' ".
515
			($type == 'date.photo' ? " AND (date_prise_de_vue LIKE ".str_replace('-', ':', $param).") " : '').
515
			($type == 'date.photo' ? " AND (date_prise_de_vue LIKE ".str_replace('-', ':', $param).") " : '').
516
			($type == 'date.ajout' ? " AND ci.date_creation LIKE $param " : '').
516
			($type == 'date.ajout' ? " AND ci.date_creation LIKE $param " : '').
517
			($type == 'date.liaison' ? " AND ci.date_liaison LIKE $param " : '').
517
			($type == 'date.liaison' ? " AND ci.date_liaison LIKE $param " : '').
518
			// TODO: recherche sur le xml
518
			// TODO: recherche sur le xml
Line 664... Line 664...
664
		$sql = null;
664
		$sql = null;
665
		if (isset($tag) && !$this->etreNull($tag)) {
665
		if (isset($tag) && !$this->etreNull($tag)) {
666
			$tag_sql = $this->getSqlWhereMotsCles($tag);
666
			$tag_sql = $this->getSqlWhereMotsCles($tag);
667
			// Construction de la requête
667
			// Construction de la requête
668
			$requete = 	'SELECT DISTINCT co.id_observation AS id_obs, ci.ce_utilisateur AS utilisateur '.
668
			$requete = 	'SELECT DISTINCT co.id_observation AS id_obs, ci.ce_utilisateur AS utilisateur '.
669
						'FROM cel_images ci'.
669
						'FROM cel_images AS ci '.
670
						'	INNER JOIN cel_obs AS co '.
670
						'	INNER JOIN cel_obs AS co '.
671
						'		ON (ci.ce_observation = co.id_observation) '.
671
						'		ON (ci.ce_observation = co.id_observation) '.
672
						'	LEFT JOIN cel_zones_geo AS l '.
672
						'	LEFT JOIN cel_zones_geo AS zg '.
673
						"		ON (l.id_zone_geo = co.ce_zone_geo) ".
673
						"		ON (zg.id_zone_geo = co.ce_zone_geo) ".
674
						"WHERE co.transmission = '1' ".
674
						"WHERE co.transmission = '1' ".
675
						$this->construireWhereCoordonnees().
675
						$this->construireWhereCoordonnees().
676
						$this->construireWhereUtilisateur().
676
						$this->construireWhereUtilisateur().
677
						$this->construireWhereNumTaxon().
677
						$this->construireWhereNumTaxon().
678
						$this->construireWhereNomTaxon().
678
						$this->construireWhereNomTaxon().