1 |
<?php
|
1 |
<?php
|
2 |
|
2 |
|
3 |
class GttCtrlActionIdentification extends aControlleurAction {
|
3 |
class GttCtrlActionIdentification extends aControlleurAction {
|
4 |
|
4 |
|
5 |
public function __construct(Registre $Registre)
|
5 |
public function __construct(Registre $Registre)
|
6 |
{
|
6 |
{
|
7 |
$Registre->ajouterEspace('Identification', 'identification');
|
7 |
$Registre->ajouterEspace('Identification', 'identification');
|
8 |
}
|
8 |
}
|
9 |
|
9 |
|
10 |
public function executer()
|
10 |
public function executer()
|
11 |
{
|
11 |
{
|
12 |
$aso_identification = array();
|
12 |
$aso_identification = array();
|
13 |
$params = array('dsn' => GTT_BDD_DSN,
|
13 |
$params = array('dsn' => GTT_BDD_DSN,
|
14 |
'table' => 'gestion_utilisateur',
|
14 |
'table' => 'gestion_utilisateur',
|
15 |
'usernamecol' => 'gu_email',
|
15 |
'usernamecol' => 'gu_email',
|
16 |
'passwordcol' => 'gu_password',
|
16 |
'passwordcol' => 'gu_password',
|
17 |
'cryptype' => 'md5',
|
17 |
'cryptype' => 'md5',
|
18 |
'db_fields' => '*');
|
18 |
'db_fields' => '*');
|
19 |
// Création de l'objet auth
|
19 |
// Création de l'objet auth
|
20 |
$GLOBALS['_GTT_']['identification'] = new Auth('DB', $params, null, false);
|
20 |
$GLOBALS['_GTT_']['identification'] = new Auth('DB', $params, null, false);
|
21 |
$GLOBALS['_GTT_']['identification']->setSessionname(GTT_AUTH_SESSION_NOM);
|
21 |
$GLOBALS['_GTT_']['identification']->setSessionname(GTT_AUTH_SESSION_NOM);
|
22 |
$GLOBALS['_GTT_']['identification']->setExpire(time()+(int)GTT_AUTH_SESSION_DUREE);
|
22 |
$GLOBALS['_GTT_']['identification']->setExpire(time()+(int)GTT_AUTH_SESSION_DUREE);
|
23 |
$GLOBALS['_GTT_']['identification']->start();
|
23 |
$GLOBALS['_GTT_']['identification']->start();
|
24 |
setcookie(session_name(),session_id(), time()+(int)GTT_AUTH_SESSION_DUREE, "/");
|
24 |
setcookie(session_name(),session_id(), time()+(int)GTT_AUTH_SESSION_DUREE, "/");
|
25 |
if ($GLOBALS['_GTT_']['identification']->getAuth()) {
|
25 |
if ($GLOBALS['_GTT_']['identification']->getAuth()) {
|
26 |
require_once GTT_CHEMIN_METIER.'Utilisateur.class.php';
|
26 |
require_once GTT_CHEMIN_METIER.'Utilisateur.class.php';
|
27 |
$GLOBALS['_GTT_']['Utilisateur'] = new Utilisateur(Utilisateur::GU_MAIL, array($GLOBALS['_GTT_']['identification']->getUserName()));
|
27 |
$GLOBALS['_GTT_']['Utilisateur'] = new Utilisateur(Utilisateur::GU_MAIL, array($GLOBALS['_GTT_']['identification']->getUserName()));
|
28 |
$aso_identification['nom'] = $GLOBALS['_GTT_']['Utilisateur']->getNom();
|
28 |
$aso_identification['nom'] = $GLOBALS['_GTT_']['Utilisateur']->getNom();
|
29 |
$aso_identification['prenom'] = $GLOBALS['_GTT_']['Utilisateur']->getPrenom();
|
29 |
$aso_identification['prenom'] = $GLOBALS['_GTT_']['Utilisateur']->getPrenom();
|
- |
|
30 |
// Récupération des infos sur l'utilisateur
|
- |
|
31 |
$aso_identification['conges_payes'] = $GLOBALS['_GTT_']['Utilisateur']->getCongesPayes();
|
- |
|
32 |
$aso_identification['rtt'] = $GLOBALS['_GTT_']['Utilisateur']->getQuotaHeuresSupp();
|
- |
|
33 |
$aso_identification['tps_w'] = $GLOBALS['_GTT_']['Utilisateur']->getTempsDeTravailJour();
|
- |
|
34 |
|
30 |
$this->getRegistre()->ajouterSquelette('identification', 'identite.tpl.html');
|
35 |
$this->getRegistre()->ajouterSquelette('identification', 'identite.tpl.html');
|
31 |
//echo '<pre>'.print_r($aso_identification, true).'</pre>';
|
36 |
//echo '<pre>'.print_r($aso_identification, true).'</pre>';
|
32 |
$this->getRegistre()->ajouterDonnee('identification', $aso_identification);
|
37 |
$this->getRegistre()->ajouterDonnee('identification', $aso_identification);
|
33 |
} else {
|
38 |
} else {
|
34 |
$this->setSuivant('Deconnexion', 1);
|
39 |
$this->setSuivant('Deconnexion', 1);
|
35 |
}
|
40 |
}
|
36 |
}
|
41 |
}
|
37 |
|
42 |
|
38 |
public function executerDeconnexion()
|
43 |
public function executerDeconnexion()
|
39 |
{
|
44 |
{
|
40 |
$aso_connexion = array();
|
45 |
$aso_connexion = array();
|
41 |
$this->getRegistre()->setTitre('Bienvenue sur GTT!');
|
46 |
$this->getRegistre()->setTitre('Bienvenue sur GTT!');
|
42 |
$this->getRegistre()->ajouterSquelette('identification', 'connexion.tpl.html');
|
47 |
$this->getRegistre()->ajouterSquelette('identification', 'connexion.tpl.html');
|
43 |
// Création de l'url de réponse du formulaire
|
48 |
// Création de l'url de réponse du formulaire
|
44 |
$aso_connexion['url'] = 'index.php?action='.GTT_ACTION_CONNEXION;
|
49 |
$aso_connexion['url'] = 'index.php?action='.GTT_ACTION_CONNEXION;
|
45 |
$GLOBALS['_GTT_']['identification']->logout();
|
50 |
$GLOBALS['_GTT_']['identification']->logout();
|
46 |
|
51 |
|
47 |
//echo '<pre>'.print_r($aso_connexion, true).'</pre>';
|
52 |
//echo '<pre>'.print_r($aso_connexion, true).'</pre>';
|
48 |
$this->getRegistre()->ajouterDonnee('identification', $aso_connexion);
|
53 |
$this->getRegistre()->ajouterDonnee('identification', $aso_connexion);
|
49 |
$this->getRegistre()->set('action_finale', true);
|
54 |
$this->getRegistre()->set('action_finale', true);
|
50 |
}
|
55 |
}
|
51 |
}
|
56 |
}
|
52 |
?>
|
57 |
?>
|