727 |
alex |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
abstract class SourceDonnees {
|
|
|
4 |
|
|
|
5 |
protected $limitesCarte = '';
|
|
|
6 |
protected $taxon = array();
|
|
|
7 |
protected $source = '';
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
public function __construct($limitesCarte, $taxon, $source) {
|
|
|
11 |
$this->limitesCarte = $limitesCarte;
|
|
|
12 |
foreach ($this->limitesCarte as $bord => $valeur) {
|
|
|
13 |
$this->limitesCarte[$bord] = str_replace(",", ".", round($valeur, 6));
|
|
|
14 |
}
|
|
|
15 |
$this->bdd = new Bdd();
|
|
|
16 |
$this->taxon = $taxon;
|
|
|
17 |
$this->source = $source;
|
|
|
18 |
}
|
|
|
19 |
|
|
|
20 |
abstract public function recupererStations();
|
|
|
21 |
|
|
|
22 |
abstract protected function construireWhereTaxon();
|
|
|
23 |
|
|
|
24 |
protected function obtenirNomRang() {
|
|
|
25 |
$nomsRangs = array('famille', 'genre', 'espece', 'sous_espece');
|
|
|
26 |
$rangs = explode(',', Config::get('rangs'));
|
|
|
27 |
for ($index = 0; $index < count($nomsRangs) && $rangs[$index] != $this->taxon['rang']; $index ++);
|
|
|
28 |
$position = $index == count($nomsRangs) ? count($nomsRangs)-1 : $index;
|
|
|
29 |
return $nomsRangs[$position];
|
|
|
30 |
}
|
|
|
31 |
|
|
|
32 |
protected function recupererSynonymesEtSousEspeces() {
|
|
|
33 |
$this->bdd->requeter("USE ".Config::get('bdd_nom'));
|
|
|
34 |
$requete =
|
|
|
35 |
"SELECT num_nom, nom_sci, num_taxonomique FROM bdtfx_v1_01 WHERE hierarchie LIKE '%-{$this->taxon['num_nom']}-%' ".
|
|
|
36 |
"OR num_taxonomique = {$this->taxon['num_taxonomique']}";
|
|
|
37 |
return $this->bdd->recupererTous($requete);
|
|
|
38 |
}
|
|
|
39 |
|
|
|
40 |
protected function recupererGenres() {
|
|
|
41 |
$this->bdd->requeter("USE ".Config::get('bdd_nom'));
|
|
|
42 |
$requete =
|
|
|
43 |
"SELECT num_nom, nom_sci, num_taxonomique FROM bdtfx_v1_01 WHERE rang=220 AND num_tax_sup={$this->taxon['num_nom']}";
|
|
|
44 |
return $this->bdd->recupererTous($requete);
|
|
|
45 |
}
|
|
|
46 |
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
?>
|