Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev Author Line No. Line
147 jpm 1
<?php
2
class AppUrls {
1514 delphine 3
	private $urlDomaine = null;
147 jpm 4
	private $urlBase = null;
990 isa 5
	private $urlMobile = null;
190 jpm 6
	private $urlBaseDossier = null;
147 jpm 7
	private $urlCourante = null;
8
	private $urlRedirection = null;
481 jpm 9
	private $urlPopUp = null;
147 jpm 10
 
1514 delphine 11
	public function __construct(Url $urlBase = null, Url $urlBaseDossier = null, Url $urlPopUp = null, Url $urlMobile = null, Url $urlDomaine = null) {
12
		$this->urlDomaine = (is_null($urlDomaine)) ? Registre::get('eFlore.domaine') : $urlDomaine;
147 jpm 13
		$this->urlBase = (is_null($urlBase)) ? Registre::get('eFlore.urlBase') : $urlBase;
190 jpm 14
		$this->urlBaseDossier = (is_null($urlBaseDossier)) ? Registre::get('eFlore.urlBaseDossier') : $urlBaseDossier;
481 jpm 15
		$this->urlPopUp = (is_null($urlPopUp)) ? Registre::get('eFlore.urlPopUp') : $urlPopUp;
1105 jpm 16
		$this->urlMobileTpl = (is_null($urlMobile)) ? Registre::get('eFlore.urlMobileTpl') : $urlMobile;
147 jpm 17
	}
18
 
19
	public function obtenirUrlBase() {
190 jpm 20
		$this->urlBase->setRequete(array());
147 jpm 21
		$url = $this->urlBase->getURL();
22
		return $url;
23
	}
24
 
190 jpm 25
	public function obtenirUrlBaseDossier() {
26
		$this->urlBaseDossier->setRequete(array());
27
		$url = $this->urlBaseDossier->getURL();
28
		return $url;
29
	}
30
 
147 jpm 31
	public function redirigerVers($url) {
32
		$url = str_replace('&amp;', '&', $url);
33
		header("Location: $url");
34
	}
35
 
36
	public function getParametresUrlListe() {
37
		$parametres = array(
291 jpm 38
			'referentiel' => Registre::get('parametres.referentiel'),
39
			'module' => 'liste',
40
			'action' => 'liste',
41
			'rang' => $this->rang,
42
			'lettre' => $this->lettre
147 jpm 43
		);
44
		return $parametres;
45
	}
46
 
47
	public function obtenirUrlListeFamille() {
48
		$parametres = $this->getParametresUrlListe();
49
		$parametres['rang'] = 'F';
50
		$this->urlBase->setRequete($parametres);
51
		$url = $this->urlBase->getURL();
52
		return $url;
53
	}
54
 
55
	public function obtenirUrlListeGenre() {
56
		$parametres = $this->getParametresUrlListe();
57
		$parametres['rang'] = 'G';
58
		$this->urlBase->setRequete($parametres);
59
		$url = $this->urlBase->getURL();
60
		return $url;
61
	}
62
 
63
	public function getParametresUrlRecherche() {
64
		$parametres = array(
1105 jpm 65
			'referentiel' => Registre::get('parametres.referentiel'),
66
			'module' => 'recherche',
67
			'action' => 'rechercheSimple',
68
			'submit' => 'Rechercher'
147 jpm 69
		);
70
		return $parametres;
71
	}
72
 
73
	public function obtenirUrlRechercheSimple($nom = null, $type = 'nom_scientifique') {
74
		$parametres = $this->getParametresUrlRecherche();
75
		$parametres['type_nom'] = $type;
76
		$parametres['nom'] = $nom;
77
		$this->urlBase->setRequete($parametres);
78
		$url = $this->urlBase->getURL();
79
		return $url;
80
	}
1105 jpm 81
 
721 mathilde 82
	public function getParametresUrlRechercheAvancee() {
83
		$parametres = array(
1514 delphine 84
			'hFR[referentiels][0]' => Registre::get('parametres.referentiel'),
85
			'in' => 'flore'
1105 jpm 86
		);
721 mathilde 87
		return $parametres;
88
	}
1105 jpm 89
 
1210 mathias 90
	public function obtenirUrlResultat($typeResultat, $params = array()) {
91
		$parametres = $this->getParametresUrlResultat();
92
		$parametres['resultat'] = $typeResultat;
93
		$parametres = array_merge($parametres, $params);
94
		$this->urlBase->setRequete($parametres);
95
		$url = $this->urlBase->getURL();
96
		return $url;
97
	}
98
 
721 mathilde 99
	public function obtenirUrlResultatAvanceOnglets($onglet, $params = array()) {
1210 mathias 100
		$parametres = $this->getParametresUrlRechercheAvancee();
101
		$parametres['resultat'] = $onglet;
102
		$parametres = array_merge($parametres, $params);
103
		$this->urlBase->setRequete($parametres);
104
		$url = $this->urlBase->getURL();
105
		return $url;
721 mathilde 106
	}
1105 jpm 107
 
721 mathilde 108
	public function obtenirUrlRechercheAvancee($params = array()) {
109
		$parametres = $this->getParametresUrlRechercheAvancee();
110
		$parametres = array_merge($parametres,$params);
1514 delphine 111
		$this->urlDomaine->setRequete($parametres);
112
		$url = $this->urlDomaine->getURL();
721 mathilde 113
		return $url;
114
	}
147 jpm 115
 
116
	public function getParametresUrlResultat() {
117
		$parametres = array(
1105 jpm 118
			'referentiel' => Registre::get('parametres.referentiel'),
119
			'module' => 'recherche',
120
			'niveau' => Registre::get('parametres.niveau'),
121
			'action' => Registre::get('parametres.action'),
122
			'submit' => 'Rechercher',
123
			'type_nom' => isset($_GET['type_nom']) ? $_GET['type_nom'] : 'nom_scientifique',
124
			'nom' => isset($_GET['nom']) ? $_GET['nom'] : ''
147 jpm 125
		);
126
		return $parametres;
127
	}
128
 
1210 mathias 129
	/*public function obtenirUrlResultatDetermination() {
147 jpm 130
		$parametres = $this->getParametresUrlResultat();
131
		$parametres['resultat'] = 'determination';
132
		$this->urlBase->setRequete($parametres);
133
		$url = $this->urlBase->getURL();
134
		return $url;
135
	}
136
 
137
	public function obtenirUrlResultatAlphab() {
138
		$parametres = $this->getParametresUrlResultat();
139
		$parametres['resultat'] = 'alphab';
140
		$this->urlBase->setRequete($parametres);
141
		$url = $this->urlBase->getURL();
142
		return $url;
143
	}
1105 jpm 144
 
147 jpm 145
	public function obtenirUrlResultatRetenu() {
146
		$parametres = $this->getParametresUrlResultat();
147
		$parametres['resultat'] = 'retenu';
148
		$this->urlBase->setRequete($parametres);
149
		$url = $this->urlBase->getURL();
150
		return $url;
151
	}
152
 
153
	public function obtenirUrlResultatDecompo() {
154
		$parametres = $this->getParametresUrlResultat();
155
		$parametres['resultat'] = 'decompo';
156
		$this->urlBase->setRequete($parametres);
157
		$url = $this->urlBase->getURL();
158
		return $url;
1210 mathias 159
	}*/
147 jpm 160
 
161
	public function getParametresUrlFiche() {
1460 delphine 162
		$referentiel = (Registre::get('parametres.referentiel') == "bdtfxr") ? 'bdtfx' : Registre::get('parametres.referentiel');
147 jpm 163
		$parametres = array(
1460 delphine 164
			'referentiel' => $referentiel,
1562 killian 165
			// 'niveau' => Registre::get('parametres.niveau'),
217 delphine 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;
1264 aurelien 205
		$this->urlPopUp->setRequete($parametres);
206
		$url = $this->urlPopUp->getURL();
291 jpm 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;
1264 aurelien 225
		$this->urlPopUp->setRequete($parametres);
226
		$url = $this->urlPopUp->getURL();
775 mathilde 227
		return $url;
228
	}
477 jpm 229
 
1264 aurelien 230
	public function getParametresUrlPopUpIllustrations() {
231
		$parametres = array(
232
			'module' => 'popup-illustrations',
1105 jpm 233
			'action' => 'fiche',
1264 aurelien 234
			'referentiel' => Registre::get('parametres.referentiel')
235
		);
236
		return $parametres;
477 jpm 237
	}
1105 jpm 238
 
1264 aurelien 239
	public function obtenirUrlPopUpIllustrations($idImg) {
240
		$parametres = $this->getParametresUrlPopUpIllustrations();
241
		$parametres['id'] = $idImg;
242
		$this->urlPopUp->setRequete($parametres);
243
		$url = $this->urlPopUp->getURL();
244
		return $url;
245
	}
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
 
1264 aurelien 266
	public function getParametresUrlPopUpContact($action) {
519 jpm 267
		$action = is_null($action) ? 'form' : $action;
1264 aurelien 268
		$parametres = array(
269
			'module' => 'popup-contact',
1105 jpm 270
			'action' => $action,
1264 aurelien 271
			'referentiel' => Registre::get('parametres.referentiel')
272
		);
273
		return $parametres;
274
	}
275
 
276
	public function obtenirUrlPopUpContact($idDestinataire, $idImage, $action = null) {
519 jpm 277
		$parametres = $this->getParametresUrlPopUpContact($action);
493 jpm 278
		$parametres['id_destinataire'] = $idDestinataire;
1264 aurelien 279
		$parametres['id_img'] = $idImage;
280
		$this->urlPopUp->setRequete($parametres);
281
		$url = $this->urlPopUp->getURL();
282
		return $url;
481 jpm 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
}
1562 killian 297
?>