21 |
mathias |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
* Barre de navigation à ajotuer dans chaque application
|
|
|
4 |
*
|
|
|
5 |
* Utilisation: http://www.tela-botanica.org/widget:reseau:navigation
|
|
|
6 |
* Paramètres GET (optionnels):
|
|
|
7 |
* - squelette (string) : utiliser un squelette particulier, qui se prête à l'éventuel
|
|
|
8 |
* framework css utilisé par l'appli cliente (voir l'attribut $squelettes)
|
|
|
9 |
*
|
|
|
10 |
* @author Mathias Chouet <mathias@tela-botanica.org>
|
|
|
11 |
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
|
|
|
12 |
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
|
|
|
13 |
* @version 0.1
|
|
|
14 |
* @copyright 2014, Tela Botanica (accueil@tela-botanica.org)
|
|
|
15 |
*/
|
|
|
16 |
class Navigation extends WidgetCommun {
|
|
|
17 |
|
|
|
18 |
const DS = DIRECTORY_SEPARATOR;
|
|
|
19 |
|
|
|
20 |
private $squelettes = array('bootstrap3'/*, 'bootstrap2', 'html'*/); // ajouter un jour d'autres possibilités que bs3
|
|
|
21 |
private $squelette;
|
|
|
22 |
|
|
|
23 |
public function __construct($config, $parametres) {
|
|
|
24 |
parent::__construct($config, $parametres);
|
|
|
25 |
$this->squelette = 'bootstrap3';
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
public function executer() {
|
|
|
29 |
$donnees = array();
|
|
|
30 |
$this->collecterParametres();
|
|
|
31 |
$cheminSquelette = dirname(__FILE__) . self::DS . 'squelettes' . self::DS . $this->squelette . '.tpl.php';
|
24 |
mathias |
32 |
|
|
|
33 |
$donnees['url_logo'] = sprintf($this->config['chemins']['baseURLRessources'], 'tb/img/32x32/logo.png');
|
29 |
mathias |
34 |
$donnees['url_logo_hires'] = sprintf($this->config['chemins']['baseURLRessources'], 'tb/img/64x64/logo.png');
|
|
|
35 |
$donnees['url_style'] = $this->config['navigation']['baseCheminWidget'] . '/squelettes/style.css';
|
24 |
mathias |
36 |
|
21 |
mathias |
37 |
$contenu = $this->traiterSquelettePhp($cheminSquelette, $donnees);
|
|
|
38 |
$this->envoyer($contenu);
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
protected function collecterParametres() {
|
|
|
42 |
if (isset($_GET['squelette']) && $_GET['squelette'] != '') {
|
|
|
43 |
if (in_array($this->squelette, $this->squelettes)) {
|
|
|
44 |
$this->squelette = $_GET['squelette'];
|
|
|
45 |
}
|
|
|
46 |
}
|
|
|
47 |
}
|
|
|
48 |
}
|
|
|
49 |
?>
|