Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 1239 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
147 jpm 1
<?php
2
class AppUrls {
3
	private $urlBase = null;
990 isa 4
	private $urlMobile = null;
190 jpm 5
	private $urlBaseDossier = null;
147 jpm 6
	private $urlCourante = null;
7
	private $urlRedirection = null;
481 jpm 8
	private $urlPopUp = null;
147 jpm 9
 
990 isa 10
	public function __construct(Url $urlBase = null, Url $urlBaseDossier = null, Url $urlPopUp = null, Url $urlMobile = null) {
147 jpm 11
		$this->urlBase = (is_null($urlBase)) ? Registre::get('eFlore.urlBase') : $urlBase;
190 jpm 12
		$this->urlBaseDossier = (is_null($urlBaseDossier)) ? Registre::get('eFlore.urlBaseDossier') : $urlBaseDossier;
481 jpm 13
		$this->urlPopUp = (is_null($urlPopUp)) ? Registre::get('eFlore.urlPopUp') : $urlPopUp;
1105 jpm 14
		$this->urlMobileTpl = (is_null($urlMobile)) ? Registre::get('eFlore.urlMobileTpl') : $urlMobile;
147 jpm 15
	}
16
 
17
	public function obtenirUrlBase() {
190 jpm 18
		$this->urlBase->setRequete(array());
147 jpm 19
		$url = $this->urlBase->getURL();
20
		return $url;
21
	}
22
 
190 jpm 23
	public function obtenirUrlBaseDossier() {
24
		$this->urlBaseDossier->setRequete(array());
25
		$url = $this->urlBaseDossier->getURL();
26
		return $url;
27
	}
28
 
147 jpm 29
	public function redirigerVers($url) {
30
		$url = str_replace('&amp;', '&', $url);
31
		header("Location: $url");
32
	}
33
 
34
	public function getParametresUrlListe() {
35
		$parametres = array(
291 jpm 36
			'referentiel' => Registre::get('parametres.referentiel'),
37
			'module' => 'liste',
38
			'action' => 'liste',
39
			'rang' => $this->rang,
40
			'lettre' => $this->lettre
147 jpm 41
		);
42
		return $parametres;
43
	}
44
 
45
	public function obtenirUrlListeFamille() {
46
		$parametres = $this->getParametresUrlListe();
47
		$parametres['rang'] = 'F';
48
		$this->urlBase->setRequete($parametres);
49
		$url = $this->urlBase->getURL();
50
		return $url;
51
	}
52
 
53
	public function obtenirUrlListeGenre() {
54
		$parametres = $this->getParametresUrlListe();
55
		$parametres['rang'] = 'G';
56
		$this->urlBase->setRequete($parametres);
57
		$url = $this->urlBase->getURL();
58
		return $url;
59
	}
60
 
61
	public function getParametresUrlRecherche() {
62
		$parametres = array(
1105 jpm 63
			'referentiel' => Registre::get('parametres.referentiel'),
64
			'module' => 'recherche',
65
			'action' => 'rechercheSimple',
66
			'submit' => 'Rechercher'
147 jpm 67
		);
68
		return $parametres;
69
	}
70
 
71
	public function obtenirUrlRechercheSimple($nom = null, $type = 'nom_scientifique') {
72
		$parametres = $this->getParametresUrlRecherche();
73
		$parametres['type_nom'] = $type;
74
		$parametres['nom'] = $nom;
75
		$this->urlBase->setRequete($parametres);
76
		$url = $this->urlBase->getURL();
77
		return $url;
78
	}
1105 jpm 79
 
721 mathilde 80
	public function getParametresUrlRechercheAvancee() {
81
		$parametres = array(
1105 jpm 82
			'referentiel' => Registre::get('parametres.referentiel'),
83
			'niveau' => Registre::get('parametres.niveau'),
84
			'module' => 'recherche',
85
			'action' => 'rechercheAvancee',
86
			'type_nom' => 'nom_scientifique'
87
		);
721 mathilde 88
		return $parametres;
89
	}
1105 jpm 90
 
1210 mathias 91
	public function obtenirUrlResultat($typeResultat, $params = array()) {
92
		$parametres = $this->getParametresUrlResultat();
93
		$parametres['resultat'] = $typeResultat;
94
		$parametres = array_merge($parametres, $params);
95
		$this->urlBase->setRequete($parametres);
96
		$url = $this->urlBase->getURL();
97
		return $url;
98
	}
99
 
721 mathilde 100
	public function obtenirUrlResultatAvanceOnglets($onglet, $params = array()) {
1210 mathias 101
		$parametres = $this->getParametresUrlRechercheAvancee();
102
		$parametres['resultat'] = $onglet;
103
		$parametres = array_merge($parametres, $params);
104
		$this->urlBase->setRequete($parametres);
105
		$url = $this->urlBase->getURL();
106
		return $url;
721 mathilde 107
	}
1105 jpm 108
 
721 mathilde 109
	public function obtenirUrlRechercheAvancee($params = array()) {
110
		$parametres = $this->getParametresUrlRechercheAvancee();
111
		$parametres = array_merge($parametres,$params);
112
		$this->urlBase->setRequete($parametres);
113
		$url = $this->urlBase->getURL();
114
		return $url;
115
	}
147 jpm 116
 
117
	public function getParametresUrlResultat() {
118
		$parametres = array(
1105 jpm 119
			'referentiel' => Registre::get('parametres.referentiel'),
120
			'module' => 'recherche',
121
			'niveau' => Registre::get('parametres.niveau'),
122
			'action' => Registre::get('parametres.action'),
123
			'submit' => 'Rechercher',
124
			'type_nom' => isset($_GET['type_nom']) ? $_GET['type_nom'] : 'nom_scientifique',
125
			'nom' => isset($_GET['nom']) ? $_GET['nom'] : ''
147 jpm 126
		);
127
		return $parametres;
128
	}
129
 
1210 mathias 130
	/*public function obtenirUrlResultatDetermination() {
147 jpm 131
		$parametres = $this->getParametresUrlResultat();
132
		$parametres['resultat'] = 'determination';
133
		$this->urlBase->setRequete($parametres);
134
		$url = $this->urlBase->getURL();
135
		return $url;
136
	}
137
 
138
	public function obtenirUrlResultatAlphab() {
139
		$parametres = $this->getParametresUrlResultat();
140
		$parametres['resultat'] = 'alphab';
141
		$this->urlBase->setRequete($parametres);
142
		$url = $this->urlBase->getURL();
143
		return $url;
144
	}
1105 jpm 145
 
147 jpm 146
	public function obtenirUrlResultatRetenu() {
147
		$parametres = $this->getParametresUrlResultat();
148
		$parametres['resultat'] = 'retenu';
149
		$this->urlBase->setRequete($parametres);
150
		$url = $this->urlBase->getURL();
151
		return $url;
152
	}
153
 
154
	public function obtenirUrlResultatDecompo() {
155
		$parametres = $this->getParametresUrlResultat();
156
		$parametres['resultat'] = 'decompo';
157
		$this->urlBase->setRequete($parametres);
158
		$url = $this->urlBase->getURL();
159
		return $url;
1210 mathias 160
	}*/
147 jpm 161
 
162
	public function getParametresUrlFiche() {
163
		$parametres = array(
217 delphine 164
			'referentiel' => Registre::get('parametres.referentiel'),
165
			'niveau' => Registre::get('parametres.niveau'),
166
			'module' => 'fiche',
167
			'action' => 'fiche'
147 jpm 168
		);
169
		return $parametres;
170
	}
171
 
369 delphine 172
	public function obtenirUrlFiche($numNom, $type_nom = 'nom_vernaculaire', $nom = '') {
147 jpm 173
		$parametres = $this->getParametresUrlFiche();
237 delphine 174
		$parametres['num_nom'] = $numNom;
217 delphine 175
		$parametres['type_nom'] = $type_nom;
176
		$parametres['nom'] = $nom;
147 jpm 177
		$this->urlBase->setRequete($parametres);
178
		$url = $this->urlBase->getURL();
179
		return $url;
180
	}
1105 jpm 181
 
182
	public function obtenirUrlMobile($numNom) {
990 isa 183
		$parametres = array(
184
			'referentiel' => Registre::get('parametres.referentiel'),
1105 jpm 185
			'num_nom' => $numNom
990 isa 186
		);
1105 jpm 187
		$urlMobile = $this->urlMobileTpl;
188
		foreach ($parametres as $cle => $val) {
189
			$urlMobile = str_replace('{'.$cle.'}', rawurlencode($val), $urlMobile);
190
		}
191
		return $urlMobile;
990 isa 192
	}
291 jpm 193
 
194
	public function getParametresUrlMetaDonnees() {
195
		$parametres = array(
196
			'module' => 'fiche-metadonnees',
197
			'action' => 'affichageMetaDonnees'
198
		);
199
		return $parametres;
200
	}
201
 
202
	public function obtenirUrlMetaDonnees($projet) {
203
		$parametres = $this->getParametresUrlMetaDonnees();
204
		$parametres['projet'] = $projet;
205
		$this->urlBase->setRequete($parametres);
206
		$url = $this->urlBase->getURL();
207
		return $url;
208
	}
1105 jpm 209
 
210
 
803 mathilde 211
	public function getParametresUrlListeFancyBoxPhytosocio() {
775 mathilde 212
		$parametres = array(
1105 jpm 213
			'module' => 'liste-fancy-box-phytosocio',
214
			'action' => 'lister'
775 mathilde 215
		);
216
		return $parametres;
217
	}
1105 jpm 218
 
803 mathilde 219
	public function obtenirUrlListeFancyBoxPhytosocio($liste,$referentiel,$num_nom, $catminat) {
220
		$parametres = $this->getParametresUrlListeFancyBoxPhytosocio();
775 mathilde 221
		$parametres['type'] = $liste;
222
		$parametres['referentiel'] = $referentiel;
223
		$parametres['num_nom'] = $num_nom;
803 mathilde 224
		$parametres['catminat'] = $catminat;
775 mathilde 225
		$this->urlBase->setRequete($parametres);
226
		$url = $this->urlBase->getURL();
227
		return $url;
228
	}
477 jpm 229
 
230
	public function getParametresUrlPopUpIllustrations() {
231
		$parametres = array(
1105 jpm 232
			'module' => 'popup-illustrations',
233
			'action' => 'fiche',
234
			'referentiel' => Registre::get('parametres.referentiel')
477 jpm 235
		);
236
		return $parametres;
237
	}
238
 
239
	public function obtenirUrlPopUpIllustrations($idImg) {
240
		$parametres = $this->getParametresUrlPopUpIllustrations();
241
		$parametres['id'] = $idImg;
481 jpm 242
		$this->urlPopUp->setRequete($parametres);
243
		$url = $this->urlPopUp->getURL();
477 jpm 244
		return $url;
245
	}
1105 jpm 246
 
667 mathilde 247
	public function getParametresPdfExport() {
248
		$parametres = array(
1105 jpm 249
			'referentiel' => Registre::get('parametres.referentiel'),
250
			'niveau' => Registre::get('parametres.niveau'),
251
			'module' => 'pdf-export',
252
			'action' => 'pdf-export'
667 mathilde 253
		);
254
		return $parametres;
255
	}
1105 jpm 256
 
257
 
676 mathilde 258
	public function obtenirUrlPdfExport($numNom) {
667 mathilde 259
		$parametres = $this->getParametresPdfExport();
260
		$parametres['num_nom'] = $numNom;
261
		$this->urlBase->setRequete($parametres);
262
		$url = $this->urlBase->getURL();
263
		return $url;
264
	}
481 jpm 265
 
519 jpm 266
	public function getParametresUrlPopUpContact($action) {
267
		$action = is_null($action) ? 'form' : $action;
481 jpm 268
		$parametres = array(
1105 jpm 269
			'module' => 'popup-contact',
270
			'action' => $action,
271
			'referentiel' => Registre::get('parametres.referentiel')
481 jpm 272
		);
273
		return $parametres;
274
	}
275
 
519 jpm 276
	public function obtenirUrlPopUpContact($idDestinataire, $idImage, $action = null) {
277
		$parametres = $this->getParametresUrlPopUpContact($action);
493 jpm 278
		$parametres['id_destinataire'] = $idDestinataire;
279
		$parametres['id_img'] = $idImage;
481 jpm 280
		$this->urlPopUp->setRequete($parametres);
281
		$url = $this->urlPopUp->getURL();
282
		return $url;
283
	}
1114 aurelien 284
 
285
	public function obtenirUrlMauvaiseIdentification($idObs) {
286
		$tpl = Config::get('urlMauvaiseIdentificationTpl');
287
		$url = sprintf($tpl, $idObs);
288
		return $url;
289
	}
290
 
291
	public function obtenirUrlProfilAnnuaire($idUtilisateur) {
292
		$tpl = Config::get('baseUrlProfilAnnuaireTpl');
293
		$url = sprintf($tpl, $idUtilisateur);
294
		return $url;
295
	}
147 jpm 296
}
297
?>