Rev 1264 | Rev 1514 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
class AppUrls {
private $urlBase = null;
private $urlMobile = null;
private $urlBaseDossier = null;
private $urlCourante = null;
private $urlRedirection = null;
private $urlPopUp = null;
public function __construct(Url $urlBase = null, Url $urlBaseDossier = null, Url $urlPopUp = null, Url $urlMobile = null) {
$this->urlBase = (is_null($urlBase)) ? Registre::get('eFlore.urlBase') : $urlBase;
$this->urlBaseDossier = (is_null($urlBaseDossier)) ? Registre::get('eFlore.urlBaseDossier') : $urlBaseDossier;
$this->urlPopUp = (is_null($urlPopUp)) ? Registre::get('eFlore.urlPopUp') : $urlPopUp;
$this->urlMobileTpl = (is_null($urlMobile)) ? Registre::get('eFlore.urlMobileTpl') : $urlMobile;
}
public function obtenirUrlBase() {
$this->urlBase->setRequete(array());
$url = $this->urlBase->getURL();
return $url;
}
public function obtenirUrlBaseDossier() {
$this->urlBaseDossier->setRequete(array());
$url = $this->urlBaseDossier->getURL();
return $url;
}
public function redirigerVers($url) {
$url = str_replace('&', '&', $url);
header("Location: $url");
}
public function getParametresUrlListe() {
$parametres = array(
'referentiel' => Registre::get('parametres.referentiel'),
'module' => 'liste',
'action' => 'liste',
'rang' => $this->rang,
'lettre' => $this->lettre
);
return $parametres;
}
public function obtenirUrlListeFamille() {
$parametres = $this->getParametresUrlListe();
$parametres['rang'] = 'F';
$this->urlBase->setRequete($parametres);
$url = $this->urlBase->getURL();
return $url;
}
public function obtenirUrlListeGenre() {
$parametres = $this->getParametresUrlListe();
$parametres['rang'] = 'G';
$this->urlBase->setRequete($parametres);
$url = $this->urlBase->getURL();
return $url;
}
public function getParametresUrlRecherche() {
$parametres = array(
'referentiel' => Registre::get('parametres.referentiel'),
'module' => 'recherche',
'action' => 'rechercheSimple',
'submit' => 'Rechercher'
);
return $parametres;
}
public function obtenirUrlRechercheSimple($nom = null, $type = 'nom_scientifique') {
$parametres = $this->getParametresUrlRecherche();
$parametres['type_nom'] = $type;
$parametres['nom'] = $nom;
$this->urlBase->setRequete($parametres);
$url = $this->urlBase->getURL();
return $url;
}
public function getParametresUrlRechercheAvancee() {
$parametres = array(
'referentiel' => Registre::get('parametres.referentiel'),
'niveau' => Registre::get('parametres.niveau'),
'module' => 'recherche',
'action' => 'rechercheAvancee',
'type_nom' => 'nom_scientifique'
);
return $parametres;
}
public function obtenirUrlResultat($typeResultat, $params = array()) {
$parametres = $this->getParametresUrlResultat();
$parametres['resultat'] = $typeResultat;
$parametres = array_merge($parametres, $params);
$this->urlBase->setRequete($parametres);
$url = $this->urlBase->getURL();
return $url;
}
public function obtenirUrlResultatAvanceOnglets($onglet, $params = array()) {
$parametres = $this->getParametresUrlRechercheAvancee();
$parametres['resultat'] = $onglet;
$parametres = array_merge($parametres, $params);
$this->urlBase->setRequete($parametres);
$url = $this->urlBase->getURL();
return $url;
}
public function obtenirUrlRechercheAvancee($params = array()) {
$parametres = $this->getParametresUrlRechercheAvancee();
$parametres = array_merge($parametres,$params);
$this->urlBase->setRequete($parametres);
$url = $this->urlBase->getURL();
return $url;
}
public function getParametresUrlResultat() {
$parametres = array(
'referentiel' => Registre::get('parametres.referentiel'),
'module' => 'recherche',
'niveau' => Registre::get('parametres.niveau'),
'action' => Registre::get('parametres.action'),
'submit' => 'Rechercher',
'type_nom' => isset($_GET['type_nom']) ? $_GET['type_nom'] : 'nom_scientifique',
'nom' => isset($_GET['nom']) ? $_GET['nom'] : ''
);
return $parametres;
}
/*public function obtenirUrlResultatDetermination() {
$parametres = $this->getParametresUrlResultat();
$parametres['resultat'] = 'determination';
$this->urlBase->setRequete($parametres);
$url = $this->urlBase->getURL();
return $url;
}
public function obtenirUrlResultatAlphab() {
$parametres = $this->getParametresUrlResultat();
$parametres['resultat'] = 'alphab';
$this->urlBase->setRequete($parametres);
$url = $this->urlBase->getURL();
return $url;
}
public function obtenirUrlResultatRetenu() {
$parametres = $this->getParametresUrlResultat();
$parametres['resultat'] = 'retenu';
$this->urlBase->setRequete($parametres);
$url = $this->urlBase->getURL();
return $url;
}
public function obtenirUrlResultatDecompo() {
$parametres = $this->getParametresUrlResultat();
$parametres['resultat'] = 'decompo';
$this->urlBase->setRequete($parametres);
$url = $this->urlBase->getURL();
return $url;
}*/
public function getParametresUrlFiche() {
$referentiel = (Registre::get('parametres.referentiel') == "bdtfxr") ? 'bdtfx' : Registre::get('parametres.referentiel');
$parametres = array(
'referentiel' => $referentiel,
'niveau' => Registre::get('parametres.niveau'),
'module' => 'fiche',
'action' => 'fiche'
);
return $parametres;
}
public function obtenirUrlFiche($numNom, $type_nom = 'nom_vernaculaire', $nom = '') {
$parametres = $this->getParametresUrlFiche();
$parametres['num_nom'] = $numNom;
$parametres['type_nom'] = $type_nom;
$parametres['nom'] = $nom;
$this->urlBase->setRequete($parametres);
$url = $this->urlBase->getURL();
return $url;
}
public function obtenirUrlMobile($numNom) {
$parametres = array(
'referentiel' => Registre::get('parametres.referentiel'),
'num_nom' => $numNom
);
$urlMobile = $this->urlMobileTpl;
foreach ($parametres as $cle => $val) {
$urlMobile = str_replace('{'.$cle.'}', rawurlencode($val), $urlMobile);
}
return $urlMobile;
}
public function getParametresUrlMetaDonnees() {
$parametres = array(
'module' => 'fiche-metadonnees',
'action' => 'affichageMetaDonnees'
);
return $parametres;
}
public function obtenirUrlMetaDonnees($projet) {
$parametres = $this->getParametresUrlMetaDonnees();
$parametres['projet'] = $projet;
$this->urlPopUp->setRequete($parametres);
$url = $this->urlPopUp->getURL();
return $url;
}
public function getParametresUrlListeFancyBoxPhytosocio() {
$parametres = array(
'module' => 'liste-fancy-box-phytosocio',
'action' => 'lister'
);
return $parametres;
}
public function obtenirUrlListeFancyBoxPhytosocio($liste,$referentiel,$num_nom, $catminat) {
$parametres = $this->getParametresUrlListeFancyBoxPhytosocio();
$parametres['type'] = $liste;
$parametres['referentiel'] = $referentiel;
$parametres['num_nom'] = $num_nom;
$parametres['catminat'] = $catminat;
$this->urlPopUp->setRequete($parametres);
$url = $this->urlPopUp->getURL();
return $url;
}
public function getParametresUrlPopUpIllustrations() {
$parametres = array(
'module' => 'popup-illustrations',
'action' => 'fiche',
'referentiel' => Registre::get('parametres.referentiel')
);
return $parametres;
}
public function obtenirUrlPopUpIllustrations($idImg) {
$parametres = $this->getParametresUrlPopUpIllustrations();
$parametres['id'] = $idImg;
$this->urlPopUp->setRequete($parametres);
$url = $this->urlPopUp->getURL();
return $url;
}
public function getParametresPdfExport() {
$parametres = array(
'referentiel' => Registre::get('parametres.referentiel'),
'niveau' => Registre::get('parametres.niveau'),
'module' => 'pdf-export',
'action' => 'pdf-export'
);
return $parametres;
}
public function obtenirUrlPdfExport($numNom) {
$parametres = $this->getParametresPdfExport();
$parametres['num_nom'] = $numNom;
$this->urlBase->setRequete($parametres);
$url = $this->urlBase->getURL();
return $url;
}
public function getParametresUrlPopUpContact($action) {
$action = is_null($action) ? 'form' : $action;
$parametres = array(
'module' => 'popup-contact',
'action' => $action,
'referentiel' => Registre::get('parametres.referentiel')
);
return $parametres;
}
public function obtenirUrlPopUpContact($idDestinataire, $idImage, $action = null) {
$parametres = $this->getParametresUrlPopUpContact($action);
$parametres['id_destinataire'] = $idDestinataire;
$parametres['id_img'] = $idImage;
$this->urlPopUp->setRequete($parametres);
$url = $this->urlPopUp->getURL();
return $url;
}
public function obtenirUrlMauvaiseIdentification($idObs) {
$tpl = Config::get('urlMauvaiseIdentificationTpl');
$url = sprintf($tpl, $idObs);
return $url;
}
public function obtenirUrlProfilAnnuaire($idUtilisateur) {
$tpl = Config::get('baseUrlProfilAnnuaireTpl');
$url = sprintf($tpl, $idUtilisateur);
return $url;
}
}
?>