Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

Rev 640 Rev 678
Line 19... Line 19...
19
	protected $ressources = array();
19
	protected $ressources = array();
Line 20... Line 20...
20
	
20
	
21
	private $bdd;
21
	private $bdd;
22
	private $retour_format = 'complet';
22
	private $retour_format = 'complet';
23
	private $retours_formats_autorises = array('complet','zone_geo');
-
 
Line 24... Line 23...
24
	protected $table_version = null;
23
	private $retours_formats_autorises = array('complet','zone_geo');
25
	
24
	
26
 
25
 
27
	public function __construct($config = null) {
-
 
28
		$this->config = $config;
26
	public function __construct($config = null) {
Line 29... Line 27...
29
		$this->bdd = $this->getBdd();
27
		$this->config = $config;
Line 30... Line 28...
30
		$this->table_version = Config::get('table_version');
28
		$this->bdd = $this->getBdd();
Line 73... Line 71...
73
	
71
	
Line 74... Line 72...
74
//+---------------------------FONCTIONS DE REQUETE---------------------------------------------------------+
72
//+---------------------------FONCTIONS DE REQUETE---------------------------------------------------------+
75
 
73
 
76
	private function obtenirLois(Array $id_lois) {
74
	private function obtenirLois(Array $id_lois) {
77
		$id_lois = array_map(array($this->bdd, 'proteger'), $id_lois);
75
		$id_lois = array_map(array($this->bdd, 'proteger'), $id_lois);
78
		$requete = "SELECT * FROM sptb_lois_v".$this->table_version.' '.
76
		$requete = "SELECT * FROM ".Config::get('bdd_table_lois').' '.
79
		           "WHERE id IN (".implode(',',$id_lois).") ";   
77
		           "WHERE id IN (".implode(',',$id_lois).") ";   
Line 80... Line 78...
80
		return $this->bdd->recupererTous($requete);
78
		return $this->bdd->recupererTous($requete);
81
	}
79
	}
82
	
80
	
83
	private function obtenirLoisZoneGeo(Array $id_lois) {
81
	private function obtenirLoisZoneGeo(Array $id_lois) {
84
		$id_lois = array_map(array($this->bdd, 'proteger'), $id_lois);
82
		$id_lois = array_map(array($this->bdd, 'proteger'), $id_lois);
85
		$requete = "SELECT DISTINCT zone_application, code_zone_application FROM sptb_lois_v".$this->table_version.' '.
83
		$requete = "SELECT DISTINCT zone_application, code_zone_application FROM ".Config::get('bdd_table_lois').' '.
Line 86... Line 84...
86
			           "WHERE id IN (".implode(',',$id_lois).") ";   
84
			           "WHERE id IN (".implode(',',$id_lois).") ";   
Line 92... Line 90...
92
		
90
		
93
		$conditions_taxons = array();
91
		$conditions_taxons = array();
94
		$conditions_taxons = $this->obtenirNumNomTaxonsSuperieurs($nn_demande);
92
		$conditions_taxons = $this->obtenirNumNomTaxonsSuperieurs($nn_demande);
Line 95... Line 93...
95
		$conditions_taxons[] = $this->bdd->proteger($nn_demande);
93
		$conditions_taxons[] = $this->bdd->proteger($nn_demande);
96
		
94
		
97
		$requete = "SELECT * FROM sptb_especes_v".$this->table_version.' '.
95
		$requete = "SELECT * FROM ".Config::get('bdd_table_especes').' '.
Line 98... Line 96...
98
		           "WHERE num_nom_retenu IN (".implode(', ', $conditions_taxons).") OR ".
96
		           "WHERE num_nom_retenu IN (".implode(', ', $conditions_taxons).") OR ".
99
				   "num_nom IN (".implode(', ', $conditions_taxons).") ";
97
				   "num_nom IN (".implode(', ', $conditions_taxons).") ";
Line 106... Line 104...
106
	private function obtenirNumNomTaxonsSuperieurs($nn_demande) {
104
	private function obtenirNumNomTaxonsSuperieurs($nn_demande) {
107
		$nn_taxons_sup = array();
105
		$nn_taxons_sup = array();
108
		// TODO: ceci ramène trop de champs alors que l'on a besoin que du numéro nomenclatural
106
		// TODO: ceci ramène trop de champs alors que l'on a besoin que du numéro nomenclatural
109
		// et il y a peut-être un meilleur moyen que ramener la hierarchie des taxons supérieurs
107
		// et il y a peut-être un meilleur moyen que ramener la hierarchie des taxons supérieurs
110
		// mais pour le moment ça marche et c'est assez rapide
108
		// mais pour le moment ça marche et c'est assez rapide
111
		$url = $this->ajouterHrefAutreProjet('taxons', $nn_demande, '/relations/superieurs','bdtfx');
109
		$url = $this->ajouterHrefAutreProjet('taxons', $nn_demande, '/relations/superieurs',Config::get('referentiel'));
112
		$classification = $this->consulterHref($url);
110
		$classification = $this->consulterHref($url);
113
		$classification = is_object($classification) ? get_object_vars($classification) : array();
111
		$classification = is_object($classification) ? get_object_vars($classification) : array();
Line 114... Line 112...
114
		
112
		
115
		if(isset($classification[$nn_demande])) {
113
		if(isset($classification[$nn_demande])) {