Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 1428 | 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() {
1461 mathias 163
		$referentiel = (Registre::get('parametres.referentiel') == "bdtfxr") ? 'bdtfx' : Registre::get('parametres.referentiel');
147 jpm 164
		$parametres = array(
1461 mathias 165
			'referentiel' => $referentiel,
217 delphine 166
			'niveau' => Registre::get('parametres.niveau'),
167
			'module' => 'fiche',
168
			'action' => 'fiche'
147 jpm 169
		);
170
		return $parametres;
171
	}
172
 
369 delphine 173
	public function obtenirUrlFiche($numNom, $type_nom = 'nom_vernaculaire', $nom = '') {
147 jpm 174
		$parametres = $this->getParametresUrlFiche();
237 delphine 175
		$parametres['num_nom'] = $numNom;
217 delphine 176
		$parametres['type_nom'] = $type_nom;
177
		$parametres['nom'] = $nom;
147 jpm 178
		$this->urlBase->setRequete($parametres);
179
		$url = $this->urlBase->getURL();
180
		return $url;
181
	}
1105 jpm 182
 
183
	public function obtenirUrlMobile($numNom) {
990 isa 184
		$parametres = array(
185
			'referentiel' => Registre::get('parametres.referentiel'),
1105 jpm 186
			'num_nom' => $numNom
990 isa 187
		);
1105 jpm 188
		$urlMobile = $this->urlMobileTpl;
189
		foreach ($parametres as $cle => $val) {
190
			$urlMobile = str_replace('{'.$cle.'}', rawurlencode($val), $urlMobile);
191
		}
192
		return $urlMobile;
990 isa 193
	}
291 jpm 194
 
195
	public function getParametresUrlMetaDonnees() {
196
		$parametres = array(
197
			'module' => 'fiche-metadonnees',
198
			'action' => 'affichageMetaDonnees'
199
		);
200
		return $parametres;
201
	}
202
 
203
	public function obtenirUrlMetaDonnees($projet) {
204
		$parametres = $this->getParametresUrlMetaDonnees();
205
		$parametres['projet'] = $projet;
1264 aurelien 206
		$this->urlPopUp->setRequete($parametres);
207
		$url = $this->urlPopUp->getURL();
291 jpm 208
		return $url;
209
	}
1105 jpm 210
 
211
 
803 mathilde 212
	public function getParametresUrlListeFancyBoxPhytosocio() {
775 mathilde 213
		$parametres = array(
1105 jpm 214
			'module' => 'liste-fancy-box-phytosocio',
215
			'action' => 'lister'
775 mathilde 216
		);
217
		return $parametres;
218
	}
1105 jpm 219
 
803 mathilde 220
	public function obtenirUrlListeFancyBoxPhytosocio($liste,$referentiel,$num_nom, $catminat) {
221
		$parametres = $this->getParametresUrlListeFancyBoxPhytosocio();
775 mathilde 222
		$parametres['type'] = $liste;
223
		$parametres['referentiel'] = $referentiel;
224
		$parametres['num_nom'] = $num_nom;
803 mathilde 225
		$parametres['catminat'] = $catminat;
1264 aurelien 226
		$this->urlPopUp->setRequete($parametres);
227
		$url = $this->urlPopUp->getURL();
775 mathilde 228
		return $url;
229
	}
477 jpm 230
 
1264 aurelien 231
	public function getParametresUrlPopUpIllustrations() {
232
		$parametres = array(
233
			'module' => 'popup-illustrations',
1105 jpm 234
			'action' => 'fiche',
1264 aurelien 235
			'referentiel' => Registre::get('parametres.referentiel')
236
		);
237
		return $parametres;
477 jpm 238
	}
1105 jpm 239
 
1264 aurelien 240
	public function obtenirUrlPopUpIllustrations($idImg) {
241
		$parametres = $this->getParametresUrlPopUpIllustrations();
242
		$parametres['id'] = $idImg;
243
		$this->urlPopUp->setRequete($parametres);
244
		$url = $this->urlPopUp->getURL();
245
		return $url;
246
	}
247
 
667 mathilde 248
	public function getParametresPdfExport() {
249
		$parametres = array(
1105 jpm 250
			'referentiel' => Registre::get('parametres.referentiel'),
251
			'niveau' => Registre::get('parametres.niveau'),
252
			'module' => 'pdf-export',
253
			'action' => 'pdf-export'
667 mathilde 254
		);
255
		return $parametres;
256
	}
1105 jpm 257
 
258
 
676 mathilde 259
	public function obtenirUrlPdfExport($numNom) {
667 mathilde 260
		$parametres = $this->getParametresPdfExport();
261
		$parametres['num_nom'] = $numNom;
262
		$this->urlBase->setRequete($parametres);
263
		$url = $this->urlBase->getURL();
264
		return $url;
265
	}
481 jpm 266
 
1264 aurelien 267
	public function getParametresUrlPopUpContact($action) {
519 jpm 268
		$action = is_null($action) ? 'form' : $action;
1264 aurelien 269
		$parametres = array(
270
			'module' => 'popup-contact',
1105 jpm 271
			'action' => $action,
1264 aurelien 272
			'referentiel' => Registre::get('parametres.referentiel')
273
		);
274
		return $parametres;
275
	}
276
 
277
	public function obtenirUrlPopUpContact($idDestinataire, $idImage, $action = null) {
519 jpm 278
		$parametres = $this->getParametresUrlPopUpContact($action);
493 jpm 279
		$parametres['id_destinataire'] = $idDestinataire;
1264 aurelien 280
		$parametres['id_img'] = $idImage;
281
		$this->urlPopUp->setRequete($parametres);
282
		$url = $this->urlPopUp->getURL();
283
		return $url;
481 jpm 284
	}
1114 aurelien 285
 
286
	public function obtenirUrlMauvaiseIdentification($idObs) {
287
		$tpl = Config::get('urlMauvaiseIdentificationTpl');
288
		$url = sprintf($tpl, $idObs);
289
		return $url;
290
	}
291
 
292
	public function obtenirUrlProfilAnnuaire($idUtilisateur) {
293
		$tpl = Config::get('baseUrlProfilAnnuaireTpl');
294
		$url = sprintf($tpl, $idUtilisateur);
295
		return $url;
296
	}
147 jpm 297
}
298
?>