Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Go to most recent revision | Details | 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
 
721 mathilde 91
	public function obtenirUrlResultatAvanceOnglets($onglet, $params = array()) {
92
	$parametres = $this->getParametresUrlRechercheAvancee();
93
	$parametres['resultat'] = $onglet;
94
	$parametres = array_merge($parametres, $params);
95
	$this->urlBase->setRequete($parametres);
96
	$url = $this->urlBase->getURL();
97
	return $url;
98
	}
1105 jpm 99
 
721 mathilde 100
	public function obtenirUrlRechercheAvancee($params = array()) {
101
		$parametres = $this->getParametresUrlRechercheAvancee();
102
		$parametres = array_merge($parametres,$params);
103
		$this->urlBase->setRequete($parametres);
104
		$url = $this->urlBase->getURL();
105
		return $url;
106
	}
147 jpm 107
 
108
	public function getParametresUrlResultat() {
109
		$parametres = array(
1105 jpm 110
			'referentiel' => Registre::get('parametres.referentiel'),
111
			'module' => 'recherche',
112
			'niveau' => Registre::get('parametres.niveau'),
113
			'action' => Registre::get('parametres.action'),
114
			'submit' => 'Rechercher',
115
			'type_nom' => isset($_GET['type_nom']) ? $_GET['type_nom'] : 'nom_scientifique',
116
			'nom' => isset($_GET['nom']) ? $_GET['nom'] : ''
147 jpm 117
		);
118
		return $parametres;
119
	}
120
 
121
	public function obtenirUrlResultatDetermination() {
122
		$parametres = $this->getParametresUrlResultat();
123
		$parametres['resultat'] = 'determination';
124
		$this->urlBase->setRequete($parametres);
125
		$url = $this->urlBase->getURL();
126
		return $url;
127
	}
128
 
129
	public function obtenirUrlResultatAlphab() {
130
		$parametres = $this->getParametresUrlResultat();
131
		$parametres['resultat'] = 'alphab';
132
		$this->urlBase->setRequete($parametres);
133
		$url = $this->urlBase->getURL();
134
		return $url;
135
	}
1105 jpm 136
 
147 jpm 137
	public function obtenirUrlResultatRetenu() {
138
		$parametres = $this->getParametresUrlResultat();
139
		$parametres['resultat'] = 'retenu';
140
		$this->urlBase->setRequete($parametres);
141
		$url = $this->urlBase->getURL();
142
		return $url;
143
	}
144
 
145
	public function obtenirUrlResultatDecompo() {
146
		$parametres = $this->getParametresUrlResultat();
147
		$parametres['resultat'] = 'decompo';
148
		$this->urlBase->setRequete($parametres);
149
		$url = $this->urlBase->getURL();
150
		return $url;
151
	}
152
 
153
	public function getParametresUrlFiche() {
154
		$parametres = array(
217 delphine 155
			'referentiel' => Registre::get('parametres.referentiel'),
156
			'niveau' => Registre::get('parametres.niveau'),
157
			'module' => 'fiche',
158
			'action' => 'fiche'
147 jpm 159
		);
160
		return $parametres;
161
	}
162
 
369 delphine 163
	public function obtenirUrlFiche($numNom, $type_nom = 'nom_vernaculaire', $nom = '') {
147 jpm 164
		$parametres = $this->getParametresUrlFiche();
237 delphine 165
		$parametres['num_nom'] = $numNom;
217 delphine 166
		$parametres['type_nom'] = $type_nom;
167
		$parametres['nom'] = $nom;
147 jpm 168
		$this->urlBase->setRequete($parametres);
169
		$url = $this->urlBase->getURL();
170
		return $url;
171
	}
1105 jpm 172
 
173
	public function obtenirUrlMobile($numNom) {
990 isa 174
		$parametres = array(
175
			'referentiel' => Registre::get('parametres.referentiel'),
1105 jpm 176
			'num_nom' => $numNom
990 isa 177
		);
1105 jpm 178
		$urlMobile = $this->urlMobileTpl;
179
		foreach ($parametres as $cle => $val) {
180
			$urlMobile = str_replace('{'.$cle.'}', rawurlencode($val), $urlMobile);
181
		}
182
		return $urlMobile;
990 isa 183
	}
291 jpm 184
 
185
	public function getParametresUrlMetaDonnees() {
186
		$parametres = array(
187
			'module' => 'fiche-metadonnees',
188
			'action' => 'affichageMetaDonnees'
189
		);
190
		return $parametres;
191
	}
192
 
193
	public function obtenirUrlMetaDonnees($projet) {
194
		$parametres = $this->getParametresUrlMetaDonnees();
195
		$parametres['projet'] = $projet;
196
		$this->urlBase->setRequete($parametres);
197
		$url = $this->urlBase->getURL();
198
		return $url;
199
	}
1105 jpm 200
 
201
 
803 mathilde 202
	public function getParametresUrlListeFancyBoxPhytosocio() {
775 mathilde 203
		$parametres = array(
1105 jpm 204
			'module' => 'liste-fancy-box-phytosocio',
205
			'action' => 'lister'
775 mathilde 206
		);
207
		return $parametres;
208
	}
1105 jpm 209
 
803 mathilde 210
	public function obtenirUrlListeFancyBoxPhytosocio($liste,$referentiel,$num_nom, $catminat) {
211
		$parametres = $this->getParametresUrlListeFancyBoxPhytosocio();
775 mathilde 212
		$parametres['type'] = $liste;
213
		$parametres['referentiel'] = $referentiel;
214
		$parametres['num_nom'] = $num_nom;
803 mathilde 215
		$parametres['catminat'] = $catminat;
775 mathilde 216
		$this->urlBase->setRequete($parametres);
217
		$url = $this->urlBase->getURL();
218
		return $url;
219
	}
477 jpm 220
 
221
	public function getParametresUrlPopUpIllustrations() {
222
		$parametres = array(
1105 jpm 223
			'module' => 'popup-illustrations',
224
			'action' => 'fiche',
225
			'referentiel' => Registre::get('parametres.referentiel')
477 jpm 226
		);
227
		return $parametres;
228
	}
229
 
230
	public function obtenirUrlPopUpIllustrations($idImg) {
231
		$parametres = $this->getParametresUrlPopUpIllustrations();
232
		$parametres['id'] = $idImg;
481 jpm 233
		$this->urlPopUp->setRequete($parametres);
234
		$url = $this->urlPopUp->getURL();
477 jpm 235
		return $url;
236
	}
1105 jpm 237
 
667 mathilde 238
	public function getParametresPdfExport() {
239
		$parametres = array(
1105 jpm 240
			'referentiel' => Registre::get('parametres.referentiel'),
241
			'niveau' => Registre::get('parametres.niveau'),
242
			'module' => 'pdf-export',
243
			'action' => 'pdf-export'
667 mathilde 244
		);
245
		return $parametres;
246
	}
1105 jpm 247
 
248
 
676 mathilde 249
	public function obtenirUrlPdfExport($numNom) {
667 mathilde 250
		$parametres = $this->getParametresPdfExport();
251
		$parametres['num_nom'] = $numNom;
252
		$this->urlBase->setRequete($parametres);
253
		$url = $this->urlBase->getURL();
254
		return $url;
255
	}
481 jpm 256
 
519 jpm 257
	public function getParametresUrlPopUpContact($action) {
258
		$action = is_null($action) ? 'form' : $action;
481 jpm 259
		$parametres = array(
1105 jpm 260
			'module' => 'popup-contact',
261
			'action' => $action,
262
			'referentiel' => Registre::get('parametres.referentiel')
481 jpm 263
		);
264
		return $parametres;
265
	}
266
 
519 jpm 267
	public function obtenirUrlPopUpContact($idDestinataire, $idImage, $action = null) {
268
		$parametres = $this->getParametresUrlPopUpContact($action);
493 jpm 269
		$parametres['id_destinataire'] = $idDestinataire;
270
		$parametres['id_img'] = $idImage;
481 jpm 271
		$this->urlPopUp->setRequete($parametres);
272
		$url = $this->urlPopUp->getURL();
273
		return $url;
274
	}
147 jpm 275
}
276
?>