Subversion Repositories Applications.gtt

Compare Revisions

Ignore whitespace Rev 106 → Rev 107

/trunk/actions/GttCtrlActionStatTableauGlobal.class.php
43,10 → 43,13
//+-------------------------------------------------------------------------------------------------+
// 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;
59,43 → 62,39
// Pour chaque utilisateur nous récupérons les infos
foreach ($utilisateurs as $Utilisateur) {
$aso_gestion = array();
// 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);
 
//+-------------------------------------------------------------------------------------------------+
// GESTION DES PROJETS
//+-------------------------------------------------------------------------------------------------+
// 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();
// 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 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);
$tab_projet_id[0] = rtrim($tab_projet_id[0], ',');
// 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, array(implode(',', $tab_projet_id)));
$tab_p = $Projet->consulter(Projet::GP_ID_LIST, $tab_projet_id);
foreach ($tab_p as $Projet) {
// Récupération de la catégorie du projet
$ProjetCategorie = new ProjetCategorie();
$cmd = ProjetCategorie::GPC_ID;
102,40 → 101,50
$param = $Projet->getCeCategorie();
$Categorie = current($ProjetCategorie->consulter($cmd, $param));
// 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;
// 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);
}
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()]['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();
}
$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']}";
142,18 → 151,26
} else {
if (false != $tab_am) {
foreach ($tab_am as $AM) {
$aso_stat['absences'][$AM->getIdAbsenceMotif()] = $AM->getLibelle();
$aso_stat['absences'][$AM->getIdAbsenceMotif()]['nom'] = $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['ab_total'] += $A->getDuree();
$aso_gestion['totaux'] += $A->getDuree();
$aso_gestion['total_a'] += $A->getDuree();
$aso_gestion['total'] += $A->getDuree();
}
}
}
}
}
$aso_stat['total_absences_projets'] += $aso_gestion['total'];
$aso_stat['utilisateurs'][] = $aso_gestion;
}
/trunk/presentation/stat_tableau_global.tpl.html
1,7 → 1,7
<div id="navigation">
<p>Navigation : <a href="<?=$url_mois_precedent;?>">&lt;&lt;</a> <?=$mois['mois'];?> <?=$mois['annee'];?> <a href="<?=$url_mois_suivant;?>">&gt;&gt;</a></p>
</div>
<?php if ($projets || $absences) : ?>
<?php if ($categories || $absences) : ?>
<table id="tab_tps_w_mensuel_salarie" summary="Tableau du temps de travail mensuel par salarié.">
<caption>Tableaux global - <?=$mois['mois'];?> <?=$mois['annee'];?></caption>
<thead>
8,48 → 8,65
<tr>
<th>Projets</th>
<?php foreach ($utilisateurs as $utilisateur) : ?>
<th>
<?=$utilisateur['prenom_nom']?>
</th>
<th><?=$utilisateur['prenom_nom']?></th>
<?php endforeach; ?>
<th>Total</th>
</tr>
</thead>
<tbody>
<?php $ligne = "impair"; ?>
<?php if ($projets) : ?>
<?foreach ($projets as $categorie => $pr):?>
<?php if ($categories) : ?>
<?foreach ($categories as $idc => $categorie):?>
<tr class="categories">
<td class="categories_titre"><?=$categorie;?></td>
<td class="categories_titre"><?=$categorie['nom'];?></td>
<?php foreach ($utilisateurs as $utilisateur) : ?>
<td class="categories_total"><?=(isset($utilisateur['categorie_totaux'][$categorie])) ? $utilisateur['categorie_totaux'][$categorie] : "&nbsp;";?></td>
<td class="categories_total"><?=(isset($utilisateur['projets'][$idc]['total'])) ? $utilisateur['projets'][$idc]['total'] : "&nbsp;";?></td>
<?php endforeach; ?>
<td><?=$categorie['total'];?></td>
</tr>
<?foreach ($pr as $id => $nom):?>
<?foreach ($categorie['projets'] as $idp => $projet):?>
<tr class="utilisateur <?=$ligne ; $ligne = ($ligne == "impair") ? "pair" : "impair" ;?>">
<td id="pr:<?=$id;?>" class="projet_nom"><?=$nom;?></td>
<td id="pr:<?=$idp;?>" class="projet_nom"><?=$projet['nom'];?></td>
<?php foreach ($utilisateurs as $utilisateur) : ?>
<td class="projet"><?=(isset($utilisateur['projets'][$categorie][$id])) ? $utilisateur['projets'][$categorie][$id]['duree'] : "&nbsp;";?></td>
<td class="projet"><?=(isset($utilisateur['projets'][$idc][$idp])) ? $utilisateur['projets'][$idc][$idp]['duree'] : "&nbsp;";?></td>
<?php endforeach; ?>
<td class="total"><?=$projet['total'];?></td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
<?php endforeach; ?>
<tr class="total">
<td>Total travail</td>
<?php foreach ($utilisateurs as $utilisateur) : ?>
<td><?=(isset($utilisateur['total_w'])) ? $utilisateur['total_w'] : "&nbsp;";?></td>
<?php endforeach; ?>
<td><?=$total_projets;?></td>
</tr>
<?php endif; ?>
<?php if ($absences) : ?>
<tr class="absences">
<td class="absences_titre">Absences</td>
<?php foreach ($utilisateurs as $utilisateur) : ?>
<td class="absences_total"><?=$utilisateur['ab_total'];?></td>
<td class="absences_total"><?=$utilisateur['total_a'];?></td>
<?php endforeach; ?>
<td><?=$total_absences;?></td>
</tr>
<?php foreach ($absences as $ab_id => $ab_libelle) : ?>
<?php foreach ($absences as $ida => $absence) : ?>
<tr class="utilisateur <?=$ligne ; $ligne = ($ligne == "impair") ? "pair" : "impair" ;?>">
<td id="ab:<?=$ab_id;?>" class="absence_nom"><?=$ab_libelle;?></td>
<td id="ab:<?=$ida;?>" class="absence_nom"><?=$absence['nom'];?></td>
<?php foreach ($utilisateurs as $utilisateur) : ?>
<td class="absence"><?= (isset($utilisateur['ab'][$ab_id])) ? $utilisateur['ab'][$ab_id] : "&nbsp;";?></td>
<td class="absence"><?= (isset($utilisateur['ab'][$ida])) ? $utilisateur['ab'][$ida] : "&nbsp;";?></td>
<?php endforeach; ?>
<td class="total"><?= (isset($absence['total'])) ? $absence['total'] : "&nbsp;";?></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
<tr class="total">
<td>Total</td>
<?php foreach ($utilisateurs as $utilisateur) : ?>
<td><?=(isset($utilisateur['total'])) ? $utilisateur['total'] : "&nbsp;";?></td>
<?php endforeach; ?>
<td><?=$total_absences_projets;?></td>
</tr>
</tbody>
</table>
<?php endif; ?>