| 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 |
|
| 185 |
aurelien |
62 |
public static function getCreditImageEspece($nom_sci) {
|
|
|
63 |
|
|
|
64 |
$nom_sci_formate = strtolower(str_replace(' ', '_', $nom_sci));
|
|
|
65 |
|
|
|
66 |
if(!file_exists(Config::get('dossier_images_especes').'/'.$nom_sci_formate.'.txt')) {
|
|
|
67 |
$credit = '';
|
|
|
68 |
} else {
|
|
|
69 |
$credit = file_get_contents(Config::get('dossier_images_especes').'/'.$nom_sci_formate.'.txt');
|
| 207 |
aurelien |
70 |
$credit = htmlentities($credit);
|
| 185 |
aurelien |
71 |
}
|
|
|
72 |
|
|
|
73 |
if(trim($credit) != '') {
|
|
|
74 |
$credit = 'Crédits : '.$credit;
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
return $credit;
|
|
|
78 |
}
|
|
|
79 |
|
| 70 |
aurelien |
80 |
public static function getUrlBaseReecrite() {
|
| 61 |
aurelien |
81 |
|
|
|
82 |
if(isset($_SERVER['REDIRECT_URL']) && $_SERVER['REDIRECT_URL'] != '') {
|
|
|
83 |
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
$base_url_reecrite = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REDIRECT_URL'];
|
|
|
87 |
$base_url_reecrite .= '/';
|
|
|
88 |
|
|
|
89 |
return $base_vrai_chemin;
|
|
|
90 |
}
|
|
|
91 |
|
| 70 |
aurelien |
92 |
public static function getUrlBase() {
|
| 61 |
aurelien |
93 |
|
|
|
94 |
$base_vrai_chemin = str_replace(realpath($_SERVER['DOCUMENT_ROOT']),'',realpath(Application::getChemin()));
|
|
|
95 |
$base_vrai_chemin .= '/';
|
|
|
96 |
|
|
|
97 |
return $base_vrai_chemin;
|
|
|
98 |
}
|
|
|
99 |
|
| 70 |
aurelien |
100 |
public static function getUrlBaseComplete() {
|
| 61 |
aurelien |
101 |
return 'http://'.$_SERVER['SERVER_NAME'].str_replace(realpath($_SERVER['DOCUMENT_ROOT']),'',realpath(Application::getChemin())).'/';
|
|
|
102 |
}
|
| 210 |
aurelien |
103 |
|
|
|
104 |
public static function getUrlDefaut() {
|
|
|
105 |
|
|
|
106 |
$params = array();
|
|
|
107 |
return self::construireUrl($params);
|
|
|
108 |
}
|
| 61 |
aurelien |
109 |
|
| 70 |
aurelien |
110 |
public static function getUrlConsultationFicheStation($id_station) {
|
| 61 |
aurelien |
111 |
|
|
|
112 |
$params = array(
|
|
|
113 |
'module' => 'Station',
|
|
|
114 |
'action' => 'afficherInformationsStation',
|
|
|
115 |
'id_station' => $id_station
|
|
|
116 |
);
|
| 70 |
aurelien |
117 |
return self::construireUrl($params);
|
| 61 |
aurelien |
118 |
}
|
|
|
119 |
|
| 70 |
aurelien |
120 |
public static function getUrlFormulaireSaisieStation() {
|
| 61 |
aurelien |
121 |
|
|
|
122 |
$params = array(
|
|
|
123 |
'module' => 'Station',
|
|
|
124 |
'action' => 'afficherFormulaireSaisieStation',
|
|
|
125 |
'id_station' => 'saisie'
|
|
|
126 |
);
|
| 70 |
aurelien |
127 |
return self::construireUrl($params);
|
| 61 |
aurelien |
128 |
}
|
|
|
129 |
|
| 70 |
aurelien |
130 |
public static function getUrlValidationFormulaireSaisieStation() {
|
| 61 |
aurelien |
131 |
$params = array(
|
|
|
132 |
'module' => 'Station',
|
|
|
133 |
'action' => 'validerFormulaireSaisieStation'
|
|
|
134 |
);
|
| 70 |
aurelien |
135 |
return self::construireUrl($params);
|
| 61 |
aurelien |
136 |
}
|
|
|
137 |
|
| 70 |
aurelien |
138 |
public static function getUrlFormulaireModificationStation($id_station) {
|
| 61 |
aurelien |
139 |
$params = array(
|
|
|
140 |
'module' => 'Station',
|
|
|
141 |
'action' => 'afficherFormulaireModificationStation',
|
|
|
142 |
'id_station' => $id_station
|
|
|
143 |
);
|
| 70 |
aurelien |
144 |
return self::construireUrl($params);
|
| 61 |
aurelien |
145 |
}
|
|
|
146 |
|
| 96 |
aurelien |
147 |
public static function getUrlValidationFormulaireModificationStation($id_station) {
|
|
|
148 |
$params = array(
|
|
|
149 |
'module' => 'Station',
|
|
|
150 |
'action' => 'validerFormulaireModificationStation',
|
|
|
151 |
'id_station' => $id_station
|
|
|
152 |
);
|
|
|
153 |
return self::construireUrl($params);
|
|
|
154 |
}
|
|
|
155 |
|
| 210 |
aurelien |
156 |
public static function getUrlFormulaireSuppressionStation() {
|
|
|
157 |
|
|
|
158 |
$params = array(
|
|
|
159 |
'module' => 'Station',
|
|
|
160 |
'action' => 'supprimerStation'
|
|
|
161 |
);
|
|
|
162 |
return self::construireUrl($params);
|
|
|
163 |
}
|
|
|
164 |
|
| 70 |
aurelien |
165 |
public static function getUrlFormulaireAjoutEspece($id_station) {
|
| 61 |
aurelien |
166 |
|
|
|
167 |
$params = array(
|
|
|
168 |
'module' => 'Espece',
|
|
|
169 |
'action' => 'afficherFormulaireSaisieEspece',
|
|
|
170 |
'id_station' => $id_station,
|
|
|
171 |
'id_espece' => 'saisie'
|
|
|
172 |
);
|
|
|
173 |
|
| 70 |
aurelien |
174 |
return self::construireUrl($params);
|
| 61 |
aurelien |
175 |
}
|
|
|
176 |
|
| 70 |
aurelien |
177 |
public static function getUrlValidationFormulaireSaisieEspece($id_station) {
|
| 61 |
aurelien |
178 |
|
|
|
179 |
$params = array(
|
|
|
180 |
'module' => 'Espece',
|
|
|
181 |
'action' => 'validerFormulaireSaisieEspece',
|
|
|
182 |
'id_station' => $id_station,
|
|
|
183 |
'id_espece' => 'saisie'
|
|
|
184 |
);
|
|
|
185 |
|
| 70 |
aurelien |
186 |
return self::construireUrl($params);
|
| 61 |
aurelien |
187 |
}
|
|
|
188 |
|
| 70 |
aurelien |
189 |
public static function getUrlConsultationFicheIndividu($id_station, $id_espece, $id_individu) {
|
| 61 |
aurelien |
190 |
|
|
|
191 |
$params = array(
|
|
|
192 |
'module' => 'Individu',
|
|
|
193 |
'action' => 'afficherInformationsIndividu',
|
|
|
194 |
'id_station' => $id_station,
|
|
|
195 |
'id_espece' => $id_espece,
|
|
|
196 |
'id_individu' => $id_individu
|
|
|
197 |
);
|
| 70 |
aurelien |
198 |
return self::construireUrl($params);
|
| 61 |
aurelien |
199 |
|
|
|
200 |
}
|
|
|
201 |
|
| 70 |
aurelien |
202 |
public static function getUrlFormulaireSaisieIndividu($id_station, $id_espece) {
|
| 61 |
aurelien |
203 |
|
|
|
204 |
$params = array(
|
|
|
205 |
'module' => 'Individu',
|
|
|
206 |
'action' => 'afficherFormulaireSaisieIndividu',
|
|
|
207 |
'id_station' => $id_station,
|
|
|
208 |
'id_espece' => $id_espece
|
|
|
209 |
);
|
| 70 |
aurelien |
210 |
return self::construireUrl($params);
|
| 61 |
aurelien |
211 |
}
|
|
|
212 |
|
| 70 |
aurelien |
213 |
public static function getUrlValidationFormulaireSaisieIndividu($id_station, $id_espece) {
|
| 61 |
aurelien |
214 |
|
|
|
215 |
$params = array(
|
|
|
216 |
'module' => 'Individu',
|
|
|
217 |
'action' => 'validerFormulaireSaisieIndividu',
|
|
|
218 |
'id_station' => $id_station,
|
|
|
219 |
'id_espece' => $id_espece
|
|
|
220 |
);
|
| 70 |
aurelien |
221 |
return self::construireUrl($params);
|
| 61 |
aurelien |
222 |
}
|
| 210 |
aurelien |
223 |
|
|
|
224 |
public static function getUrlFormulaireModificationIndividu($id_station, $id_espece, $id_individu) {
|
|
|
225 |
|
|
|
226 |
$params = array(
|
|
|
227 |
'module' => 'Individu',
|
|
|
228 |
'action' => 'afficherFormulaireModificationIndividu',
|
|
|
229 |
'id_station' => $id_station,
|
|
|
230 |
'id_espece' => $id_espece,
|
|
|
231 |
'id_individu' => $id_individu
|
|
|
232 |
);
|
|
|
233 |
return self::construireUrl($params);
|
|
|
234 |
}
|
|
|
235 |
|
|
|
236 |
public static function getUrlValidationFormulaireModificationIndividu($id_station, $id_espece, $id_individu) {
|
|
|
237 |
|
|
|
238 |
$params = array(
|
|
|
239 |
'module' => 'Individu',
|
|
|
240 |
'action' => 'validerFormulaireModificationIndividu',
|
|
|
241 |
'id_station' => $id_station,
|
|
|
242 |
'id_espece' => $id_espece,
|
|
|
243 |
'id_individu' => $id_individu
|
|
|
244 |
);
|
|
|
245 |
return self::construireUrl($params);
|
|
|
246 |
}
|
|
|
247 |
|
|
|
248 |
public static function getUrlSuppressionIndividu($id_station, $id_espece, $id_individu) {
|
|
|
249 |
|
|
|
250 |
$params = array(
|
|
|
251 |
'module' => 'Individu',
|
|
|
252 |
'action' => 'supprimerIndividu',
|
|
|
253 |
'id_station' => $id_station
|
|
|
254 |
);
|
|
|
255 |
return self::construireUrl($params);
|
|
|
256 |
}
|
| 61 |
aurelien |
257 |
|
| 70 |
aurelien |
258 |
public static function getUrlConsultationEspeceStation($id_station, $id_espece, $annee = null) {
|
| 61 |
aurelien |
259 |
|
|
|
260 |
if($annee == null) {
|
|
|
261 |
$annee = date('Y');
|
|
|
262 |
}
|
|
|
263 |
|
|
|
264 |
$params = array(
|
|
|
265 |
'module' => 'Individu',
|
|
|
266 |
'action' => 'afficherListeIndividu',
|
|
|
267 |
'id_station' => $id_station,
|
|
|
268 |
'id_espece' => $id_espece,
|
|
|
269 |
'annee' => $annee
|
|
|
270 |
);
|
|
|
271 |
|
| 70 |
aurelien |
272 |
return self::construireUrl($params);
|
| 61 |
aurelien |
273 |
}
|
| 210 |
aurelien |
274 |
|
| 70 |
aurelien |
275 |
public static function getUrlFormulaireModificationObservation($id_station,$id_espece, $id_individu, $annee = null) {
|
| 61 |
aurelien |
276 |
|
|
|
277 |
if($annee == null) {
|
|
|
278 |
$annee = date('Y');
|
|
|
279 |
}
|
|
|
280 |
|
|
|
281 |
$params = array(
|
|
|
282 |
'module' => 'Observation',
|
|
|
283 |
'action' => 'afficherFormulaireModificationObservation',
|
|
|
284 |
'id_station' => $id_station,
|
|
|
285 |
'id_espece' => $id_espece,
|
|
|
286 |
'id_individu' => $id_individu,
|
|
|
287 |
'annee' => $annee
|
|
|
288 |
);
|
|
|
289 |
|
| 70 |
aurelien |
290 |
return self::construireUrl($params);
|
| 61 |
aurelien |
291 |
}
|
|
|
292 |
|
| 70 |
aurelien |
293 |
public static function getUrlValidationFormulaireModificationObservation($id_station,$id_espece, $id_individu, $annee = null) {
|
| 61 |
aurelien |
294 |
|
|
|
295 |
if($annee == null) {
|
|
|
296 |
$annee = date('Y');
|
|
|
297 |
}
|
|
|
298 |
|
|
|
299 |
$params = array(
|
|
|
300 |
'module' => 'Observation',
|
|
|
301 |
'action' => 'validerFormulaireModificationObservation',
|
|
|
302 |
'id_station' => $id_station,
|
|
|
303 |
'id_espece' => $id_espece,
|
|
|
304 |
'id_individu' => $id_individu,
|
|
|
305 |
'annee' => $annee
|
|
|
306 |
);
|
|
|
307 |
|
| 70 |
aurelien |
308 |
return self::construireUrl($params);
|
| 61 |
aurelien |
309 |
}
|
|
|
310 |
|
| 210 |
aurelien |
311 |
public static function getUrlExportDonneesObservations() {
|
|
|
312 |
|
|
|
313 |
return Config::get('url_jrest').'OdsExport/FichierExportObservationCSV/';
|
|
|
314 |
}
|
|
|
315 |
|
|
|
316 |
public static function getUrlExportDonneesObservationsPourUtilisateur() {
|
|
|
317 |
|
|
|
318 |
$params = array(
|
|
|
319 |
'module' => 'Export',
|
|
|
320 |
'action' => 'envoyerFichierCSVExportObservation'
|
|
|
321 |
);
|
|
|
322 |
|
|
|
323 |
return self::construireUrl($params);
|
|
|
324 |
}
|
|
|
325 |
|
| 70 |
aurelien |
326 |
public static function renvoyerStylesInclus() {
|
| 61 |
aurelien |
327 |
|
|
|
328 |
$styles = '';
|
| 70 |
aurelien |
329 |
$styles .= '<link href="'.self::getUrlStyle().'saisie.css" rel="stylesheet" type="text/css"/>';
|
|
|
330 |
$styles .= '<link href="'.self::getUrlStyle().'jquery_ui/jquery-ui-1.8.6.custom.css" rel="stylesheet" type="text/css"/>';
|
|
|
331 |
$styles .= '<link href="'.self::getUrlStyle().'jquery_ui/jquery.ui.datepicker.css" rel="stylesheet" type="text/css"/>';
|
| 61 |
aurelien |
332 |
|
|
|
333 |
return $styles;
|
|
|
334 |
|
|
|
335 |
}
|
|
|
336 |
|
| 70 |
aurelien |
337 |
public static function renvoyerScriptsInclus() {
|
| 61 |
aurelien |
338 |
|
| 219 |
aurelien |
339 |
$scripts = '<script type="text/javascript">'.
|
| 210 |
aurelien |
340 |
' var urlBaseJrest = "'.Config::get('url_jrest').'"; '.
|
|
|
341 |
'</script>';
|
| 61 |
aurelien |
342 |
$scripts .= '<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>';
|
| 70 |
aurelien |
343 |
$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'jquery-1.4.4.min.js"></script>';
|
|
|
344 |
$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'jquery_ui/jquery-ui-1.8.6.custom.min.js"></script>';
|
| 83 |
aurelien |
345 |
$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'saisie.js"></script>';
|
| 210 |
aurelien |
346 |
|
|
|
347 |
if(AppControleur::getUtilisateur()->estAdmin()) {
|
|
|
348 |
$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'saisie_admin.js"></script>';
|
|
|
349 |
}
|
|
|
350 |
|
| 70 |
aurelien |
351 |
$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'jquery_ui/jquery.ui.datepicker.js"></script>';
|
|
|
352 |
$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'jquery_ui/jquery.ui.datepicker-fr.js"></script>';
|
| 61 |
aurelien |
353 |
|
|
|
354 |
return $scripts;
|
|
|
355 |
|
|
|
356 |
}
|
|
|
357 |
|
|
|
358 |
|
| 70 |
aurelien |
359 |
}
|
|
|
360 |
?>
|