Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

Rev 1201 Rev 1212
Line 105... Line 105...
105
		"SELECT DISTINCTROW lieu_commune_code_insee, observation_date AS date, observateur_nom_complet AS auteur ".
105
		"SELECT DISTINCTROW lieu_commune_code_insee, observation_date AS date, observateur_nom_complet AS auteur ".
106
		"FROM {$source}_tapir WHERE ".$this->construireWhereTaxonMoissonnage($source)." ".
106
		"FROM {$source}_tapir WHERE ".$this->construireWhereTaxonMoissonnage($source)." ".
107
		"AND lieu_station_longitude BETWEEN ".$this->limitesCarte['ouest']." AND ".$this->limitesCarte['est']." ".
107
		"AND lieu_station_longitude BETWEEN ".$this->limitesCarte['ouest']." AND ".$this->limitesCarte['est']." ".
108
		"AND lieu_station_latitude BETWEEN ".$this->limitesCarte['sud']." AND ".$this->limitesCarte['nord']." ".
108
		"AND lieu_station_latitude BETWEEN ".$this->limitesCarte['sud']." AND ".$this->limitesCarte['nord']." ".
109
		"AND Length(lieu_commune_code_insee)=5 ORDER BY lieu_commune_code_insee, date"." -- " . __FILE__ . ":" . __LINE__." ". @$_SERVER['REQUEST_URI'];
109
		"AND Length(lieu_commune_code_insee)=5 ORDER BY lieu_commune_code_insee, date"." -- " . __FILE__ . ":" . __LINE__." ". @$_SERVER['REQUEST_URI'];
110
		$stations = $this->bdd->recupererTous($requete);
110
		$stations = $this->bdd->recupererTous($requete);		
111
		$this->rechercherInfosCommune($stations);
111
		$this->rechercherInfosCommune($stations);
112
		return $stations;
112
		return $stations;
113
	}
113
	}
Line 114... Line 114...
114
	
114
	
Line 122... Line 122...
122
		" ORDER BY lat DESC, lng ASC, lieu_commune_code_insee, date"." -- " . __FILE__ . ":" . __LINE__." ". @$_SERVER['REQUEST_URI'];
122
		" ORDER BY lat DESC, lng ASC, lieu_commune_code_insee, date"." -- " . __FILE__ . ":" . __LINE__." ". @$_SERVER['REQUEST_URI'];
123
		$stations = $this->bdd->recupererTous($requete);
123
		$stations = $this->bdd->recupererTous($requete);
124
		return $stations;
124
		return $stations;
125
	}
125
	}
Line -... Line 126...
-
 
126
	
-
 
127
	public function recupererStationsPhotoflora() {
-
 
128
		$this->bdd->requeter("USE ".Config::get('bdd_nom'));
-
 
129
		$requete =
-
 
130
		"SELECT DISTINCTROW lieu_commune_code_insee, observation_date AS date, observateur_nom_complet AS auteur ".
-
 
131
		"FROM photoflora_tapir WHERE ".$this->construireWhereTaxonMoissonnage('photoflora')." ".
-
 
132
		"AND Length(lieu_commune_code_insee)=5 ORDER BY lieu_commune_code_insee, date"." -- " . __FILE__ . ":" . __LINE__." ". @$_SERVER['REQUEST_URI'];
-
 
133
		$stations = $this->bdd->recupererTous($requete);
-
 
134
		$this->rechercherInfosCommune($stations);
-
 
135
		return $stations;
-
 
136
	}
-
 
137
	
126
	
138
	
127
	private function construireWhereTaxonMoissonnage($source) {
139
	private function construireWhereTaxonMoissonnage($source) {
128
		$nomRang = $this->obtenirNomRang();
140
		$nomRang = $this->obtenirNomRang();
129
		$criteres = array();
141
		$criteres = array();
130
		$criteres[] = (in_array($source, array("baznat", "ifn", "vigie_flore")) ) ? 
142
		$criteres[] = (in_array($source, array("baznat", "ifn", "vigie_flore", "photoflora")) ) ? 
131
						"num_nom = ".$this->taxon['num_nom'] : 
143
						"num_nom = ".$this->taxon['num_nom'] : 
132
						"nom_scientifique_complet LIKE ".$this->bdd->proteger($this->taxon['nom_sci']) ;
144
						"nom_scientifique_complet LIKE ".$this->bdd->proteger($this->taxon['nom_sci']) ;
133
		if ($this->nomRang == 'espece' || $this->nomRang == 'sous_espece') {
145
		if ($this->nomRang == 'espece' || $this->nomRang == 'sous_espece') {
134
			foreach ($this->taxons as $sousTaxon) {
146
			foreach ($this->taxons as $sousTaxon) {
135
				if ($source == "sophy") {
147
				if ($source == "sophy") {
136
					if ($sousTaxon['num_nom'] = $sousTaxon['num_nom_retenu']) {
148
					if (isset($sousTaxon['num_nom_retenu']) && $sousTaxon['num_nom'] == $sousTaxon['num_nom_retenu']) {
137
						$criteres[] =
149
						$criteres[] =
138
						"nom_scientifique_complet LIKE ".$this->bdd->proteger($sousTaxon['nom_sci']) ;
150
						"nom_scientifique_complet LIKE ".$this->bdd->proteger($sousTaxon['nom_sci']) ;
139
					}
151
					}
140
				} else {
152
				} else {
141
					$criteres[] = (in_array($source, array("baznat", "ifn", "vigie_flore"))) ?
153
					$criteres[] = (in_array($source, array("baznat", "ifn", "vigie_flore", "photoflora"))) ?
142
										"num_nom = ".$sousTaxon['num_nom'] : 
154
										"num_nom = ".$sousTaxon['num_nom'] : 
143
										"nom_scientifique_complet LIKE ".$this->bdd->proteger($sousTaxon['nom_sci']) ;
155
										"nom_scientifique_complet LIKE ".$this->bdd->proteger($sousTaxon['nom_sci']) ;
144
				}
156
				}
145
			}
157
			}
146
		} elseif ($this->nomRang == 'famille') {
158
		} elseif ($this->nomRang == 'famille') {
147
			foreach ($this->genres as $genre) {
159
			foreach ($this->genres as $genre) {
148
				$criteres[] = "nom_scientifique_complet LIKE ".$this->bdd->proteger($genre['nom_sci']."%");
160
				$criteres[] = "nom_scientifique_complet LIKE ".$this->bdd->proteger($genre['nom_sci']."%");
149
			}
161
			}
150
		}
162
		}
-
 
163
		return "(".implode(' OR ',array_unique($criteres)).")";
151
		return "(".implode(' OR ',array_unique($criteres)).")";
164
		
Line 152... Line 165...
152
	}
165
	}
153
	
166
	
154
	private function rechercherInfosCommune(& $stations) {
167
	private function rechercherInfosCommune(& $stations) {