Subversion Repositories Applications.gtt

Compare Revisions

Ignore whitespace Rev 180 → Rev 181

/branches/v1.2-democrite/actions/GttCtrlActionIdentification.class.php
New file
0,0 → 1,61
<?php
 
class GttCtrlActionIdentification extends aControlleurAction {
 
public function __construct(Registre $Registre)
{
$Registre->ajouterEspace('Identification', 'identification');
}
 
public function executer()
{
$aso_identification = array();
$params = array('dsn' => GTT_BDD_DSN,
'table' => GTT_BDD_PREFIXE.'gestion_utilisateur',
'usernamecol' => 'gu_email',
'passwordcol' => 'gu_password',
'cryptype' => 'md5',
'db_fields' => '*');
// Création de l'objet auth
$GLOBALS['_GTT_']['identification'] = new Auth('DB', $params, null, false);
$GLOBALS['_GTT_']['identification']->setSessionname(GTT_AUTH_SESSION_NOM);
$GLOBALS['_GTT_']['identification']->setExpire(time()+(int)GTT_AUTH_SESSION_DUREE);
$GLOBALS['_GTT_']['identification']->start();
setcookie(session_name(),session_id(), time()+(int)GTT_AUTH_SESSION_DUREE, "/");
if ($GLOBALS['_GTT_']['identification']->getAuth()) {
require_once GTT_CHEMIN_METIER.'Utilisateur.class.php';
$GLOBALS['_GTT_']['Utilisateur'] = new Utilisateur(Utilisateur::GU_MAIL, array($GLOBALS['_GTT_']['identification']->getUserName()));
$aso_identification['nom'] = $GLOBALS['_GTT_']['Utilisateur']->getNom();
$aso_identification['prenom'] = $GLOBALS['_GTT_']['Utilisateur']->getPrenom();
// Récupération des infos sur l'utilisateur
$aso_identification['cp'] = $GLOBALS['_GTT_']['Utilisateur']->getCongesPayes();
$cp = $aso_identification['cp'] / $GLOBALS['_GTT_']['Utilisateur']->getTempsDeTravailJour();
$aso_identification['cp_j'] = round($cp, 1);
$aso_identification['rtt'] = $GLOBALS['_GTT_']['Utilisateur']->getQuotaHeuresSupp();
$rtt = $aso_identification['rtt'] / $GLOBALS['_GTT_']['Utilisateur']->getTempsDeTravailJour();
$aso_identification['rtt_j'] = round($rtt, 1);
$aso_identification['tps_w'] = $GLOBALS['_GTT_']['Utilisateur']->getTempsDeTravailJour();
 
$this->getRegistre()->ajouterSquelette('identification', 'identite');
//echo '<pre>'.print_r($aso_identification, true).'</pre>';
$this->getRegistre()->ajouterDonnee('identification', $aso_identification);
} else {
$this->setSuivant('Deconnexion', 1);
}
}
 
public function executerDeconnexion()
{
$aso_connexion = array();
$this->getRegistre()->setTitre('Bienvenue sur GTT!');
$this->getRegistre()->ajouterSquelette('identification', 'connexion');
// Création de l'url de réponse du formulaire
$aso_connexion['url'] = 'index.php?action='.GTT_ACTION_CONNEXION;
$GLOBALS['_GTT_']['identification']->logout();
 
//echo '<pre>'.print_r($aso_connexion, true).'</pre>';
$this->getRegistre()->ajouterDonnee('identification', $aso_connexion);
$this->getRegistre()->set('action_finale', true);
}
}
?>