Blame | Last modification | View Log | RSS feed
<?phpfinal class DonneesMoissonnage extends SourceDonnees {public function __construct($limitesCarte, $taxon, $source) {parent::__construct($limitesCarte, $taxon, $source);}final public function recupererStations() {$bdd = new Bdd();$bdd->requeter("USE ".Config::get('bdd_nom'));$requete ="SELECT Floor(lieu_station_latitude*10)/10 AS lat, Floor(lieu_station_longitude*10)/10 AS lng, "."COUNT(guid) AS nb_observations FROM {$this->source}_tapir WHERE ".$this->construireWhereTaxon()." "."AND lieu_station_longitude BETWEEN ".$this->limitesCarte['ouest']." AND ".$this->limitesCarte['est']." "."AND lieu_station_latitude BETWEEN ".$this->limitesCarte['sud']." AND ".$this->limitesCarte['nord']." "."GROUP BY Floor(lieu_station_latitude*10)/10, Floor(lieu_station_longitude*10)/10 "."ORDER BY lat DESC, lng ASC";//echo $requete.'<br>';return $bdd->recupererTous($requete);}final protected function construireWhereTaxon() {$nomRang = $this->obtenirNomRang();$criteres = array();$criteres[] = "nom_scientifique_complet LIKE ".$this->bdd->proteger($this->taxon['nom_sci']."%");if ($nomRang == 'espece') {$sousTaxons = $this->recupererSynonymesEtSousEspeces();foreach ($sousTaxons as $sousTaxon) {$criteres[] = "nom_scientifique_complet LIKE ".$this->bdd->proteger($sousTaxon['nom_sci']."%");}} elseif ($nomRang == 'famille') {$sousTaxons = $this->recupererGenres();foreach ($sousTaxons as $sousTaxon) {$criteres[] = "nom_scientifique_complet LIKE ".$this->bdd->proteger($sousTaxon['nom_sci']."%");}}return "(".implode(' OR ',array_unique($criteres)).")";}}?>