Subversion Repositories Sites.obs-saisons.fr

Rev

Rev 206 | Rev 233 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 206 Rev 210
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
 
3
 
4
/**
4
/**
5
 * Classe de gestion des liens.
5
 * Classe de gestion des liens.
6
 *
6
 *
7
 * @package     ODS_saisie
7
 * @package     ODS_saisie
8
 * @category    Php 5.2
8
 * @category    Php 5.2
9
 * @author      Aurélien Peronnet <aurelien@tela-botanica.org>
9
 * @author      Aurélien Peronnet <aurelien@tela-botanica.org>
10
 * @copyright   2010 Tela-Botanica
10
 * @copyright   2010 Tela-Botanica
11
 * @license     http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
11
 * @license     http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
12
 * @license     http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
12
 * @license     http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
13
 * @version     SVN: $Id: Fiche.php 152 2010-09-06 16:19:12Z jpm $
13
 * @version     SVN: $Id: Fiche.php 152 2010-09-06 16:19:12Z jpm $
14
 */
14
 */
15
class Liens extends aControleur {
15
class Liens extends aControleur {
16
 
16
 
17
	public static function construireUrl($tableau_params, $conserver_parametres_actuels = false) {
17
	public static function construireUrl($tableau_params, $conserver_parametres_actuels = false) {
18
		
18
		
19
		if ($conserver_parametres_actuels) {
19
		if ($conserver_parametres_actuels) {
20
			return '?'.http_build_query($tableau_params + $_GET);
20
			return '?'.http_build_query($tableau_params + $_GET);
21
		}
21
		}
22
		return '?'.http_build_query($tableau_params);
22
		return '?'.http_build_query($tableau_params);
23
	}
23
	}
24
	
24
	
25
	public static function getUrlSquelette() {
25
	public static function getUrlSquelette() {
26
    	    	
26
    	    	
27
    	$url_base = self::getUrlBaseComplete();    	
27
    	$url_base = self::getUrlBaseComplete();    	
28
    	$url_base_squelette = $url_base.Config::get('dossier_squelettes').DS;
28
    	$url_base_squelette = $url_base.Config::get('dossier_squelettes').DS;
29
    	
29
    	
30
    	return $url_base_squelette;
30
    	return $url_base_squelette;
31
    }
31
    }
32
    
32
    
33
    public static function getUrlStyle() {
33
    public static function getUrlStyle() {
34
    	$url_base_style = self::getUrlSquelette().'css'.DS;
34
    	$url_base_style = self::getUrlSquelette().'css'.DS;
35
    	
35
    	
36
    	return $url_base_style;
36
    	return $url_base_style;
37
    }
37
    }
38
    
38
    
39
    public static function getUrlScript() {
39
    public static function getUrlScript() {
40
    	$url_base_script = self::getUrlSquelette().'js'.DS;
40
    	$url_base_script = self::getUrlSquelette().'js'.DS;
41
    	
41
    	
42
    	return $url_base_script;
42
    	return $url_base_script;
43
    }
43
    }
44
    
44
    
45
    public static function getUrlImage() {
45
    public static function getUrlImage() {
46
    	$url_base_image = self::getUrlSquelette().'images'.DS;
46
    	$url_base_image = self::getUrlSquelette().'images'.DS;
47
    	
47
    	
48
    	return $url_base_image;
48
    	return $url_base_image;
49
    }
49
    }
50
    
50
    
51
    public static function getUrlImageEspece($nom_sci, $format = 'CXS') {
51
    public static function getUrlImageEspece($nom_sci, $format = 'CXS') {
52
    	
52
    	
53
    	$nom_sci_formate = strtolower(str_replace(' ', '_', $nom_sci));
53
    	$nom_sci_formate = strtolower(str_replace(' ', '_', $nom_sci));
54
    	
54
    	
55
    	if(!file_exists(Config::get('dossier_images_especes').$format.'/'.$nom_sci_formate.'.jpg')) {
55
    	if(!file_exists(Config::get('dossier_images_especes').$format.'/'.$nom_sci_formate.'.jpg')) {
56
    		return Config::get('url_images_especes').$format.'/'.'vide.jpg';
56
    		return Config::get('url_images_especes').$format.'/'.'vide.jpg';
57
       	}
57
       	}
58
       	
58
       	
59
    	return Config::get('url_images_especes').$format.'/'.$nom_sci_formate.'.jpg';
59
    	return Config::get('url_images_especes').$format.'/'.$nom_sci_formate.'.jpg';
60
    }
60
    }
61
    
61
    
62
    public static function getCreditImageEspece($nom_sci) {
62
    public static function getCreditImageEspece($nom_sci) {
63
    	
63
    	
64
    	$nom_sci_formate = strtolower(str_replace(' ', '_', $nom_sci));
64
    	$nom_sci_formate = strtolower(str_replace(' ', '_', $nom_sci));
65
    	
65
    	
66
    	if(!file_exists(Config::get('dossier_images_especes').'/'.$nom_sci_formate.'.txt')) {
66
    	if(!file_exists(Config::get('dossier_images_especes').'/'.$nom_sci_formate.'.txt')) {
67
    		$credit = '';
67
    		$credit = '';
68
       	} else {
68
       	} else {
69
       		$credit = file_get_contents(Config::get('dossier_images_especes').'/'.$nom_sci_formate.'.txt');
69
       		$credit = file_get_contents(Config::get('dossier_images_especes').'/'.$nom_sci_formate.'.txt');
70
       	}
70
       	}
71
       	
71
       	
72
       	if(trim($credit) != '') {
72
       	if(trim($credit) != '') {
73
       		$credit = 'Crédits : '.$credit;
73
       		$credit = 'Crédits : '.$credit;
74
       	}
74
       	}
75
       	
75
       	
76
    	return $credit;
76
    	return $credit;
77
    }
77
    }
78
    
78
    
79
	public static function getUrlBaseReecrite() {
79
	public static function getUrlBaseReecrite() {
80
		
80
		
81
		if(isset($_SERVER['REDIRECT_URL']) && $_SERVER['REDIRECT_URL'] != '') {
81
		if(isset($_SERVER['REDIRECT_URL']) && $_SERVER['REDIRECT_URL'] != '') {
82
			
82
			
83
		}
83
		}
84
		
84
		
85
		$base_url_reecrite = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REDIRECT_URL'];
85
		$base_url_reecrite = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REDIRECT_URL'];
86
		$base_url_reecrite .= '/';
86
		$base_url_reecrite .= '/';
87
		
87
		
88
		return $base_url_reecrite;
88
		return $base_url_reecrite;
89
	}
89
	}
90
    
90
    
91
	public static function getUrlBase() {
91
	public static function getUrlBase() {
92
		
92
		
93
		$base_vrai_chemin = str_replace(realpath($_SERVER['DOCUMENT_ROOT']),'',realpath(Application::getChemin()));
93
		$base_vrai_chemin = str_replace(realpath($_SERVER['DOCUMENT_ROOT']),'',realpath(Application::getChemin()));
94
		$base_vrai_chemin .= '/';
94
		$base_vrai_chemin .= '/';
95
		
95
		
96
		return $base_vrai_chemin;
96
		return $base_vrai_chemin;
97
	}
97
	}
98
	
98
	
99
	public static function getUrlBaseComplete() {
99
	public static function getUrlBaseComplete() {
100
		return 'http://'.$_SERVER['SERVER_NAME'].str_replace(realpath($_SERVER['DOCUMENT_ROOT']),'',realpath(Application::getChemin())).'/';
100
		return 'http://'.$_SERVER['SERVER_NAME'].str_replace(realpath($_SERVER['DOCUMENT_ROOT']),'',realpath(Application::getChemin())).'/';
101
	}
101
	}
102
    
102
    
103
    public static function getUrlConsultationFicheStation($id_station) {  	
103
    public static function getUrlConsultationFicheStation($id_station) {  	
104
    	
104
    	
105
    	$params = array(
105
    	$params = array(
106
    		'module' => 'Station',
106
    		'module' => 'Station',
107
    		'action' => 'afficherInformationsStation',
107
    		'action' => 'afficherInformationsStation',
108
    		'id_station' => $id_station
108
    		'id_station' => $id_station
109
    	);
109
    	);
110
    	return self::construireUrl($params);	
110
    	return self::construireUrl($params);	
111
    }
111
    }
112
    
112
    
113
    public static function renvoyerStylesInclus() {
113
    public static function renvoyerStylesInclus() {
114
    	
114
    	
115
    	$styles = '';
115
    	$styles = '';
116
    	$styles .= '<link href="'.self::getUrlStyle().'rendu.css" rel="stylesheet" type="text/css"/>';		
116
    	$styles .= '<link href="'.self::getUrlStyle().'rendu.css" rel="stylesheet" type="text/css"/>';		
117
		$styles .= '<link href="'.self::getUrlStyle().'jquery_ui/jquery-ui-1.8.9.custom.css" rel="stylesheet" type="text/css"/>';
117
		$styles .= '<link href="'.self::getUrlStyle().'jquery_ui/jquery-ui-1.8.9.custom.css" rel="stylesheet" type="text/css"/>';
118
    	
118
    	
119
    	return $styles;
119
    	return $styles;
120
    	
120
    	
121
    }
121
    }
122
    
122
    
123
	public static function renvoyerScriptsInclus() {
123
	public static function renvoyerScriptsInclus() {
124
		
124
		
125
    	$scripts = '';
125
    	$scripts = '';
126
    	$scripts .= '<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>';
126
    	$scripts .= '<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>';
127
    	$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'jquery-1.4.4.min.js"></script>';
127
    	$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'jquery-1.4.4.min.js"></script>';
128
    	$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'jquery_ui/jquery-ui-1.8.9.custom.min.js"></script>';
128
    	$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'jquery_ui/jquery-ui-1.8.9.custom.min.js"></script>';
129
		$scripts .= '<script> var urlBaseJrest = "'.Config::get('url_jrest').'";</script>';
129
		$scripts .= '<script> var urlBaseJrest = "'.Config::get('url_jrest').'";</script>';
-
 
130
		$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'iconmaker.js"></script>';
130
    	$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'rendu.js"></script>';
131
    	$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'rendu.js"></script>';
131
    	
132
    	
132
    	return $scripts;
133
    	return $scripts;
133
    	
134
    	
134
    }
135
    }
135
    
136
    
136
    
137
    
137
}
138
}
138
?>
139
?>