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