Subversion Repositories Sites.obs-saisons.fr

Rev

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

<?php
// declare(encoding='UTF-8');

/**
 * Classe de gestion des liens.
 *
 * @package     ODS_saisie
 * @category    Php 5.2
 * @author      Aurélien Peronnet <aurelien@tela-botanica.org>
 * @copyright   2010 Tela-Botanica
 * @license     http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
 * @license     http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
 * @version     SVN: $Id: Fiche.php 152 2010-09-06 16:19:12Z jpm $
 */
class Liens extends aControleur {

        public static function construireUrl($tableau_params, $conserver_parametres_actuels = false) {
                
                if ($conserver_parametres_actuels) {
                        return '?'.http_build_query($tableau_params + $_GET);
                }
                return '?'.http_build_query($tableau_params);
        }
        
        public static function getUrlSquelette() {
                
        $url_base = self::getUrlBaseComplete();         
        $url_base_squelette = $url_base.Config::get('dossier_squelettes').DS;
        
        return $url_base_squelette;
    }
    
    public static function getUrlStyle() {
        $url_base_style = self::getUrlSquelette().'css'.DS;
        
        return $url_base_style;
    }
    
    public static function getUrlScript() {
        $url_base_script = self::getUrlSquelette().'js'.DS;
        
        return $url_base_script;
    }
    
    public static function getUrlImage() {
        $url_base_image = self::getUrlSquelette().'images'.DS;
        
        return $url_base_image;
    }
    
        public static function getUrlBaseReecrite() {
                
                if(isset($_SERVER['REDIRECT_URL']) && $_SERVER['REDIRECT_URL'] != '') {
                        
                }
                
                $base_url_reecrite = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REDIRECT_URL'];
                $base_url_reecrite .= '/';
                
                return $base_vrai_chemin;
        }
    
        public static function getUrlBase() {
                
                $base_vrai_chemin = str_replace(realpath($_SERVER['DOCUMENT_ROOT']),'',realpath(Application::getChemin()));
                $base_vrai_chemin .= '/';
                
                return $base_vrai_chemin;
        }
        
        public static function getUrlBaseComplete() {
                return 'http://'.$_SERVER['SERVER_NAME'].str_replace(realpath($_SERVER['DOCUMENT_ROOT']),'',realpath(Application::getChemin())).'/';
        }
    
    public static function getUrlConsultationFicheStation($id_station) {        
        
        $params = array(
                'module' => 'Station',
                'action' => 'afficherInformationsStation',
                'id_station' => $id_station
        );
        return self::construireUrl($params);    
    }
    
    public static function getUrlFormulaireSaisieStation() {
        
        $params = array(
                'module' => 'Station',
                'action' => 'afficherFormulaireSaisieStation',
                'id_station' => 'saisie'
        );
        return self::construireUrl($params);
    }
    
    public static function getUrlValidationFormulaireSaisieStation() {
        $params = array(
                'module' => 'Station',
                'action' => 'validerFormulaireSaisieStation'
        );
        return self::construireUrl($params);
    }
    
    public static function getUrlFormulaireModificationStation($id_station) {
        $params = array(
                'module' => 'Station',
                'action' => 'afficherFormulaireModificationStation',
                'id_station' => $id_station
        );
        return self::construireUrl($params);
    }
    
        public static function getUrlFormulaireAjoutEspece($id_station) {  

                $params = array(
                'module' => 'Espece',
                'action' => 'afficherFormulaireSaisieEspece',
                'id_station' => $id_station,
                'id_espece' => 'saisie'
        ); 
        
        return self::construireUrl($params); 
        }
        
        public static function getUrlValidationFormulaireSaisieEspece($id_station) {  
                
                $params = array(
                'module' => 'Espece',
                'action' => 'validerFormulaireSaisieEspece',
                'id_station' => $id_station,
                'id_espece' => 'saisie'
        );      
        
        return self::construireUrl($params);    
        }
    
    public static function getUrlConsultationFicheIndividu($id_station, $id_espece, $id_individu) { 

        $params = array(
                'module' => 'Individu',
                'action' => 'afficherInformationsIndividu',
                'id_station' => $id_station,
                'id_espece' => $id_espece,
                'id_individu' => $id_individu
        );
        return self::construireUrl($params);
        
    }
    
        public static function getUrlFormulaireSaisieIndividu($id_station, $id_espece) {        
                
                $params = array(
                'module' => 'Individu',
                'action' => 'afficherFormulaireSaisieIndividu',
                'id_station' => $id_station,
                'id_espece' => $id_espece
        );
        return self::construireUrl($params);    
    }
    
        public static function getUrlValidationFormulaireSaisieIndividu($id_station, $id_espece) { 

                $params = array(
                'module' => 'Individu',
                'action' => 'validerFormulaireSaisieIndividu',
                'id_station' => $id_station,
                'id_espece' => $id_espece
        );
        return self::construireUrl($params); 
    }
  
    public static function getUrlConsultationEspeceStation($id_station, $id_espece, $annee = null) { 
        
        if($annee == null) {
                $annee = date('Y');
        }
        
        $params = array(
                'module' => 'Individu',
                'action' => 'afficherListeIndividu',
                'id_station' => $id_station,
                'id_espece' => $id_espece,
                'annee' => $annee
        );      
        
        return self::construireUrl($params); 
    }
    
    public static function getUrlFormulaireModificationObservation($id_station,$id_espece, $id_individu, $annee = null) {
        
        if($annee == null) {
                $annee = date('Y');
        }
        
        $params = array(
                'module' => 'Observation',
                'action' => 'afficherFormulaireModificationObservation',
                'id_station' => $id_station,
                'id_espece' => $id_espece,
                'id_individu' => $id_individu,
                'annee' => $annee
        );      
        
        return self::construireUrl($params);    
    }
    
        public static function getUrlValidationFormulaireModificationObservation($id_station,$id_espece, $id_individu, $annee = null) {
                
                if($annee == null) {
                $annee = date('Y');
        }
        
        $params = array(
                'module' => 'Observation',
                'action' => 'validerFormulaireModificationObservation',
                'id_station' => $id_station,
                'id_espece' => $id_espece,
                'id_individu' => $id_individu,
                'annee' => $annee
        ); 
        
                return self::construireUrl($params); 
    }
    
    public static function renvoyerStylesInclus() {
        
        $styles = '';
        $styles .= '<link href="'.self::getUrlStyle().'saisie.css" rel="stylesheet" type="text/css"/>';         
                $styles .= '<link href="'.self::getUrlStyle().'jquery_ui/jquery-ui-1.8.6.custom.css" rel="stylesheet" type="text/css"/>';
                $styles .= '<link href="'.self::getUrlStyle().'jquery_ui/jquery.ui.datepicker.css" rel="stylesheet" type="text/css"/>';
        
        return $styles;
        
    }
    
        public static function renvoyerScriptsInclus() {
                
        $scripts = '';
        $scripts .= '<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>';
        $scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'jquery-1.4.4.min.js"></script>';
        $scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'jquery_ui/jquery-ui-1.8.6.custom.min.js"></script>';
                $scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'saisie.js"></script>';
        $scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'jquery_ui/jquery.ui.datepicker.js"></script>';
        $scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'jquery_ui/jquery.ui.datepicker-fr.js"></script>';
        
        return $scripts;
        
    }
    
    
}
?>