| 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');
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
if(trim($credit) != '') {
|
|
|
73 |
$credit = 'Crédits : '.$credit;
|
|
|
74 |
}
|
|
|
75 |
|
|
|
76 |
return $credit;
|
|
|
77 |
}
|
|
|
78 |
|
| 70 |
aurelien |
79 |
public static function getUrlBaseReecrite() {
|
| 61 |
aurelien |
80 |
|
|
|
81 |
if(isset($_SERVER['REDIRECT_URL']) && $_SERVER['REDIRECT_URL'] != '') {
|
|
|
82 |
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
$base_url_reecrite = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REDIRECT_URL'];
|
|
|
86 |
$base_url_reecrite .= '/';
|
|
|
87 |
|
|
|
88 |
return $base_vrai_chemin;
|
|
|
89 |
}
|
|
|
90 |
|
| 70 |
aurelien |
91 |
public static function getUrlBase() {
|
| 61 |
aurelien |
92 |
|
|
|
93 |
$base_vrai_chemin = str_replace(realpath($_SERVER['DOCUMENT_ROOT']),'',realpath(Application::getChemin()));
|
|
|
94 |
$base_vrai_chemin .= '/';
|
|
|
95 |
|
|
|
96 |
return $base_vrai_chemin;
|
|
|
97 |
}
|
|
|
98 |
|
| 70 |
aurelien |
99 |
public static function getUrlBaseComplete() {
|
| 61 |
aurelien |
100 |
return 'http://'.$_SERVER['SERVER_NAME'].str_replace(realpath($_SERVER['DOCUMENT_ROOT']),'',realpath(Application::getChemin())).'/';
|
|
|
101 |
}
|
|
|
102 |
|
| 70 |
aurelien |
103 |
public static function getUrlConsultationFicheStation($id_station) {
|
| 61 |
aurelien |
104 |
|
|
|
105 |
$params = array(
|
|
|
106 |
'module' => 'Station',
|
|
|
107 |
'action' => 'afficherInformationsStation',
|
|
|
108 |
'id_station' => $id_station
|
|
|
109 |
);
|
| 70 |
aurelien |
110 |
return self::construireUrl($params);
|
| 61 |
aurelien |
111 |
}
|
|
|
112 |
|
| 70 |
aurelien |
113 |
public static function getUrlFormulaireSaisieStation() {
|
| 61 |
aurelien |
114 |
|
|
|
115 |
$params = array(
|
|
|
116 |
'module' => 'Station',
|
|
|
117 |
'action' => 'afficherFormulaireSaisieStation',
|
|
|
118 |
'id_station' => 'saisie'
|
|
|
119 |
);
|
| 70 |
aurelien |
120 |
return self::construireUrl($params);
|
| 61 |
aurelien |
121 |
}
|
|
|
122 |
|
| 70 |
aurelien |
123 |
public static function getUrlValidationFormulaireSaisieStation() {
|
| 61 |
aurelien |
124 |
$params = array(
|
|
|
125 |
'module' => 'Station',
|
|
|
126 |
'action' => 'validerFormulaireSaisieStation'
|
|
|
127 |
);
|
| 70 |
aurelien |
128 |
return self::construireUrl($params);
|
| 61 |
aurelien |
129 |
}
|
|
|
130 |
|
| 70 |
aurelien |
131 |
public static function getUrlFormulaireModificationStation($id_station) {
|
| 61 |
aurelien |
132 |
$params = array(
|
|
|
133 |
'module' => 'Station',
|
|
|
134 |
'action' => 'afficherFormulaireModificationStation',
|
|
|
135 |
'id_station' => $id_station
|
|
|
136 |
);
|
| 70 |
aurelien |
137 |
return self::construireUrl($params);
|
| 61 |
aurelien |
138 |
}
|
|
|
139 |
|
| 96 |
aurelien |
140 |
public static function getUrlValidationFormulaireModificationStation($id_station) {
|
|
|
141 |
$params = array(
|
|
|
142 |
'module' => 'Station',
|
|
|
143 |
'action' => 'validerFormulaireModificationStation',
|
|
|
144 |
'id_station' => $id_station
|
|
|
145 |
);
|
|
|
146 |
return self::construireUrl($params);
|
|
|
147 |
}
|
|
|
148 |
|
| 70 |
aurelien |
149 |
public static function getUrlFormulaireAjoutEspece($id_station) {
|
| 61 |
aurelien |
150 |
|
|
|
151 |
$params = array(
|
|
|
152 |
'module' => 'Espece',
|
|
|
153 |
'action' => 'afficherFormulaireSaisieEspece',
|
|
|
154 |
'id_station' => $id_station,
|
|
|
155 |
'id_espece' => 'saisie'
|
|
|
156 |
);
|
|
|
157 |
|
| 70 |
aurelien |
158 |
return self::construireUrl($params);
|
| 61 |
aurelien |
159 |
}
|
|
|
160 |
|
| 70 |
aurelien |
161 |
public static function getUrlValidationFormulaireSaisieEspece($id_station) {
|
| 61 |
aurelien |
162 |
|
|
|
163 |
$params = array(
|
|
|
164 |
'module' => 'Espece',
|
|
|
165 |
'action' => 'validerFormulaireSaisieEspece',
|
|
|
166 |
'id_station' => $id_station,
|
|
|
167 |
'id_espece' => 'saisie'
|
|
|
168 |
);
|
|
|
169 |
|
| 70 |
aurelien |
170 |
return self::construireUrl($params);
|
| 61 |
aurelien |
171 |
}
|
|
|
172 |
|
| 70 |
aurelien |
173 |
public static function getUrlConsultationFicheIndividu($id_station, $id_espece, $id_individu) {
|
| 61 |
aurelien |
174 |
|
|
|
175 |
$params = array(
|
|
|
176 |
'module' => 'Individu',
|
|
|
177 |
'action' => 'afficherInformationsIndividu',
|
|
|
178 |
'id_station' => $id_station,
|
|
|
179 |
'id_espece' => $id_espece,
|
|
|
180 |
'id_individu' => $id_individu
|
|
|
181 |
);
|
| 70 |
aurelien |
182 |
return self::construireUrl($params);
|
| 61 |
aurelien |
183 |
|
|
|
184 |
}
|
|
|
185 |
|
| 70 |
aurelien |
186 |
public static function getUrlFormulaireSaisieIndividu($id_station, $id_espece) {
|
| 61 |
aurelien |
187 |
|
|
|
188 |
$params = array(
|
|
|
189 |
'module' => 'Individu',
|
|
|
190 |
'action' => 'afficherFormulaireSaisieIndividu',
|
|
|
191 |
'id_station' => $id_station,
|
|
|
192 |
'id_espece' => $id_espece
|
|
|
193 |
);
|
| 70 |
aurelien |
194 |
return self::construireUrl($params);
|
| 61 |
aurelien |
195 |
}
|
|
|
196 |
|
| 70 |
aurelien |
197 |
public static function getUrlValidationFormulaireSaisieIndividu($id_station, $id_espece) {
|
| 61 |
aurelien |
198 |
|
|
|
199 |
$params = array(
|
|
|
200 |
'module' => 'Individu',
|
|
|
201 |
'action' => 'validerFormulaireSaisieIndividu',
|
|
|
202 |
'id_station' => $id_station,
|
|
|
203 |
'id_espece' => $id_espece
|
|
|
204 |
);
|
| 70 |
aurelien |
205 |
return self::construireUrl($params);
|
| 61 |
aurelien |
206 |
}
|
|
|
207 |
|
| 70 |
aurelien |
208 |
public static function getUrlConsultationEspeceStation($id_station, $id_espece, $annee = null) {
|
| 61 |
aurelien |
209 |
|
|
|
210 |
if($annee == null) {
|
|
|
211 |
$annee = date('Y');
|
|
|
212 |
}
|
|
|
213 |
|
|
|
214 |
$params = array(
|
|
|
215 |
'module' => 'Individu',
|
|
|
216 |
'action' => 'afficherListeIndividu',
|
|
|
217 |
'id_station' => $id_station,
|
|
|
218 |
'id_espece' => $id_espece,
|
|
|
219 |
'annee' => $annee
|
|
|
220 |
);
|
|
|
221 |
|
| 70 |
aurelien |
222 |
return self::construireUrl($params);
|
| 61 |
aurelien |
223 |
}
|
|
|
224 |
|
| 70 |
aurelien |
225 |
public static function getUrlFormulaireModificationObservation($id_station,$id_espece, $id_individu, $annee = null) {
|
| 61 |
aurelien |
226 |
|
|
|
227 |
if($annee == null) {
|
|
|
228 |
$annee = date('Y');
|
|
|
229 |
}
|
|
|
230 |
|
|
|
231 |
$params = array(
|
|
|
232 |
'module' => 'Observation',
|
|
|
233 |
'action' => 'afficherFormulaireModificationObservation',
|
|
|
234 |
'id_station' => $id_station,
|
|
|
235 |
'id_espece' => $id_espece,
|
|
|
236 |
'id_individu' => $id_individu,
|
|
|
237 |
'annee' => $annee
|
|
|
238 |
);
|
|
|
239 |
|
| 70 |
aurelien |
240 |
return self::construireUrl($params);
|
| 61 |
aurelien |
241 |
}
|
|
|
242 |
|
| 70 |
aurelien |
243 |
public static function getUrlValidationFormulaireModificationObservation($id_station,$id_espece, $id_individu, $annee = null) {
|
| 61 |
aurelien |
244 |
|
|
|
245 |
if($annee == null) {
|
|
|
246 |
$annee = date('Y');
|
|
|
247 |
}
|
|
|
248 |
|
|
|
249 |
$params = array(
|
|
|
250 |
'module' => 'Observation',
|
|
|
251 |
'action' => 'validerFormulaireModificationObservation',
|
|
|
252 |
'id_station' => $id_station,
|
|
|
253 |
'id_espece' => $id_espece,
|
|
|
254 |
'id_individu' => $id_individu,
|
|
|
255 |
'annee' => $annee
|
|
|
256 |
);
|
|
|
257 |
|
| 70 |
aurelien |
258 |
return self::construireUrl($params);
|
| 61 |
aurelien |
259 |
}
|
|
|
260 |
|
| 70 |
aurelien |
261 |
public static function renvoyerStylesInclus() {
|
| 61 |
aurelien |
262 |
|
|
|
263 |
$styles = '';
|
| 70 |
aurelien |
264 |
$styles .= '<link href="'.self::getUrlStyle().'saisie.css" rel="stylesheet" type="text/css"/>';
|
|
|
265 |
$styles .= '<link href="'.self::getUrlStyle().'jquery_ui/jquery-ui-1.8.6.custom.css" rel="stylesheet" type="text/css"/>';
|
|
|
266 |
$styles .= '<link href="'.self::getUrlStyle().'jquery_ui/jquery.ui.datepicker.css" rel="stylesheet" type="text/css"/>';
|
| 61 |
aurelien |
267 |
|
|
|
268 |
return $styles;
|
|
|
269 |
|
|
|
270 |
}
|
|
|
271 |
|
| 70 |
aurelien |
272 |
public static function renvoyerScriptsInclus() {
|
| 61 |
aurelien |
273 |
|
|
|
274 |
$scripts = '';
|
|
|
275 |
$scripts .= '<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>';
|
| 70 |
aurelien |
276 |
$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'jquery-1.4.4.min.js"></script>';
|
|
|
277 |
$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'jquery_ui/jquery-ui-1.8.6.custom.min.js"></script>';
|
| 83 |
aurelien |
278 |
$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'saisie.js"></script>';
|
| 70 |
aurelien |
279 |
$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'jquery_ui/jquery.ui.datepicker.js"></script>';
|
|
|
280 |
$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'jquery_ui/jquery.ui.datepicker-fr.js"></script>';
|
| 61 |
aurelien |
281 |
|
|
|
282 |
return $scripts;
|
|
|
283 |
|
|
|
284 |
}
|
|
|
285 |
|
|
|
286 |
|
| 70 |
aurelien |
287 |
}
|
|
|
288 |
?>
|