Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 747 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

abstract class SourceDonnees {
        
        protected $limitesCarte = '';
        protected $taxon = array();
        protected $source = '';
        
        
        public function __construct($limitesCarte, $taxon, $source) {
                $this->limitesCarte = $limitesCarte;
                foreach ($this->limitesCarte as $bord => $valeur) {
                        $this->limitesCarte[$bord] = str_replace(",", ".", round($valeur, 6));
                }
                $this->bdd = new Bdd();
                $this->taxon = $taxon;
                $this->source = $source;
        }
        
        abstract public function recupererStations();
        
        abstract protected function construireWhereTaxon();
        
        protected function obtenirNomRang() {
                $nomsRangs = array('famille', 'genre', 'espece', 'sous_espece');
                $rangs = explode(',', Config::get('rangs'));
                for ($index = 0; $index < count($nomsRangs) && $rangs[$index] != $this->taxon['rang']; $index ++);
                $position = $index == count($nomsRangs) ? count($nomsRangs)-1 : $index;
                return $nomsRangs[$position];
        }
        
        protected function recupererSynonymesEtSousEspeces() {
                $this->bdd->requeter("USE ".Config::get('bdd_nom'));
                $requete =
                "SELECT num_nom, nom_sci, num_taxonomique FROM bdtfx_v1_01 WHERE hierarchie LIKE '%-{$this->taxon['num_nom']}-%' ".
                "OR num_taxonomique = {$this->taxon['num_taxonomique']}";
                return $this->bdd->recupererTous($requete);
        }
        
        protected function recupererGenres() {
                $this->bdd->requeter("USE ".Config::get('bdd_nom'));
                $requete =
                "SELECT num_nom, nom_sci, num_taxonomique FROM bdtfx_v1_01 WHERE rang=220 AND num_tax_sup={$this->taxon['num_nom']}";
                return $this->bdd->recupererTous($requete);
        }
        
}

?>