Line 7... |
Line 7... |
7 |
$Registre->ajouterSquelette('stat_tableau_charge', 'stat_tableau_charge.tpl.html');
|
7 |
$Registre->ajouterSquelette('stat_tableau_charge', 'stat_tableau_charge.tpl.html');
|
8 |
}
|
8 |
}
|
Line 9... |
Line 9... |
9 |
|
9 |
|
10 |
public function executer()
|
10 |
public function executer()
|
- |
|
11 |
{
|
- |
|
12 |
//+-------------------------------------------------------------------------------------------------+
|
- |
|
13 |
// GESTION D'INFO GLOBALES
|
11 |
{
|
14 |
//+-------------------------------------------------------------------------------------------------+
|
12 |
$aso_stat = array();
|
15 |
$aso_stat = array('total_w' => 0,'total_a' => 0, 'total' => 0);
|
Line 13... |
Line 16... |
13 |
$this->getRegistre()->setTitre('Plan de charge');
|
16 |
$this->getRegistre()->setTitre('Plan de charge');
|
14 |
|
17 |
|
15 |
//+-------------------------------------------------------------------------------------------------+
|
18 |
//+-------------------------------------------------------------------------------------------------+
|
Line 67... |
Line 70... |
67 |
//echo '<pre>'.print_r($Month, true).'</pre>';
|
70 |
//echo '<pre>'.print_r($Month, true).'</pre>';
|
68 |
$tab_semaine_jours = $Week->fetchAll();
|
71 |
$tab_semaine_jours = $Week->fetchAll();
|
69 |
foreach ($tab_semaine_jours as $num => $Day) {
|
72 |
foreach ($tab_semaine_jours as $num => $Day) {
|
70 |
// Nous prenons en compte uniquement les jours du mois courant
|
73 |
// Nous prenons en compte uniquement les jours du mois courant
|
71 |
if ($Day->thisMonth() == $_GET['mois']) {
|
74 |
if ($Day->thisMonth() == $_GET['mois']) {
|
72 |
$element = array();
|
75 |
$element = array('travail' => 0, 'absence' => 0, 'w_et_a' => 0);
|
73 |
$element['jour'] = $Day->thisDay();
|
76 |
$element['jour'] = $Day->thisDay();
|
74 |
$element['jour_nom'] = $Calendrier->getNomJours($num);
|
77 |
$element['jour_nom'] = $Calendrier->getNomJours($num);
|
75 |
$element['class'] = 'jour';
|
78 |
$element['class'] = 'jour';
|
76 |
// Nous vérifions le type de jour
|
79 |
// Nous vérifions le type de jour
|
77 |
// Jour courrant
|
80 |
// Jour courrant
|
Line 142... |
Line 145... |
142 |
if ($tab_tp) {
|
145 |
if ($tab_tp) {
|
143 |
foreach ($tab_tp as $TP) {
|
146 |
foreach ($tab_tp as $TP) {
|
144 |
$j = date('Y-m-d', strtotime($TP->getIdDateTravail()));
|
147 |
$j = date('Y-m-d', strtotime($TP->getIdDateTravail()));
|
145 |
if ($TP->getIdProjet() == $Projet->getIdProjet()) {
|
148 |
if ($TP->getIdProjet() == $Projet->getIdProjet()) {
|
146 |
// Récupération des infos sur les catégories
|
149 |
// Récupération des infos sur les catégories
|
147 |
if (!isset($aso_stat['categorie_totaux'][$Categorie->getLibelle()][$j])) {
|
150 |
if (!isset($aso_stat['categories'][$Categorie->getLibelle()][$j])) {
|
148 |
$aso_stat['categorie_totaux'][$Categorie->getLibelle()][$j] = 0;
|
151 |
$aso_stat['categories'][$Categorie->getLibelle()][$j] = 0;
|
- |
|
152 |
}
|
- |
|
153 |
$aso_stat['categories'][$Categorie->getLibelle()][$j] += $TP->getDuree();
|
- |
|
154 |
if (!isset($aso_stat['categories'][$Categorie->getLibelle()]['total'])) {
|
- |
|
155 |
$aso_stat['categories'][$Categorie->getLibelle()]['total'] = 0;
|
149 |
}
|
156 |
}
|
150 |
$aso_stat['categorie_totaux'][$Categorie->getLibelle()][$j] += $TP->getDuree();
|
157 |
$aso_stat['categories'][$Categorie->getLibelle()]['total'] += $TP->getDuree();
|
- |
|
158 |
|
- |
|
159 |
// Récupération du total de travail
|
- |
|
160 |
$aso_stat['total_w'] += $TP->getDuree();
|
- |
|
161 |
|
- |
|
162 |
// Récupération du total de temps global (travail+absence)
|
- |
|
163 |
$aso_stat['total'] += $TP->getDuree();
|
- |
|
164 |
|
- |
|
165 |
// Récupération d'info sur le temps travaillé
|
- |
|
166 |
$aso_stat['elements'][$j]['travail'] += $TP->getDuree();
|
- |
|
167 |
|
- |
|
168 |
// Récupération du total travail + absence par jour
|
- |
|
169 |
$aso_stat['elements'][$j]['w_et_a'] += $TP->getDuree();
|
- |
|
170 |
|
151 |
// Récupération des infos sur les projets
|
171 |
// Récupération des infos sur les projets
|
152 |
if (!isset($aso_stat['projets'][$Categorie->getLibelle()][$Projet->getIdProjet()])) {
|
172 |
if (!isset($aso_stat['projets'][$Categorie->getLibelle()][$Projet->getIdProjet()])) {
|
153 |
$aso_stat['projets'][$Categorie->getLibelle()][$Projet->getIdProjet()] = array(
|
173 |
$aso_stat['projets'][$Categorie->getLibelle()][$Projet->getIdProjet()] = array(
|
154 |
'id' => $Projet->getIdProjet(),
|
174 |
'id' => $Projet->getIdProjet(),
|
155 |
'nom' => $Projet->getNom(),
|
175 |
'nom' => $Projet->getNom(),
|
- |
|
176 |
'desc' => $Projet->getDescription(),
|
156 |
'duree' => array());
|
177 |
'duree' => array(),
|
- |
|
178 |
'total' => 0);
|
157 |
}
|
179 |
}
|
158 |
$aso_stat['projets'][$Categorie->getLibelle()][$Projet->getIdProjet()]['duree'][$j] = $TP->getDuree();
|
180 |
$aso_stat['projets'][$Categorie->getLibelle()][$Projet->getIdProjet()]['duree'][$j] = $TP->getDuree();
|
- |
|
181 |
$aso_stat['projets'][$Categorie->getLibelle()][$Projet->getIdProjet()]['total'] += $TP->getDuree();
|
159 |
}
|
182 |
}
|
160 |
}
|
183 |
}
|
161 |
}
|
184 |
}
|
162 |
}
|
185 |
}
|
163 |
} else {
|
186 |
} else {
|
Line 179... |
Line 202... |
179 |
$tab_a = $Absence->consulter($cmd, $param);
|
202 |
$tab_a = $Absence->consulter($cmd, $param);
|
180 |
if ($tab_a != false) {
|
203 |
if ($tab_a != false) {
|
181 |
$aso_stat['ab_total'] = '';
|
204 |
$aso_stat['ab_total'] = '';
|
182 |
if ($tab_am) {
|
205 |
if ($tab_am) {
|
183 |
foreach ($tab_am as $AM) {
|
206 |
foreach ($tab_am as $AM) {
|
- |
|
207 |
// Initialisation du tableau des types d'absences
|
184 |
$aso_stat['absences'][$AM->getIdAbsenceMotif()] = $AM->getLibelle();
|
208 |
$aso_stat['absences'][$AM->getIdAbsenceMotif()]['nom'] = $AM->getLibelle();
|
- |
|
209 |
if (!isset($aso_stat['absences'][$AM->getIdAbsenceMotif()]['total'])) {
|
185 |
//$aso_gestion['ab'][$AM->getIdAbsenceMotif()] = 0;
|
210 |
$aso_stat['absences'][$AM->getIdAbsenceMotif()]['total'] = 0;
|
- |
|
211 |
}
|
- |
|
212 |
|
186 |
if ($tab_a) {
|
213 |
if ($tab_a) {
|
187 |
foreach ($tab_a as $A) {
|
214 |
foreach ($tab_a as $A) {
|
188 |
if ($A->getIdAbsenceMotif() == $AM->getIdAbsenceMotif() && $A->getDuree() != 0) {
|
215 |
if ($A->getIdAbsenceMotif() == $AM->getIdAbsenceMotif() && $A->getDuree() != 0) {
|
189 |
$j = date('Y-m-d', strtotime($A->getIdDateAbsence()));
|
216 |
$j = date('Y-m-d', strtotime($A->getIdDateAbsence()));
|
- |
|
217 |
|
190 |
// Récupération des infos sur les absences
|
218 |
// Récupération des infos sur les absences
|
191 |
$aso_stat['ab'][$AM->getIdAbsenceMotif()][$j] = $A->getDuree();
|
219 |
$aso_stat['ab'][$AM->getIdAbsenceMotif()][$j] = $A->getDuree();
|
- |
|
220 |
|
- |
|
221 |
// Récupération du total des absences par jour
|
- |
|
222 |
$aso_stat['elements'][$j]['absence'] += $A->getDuree();
|
- |
|
223 |
|
- |
|
224 |
// Récupération du total travail + absence par jour
|
- |
|
225 |
$aso_stat['elements'][$j]['w_et_a'] += $A->getDuree();
|
- |
|
226 |
|
- |
|
227 |
// Récupération du total pour chaque type d'absence
|
- |
|
228 |
$aso_stat['absences'][$AM->getIdAbsenceMotif()]['total'] += $A->getDuree();
|
- |
|
229 |
|
192 |
// Récupération du total des absences
|
230 |
// Récupération du total des absences
|
193 |
if (!isset($aso_stat['ab_total'][$j])) {
|
231 |
$aso_stat['total_a'] += $A->getDuree();
|
- |
|
232 |
|
194 |
$aso_stat['ab_total'][$j] = 0;
|
233 |
// Récupération du total de temps global (travail+absence)
|
195 |
}
|
- |
|
196 |
$aso_stat['ab_total'][$j] += $A->getDuree();
|
234 |
$aso_stat['total'] += $A->getDuree();
|
197 |
}
|
235 |
}
|
198 |
}
|
236 |
}
|
199 |
}
|
237 |
}
|
200 |
}
|
238 |
}
|
201 |
}
|
239 |
}
|
202 |
} else {
|
240 |
} else {
|
203 |
$aso_stat['messages'][] = 'Aucune absence de mentionnée en '.$aso_stat['mois']['mois'].' '.$aso_stat['mois']['annee'];
|
241 |
$aso_stat['messages'][] = 'Aucune absence de mentionnée en '.$aso_stat['mois']['mois'].' '.$aso_stat['mois']['annee'];
|
204 |
}
|
242 |
}
|
Line 205... |
Line -... |
205 |
|
- |
|
206 |
|
243 |
|
207 |
trigger_error('<pre>'.print_r($aso_stat, true).'</pre>', E_USER_NOTICE);
|
244 |
//trigger_error('<pre>'.print_r($aso_stat, true).'</pre>', E_USER_NOTICE);
|
208 |
$this->getRegistre()->ajouterDonnee('stat_tableau_charge', $aso_stat);
|
245 |
$this->getRegistre()->ajouterDonnee('stat_tableau_charge', $aso_stat);
|
209 |
}
|
246 |
}
|
210 |
}
|
247 |
}
|
211 |
?>
|
248 |
?>
|