Line 61... |
Line 61... |
61 |
*/
|
61 |
*/
|
62 |
public function getCarteDefautJson($params) {
|
62 |
public function getCarteDefautJson($params) {
|
63 |
$json = null;
|
63 |
$json = null;
|
64 |
$parametres = $this->traiterParametres(array('utilisateur', 'projet', 'dept', 'num_taxon'), $params, false);
|
64 |
$parametres = $this->traiterParametres(array('utilisateur', 'projet', 'dept', 'num_taxon'), $params, false);
|
65 |
extract($parametres);
|
65 |
extract($parametres);
|
- |
|
66 |
$dept = $this->traiterValeursMultiples($dept);
|
Line 66... |
Line 67... |
66 |
|
67 |
|
67 |
$requete = 'SELECT sector, x_utm, y_utm '.
|
68 |
$requete = 'SELECT sector, x_utm, y_utm '.
|
68 |
'FROM cel_inventory AS i '.
|
69 |
'FROM cel_inventory AS i '.
|
69 |
' LEFT JOIN locations AS l '.
|
70 |
' LEFT JOIN locations AS l '.
|
70 |
" ON (l.name = i.location AND l.code = TRIM(LEADING '0' FROM i.id_location)) ".
|
71 |
" ON (l.name = i.location AND l.code = TRIM(LEADING '0' FROM i.id_location)) ".
|
71 |
"WHERE transmission = '1' ".
|
72 |
"WHERE transmission = '1' ".
|
72 |
(isset($utilisateur) ? " AND identifiant = '$utilisateur' " : '' ).
|
73 |
(isset($utilisateur) ? " AND identifiant = '$utilisateur' " : '' ).
|
73 |
(isset($dept) ? " AND l.insee_code LIKE '$dept%' " : '').
|
74 |
(isset($dept) ? " AND l.code IN ($dept) " : '').
|
74 |
(isset($num_taxon) ? " AND num_taxon = '$num_taxon' " : '' ).
|
75 |
(isset($num_taxon) ? " AND num_taxon = '$num_taxon' " : '' ).
|
75 |
(isset($projet) ? ' AND ('.$this->getSqlWhereProjet($projet).') ' : '' );
|
76 |
(isset($projet) ? ' AND ('.$this->getSqlWhereProjet($projet).') ' : '' );
|
Line 76... |
Line 77... |
76 |
$resultats = $this->executerRequete($requete);
|
77 |
$resultats = $this->executerRequete($requete);
|
Line 130... |
Line 131... |
130 |
*/
|
131 |
*/
|
131 |
public function getCartePreciseJson($params) {
|
132 |
public function getCartePreciseJson($params) {
|
132 |
$json = null;
|
133 |
$json = null;
|
133 |
$parametres = $this->traiterParametres(array('cle', 'utilisateur', 'projet', 'dept', 'num_taxon'), $params, false);
|
134 |
$parametres = $this->traiterParametres(array('cle', 'utilisateur', 'projet', 'dept', 'num_taxon'), $params, false);
|
134 |
extract($parametres);
|
135 |
extract($parametres);
|
- |
|
136 |
$dept = $this->traiterValeursMultiples($dept);
|
Line 135... |
Line 137... |
135 |
|
137 |
|
136 |
// Vérification que la clé passée dans l'url est correspond à celle attendue
|
138 |
// Vérification que la clé passée dans l'url est correspond à celle attendue
|
137 |
if ($cle == $this->config['jrest_admin']['cleCarto']) {
|
139 |
if ($cle == $this->config['jrest_admin']['cleCarto']) {
|
138 |
$requete = 'SELECT sector, x_utm, y_utm, coord_x, coord_y, ref_geo '.
|
140 |
$requete = 'SELECT sector, x_utm, y_utm, coord_x, coord_y, ref_geo '.
|
139 |
'FROM cel_inventory AS i '.
|
141 |
'FROM cel_inventory AS i '.
|
140 |
' LEFT JOIN locations AS l '.
|
142 |
' LEFT JOIN locations AS l '.
|
141 |
" ON (l.name = i.location AND l.code = TRIM(LEADING '0' FROM i.id_location)) ".
|
143 |
" ON (l.name = i.location AND l.code = TRIM(LEADING '0' FROM i.id_location)) ".
|
142 |
"WHERE transmission = '1' ".
|
144 |
"WHERE transmission = '1' ".
|
143 |
(isset($utilisateur) ? " AND identifiant = '$utilisateur' " : '' ).
|
145 |
(isset($utilisateur) ? " AND identifiant = '$utilisateur' " : '' ).
|
144 |
(isset($dept) ? " AND l.insee_code LIKE '$dept%' " : '').
|
146 |
(isset($dept) ? " AND l.code IN ($dept) " : '').
|
145 |
(isset($num_taxon) ? " AND num_taxon = '$num_taxon' " : '' ).
|
147 |
(isset($num_taxon) ? " AND num_taxon = '$num_taxon' " : '' ).
|
146 |
(isset($projet) ? ' AND ('.$this->getSqlWhereProjet($projet).') ' : '' );
|
148 |
(isset($projet) ? ' AND ('.$this->getSqlWhereProjet($projet).') ' : '' );
|
Line 147... |
Line 149... |
147 |
$resultats = $this->executerRequete($requete);
|
149 |
$resultats = $this->executerRequete($requete);
|
Line 196... |
Line 198... |
196 |
*/
|
198 |
*/
|
197 |
public function getObservations($params) {
|
199 |
public function getObservations($params) {
|
198 |
$json = null;
|
200 |
$json = null;
|
199 |
$parametres = $this->traiterParametres(array('station', 'utilisateur', 'projet', 'dept', 'num_taxon'), $params, false);
|
201 |
$parametres = $this->traiterParametres(array('station', 'utilisateur', 'projet', 'dept', 'num_taxon'), $params, false);
|
200 |
extract($parametres);
|
202 |
extract($parametres);
|
- |
|
203 |
$dept = $this->traiterValeursMultiples($dept);
|
Line 201... |
Line 204... |
201 |
|
204 |
|
202 |
// Récupération des coordonnées depuis l'id station
|
205 |
// Récupération des coordonnées depuis l'id station
|
203 |
//$this->debug[] = $station;
|
206 |
//$this->debug[] = $station;
|
204 |
list($type, $coord) = explode(':', $station);
|
207 |
list($type, $coord) = explode(':', $station);
|
Line 221... |
Line 224... |
221 |
" ON (l.name = i.location AND l.code = TRIM(LEADING '0' FROM i.id_location)) ".
|
224 |
" ON (l.name = i.location AND l.code = TRIM(LEADING '0' FROM i.id_location)) ".
|
222 |
"WHERE transmission = '1' ".
|
225 |
"WHERE transmission = '1' ".
|
223 |
(($type == 'UTM') ? " AND (sector = '$secteur' AND x_utm = '$x_utm' AND y_utm = '$y_utm' ) " : '').
|
226 |
(($type == 'UTM') ? " AND (sector = '$secteur' AND x_utm = '$x_utm' AND y_utm = '$y_utm' ) " : '').
|
224 |
(($type == 'LngLat') ? " AND (coord_x = '$coord_x' AND coord_y = '$coord_y' ) " : '').
|
227 |
(($type == 'LngLat') ? " AND (coord_x = '$coord_x' AND coord_y = '$coord_y' ) " : '').
|
225 |
(isset($utilisateur) ? " AND identifiant = '$utilisateur' " : '').
|
228 |
(isset($utilisateur) ? " AND identifiant = '$utilisateur' " : '').
|
226 |
(isset($dept) ? " AND l.insee_code LIKE '$dept%' " : '').
|
229 |
(isset($dept) ? " AND l.code IN ($dept) " : '').
|
227 |
(isset($num_taxon) ? " AND num_taxon = '$num_taxon' " : '' ).
|
230 |
(isset($num_taxon) ? " AND num_taxon = '$num_taxon' " : '' ).
|
228 |
((isset($projet) && $projet_sql != '') ? " AND ($projet_sql) " : '' ).
|
231 |
((isset($projet) && $projet_sql != '') ? " AND ($projet_sql) " : '' ).
|
229 |
'ORDER BY nom_sel ASC ';
|
232 |
'ORDER BY nom_sel ASC ';
|
Line 230... |
Line 233... |
230 |
|
233 |
|
Line 245... |
Line 248... |
245 |
*/
|
248 |
*/
|
246 |
public function getTaxons($params) {
|
249 |
public function getTaxons($params) {
|
247 |
$json = null;
|
250 |
$json = null;
|
248 |
$parametres = $this->traiterParametres(array('utilisateur', 'projet', 'dept', 'num_taxon'), $params, false);
|
251 |
$parametres = $this->traiterParametres(array('utilisateur', 'projet', 'dept', 'num_taxon'), $params, false);
|
249 |
extract($parametres);
|
252 |
extract($parametres);
|
250 |
|
- |
|
- |
|
253 |
$dept = $this->traiterValeursMultiples($dept);
|
251 |
// Récupération du filtre where pour les mots clés "projet"
|
254 |
// Récupération du filtre where pour les mots clés "projet"
|
252 |
if (isset($projet)) {
|
255 |
if (isset($projet)) {
|
253 |
$projet_sql = $this->getSqlWhereProjet($projet);
|
256 |
$projet_sql = $this->getSqlWhereProjet($projet);
|
254 |
}
|
257 |
}
|
Line 257... |
Line 260... |
257 |
'FROM cel_inventory AS i '.
|
260 |
'FROM cel_inventory AS i '.
|
258 |
' LEFT JOIN locations AS l '.
|
261 |
' LEFT JOIN locations AS l '.
|
259 |
" ON (l.name = i.location AND l.code = TRIM(LEADING '0' FROM i.id_location)) ".
|
262 |
" ON (l.name = i.location AND l.code = TRIM(LEADING '0' FROM i.id_location)) ".
|
260 |
"WHERE transmission = '1' ".
|
263 |
"WHERE transmission = '1' ".
|
261 |
(isset($utilisateur) ? " AND identifiant = '$utilisateur' " : '').
|
264 |
(isset($utilisateur) ? " AND identifiant = '$utilisateur' " : '').
|
262 |
(isset($dept) ? " AND l.insee_code LIKE '$dept%' " : '').
|
265 |
(isset($dept) ? " AND l.code IN ($dept) " : '').
|
263 |
(isset($num_taxon) ? " AND num_taxon = '$num_taxon' " : '' ).
|
266 |
(isset($num_taxon) ? " AND num_taxon = '$num_taxon' " : '' ).
|
264 |
((isset($projet) && $projet_sql != '') ? " AND ($projet_sql) " : '' ).
|
267 |
((isset($projet) && $projet_sql != '') ? " AND ($projet_sql) " : '' ).
|
265 |
'ORDER BY nom_ret ASC ';
|
268 |
'ORDER BY nom_ret ASC ';
|
266 |
//$this->debug[] = $requete;
|
269 |
//$this->debug[] = $requete;
|
Line 300... |
Line 303... |
300 |
}
|
303 |
}
|
Line 301... |
Line 304... |
301 |
|
304 |
|
302 |
$sql = implode(" \nOR ", $requete_projet);
|
305 |
$sql = implode(" \nOR ", $requete_projet);
|
303 |
return $sql;
|
306 |
return $sql;
|
304 |
}
|
- |
|
305 |
|
307 |
}
|
306 |
}
|
308 |
}
|