Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

<?php
class AppUrls {
        private $urlBase = null;
        private $urlCourante = null;
        private $urlRedirection = null;

        public function __construct(Url $urlBase = null) {
                $this->urlBase = (is_null($urlBase)) ? Registre::get('eFlore.urlBase') : $urlBase;
        }

        public function obtenirUrlBase() {
                $url = $this->urlBase->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',
                                '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'),
                                'module' => 'fiche',
                                'action' => 'fiche'
                );
                return $parametres;
        }

        public function obtenirUrlFiche($numNom) {
                $parametres = $this->getParametresUrlFiche();
                $parametres['nn'] = $numNom;
                $this->urlBase->setRequete($parametres);
                $url = $this->urlBase->getURL();
                return $url;
        }
}
?>