Rev 210 | 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 getUrlImageEspece($nom_sci, $format = 'CXS') {
$nom_sci_formate = strtolower(str_replace(' ', '_', $nom_sci));
if(!file_exists(Config::get('dossier_images_especes').$format.'/'.$nom_sci_formate.'.jpg')) {
return Config::get('url_images_especes').$format.'/'.'vide.jpg';
}
return Config::get('url_images_especes').$format.'/'.$nom_sci_formate.'.jpg';
}
public static function getCreditImageEspece($nom_sci) {
$nom_sci_formate = strtolower(str_replace(' ', '_', $nom_sci));
if(!file_exists(Config::get('dossier_images_especes').'/'.$nom_sci_formate.'.txt')) {
$credit = '';
} else {
$credit = file_get_contents(Config::get('dossier_images_especes').'/'.$nom_sci_formate.'.txt');
}
if(trim($credit) != '') {
$credit = 'Crédits : '.$credit;
}
return $credit;
}
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_url_reecrite;
}
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 renvoyerStylesInclus() {
$styles = '';
$styles .= '<link href="'.self::getUrlStyle().'rendu.css" rel="stylesheet" type="text/css"/>';
$styles .= '<link href="'.self::getUrlStyle().'jquery_ui/jquery-ui-1.8.9.custom.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.9.custom.min.js"></script>';
$scripts .= '<script> var urlBaseJrest = "'.Config::get('url_jrest').'";</script>';
$scripts .= '<script type="text/javascript" src="'.self::getUrlScript().'rendu.js"></script>';
return $scripts;
}
}
?>