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