| Line 14... |
Line 14... |
| 14 |
/**
|
14 |
/**
|
| 15 |
* Méthode de connection à la base de données sur demande.
|
15 |
* Méthode de connection à la base de données sur demande.
|
| 16 |
* Tous les services web n'ont pas besoin de s'y connecter.
|
16 |
* Tous les services web n'ont pas besoin de s'y connecter.
|
| 17 |
*/
|
17 |
*/
|
| 18 |
protected function getBdd() {
|
18 |
protected function getBdd() {
|
| 19 |
if (! isset($this->Bdd)) {
|
19 |
if (! isset($this->Bdd)) {
|
| 20 |
$this->Bdd = new Bdd();
|
20 |
$this->Bdd = new Bdd();
|
| 21 |
}
|
21 |
}
|
| 22 |
return $this->Bdd;
|
22 |
return $this->Bdd;
|
| 23 |
}
|
23 |
}
|
| Line 24... |
Line 24... |
| 24 |
|
24 |
|
| 25 |
public function definirCouleurs() {
|
25 |
public function definirCouleurs() {
|
| 26 |
// green
|
26 |
// green
|
| Line 61... |
Line 61... |
| 61 |
*/
|
61 |
*/
|
| 62 |
if ($this->info['nt'] == 0) {
|
62 |
if ($this->info['nt'] == 0) {
|
| 63 |
$inventoriesCel = array();
|
63 |
$inventoriesCel = array();
|
| 64 |
} else {
|
64 |
} else {
|
| 65 |
$queryCel = "SELECT 'cel' as collection_code, zone_geo as location, REPLACE(ce_zone_geo,'INSEE-C:','') as id_location, date_observation, ".
|
65 |
$queryCel = "SELECT 'cel' as collection_code, zone_geo as location, REPLACE(ce_zone_geo,'INSEE-C:','') as id_location, date_observation, ".
|
| 66 |
" longitude as y_utm, latitude as x_utm, geodatum as sector, courriel_utilisateur as identifiant FROM tb_cel.cel_obs ".
|
66 |
" longitude as y_utm, latitude as x_utm, geodatum as sector, courriel_utilisateur as identifiant FROM tb_cel.cel_obs ".
|
| 67 |
"WHERE nt = '".$this->info['nt']."' ".
|
67 |
"WHERE nt = '".$this->info['nt']."' ".
|
| 68 |
" AND transmission = 1";
|
68 |
" AND transmission = 1";
|
| 69 |
$inventoriesCel = $this->getBdd()->recupererTous($queryCel);
|
69 |
$inventoriesCel = $this->getBdd()->recupererTous($queryCel);
|
| 70 |
}
|
70 |
}
|
| Line 71... |
Line 71... |
| 71 |
|
71 |
|
| 72 |
// Recuperation des donnees de moissonage
|
72 |
// Recuperation des donnees de moissonage
|
| 73 |
// Collection code = 'flore' (Cenlr)
|
73 |
// Collection code = 'flore' (Cenlr)
|
| 74 |
if ($this->info['nom'] == '') {
|
74 |
if ($this->info['nom'] == '') {
|
| 75 |
$inventoriesCenlr = array();
|
75 |
$inventoriesCenlr = array();
|
| 76 |
} else {
|
76 |
} else {
|
| 77 |
$queryCenlr = "SELECT collection_code, locality as location, county as id_location, ".
|
77 |
$queryCenlr = "SELECT collection_code, locality as location, county as id_location, ".
|
| 78 |
" STR_TO_DATE(concat(year, '/',month, '/',day), '%Y/%m/%d') as date_observation, latitude as y_utm , ".
|
78 |
" STR_TO_DATE(concat(year, '/',month, '/',day), '%Y/%m/%d') as date_observation, latitude as y_utm , ".
|
| 79 |
" longitude as x_utm , max_altitude as sector, collector_name as identifiant ".
|
79 |
" longitude as x_utm , max_altitude as sector, collector_name as identifiant ".
|
| 80 |
"FROM tb_hit_indexation.raw_occurrence_record ".
|
80 |
"FROM tb_hit_indexation.raw_occurrence_record ".
|
| 81 |
"WHERE scientific_name = ".$this->getBdd()->proteger($this->info['nom']).
|
81 |
"WHERE scientific_name = ".$this->getBdd()->proteger($this->info['nom']).
|
| 82 |
" AND collection_code = 'flore' ".
|
82 |
" AND collection_code = 'flore' ".
|
| 83 |
" AND (deleted IS NULL OR deleted = '0000-00-00 00:00:00')";
|
83 |
" AND (deleted IS NULL OR deleted = '0000-00-00 00:00:00')";
|
| 84 |
$inventoriesCenlr = $this->getBdd()->recupererTous($queryCenlr);
|
84 |
$inventoriesCenlr = $this->getBdd()->recupererTous($queryCenlr);
|
| Line 85... |
Line 85... |
| 85 |
}
|
85 |
}
|
| 86 |
|
86 |
|
| Line 97... |
Line 97... |
| 97 |
// Collection code = 'sophy'
|
97 |
// Collection code = 'sophy'
|
| 98 |
if ($this->info['nom_ss_auteur'] == '') {
|
98 |
if ($this->info['nom_ss_auteur'] == '') {
|
| 99 |
$inventoriesSophy = array();
|
99 |
$inventoriesSophy = array();
|
| 100 |
} else {
|
100 |
} else {
|
| 101 |
$querySophy = "SELECT 'sophy' as collection_code, lieu_station_nom as location, lieu_commune_code_insee as id_location, ".
|
101 |
$querySophy = "SELECT 'sophy' as collection_code, lieu_station_nom as location, lieu_commune_code_insee as id_location, ".
|
| 102 |
" observation_date as date_observation, lieu_station_utm_est as x_utm , ".
|
102 |
" observation_date as date_observation, lieu_station_utm_est as x_utm , ".
|
| 103 |
" lieu_station_utm_nord as y_utm , lieu_station_utm_zone as sector, observateur_nom_complet as identifiant ".
|
103 |
" lieu_station_utm_nord as y_utm , lieu_station_utm_zone as sector, observateur_nom_complet as identifiant ".
|
| 104 |
"FROM sophy_tapir ".
|
104 |
"FROM sophy_tapir ".
|
| 105 |
"WHERE nom_scientifique_complet = ".$this->getBdd()->proteger($this->info['nom_ss_auteur']);
|
105 |
"WHERE nom_scientifique_complet = ".$this->getBdd()->proteger($this->info['nom_ss_auteur']);
|
| 106 |
$inventoriesSophy = $this->getBdd()->recupererTous($querySophy);
|
106 |
$inventoriesSophy = $this->getBdd()->recupererTous($querySophy);
|
| 107 |
}
|
107 |
}
|
| Line 108... |
Line 108... |
| 108 |
|
108 |
|
| 109 |
return array_merge($inventoriesCel, $inventoriesCenlr, $inventoriesSophy); //$inventoriesCbnmed,
|
109 |
return array_merge($inventoriesCel, $inventoriesCenlr, $inventoriesSophy); //$inventoriesCbnmed,
|