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