Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 481 | Rev 667 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
class AppUrls {
        private $urlBase = 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) {
                $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;
        }

        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('&amp;', '&', $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 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() {
                $parametres = array(
                        'referentiel' => Registre::get('parametres.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 getParametresUrlMetaDonnees() {
                $parametres = array(
                        'module' => 'fiche-metadonnees',
                        'action' => 'affichageMetaDonnees'
                );
                return $parametres;
        }

        public function obtenirUrlMetaDonnees($projet) {
                $parametres = $this->getParametresUrlMetaDonnees();
                $parametres['projet'] = $projet;
                $this->urlBase->setRequete($parametres);
                $url = $this->urlBase->getURL();
                return $url;
        }

        public function getParametresUrlPopUpIllustrations() {
                $parametres = array(
                                'module' => 'popup-illustrations',
                                'action' => 'fiche'
                );
                return $parametres;
        }

        public function obtenirUrlPopUpIllustrations($idImg) {
                $parametres = $this->getParametresUrlPopUpIllustrations();
                $parametres['id'] = $idImg;
                $this->urlPopUp->setRequete($parametres);
                $url = $this->urlPopUp->getURL();
                return $url;
        }

        public function getParametresUrlPopUpContact() {
                $parametres = array(
                                'module' => 'popup-contact',
                                'action' => 'form'
                );
                return $parametres;
        }

        public function obtenirUrlPopUpContact($idDestinataire, $idImage) {
                $parametres = $this->getParametresUrlPopUpContact();
                $parametres['id_destinataire'] = $idDestinataire;
                $parametres['id_img'] = $idImage;
                $this->urlPopUp->setRequete($parametres);
                $url = $this->urlPopUp->getURL();
                return $url;
        }
}
?>