2025-03-26 10:57:42 +01:00

95 lines
4.3 KiB
PHP

<?php
use Module\ACM\Classe\Classe\gestionAbsence;
use Module\ACM\Classe\Classe\gestionDate;
use Module\ACM\Classe\Classe\gestionUtilisateurSemaine;
include_once "css/StyleTableau.css.php";
/** @var $liste */
/** @var $listeDateSemaine */
/** @var array $semaine */
/** @var $titreSemaine */
/** @var DateTime $date */
/** @var $langs */
$csrfToken = function_exists('newToken') ? newToken() : $_SESSION['newtoken'];
$datePrec = new DateTime($semaine[0]->format('Y-m-d')); $dateSuv = new DateTime($semaine[0]->format('Y-m-d'));$datePrecMois = new DateTime($semaine[0]->format('Y-m-d')); $dateSuvMois = new DateTime($semaine[0]->format('Y-m-d'));
$datePrec->modify('-1 week'); $dateSuv->modify('+1 week');$datePrecMois->modify('-1 month'); $dateSuvMois->modify('+1 month');
$datePrec = $datePrec->format("Y-m-d"); $dateSuv = $dateSuv->format("Y-m-d");$datePrecMois = $datePrecMois->format("Y-m-d"); $dateSuvMois = $dateSuvMois->format("Y-m-d");
?>
<script src="<?=DOL_URL_ROOT;?>/custom/ACM/js/envoiePost.js"></script>
<h2>
<a class="puce" href="#" onclick="envoyerPost({action:'afficherAbsence', controleur:'absence', date:'<?=$datePrecMois?>'}, 'index.php', '<?=$csrfToken?>')">≪</a>
<a class="puce" href="#" onclick="envoyerPost({action:'afficherAbsence', controleur:'absence', date:'<?=$datePrec?>'}, 'index.php', '<?=$csrfToken?>')">◄</a>
<?=$titreSemaine?>
<a class="puce" href="#" onclick="envoyerPost({action:'afficherAbsence', controleur:'absence', date:'<?=$dateSuv?>'}, 'index.php', '<?=$csrfToken?>')">►</a>
<a class="puce" href="#" onclick="envoyerPost({action:'afficherAbsence', controleur:'absence', date:'<?=$dateSuvMois?>'}, 'index.php', '<?=$csrfToken?>')">≫</a>
</h2>
<table id="rhTable" class="centpercent">
<thead >
<tr>
<th rowspan="2">
<?=$langs->trans("ACMLogin")?>
</th>
<?php foreach ($semaine as $jour) { ?>
<th colspan="2">
<?= $jour->format("d/m/Y") ?>
</th>
<?php } ?>
</tr>
<tr>
<?php foreach ($semaine as $jour) {?>
<td>
<?=$langs->trans("ACMAm")?>
</td>
<td>
<?=$langs->trans("ACMPm")?>
</td >
<?php } ?>
</tr>
</thead>
<tbody>
<?php foreach ($liste as $user) {
$pasVide = $listeDateSemaine[$user["login"]]["Congé"] != "" || $listeDateSemaine[$user["login"]]["Malade"] != ""
|| $listeDateSemaine[$user["login"]]["Recupe"] != "";
if ($pasVide){
$rowspan = 1;
$listeFonctionnel = [];
if ($listeDateSemaine[$user["login"]]["Congé"] != ""){$rowspan++;$listeFonctionnel[] = $listeDateSemaine[$user["login"]]["Congé"];}
if ($listeDateSemaine[$user["login"]]["Malade"] != ""){$rowspan++;$listeFonctionnel[] = $listeDateSemaine[$user["login"]]["Malade"];}
if ($listeDateSemaine[$user["login"]]["Recupe"] != ""){$rowspan++;$listeFonctionnel[] = $listeDateSemaine[$user["login"]]["Recupe"];}
}
else {
$rowspan = 2;
}
?>
<tr class="ligne_semaine">
<th rowspan="<?=$rowspan?>"><?=$user["login"]?></th>
</tr>
<?php if ($pasVide) {
$x=1;
$class = "";
foreach ($listeFonctionnel as $affichage) {
$x++;
if ($x == $rowspan) $class = "class=\"ligne_semaine\"";
echo "<tr $class> $affichage</tr>";
}
?>
<?php } else {
echo "<tr class=\"ligne_semaine\">";
foreach ($semaine as $jour) {?>
<td></td><td></td>
<?php } echo "</tr>";
}?>
<?php } ?>
</tbody>
</table>
<table id="lexique" class="centpercent">
<tr>
<th><font class="couleurCongee">&#9632;</font> <?=$langs->trans("ACMConge")?></th>
<th><font class="couleurMalade">&#9632;</font> <?=$langs->trans("ACMMalade")?></th>
<th><font class="couleurRecupe">&#9632;</font> <?=$langs->trans("ACMRecupe")?></th>
</tr>
</table>