43,13 → 43,10 |
//+-------------------------------------------------------------------------------------------------+ |
// GESTION D'INFO GLOBALES |
//+-------------------------------------------------------------------------------------------------+ |
// Initialisation de variables communes à la gestion des projets et des absences |
$aso_stat['total_absences_projets'] = 0; |
|
// Récupération des infos sur les utilisateurs |
$DaoUtilsateur = new Utilisateur(); |
$utilisateurs = $DaoUtilsateur->consulter(Utilisateur::GU_TOUS_AFFICHABLE); |
|
|
// Récupération des motifs d'absence |
$AbsenceMotif = new AbsenceMotif(); |
$cmd = AbsenceMotif::GAM_TOUS; |
62,39 → 59,43 |
|
// Pour chaque utilisateur nous récupérons les infos |
foreach ($utilisateurs as $Utilisateur) { |
// Initialisation du talbeau des infos sur l'utilisateur |
$aso_gestion = array( 'prenom_nom' => $Utilisateur->getPrenom().' '.$Utilisateur->getNom(), |
'total_w' => 0, |
'total_a' => 0, |
'total' => 0); |
|
$aso_gestion = array(); |
//+-------------------------------------------------------------------------------------------------+ |
// GESTION DES PROJETS |
//+-------------------------------------------------------------------------------------------------+ |
// Initialisation de variables propre aux absences |
$aso_stat['total_projets'] = 0; |
|
// Récupération du temps de travail pour un utilisateur à une date donnée |
$TravailProjet = new TravailProjet(); |
$cmd = TravailProjet::GTP_ID_UTILISATEUR_DATE_DEB_FIN; |
$param = array($Utilisateur->getIdUtilisateur(), $mois_courant_j1, $mois_courant_j36); |
$tab_tp = $TravailProjet->consulter($cmd, $param); |
if (false == $tab_tp) { |
$aso_stat['categories'] = false; |
$aso_stat['messages'][] = "Aucune information sur le travail de ${aso_gestion['prenom_nom']}"; |
} else { |
// Récupération des identifiants des projets |
$tab_projet_id = array(''); |
foreach ($tab_tp as $tp) { |
$tab_projet_id[0] .= $tp->getIdProjet().','; |
// Récupération des infos sur l'utilisateur |
$aso_gestion['prenom_nom'] = $Utilisateur->getPrenom().' '.$Utilisateur->getNom(); |
$aso_gestion['conges_payes'] = $Utilisateur->getCongesPayes(); |
$aso_gestion['rtt'] = $Utilisateur->getQuotaHeuresSupp(); |
$aso_gestion['tps_w'] = $Utilisateur->getTempsDeTravailJour(); |
|
// Récupération des projets sur lesquels l'utilisateur travaille |
$UtilsateurAProjet = new UtilisateurAProjet(); |
$tab_uap = $UtilsateurAProjet->consulter(UtilisateurAProjet::GUAP_UTILISATEUR, $Utilisateur->getIdUtilisateur()); |
|
if (false == $tab_uap) { |
$aso_stat['projets'] = false; |
$aso_stat['messages'][] = "Aucune information sur le travail de ${aso_gestion['prenom_nom']}"; |
} else { |
//echo '<pre>la'.print_r($tab_uap, true).'</pre>'; |
$tab_projet_id = array(); |
foreach ($tab_uap as $uap) { |
$tab_projet_id[] = $uap->getIdProjet(); |
} |
$tab_projet_id[0] = rtrim($tab_projet_id[0], ','); |
|
// Récupération du temps de travail pour un utilisateur à une date donnée |
$TravailProjet = new TravailProjet(); |
$cmd = TravailProjet::GTP_ID_UTILISATEUR_DATE_DEB_FIN; |
$param = array($Utilisateur->getIdUtilisateur(), $mois_courant_j1, $mois_courant_j36); |
$tab_tp = $TravailProjet->consulter($cmd, $param); |
|
// Récupération des infos sur les projets de l'utilisateur |
$aso_gestion['totaux'] = 0; |
$Projet = new Projet(); |
$tab_p = $Projet->consulter(Projet::GP_ID_LIST, $tab_projet_id); |
$tab_p = $Projet->consulter(Projet::GP_ID_LIST, array(implode(',', $tab_projet_id))); |
|
foreach ($tab_p as $Projet) { |
|
// Récupération de la catégorie du projet |
$ProjetCategorie = new ProjetCategorie(); |
$cmd = ProjetCategorie::GPC_ID; |
101,50 → 102,40 |
$param = $Projet->getCeCategorie(); |
$Categorie = current($ProjetCategorie->consulter($cmd, $param)); |
|
// Info trans utilisateur sur les catégories |
if (!isset($aso_stat['categories'][$Categorie->getIdCategorie()])) { |
$aso_stat['categories'][$Categorie->getIdCategorie()] = array( 'projets' => array(), |
'nom' => $Categorie->getLibelle(), |
'total' => 0); |
// Nous vérifions le temps de travail pour ce projet pour la semaine courrante |
$aso_tps_w = 0; |
if (!isset($aso_gestion['categorie_totaux'][$Categorie->getLibelle()])) { |
$aso_gestion['categorie_totaux'][$Categorie->getLibelle()] = 0; |
} |
$aso_stat['categories'][$Categorie->getIdCategorie()]['projets'][$Projet->getIdProjet()]['nom'] = $Projet->getNom(); |
|
foreach ($tab_tp as $TP) { |
if ($TP->getIdProjet() == $Projet->getIdProjet()) { |
// Info trans utilisateur sur les catégories |
if (!isset($aso_stat['categories'][$Categorie->getIdCategorie()]['projets'][$Projet->getIdProjet()]['total'])) { |
$aso_stat['categories'][$Categorie->getIdCategorie()]['projets'][$Projet->getIdProjet()]['total'] = 0; |
} else { |
$aso_stat['categories'][$Categorie->getIdCategorie()]['projets'][$Projet->getIdProjet()]['total'] += $TP->getDuree(); |
if ($tab_tp) { |
foreach ($tab_tp as $TP) { |
if ($TP->getIdProjet() == $Projet->getIdProjet()) { |
$aso_gestion['categorie_totaux'][$Categorie->getLibelle()] += $TP->getDuree(); |
$aso_gestion['totaux'] += $TP->getDuree(); |
// Stockage des infos nécessaire pour l'affichage |
if (!isset($aso_gestion['projets'][$Categorie->getLibelle()][$Projet->getIdProjet()])) { |
$aso_gestion['projets'][$Categorie->getLibelle()][$Projet->getIdProjet()] = array( |
'id' => $Projet->getIdProjet(), |
'nom' => $Projet->getNom(), |
'duree' => 0); |
} |
$aso_gestion['projets'][$Categorie->getLibelle()][$Projet->getIdProjet()]['duree'] += $TP->getDuree(); |
} |
$aso_stat['categories'][$Categorie->getIdCategorie()]['total'] += $TP->getDuree(); |
// Stockage des infos nécessaire pour l'affichage d'un utilisateur |
if (!isset($aso_gestion['projets'][$Categorie->getIdCategorie()][$Projet->getIdProjet()])) { |
$aso_gestion['projets'][$Categorie->getIdCategorie()][$Projet->getIdProjet()] = array( |
'id' => $Projet->getIdProjet(), |
'nom' => $Projet->getNom(), |
'duree' => 0); |
} |
$aso_gestion['projets'][$Categorie->getIdCategorie()][$Projet->getIdProjet()]['duree'] += $TP->getDuree(); |
$aso_gestion['total_w'] += $TP->getDuree(); |
} |
} |
$aso_stat['projets'][$Categorie->getLibelle()][$Projet->getIdProjet()] = $Projet->getNom(); |
} |
} |
$aso_gestion['total'] = $aso_gestion['total_w']; |
$aso_stat['total_projets'] += $aso_gestion['total_w']; |
|
|
//+-------------------------------------------------------------------------------------------------+ |
// GESTION DES ABSENCES |
//+-------------------------------------------------------------------------------------------------+ |
// Initialisation de variables propre aux absences |
$aso_stat['total_absences'] = 0; |
|
// Récupération des absences pour un utilisateur à une date donnée |
$Absence = new Absence(); |
$cmd = Absence::GA_ID_UTILISATEUR_DATE_DEB_FIN; |
$param = array($Utilisateur->getIdUtilisateur(), $mois_courant_j1, $mois_courant_j36); |
$tab_a = $Absence->consulter($cmd, $param); |
$aso_gestion['ab_total'] = ''; |
if (false == $tab_a) { |
$aso_stat['absences'] = false; |
$aso_stat['messages'][] = "Aucune information sur les absences de ${aso_gestion['prenom_nom']}"; |
151,26 → 142,18 |
} else { |
if (false != $tab_am) { |
foreach ($tab_am as $AM) { |
$aso_stat['absences'][$AM->getIdAbsenceMotif()]['nom'] = $AM->getLibelle(); |
|
$aso_stat['absences'][$AM->getIdAbsenceMotif()] = $AM->getLibelle(); |
//$aso_gestion['ab'][$AM->getIdAbsenceMotif()] = 0; |
foreach ($tab_a as $A) { |
if ($A->getIdAbsenceMotif() == $AM->getIdAbsenceMotif() && $A->getDuree() != 0) { |
if (!isset($aso_stat['absences'][$AM->getIdAbsenceMotif()]['total'])) { |
$aso_stat['absences'][$AM->getIdAbsenceMotif()]['total'] = 0; |
} else { |
$aso_stat['absences'][$AM->getIdAbsenceMotif()]['total'] += $A->getDuree(); |
} |
$aso_stat['total_absences'] += $A->getDuree(); |
$aso_gestion['ab'][$AM->getIdAbsenceMotif()] = $A->getDuree(); |
$aso_gestion['total_a'] += $A->getDuree(); |
$aso_gestion['total'] += $A->getDuree(); |
$aso_gestion['ab_total'] += $A->getDuree(); |
$aso_gestion['totaux'] += $A->getDuree(); |
} |
} |
} |
} |
} |
$aso_stat['total_absences_projets'] += $aso_gestion['total']; |
$aso_stat['utilisateurs'][] = $aso_gestion; |
} |
|