/trunk/actions/GttCtrlActionAdminUtilisateur.class.php |
---|
189,7 → 189,13 |
$Utilisateur->setTempsDeTravailJour($_POST['ut_temps_de_travail_jour']); |
$Utilisateur->setTempsDeTravailMois($_POST['ut_temps_de_travail_mois']); |
$Utilisateur->setQuotaHeuresSupp($_POST['ut_quota_heures_supp']); |
if (!isset($_POST['ut_mark_admin'])) { |
$_POST['ut_mark_admin'] = 0; |
} |
$Utilisateur->setMarkAdmin($_POST['ut_mark_admin']); |
if (!isset($_POST['ut_mark_recapitulatif'])) { |
$_POST['ut_mark_recapitulatif'] = 0; |
} |
$Utilisateur->setMarkRecapitulatif($_POST['ut_mark_recapitulatif']); |
$Utilisateur->ajouter(); |
// Action suivante |
/trunk/actions/GttCtrlActionStatTableauCharge.class.php |
---|
New file |
0,0 → 1,220 |
<?php |
class GttCtrlActionStatTableauCharge extends aControlleurAction { |
public function __construct(Registre $Registre) |
{ |
$Registre->ajouterEspace('StatTableauCharge', 'stat_tableau_charge'); |
$Registre->ajouterSquelette('stat_tableau_charge', 'stat_tableau_charge.tpl.html'); |
} |
public function executer() |
{ |
$aso_stat = array(); |
$this->getRegistre()->setTitre('Plan de charge'); |
//+-------------------------------------------------------------------------------------------------+ |
// GESTION DES PARAMÊTRE de l'URL |
//+-------------------------------------------------------------------------------------------------+ |
// Initialisation des variables |
if (!isset($_GET['annee'])) { |
$_GET['annee'] = date('Y'); |
} |
if (!isset($_GET['mois'])) { |
$_GET['mois'] = date('m'); |
} |
if (!isset($_GET['uid'])) {// ID de l'utilisateur à afficher |
$_GET['uid'] = null; |
} |
//+-------------------------------------------------------------------------------------------------+ |
// GESTION DES UTILISATEURS |
//+-------------------------------------------------------------------------------------------------+ |
$DaoUtilsateur = new Utilisateur(); |
$utilisateurs = $DaoUtilsateur->consulter(Utilisateur::GU_TOUS_AFFICHABLE); |
if (is_object($utilisateurs)) { |
$utilisateurs[0] = $utilisateurs; |
} |
$UtilisateurCourant = null; |
foreach ($utilisateurs as $Utilisateur) { |
// Récupération des infos sur l'utilisateur |
$aso_stat['utilisateurs'][$Utilisateur->getIdUtilisateur()]['courant'] = false; |
$aso_stat['utilisateurs'][$Utilisateur->getIdUtilisateur()]['nom'] = $Utilisateur->getPrenom().' '.$Utilisateur->getNom(); |
if ( (!is_null($_GET['uid']) && $Utilisateur->getIdUtilisateur() == $_GET['uid']) |
|| (is_null($_GET['uid']) && $Utilisateur->getIdUtilisateur() == $GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur()) ) { |
$UtilisateurCourant = clone $Utilisateur; |
$aso_stat['utilisateurs'][$Utilisateur->getIdUtilisateur()]['courant'] = true; |
$aso_stat['utilisateur_courant'] = $Utilisateur->getPrenom().' '.$Utilisateur->getNom(); |
$_GET['uid'] = $Utilisateur->getIdUtilisateur(); |
} |
} |
$aso_stat['etre_admin'] = $GLOBALS['_GTT_']['Utilisateur']->getMarkAdmin(); |
$Utilisateur = $UtilisateurCourant; |
//+-------------------------------------------------------------------------------------------------+ |
// GESTION DES CALENDRIERS |
//+-------------------------------------------------------------------------------------------------+ |
// Construction du Calendrier |
$Calendrier = new Calendrier(); |
$tab_jours_feries = $Calendrier->getListeFeries(); |
// Construction de l'objet mois |
$Month = new Calendar_Month_Weeks($_GET['annee'], $_GET['mois']); |
$Month->build(); |
// Récupération des jours du mois |
while ($Week = $Month->fetch()) { |
$Week->build(); |
//echo '<pre>'.print_r($Month, true).'</pre>'; |
$tab_semaine_jours = $Week->fetchAll(); |
foreach ($tab_semaine_jours as $num => $Day) { |
// Nous prenons en compte uniquement les jours du mois courant |
if ($Day->thisMonth() == $_GET['mois']) { |
$element = array(); |
$element['jour'] = $Day->thisDay(); |
$element['jour_nom'] = $Calendrier->getNomJours($num); |
$element['class'] = 'jour'; |
// Nous vérifions le type de jour |
// Jour courrant |
if ($Day->isSelected()) { |
$element['class'] .= ' jour_courrant'; |
} |
// Jour n'appartenant pas au moins courrant |
if ($Day->isEmpty()) { |
$element['class'] .= ' jour_vide'; |
} |
// Jour férié |
foreach ($tab_jours_feries as $jour_ferie) { |
if ($Day->thisDay(true) == $jour_ferie) { |
$element['class'] .= ' jour_ferie'; |
} |
} |
// Jour de week-end |
if ($element['jour_nom'] == GESTION_DIM_L || $element['jour_nom'] == GESTION_SAM_L) { |
$element['class'] .= ' jour_we'; |
} |
$id = date('Y-m-d', mktime(0, 0, 0, $Day->thisMonth(), $Day->thisDay(), $Day->thisYear())); |
$aso_stat['elements'][$id] = $element; |
} |
} |
} |
// Construction de l'url pour les mois précédent/suivant/courant et paramêtres pour le formulaire utilisateur |
$aso_stat['form_url'] = 'index.php'; |
$aso_stat['form_param']['action'] = GTT_ACTION_STAT_TAB_CHARGE; |
$aso_stat['form_param']['annee'] = $Month->thisYear(); |
$aso_stat['form_param']['mois'] = $Month->thisMonth(); |
$PMonth = $Month->prevMonth('object'); |
$aso_stat['url_mois_precedent'] = 'index.php?action='.GTT_ACTION_STAT_TAB_CHARGE.'&annee='.$PMonth->thisYear().'&mois='.$PMonth->thisMonth().'&uid='.$_GET['uid']; |
$NMonth = $Month->nextMonth('object'); |
$aso_stat['url_mois_suivant'] = 'index.php?action='.GTT_ACTION_STAT_TAB_CHARGE.'&annee='.$NMonth->thisYear().'&mois='.$NMonth->thisMonth().'&uid='.$_GET['uid']; |
$aso_stat['mois']['mois'] = $Calendrier->getNomMois($Month->thisMonth()); |
$aso_stat['mois']['annee'] = $Month->thisYear(); |
$mois_courant_j1 = $Month->thisYear().'-'.sprintf("%02s", $Month->thisMonth()).'-'.sprintf("%02s", $Month->thisDay()).' 00:00:00'; |
$mois_courant_j36 = date('Y-m-d H:i:s', mktime(0, 0, 0, $NMonth->thisMonth(), 0, $NMonth->thisYear())); |
//+-------------------------------------------------------------------------------------------------+ |
// GESTION DES PROJETS |
//+-------------------------------------------------------------------------------------------------+ |
// Récupération du temps de travail pour un utilisateur pour le mois donné |
$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 ($tab_tp && count($tab_tp) == 1) { |
$tab_tp = array($tab_tp); |
} |
if ($tab_tp != false) { |
$tab_projet_id = array(); |
foreach ($tab_tp as $utp) { |
$tab_projet_id[] = $utp->getIdProjet(); |
} |
// Nous vérifions qu'il y a des données pour l'utilisateur courant pour le mois donné |
// Récupération des infos sur les projets de l'utilisateur |
$Projet = new Projet(); |
$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; |
$param = $Projet->getCeCategorie(); |
$Categorie = $ProjetCategorie->consulter($cmd, $param); |
// Nous vérifions le temps de travail pour ce projet |
$aso_tps_w = 0; |
if ($tab_tp) { |
foreach ($tab_tp as $TP) { |
$j = date('Y-m-d', strtotime($TP->getIdDateTravail())); |
if ($TP->getIdProjet() == $Projet->getIdProjet()) { |
// Récupération des infos sur les catégories |
if (!isset($aso_stat['categorie_totaux'][$Categorie->getLibelle()][$j])) { |
$aso_stat['categorie_totaux'][$Categorie->getLibelle()][$j] = 0; |
} |
$aso_stat['categorie_totaux'][$Categorie->getLibelle()][$j] += $TP->getDuree(); |
// Récupération des infos sur les projets |
if (!isset($aso_stat['projets'][$Categorie->getLibelle()][$Projet->getIdProjet()])) { |
$aso_stat['projets'][$Categorie->getLibelle()][$Projet->getIdProjet()] = array( |
'id' => $Projet->getIdProjet(), |
'nom' => $Projet->getNom(), |
'duree' => array()); |
} |
$aso_stat['projets'][$Categorie->getLibelle()][$Projet->getIdProjet()]['duree'][$j] = $TP->getDuree(); |
} |
} |
} |
} |
} else { |
$aso_stat['messages'][] = 'Aucune information sur le travail en '.$aso_stat['mois']['mois'].' '.$aso_stat['mois']['annee']; |
} |
//+-------------------------------------------------------------------------------------------------+ |
// GESTION DES ABSENCES |
//+-------------------------------------------------------------------------------------------------+ |
// Récupération des motifs d'absence |
$AbsenceMotif = new AbsenceMotif(); |
$cmd = AbsenceMotif::GAM_TOUS; |
$tab_am = $AbsenceMotif->consulter($cmd); |
if ($tab_am && count($tab_am) == 1) { |
$tab_am = array($tab_am); |
} |
// 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); |
if ($tab_a && count($tab_a) == 1) { |
$tab_a = array($tab_a); |
} |
if ($tab_a != false) { |
$aso_stat['ab_total'] = ''; |
if ($tab_am) { |
foreach ($tab_am as $AM) { |
$aso_stat['absences'][$AM->getIdAbsenceMotif()] = $AM->getLibelle(); |
//$aso_gestion['ab'][$AM->getIdAbsenceMotif()] = 0; |
if ($tab_a) { |
foreach ($tab_a as $A) { |
if ($A->getIdAbsenceMotif() == $AM->getIdAbsenceMotif() && $A->getDuree() != 0) { |
$j = date('Y-m-d', strtotime($A->getIdDateAbsence())); |
// Récupération des infos sur les absences |
$aso_stat['ab'][$AM->getIdAbsenceMotif()][$j] = $A->getDuree(); |
// Récupération du total des absences |
if (!isset($aso_stat['ab_total'][$j])) { |
$aso_stat['ab_total'][$j] = 0; |
} |
$aso_stat['ab_total'][$j] += $A->getDuree(); |
} |
} |
} |
} |
} |
} else { |
$aso_stat['messages'][] = 'Aucune absence de mentionnée en '.$aso_stat['mois']['mois'].' '.$aso_stat['mois']['annee']; |
} |
trigger_error('<pre>'.print_r($aso_stat, true).'</pre>', E_USER_NOTICE); |
$this->getRegistre()->ajouterDonnee('stat_tableau_charge', $aso_stat); |
} |
} |
?> |
/trunk/presentation/disposition.css |
---|
7,6 → 7,7 |
padding:0;} |
legend{ |
margin:0 0 0 1em;} |
/* Disposition des éléments sur la page */ |
#zone_entete { |
height:75px;} |
27,7 → 28,8 |
margin:0 250px; |
padding:0; |
min-height:400px; |
min-width:800px;} |
min-width:800px; |
overflow:auto;} |
#zone_droite { |
position:absolute; |
right:0; |
38,9 → 40,13 |
margin-top:10px; |
height:100%;} |
/* Détails */ |
/* Autres zones mineures*/ |
#zone_accessibilite { |
float:right;} |
#zone_menu{ |
padding:0 0 0 5px;} |
/* Détails */ |
#gestion { |
width:100%; |
text-align:center;} |
/trunk/presentation/menu.tpl.html |
---|
8,6 → 8,7 |
<h3>Statistiques</h3> |
<ul> |
<li><a href="index.php?action=stat-tableau-global">Tableau général</a></li> |
<li><a href="index.php?action=stat-tableau-charge">Plan de charge</a></li> |
</ul> |
<?php if ($bool_admin) : ?> |
<h3>Administration</h3> |
/trunk/presentation/impression.css |
---|
New file |
0,0 → 1,10 |
#zone_droite, #zone_erreur,#navigation,#zone_accessibilite {display:none;} |
#zone_gauche{page-break-after: always;} |
table{ |
border: medium solid grey; |
border-collapse: collapse; |
margin:0} |
td,th{border:thin solid grey;} |
th{border-bottom: medium solid grey;} |
td,th{text-align:center;} |
.entete{text-align:left;} |
/trunk/presentation/principal.tpl.html |
---|
3,8 → 3,10 |
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr"> |
<head> |
<meta http-equiv="Content-Style-Type" content="text/css" /> |
<style type="text/css" media="screen"><!-- @import "presentation/disposition.css"; --></style> |
<style type="text/css" media="screen"><!-- @import "presentation/disposition.css"; --></style> |
<style type="text/css" media="print"><!-- @import "presentation/impression.css"; --></style> |
<link rel="stylesheet" type="text/css" href="presentation/emeraude/emeraude.css" media="screen" title="Émeraude" /> |
<title><?=$titre;?></title> |
</head> |
<body> |
/trunk/presentation/stat_tableau_charge.tpl.html |
---|
New file |
0,0 → 1,79 |
<div id="navigation"> |
<p>Navigation : <a href="<?=$url_mois_precedent;?>"><<</a> <?=$mois['mois'];?> <?=$mois['annee'];?> <a href="<?=$url_mois_suivant;?>">>></a></p> |
<?php if ($etre_admin) : ?> |
<form id="form_utilisateur" name="form_utilisateur" action="<?=$form_url;?>" method="get"> |
<input type="hidden" name="action" value="<?=$form_param['action'];?>"/> |
<input type="hidden" name="annee" value="<?=$form_param['annee'];?>"/> |
<input type="hidden" name="mois" value="<?=$form_param['mois'];?>"/> |
<label for="uid">Utilisateur :</label> |
<select id="uid" name="uid" onchange="javascript:this.form.submit();"> |
<?php foreach ($utilisateurs as $id => $utilisateur) : ?> |
<option value="<?php echo $id; ?>" <?php echo ($utilisateur['courant']) ? 'selected="selected"' : ''; ?>><?php echo $utilisateur['nom']; ?></option> |
<?php endforeach; ?> |
</select> |
<input type="submit" name="btn_envoyer_utilisateur" value="OK"/> |
</form> |
<?php endif; ?> |
</div> |
<?php if (isset($projets) || isset($absences)) : ?> |
<table id="tab_tps_w_mensuel_salarie" summary="Tableau du temps de travail mensuel par salarié."> |
<caption>Plan de charge - <?=$mois['mois'];?> <?=$mois['annee'];?> - <?=$utilisateur_courant;?></caption> |
<colgroup> |
<col id="col_titre" span="1"/> |
</colgroup> |
<thead> |
<tr> |
<th>Projets</th> |
<?php foreach ($elements as $jour) : ?> |
<th class="<?=$jour['class']?>"> |
<?=$jour['jour_nom']?> <?=$jour['jour']?> |
</th> |
<?php endforeach; ?> |
</tr> |
</thead> |
<tbody> |
<?php if (isset($projets)) : ?> |
<?php $ligne = "impair"; ?> |
<?foreach ($projets as $categorie => $pr):?> |
<tr class="categories <?=$ligne ; $ligne = ($ligne == "impair") ? "pair" : "impair" ;?>"> |
<td class="entete categories_titre"><?=$categorie;?></td> |
<?php foreach ($elements as $jour_id => $jour) : ?> |
<td class="categories_total"><?=(isset($categorie_totaux[$categorie][$jour_id])) ? $categorie_totaux[$categorie][$jour_id] : " ";?></td> |
<?php endforeach; ?> |
</tr> |
<?foreach ($pr as $id => $projet):?> |
<tr class="projets <?=$ligne ; $ligne = ($ligne == "impair") ? "pair" : "impair" ;?>"> |
<td id="pr:<?=$id;?>" class="entete projet_nom"><?=$projet['nom'];?></td> |
<?php foreach ($elements as $jour_id => $jour) : ?> |
<td class="projet"><?=(isset($projet['duree'][$jour_id])) ? $projet['duree'][$jour_id] : " ";?></td> |
<?php endforeach; ?> |
</tr> |
<?php endforeach; ?> |
<?php endforeach; ?> |
<?php endif; ?> |
<?php if (isset($absences)) : ?> |
<?php $ligne = "impair"; ?> |
<tr class="absences"> |
<td class="entete absences_titre">Absences</td> |
<?php foreach ($elements as $jour_id => $jour) : ?> |
<td class="absences_total"><?=(isset($ab_total[$jour_id])) ? $ab_total[$jour_id] : " ";?></td> |
<?php endforeach; ?> |
</tr> |
<?php foreach ($absences as $ab_id => $ab_libelle) : ?> |
<tr class="<?=$ligne ; $ligne = ($ligne == "impair") ? "pair" : "impair" ;?>"> |
<td id="ab:<?=$ab_id;?>" class="entete absence_nom"><?=$ab_libelle;?></td> |
<?php foreach ($elements as $jour_id => $jour) : ?> |
<td class="absence"><?= (isset($ab[$ab_id][$jour_id])) ? $ab[$ab_id][$jour_id] : " ";?></td> |
<?php endforeach; ?> |
</tr> |
<?php endforeach; ?> |
<?php endif; ?> |
</tbody> |
</table> |
<?php endif; ?> |
<?php if (isset($messages)) : ?> |
<?php foreach ($messages as $message) : ?> |
<p class="information"><?=$message;?></p> |
<?php endforeach; ?> |
<?php endif; ?> |
/trunk/presentation/emeraude/emeraude.css |
---|
42,15 → 42,13 |
color: #5D5F53;} |
/* Présentation générale des tableaux */ |
table{ |
border:1px dotted black;} |
table{border:1px dotted black;} |
th{ |
background-color:#486300; |
color:white;} |
td{ |
text-align:center;} |
tr.pair{ |
background-color: #F1F2E7;} |
td{text-align:center;} |
tr.pair{background-color: #F1F2E7;} |
caption{margin-top:1em;} |
/*Présentation des bulles d'aide */ |
*[title]:after {content:" "url(images/help_view_16x16.gif);} |
172,7 → 170,6 |
padding:1px; |
margin:0 0.2em;} |
.projet { |
text-align:left; |
font-weight:bold; |
width:300px;} |
.utilisateur{ |
186,8 → 183,18 |
.jour_ferie { |
background-color:red; |
border-width:2px outset #74C054;} |
.jour_vide {color:white;} |
/* Tableau */ |
.jour_we { |
color:black; |
background-color: #F1F2E7; |
border-width:2px outset #74C054;} |
.jour_vide { |
color:white; |
background-color: grey;} |
/* Tableau identification */ |
#connexion{border:0;} |
#connexion td{ |
width:50%;} |
/* Tableau stats*/ |
tr.categories,tr.absences{ |
height:1em; |
font-size:1.2em; |
195,5 → 202,13 |
padding:1px; |
margin:0 0.2em; |
background-image: url('images/a2.gif');} |
td.absences_titre,td.categories_titre{ |
width:30%;} |
#tab_tps_w_mensuel_salarie{ |
width:100%;} |
.entete{width:250px;} |
#navigation{text-align:center;} |
#navigation p{margin:0;} |
#form_utilisateur label{ |
display:inline; |
float:none; |
min-width:0; |
font-weight:normal;} |
/trunk/bibliotheque/metier/TravailProjet.class.php |
---|
126,19 → 126,20 |
*/ |
public function consulter($cmd = '', $parametres = array(), $instancier = false) |
{ |
if (!is_array($parametres)) { |
$parametres[0] = $parametres; |
} |
switch ($cmd) { |
case TravailProjet::GTP_ID: |
$requete = 'SELECT * '. |
'FROM gestion_travail_projet '. |
'WHERE gtp_id_utilisateur = '.$parametres[0].' AND gtp_id_projet = '.$parametres[1].' AND gtp_id_date_travail = "'.$parametres[2].'" '; |
'WHERE gtp_id_utilisateur = #0 '. |
' AND gtp_id_projet = #1 '. |
' AND gtp_id_date_travail = "#2" '; |
break; |
case TravailProjet::GTP_ID_UTILISATEUR_DATE_DEB_FIN: |
$requete = 'SELECT * '. |
'FROM gestion_travail_projet '. |
'WHERE gtp_id_utilisateur = '.$parametres[0].' AND gtp_id_date_travail >= "'.$parametres[1].'" '.' AND gtp_id_date_travail <= "'.$parametres[2].'" '; |
'WHERE gtp_id_utilisateur = #0 '. |
' AND gtp_id_date_travail >= "#1" '. |
' AND gtp_id_date_travail <= "#2" '; |
break; |
case TravailProjet::GTP_ID_MAX_UTILISATEUR: |
$requete = 'SELECT MAX(gtp_id_utilisateur) '. |
155,7 → 156,7 |
case TravailProjet::GTP_PROJET: |
$requete = 'SELECT gtp_id_projet '. |
'FROM gestion_travail_projet '. |
'WHERE gtp_id_projet = '.$parametres[0]; |
'WHERE gtp_id_projet = #0 '; |
break; |
default : |
$message = 'Commande '.$cmd.' inconnue!'; |
162,23 → 163,7 |
$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message); |
trigger_error($e, E_USER_ERROR); |
} |
$resultat = $GLOBALS['db']->query($requete); |
//echo '<pre>'.print_r($resultat, true).'</pre>'; |
(DB::isError($resultat)) ? die (GestionnaireErreur::retournerErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ; |
$tab_resultat = array(); |
while ($donnees =& $resultat->fetchRow(DB_FETCHMODE_ASSOC)) { |
$tab_resultat[] = $this->basculerEnregistrementObjet($donnees, $instancier); |
} |
$resultat_nbre = count($tab_resultat); |
if ($resultat_nbre > 1) { |
return $tab_resultat; |
} else if ($resultat_nbre == 1) { |
return $tab_resultat[0]; |
} else if ($resultat_nbre == 0) { |
return false; |
} |
return parent::consulter($requete, $parametres, $instancier); |
} |
/** Afficher l'objet TravailProjet */ |