Subversion Repositories Applications.reseau

Rev

Rev 56 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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