Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 247 | Rev 369 | 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;

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

        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 = '', $nom_retenu = '') {
                $parametres = $this->getParametresUrlFiche();
                $parametres['num_nom'] = $numNom;
                $parametres['type_nom'] = $type_nom;
                $parametres['nom'] = $nom;
                $parametres['nom_retenu'] = $nom_retenu;
                $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;
        }
}
?>