Subversion Repositories Applications.reseau

Rev

Rev 56 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
56 mathias 1
<?php
2
/**
3
 * Portail d'authentification qui présente les différentes application TB; permet(tra un jour)
4
 * de se connecter en utilisant d'autres comptes (Plante-net, ils recolmatent, visagelivre...)
5
 *
6
 * Utilisation: http://www.tela-botanica.org/widget:reseau:auth
7
 * Paramètres GET (optionnels):
8
 *
9
 * @author	Mathias Chouet <mathias@tela-botanica.org>
10
 * @license	GPL v3 <http://www.gnu.org/licenses/gpl.txt>
11
 * @license	CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
12
 * @version	0.1
13
 * @copyright 2015, Tela Botanica
14
 */
15
class Auth extends WidgetCommun {
16
 
17
	protected $langue;
18
	protected $langueDefaut;
68 mathias 19
	protected $origine;
20
	protected $action;
56 mathias 21
	protected $baseUrlAuth;
22
 
23
	public function __construct($config, $parametres) {
24
		parent::__construct($config, $parametres);
25
		$this->langueDefaut = $this->config['auth']['langueDefaut'];
26
		$this->baseUrlAuth = $this->config['auth']['baseUrlAuth'];
27
	}
28
 
29
	/**
30
	 * Méthode appelée par défaut pour charger ce widget
31
	 */
32
	public function executer() {
68 mathias 33
		$this->collecterParametres();
34
		// choix du squelette en fonction de la langue
56 mathias 35
		$squelette = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'squelettes' . DIRECTORY_SEPARATOR . 'auth_' . $this->langue . '.tpl.php';
36
		if (! file_exists($squelette)) {
37
			$squelette = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'squelettes' . DIRECTORY_SEPARATOR . 'auth_' . $this->langueDefaut . '.tpl.php';
38
		}
39
 
40
		$widget['donnees']['url_css'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], 'modules/auth/squelettes/css/defaut.css');
41
		$widget['donnees']['url_js'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], 'modules/auth/squelettes/js/defaut.js');
42
		$widget['donnees']['baseUrlAuth'] = $this->baseUrlAuth;
68 mathias 43
		$widget['donnees']['origine'] = $this->origine;
44
		$widget['donnees']['action'] = $this->action;
56 mathias 45
 
46
		$contenu = $this->traiterSquelettePhp($squelette, $widget['donnees']);
47
		$this->envoyer($contenu);
48
	}
68 mathias 49
 
50
	protected function collecterParametres() {
51
		if (isset($_GET['origine']) && $_GET['origine'] != '') {
52
			$this->origine = $_GET['origine'];
53
		}
54
		if (isset($_GET['action']) && $_GET['action'] != '') {
55
			$this->action = $_GET['action'];
56
		}
57
		if (isset($_GET['lang']) && $_GET['lang'] != '') {
58
			$this->langue = $_GET['lang'];
59
		} else {
60
			$this->langue = $this->langueDefaut;
61
		}
62
	}
56 mathias 63
}
64
?>