61 |
aurelien |
1 |
<?php
|
|
|
2 |
// declare(encoding='UTF-8');
|
|
|
3 |
|
|
|
4 |
/**
|
|
|
5 |
* Classe de gestion des liens.
|
|
|
6 |
*
|
|
|
7 |
* @package ODS_saisie
|
|
|
8 |
* @category Php 5.2
|
|
|
9 |
* @author Aurélien Peronnet <aurelien@tela-botanica.org>
|
|
|
10 |
* @copyright 2010 Tela-Botanica
|
|
|
11 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
|
|
|
12 |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
|
|
|
13 |
* @version SVN: $Id: Fiche.php 152 2010-09-06 16:19:12Z jpm $
|
|
|
14 |
*/
|
|
|
15 |
class Liens extends aControleur {
|
|
|
16 |
|
70 |
aurelien |
17 |
public static function construireUrl($tableau_params, $conserver_parametres_actuels = false) {
|
61 |
aurelien |
18 |
|
|
|
19 |
if ($conserver_parametres_actuels) {
|
|
|
20 |
return '?'.http_build_query($tableau_params + $_GET);
|
|
|
21 |
}
|
|
|
22 |
return '?'.http_build_query($tableau_params);
|
|
|
23 |
}
|
|
|
24 |
|
70 |
aurelien |
25 |
public static function getUrlSquelette() {
|
61 |
aurelien |
26 |
|
70 |
aurelien |
27 |
$url_base = self::getUrlBaseComplete();
|
61 |
aurelien |
28 |
$url_base_squelette = $url_base.Config::get('dossier_squelettes').DS;
|
|
|
29 |
|
|
|
30 |
return $url_base_squelette;
|
|
|
31 |
}
|
|
|
32 |
|
70 |
aurelien |
33 |
public static function getUrlStyle() {
|
|
|
34 |
$url_base_style = self::getUrlSquelette().'css'.DS;
|
61 |
aurelien |
35 |
|
|
|
36 |
return $url_base_style;
|
|
|
37 |
}
|
|
|
38 |
|
70 |
aurelien |
39 |
public static function getUrlScript() {
|
|
|
40 |
$url_base_script = self::getUrlSquelette().'js'.DS;
|
61 |
aurelien |
41 |
|
|
|
42 |
return $url_base_script;
|
|
|
43 |
}
|
|
|
44 |
|
70 |
aurelien |
45 |
public static function getUrlImage() {
|
|
|
46 |
$url_base_image = self::getUrlSquelette().'images'.DS;
|
61 |
aurelien |
47 |
|
|
|
48 |
return $url_base_image;
|
|
|
49 |
}
|
|
|
50 |
|
167 |
aurelien |
51 |
public static function getUrlImageEspece($nom_sci, $format = 'CXS') {
|
|
|
52 |
|
|
|
53 |
$nom_sci_formate = strtolower(str_replace(' ', '_', $nom_sci));
|
|
|
54 |
|
|
|
55 |
if(!file_exists(Config::get('dossier_images_especes').$format.'/'.$nom_sci_formate.'.jpg')) {
|
|
|
56 |
return Config::get('url_images_especes').$format.'/'.'vide.jpg';
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
return Config::get('url_images_especes').$format.'/'.$nom_sci_formate.'.jpg';
|
96 |
aurelien |
60 |
}
|
|
|
61 |
|
259 |
aurelien |
62 |
public static function getUrlFicheEspece($nom_sci) {
|
|
|
63 |
|
|
|
64 |
$nom_sci_formate = strtolower(str_replace(' ', '_', $nom_sci));
|
|
|
65 |
return Config::get('url_fiches_especes').$nom_sci_formate.'/';
|
|
|
66 |
}
|
|
|
67 |
|
287 |
aurelien |
68 |
public static function getUrlAdministrationEspeces() {
|
|
|
69 |
$params = array(
|
|
|
70 |
'module' => 'Administration',
|
|
|
71 |
'action' => 'afficherListeEspecesAdministrables'
|
|
|
72 |
);
|
|
|
73 |
return self::construireUrl($params);
|
|
|
74 |
}
|
|
|
75 |
|
185 |
aurelien |
76 |
public static function getCreditImageEspece($nom_sci) {
|
|
|
77 |
|
|
|
78 |
$nom_sci_formate = strtolower(str_replace(' ', '_', $nom_sci));
|
|
|
79 |
|
|
|
80 |
if(!file_exists(Config::get('dossier_images_especes').'/'.$nom_sci_formate.'.txt')) {
|
|
|
81 |
$credit = '';
|
|
|
82 |
} else {
|
|
|
83 |
$credit = file_get_contents(Config::get('dossier_images_especes').'/'.$nom_sci_formate.'.txt');
|
207 |
aurelien |
84 |
$credit = htmlentities($credit);
|
185 |
aurelien |
85 |
}
|
|
|
86 |
|
|
|
87 |
if(trim($credit) != '') {
|
|
|
88 |
$credit = 'Crédits : '.$credit;
|
|
|
89 |
}
|
|
|
90 |
|
|
|
91 |
return $credit;
|
|
|
92 |
}
|
|
|
93 |
|
70 |
aurelien |
94 |
public static function getUrlBaseReecrite() {
|
61 |
aurelien |
95 |
|
|
|
96 |
if(isset($_SERVER['REDIRECT_URL']) && $_SERVER['REDIRECT_URL'] != '') {
|
|
|
97 |
|
|
|
98 |
}
|
|
|
99 |
|
|
|
100 |
$base_url_reecrite = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REDIRECT_URL'];
|
|
|
101 |
$base_url_reecrite .= '/';
|
|
|
102 |
|
259 |
aurelien |
103 |
return $base_url_reecrite;
|
61 |
aurelien |
104 |
}
|
|
|
105 |
|
70 |
aurelien |
106 |
public static function getUrlBase() {
|
61 |
aurelien |
107 |
|
|
|
108 |
$base_vrai_chemin = str_replace(realpath($_SERVER['DOCUMENT_ROOT']),'',realpath(Application::getChemin()));
|
|
|
109 |
$base_vrai_chemin .= '/';
|
|
|
110 |
|
|
|
111 |
return $base_vrai_chemin;
|
|
|
112 |
}
|
|
|
113 |
|
70 |
aurelien |
114 |
public static function getUrlBaseComplete() {
|
61 |
aurelien |
115 |
return 'http://'.$_SERVER['SERVER_NAME'].str_replace(realpath($_SERVER['DOCUMENT_ROOT']),'',realpath(Application::getChemin())).'/';
|
|
|
116 |
}
|
210 |
aurelien |
117 |
|
|
|
118 |
public static function getUrlDefaut() {
|
|
|
119 |
|
|
|
120 |
$params = array();
|
|
|
121 |
return self::construireUrl($params);
|
|
|
122 |
}
|
61 |
aurelien |
123 |
|
70 |
aurelien |
124 |
public static function getUrlConsultationFicheStation($id_station) {
|
61 |
aurelien |
125 |
|
|
|
126 |
$params = array(
|
|
|
127 |
'module' => 'Station',
|
|
|
128 |
'action' => 'afficherInformationsStation',
|
|
|
129 |
'id_station' => $id_station
|
|
|
130 |
);
|
70 |
aurelien |
131 |
return self::construireUrl($params);
|
61 |
aurelien |
132 |
}
|
|
|
133 |
|
70 |
aurelien |
134 |
public static function getUrlFormulaireSaisieStation() {
|
61 |
aurelien |
135 |
|
|
|
136 |
$params = array(
|
|
|
137 |
'module' => 'Station',
|
|
|
138 |
'action' => 'afficherFormulaireSaisieStation',
|
|
|
139 |
'id_station' => 'saisie'
|
|
|
140 |
);
|
70 |
aurelien |
141 |
return self::construireUrl($params);
|
61 |
aurelien |
142 |
}
|
|
|
143 |
|
70 |
aurelien |
144 |
public static function getUrlValidationFormulaireSaisieStation() {
|
61 |
aurelien |
145 |
$params = array(
|
|
|
146 |
'module' => 'Station',
|
|
|
147 |
'action' => 'validerFormulaireSaisieStation'
|
|
|
148 |
);
|
70 |
aurelien |
149 |
return self::construireUrl($params);
|
61 |
aurelien |
150 |
}
|
|
|
151 |
|
70 |
aurelien |
152 |
public static function getUrlFormulaireModificationStation($id_station) {
|
61 |
aurelien |
153 |
$params = array(
|
|
|
154 |
'module' => 'Station',
|
|
|
155 |
'action' => 'afficherFormulaireModificationStation',
|
|
|
156 |
'id_station' => $id_station
|
|
|
157 |
);
|
70 |
aurelien |
158 |
return self::construireUrl($params);
|
61 |
aurelien |
159 |
}
|
|
|
160 |
|
96 |
aurelien |
161 |
public static function getUrlValidationFormulaireModificationStation($id_station) {
|
|
|
162 |
$params = array(
|
|
|
163 |
'module' => 'Station',
|
|
|
164 |
'action' => 'validerFormulaireModificationStation',
|
|
|
165 |
'id_station' => $id_station
|
|
|
166 |
);
|
|
|
167 |
return self::construireUrl($params);
|
|
|
168 |
}
|
|
|
169 |
|
294 |
aurelien |
170 |
public static function getUrlFormulaireSuppressionStation() {
|
210 |
aurelien |
171 |
|
|
|
172 |
$params = array(
|
|
|
173 |
'module' => 'Station',
|
|
|
174 |
'action' => 'supprimerStation'
|
|
|
175 |
);
|
|
|
176 |
return self::construireUrl($params);
|
|
|
177 |
}
|
|
|
178 |
|
70 |
aurelien |
179 |
public static function getUrlFormulaireAjoutEspece($id_station) {
|
61 |
aurelien |
180 |
|
|
|
181 |
$params = array(
|
|
|
182 |
'module' => 'Espece',
|
|
|
183 |
'action' => 'afficherFormulaireSaisieEspece',
|
|
|
184 |
'id_station' => $id_station,
|
|
|
185 |
'id_espece' => 'saisie'
|
|
|
186 |
);
|
|
|
187 |
|
70 |
aurelien |
188 |
return self::construireUrl($params);
|
61 |
aurelien |
189 |
}
|
|
|
190 |
|
70 |
aurelien |
191 |
public static function getUrlValidationFormulaireSaisieEspece($id_station) {
|
61 |
aurelien |
192 |
|
|
|
193 |
$params = array(
|
|
|
194 |
'module' => 'Espece',
|
|
|
195 |
'action' => 'validerFormulaireSaisieEspece',
|
|
|
196 |
'id_station' => $id_station,
|
|
|
197 |
'id_espece' => 'saisie'
|
|
|
198 |
);
|
|
|
199 |
|
70 |
aurelien |
200 |
return self::construireUrl($params);
|
61 |
aurelien |
201 |
}
|
|
|
202 |
|
70 |
aurelien |
203 |
public static function getUrlConsultationFicheIndividu($id_station, $id_espece, $id_individu) {
|
61 |
aurelien |
204 |
|
|
|
205 |
$params = array(
|
|
|
206 |
'module' => 'Individu',
|
|
|
207 |
'action' => 'afficherInformationsIndividu',
|
|
|
208 |
'id_station' => $id_station,
|
|
|
209 |
'id_espece' => $id_espece,
|
|
|
210 |
'id_individu' => $id_individu
|
|
|
211 |
);
|
70 |
aurelien |
212 |
return self::construireUrl($params);
|
61 |
aurelien |
213 |
|
|
|
214 |
}
|
|
|
215 |
|
70 |
aurelien |
216 |
public static function getUrlFormulaireSaisieIndividu($id_station, $id_espece) {
|
61 |
aurelien |
217 |
|
|
|
218 |
$params = array(
|
|
|
219 |
'module' => 'Individu',
|
|
|
220 |
'action' => 'afficherFormulaireSaisieIndividu',
|
|
|
221 |
'id_station' => $id_station,
|
|
|
222 |
'id_espece' => $id_espece
|
|
|
223 |
);
|
70 |
aurelien |
224 |
return self::construireUrl($params);
|
61 |
aurelien |
225 |
}
|
|
|
226 |
|
70 |
aurelien |
227 |
public static function getUrlValidationFormulaireSaisieIndividu($id_station, $id_espece) {
|
61 |
aurelien |
228 |
|
|
|
229 |
$params = array(
|
|
|
230 |
'module' => 'Individu',
|
|
|
231 |
'action' => 'validerFormulaireSaisieIndividu',
|
|
|
232 |
'id_station' => $id_station,
|
|
|
233 |
'id_espece' => $id_espece
|
|
|
234 |
);
|
70 |
aurelien |
235 |
return self::construireUrl($params);
|
61 |
aurelien |
236 |
}
|
210 |
aurelien |
237 |
|
|
|
238 |
public static function getUrlFormulaireModificationIndividu($id_station, $id_espece, $id_individu) {
|
|
|
239 |
|
|
|
240 |
$params = array(
|
|
|
241 |
'module' => 'Individu',
|
|
|
242 |
'action' => 'afficherFormulaireModificationIndividu',
|
|
|
243 |
'id_station' => $id_station,
|
|
|
244 |
'id_espece' => $id_espece,
|
|
|
245 |
'id_individu' => $id_individu
|
|
|
246 |
);
|
|
|
247 |
return self::construireUrl($params);
|
|
|
248 |
}
|
|
|
249 |
|
|
|
250 |
public static function getUrlValidationFormulaireModificationIndividu($id_station, $id_espece, $id_individu) {
|
|
|
251 |
|
|
|
252 |
$params = array(
|
|
|
253 |
'module' => 'Individu',
|
|
|
254 |
'action' => 'validerFormulaireModificationIndividu',
|
|
|
255 |
'id_station' => $id_station,
|
|
|
256 |
'id_espece' => $id_espece,
|
|
|
257 |
'id_individu' => $id_individu
|
|
|
258 |
);
|
|
|
259 |
return self::construireUrl($params);
|
|
|
260 |
}
|
|
|
261 |
|
|
|
262 |
public static function getUrlSuppressionIndividu($id_station, $id_espece, $id_individu) {
|
|
|
263 |
|
|
|
264 |
$params = array(
|
|
|
265 |
'module' => 'Individu',
|
|
|
266 |
'action' => 'supprimerIndividu',
|
|
|
267 |
'id_station' => $id_station
|
|
|
268 |
);
|
|
|
269 |
return self::construireUrl($params);
|
|
|
270 |
}
|
61 |
aurelien |
271 |
|
70 |
aurelien |
272 |
public static function getUrlConsultationEspeceStation($id_station, $id_espece, $annee = null) {
|
61 |
aurelien |
273 |
|
|
|
274 |
if($annee == null) {
|
|
|
275 |
$annee = date('Y');
|
|
|
276 |
}
|
|
|
277 |
|
|
|
278 |
$params = array(
|
|
|
279 |
'module' => 'Individu',
|
|
|
280 |
'action' => 'afficherListeIndividu',
|
|
|
281 |
'id_station' => $id_station,
|
|
|
282 |
'id_espece' => $id_espece,
|
|
|
283 |
'annee' => $annee
|
|
|
284 |
);
|
|
|
285 |
|
70 |
aurelien |
286 |
return self::construireUrl($params);
|
61 |
aurelien |
287 |
}
|
210 |
aurelien |
288 |
|
70 |
aurelien |
289 |
public static function getUrlFormulaireModificationObservation($id_station,$id_espece, $id_individu, $annee = null) {
|
61 |
aurelien |
290 |
|
|
|
291 |
if($annee == null) {
|
|
|
292 |
$annee = date('Y');
|
|
|
293 |
}
|
|
|
294 |
|
|
|
295 |
$params = array(
|
|
|
296 |
'module' => 'Observation',
|
|
|
297 |
'action' => 'afficherFormulaireModificationObservation',
|
|
|
298 |
'id_station' => $id_station,
|
|
|
299 |
'id_espece' => $id_espece,
|
|
|
300 |
'id_individu' => $id_individu,
|
|
|
301 |
'annee' => $annee
|
|
|
302 |
);
|
|
|
303 |
|
70 |
aurelien |
304 |
return self::construireUrl($params);
|
61 |
aurelien |
305 |
}
|
|
|
306 |
|
70 |
aurelien |
307 |
public static function getUrlValidationFormulaireModificationObservation($id_station,$id_espece, $id_individu, $annee = null) {
|
61 |
aurelien |
308 |
|
|
|
309 |
if($annee == null) {
|
|
|
310 |
$annee = date('Y');
|
|
|
311 |
}
|
|
|
312 |
|
|
|
313 |
$params = array(
|
|
|
314 |
'module' => 'Observation',
|
|
|
315 |
'action' => 'validerFormulaireModificationObservation',
|
|
|
316 |
'id_station' => $id_station,
|
|
|
317 |
'id_espece' => $id_espece,
|
|
|
318 |
'id_individu' => $id_individu,
|
|
|
319 |
'annee' => $annee
|
|
|
320 |
);
|
|
|
321 |
|
70 |
aurelien |
322 |
return self::construireUrl($params);
|
61 |
aurelien |
323 |
}
|
|
|
324 |
|
210 |
aurelien |
325 |
public static function getUrlExportDonneesObservations() {
|
|
|
326 |
|
|
|
327 |
return Config::get('url_jrest').'OdsExport/FichierExportObservationCSV/';
|
|
|
328 |
}
|
|
|
329 |
|
|
|
330 |
public static function getUrlExportDonneesObservationsPourUtilisateur() {
|
|
|
331 |
|
|
|
332 |
$params = array(
|
|
|
333 |
'module' => 'Export',
|
|
|
334 |
'action' => 'envoyerFichierCSVExportObservation'
|
|
|
335 |
);
|
|
|
336 |
|
|
|
337 |
return self::construireUrl($params);
|
|
|
338 |
}
|
|
|
339 |
|
292 |
aurelien |
340 |
public static function getUrlFormulaireAjoutEspeceAdmin() {
|
|
|
341 |
|
|
|
342 |
$params = array(
|
|
|
343 |
'module' => 'Administration',
|
|
|
344 |
'action' => 'afficherFormulaireAjoutEspeceAdmin',
|
|
|
345 |
'id_espece' => $id_espece
|
|
|
346 |
);
|
|
|
347 |
return self::construireUrl($params);
|
|
|
348 |
}
|
|
|
349 |
|
|
|
350 |
public static function getUrlValidationFormulaireAjoutEspeceAdmin() {
|
|
|
351 |
$params = array(
|
|
|
352 |
'module' => 'Administration',
|
|
|
353 |
'action' => 'validerFormulaireAjoutEspeceAdmin',
|
|
|
354 |
'id_espece' => $id_espece
|
|
|
355 |
);
|
|
|
356 |
return self::construireUrl($params);
|
|
|
357 |
}
|
|
|
358 |
|
287 |
aurelien |
359 |
public static function getUrlFormulaireModificationEspeceAdmin($id_espece) {
|
|
|
360 |
|
|
|
361 |
$params = array(
|
|
|
362 |
'module' => 'Administration',
|
|
|
363 |
'action' => 'afficherFormulaireModificationEspeceAdmin',
|
|
|
364 |
'id_espece' => $id_espece
|
|
|
365 |
);
|
|
|
366 |
return self::construireUrl($params);
|
|
|
367 |
}
|
|
|
368 |
|
|
|
369 |
public static function getUrlValidationFormulaireModificationEspeceAdmin($id_espece) {
|
|
|
370 |
$params = array(
|
|
|
371 |
'module' => 'Administration',
|
|
|
372 |
'action' => 'validerFormulaireModificationEspeceAdmin',
|
|
|
373 |
'id_espece' => $id_espece
|
|
|
374 |
);
|
|
|
375 |
return self::construireUrl($params);
|
|
|
376 |
}
|
|
|
377 |
|
292 |
aurelien |
378 |
public static function getUrlFormulaireAjoutImageEspeceAdmin($id_espece) {
|
|
|
379 |
$params = array(
|
|
|
380 |
'module' => 'Administration',
|
|
|
381 |
'action' => 'afficherFormulaireAjoutImageEspeceAdmin',
|
|
|
382 |
'id_espece' => $id_espece
|
|
|
383 |
);
|
|
|
384 |
return self::construireUrl($params);
|
|
|
385 |
}
|
|
|
386 |
|
|
|
387 |
public static function getUrlValidationFormulaireAjoutImageEspeceAdmin($id_espece) {
|
|
|
388 |
$params = array(
|
|
|
389 |
'module' => 'Administration',
|
|
|
390 |
'action' => 'validerFormulaireAjoutImageEspeceAdmin',
|
|
|
391 |
'id_espece' => $id_espece
|
|
|
392 |
);
|
|
|
393 |
return self::construireUrl($params);
|
|
|
394 |
}
|
|
|
395 |
|
70 |
aurelien |
396 |
public static function renvoyerStylesInclus() {
|
61 |
aurelien |
397 |
|
|
|
398 |
$styles = '';
|
70 |
aurelien |
399 |
$styles .= '<link href="'.self::getUrlStyle().'saisie.css" rel="stylesheet" type="text/css"/>';
|
|
|
400 |
$styles .= '<link href="'.self::getUrlStyle().'jquery_ui/jquery-ui-1.8.6.custom.css" rel="stylesheet" type="text/css"/>';
|
|
|
401 |
$styles .= '<link href="'.self::getUrlStyle().'jquery_ui/jquery.ui.datepicker.css" rel="stylesheet" type="text/css"/>';
|
61 |
aurelien |
402 |
|
|
|
403 |
return $styles;
|
|
|
404 |
|
|
|
405 |
}
|
|
|
406 |
|
70 |
aurelien |
407 |
public static function renvoyerScriptsInclus() {
|
61 |
aurelien |
408 |
|
219 |
aurelien |
409 |
$scripts = '<script type="text/javascript">'.
|
210 |
aurelien |
410 |
' var urlBaseJrest = "'.Config::get('url_jrest').'"; '.
|
|
|
411 |
'</script>';
|
61 |
aurelien |
412 |
$scripts .= '<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>';
|
70 |
aurelien |
413 |
$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'jquery-1.4.4.min.js"></script>';
|
|
|
414 |
$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'jquery_ui/jquery-ui-1.8.6.custom.min.js"></script>';
|
83 |
aurelien |
415 |
$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'saisie.js"></script>';
|
210 |
aurelien |
416 |
|
|
|
417 |
if(AppControleur::getUtilisateur()->estAdmin()) {
|
|
|
418 |
$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'saisie_admin.js"></script>';
|
|
|
419 |
}
|
|
|
420 |
|
70 |
aurelien |
421 |
$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'jquery_ui/jquery.ui.datepicker.js"></script>';
|
|
|
422 |
$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'jquery_ui/jquery.ui.datepicker-fr.js"></script>';
|
61 |
aurelien |
423 |
|
|
|
424 |
return $scripts;
|
|
|
425 |
|
|
|
426 |
}
|
|
|
427 |
|
|
|
428 |
|
70 |
aurelien |
429 |
}
|
|
|
430 |
?>
|