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