diff options
author | Minteck <contact@minteck.org> | 2023-01-25 21:29:28 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2023-01-25 21:29:28 +0100 |
commit | ce1ed675a34f5e3d1d317e6d8a1bd33de55b72d8 (patch) | |
tree | 4f8d8aa12fea4fc5d76c0e116a2c4caca02f779e /absences | |
parent | 0fb31ef23c57749eec78cb3eb38d825e2ca037b5 (diff) | |
download | nots-mane.tar.gz nots-mane.tar.bz2 nots-mane.zip |
Diffstat (limited to 'absences')
-rwxr-xr-x | absences/index.php | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/absences/index.php b/absences/index.php index bcc58f3..b9d6392 100755 --- a/absences/index.php +++ b/absences/index.php @@ -1,13 +1,41 @@ <?php -$title = "Absences et retards"; +$title = "Absences"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/header.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/navigation.php"; +$absences = data_absences(); + ?> -<div class="container"><br><h2><?= $title ?></h2><div class="alert alert-warning"><b>Cette page n'est pas encore disponible.</b> Nots est un logiciel en développement actif, et certaines pages ne sont pas encore disponibles. <a href="/about">En savoir plus.</a></div></div> +<div class="container"> + <br><h2><?= $title ?></h2> + + <?php foreach (array_reverse($absences["data"]["absences"]["absences"]) as $absence): ?> + <div style="margin-top: 5px; padding-top: 5px; padding-bottom: 5px; margin-left: 10px; padding-left: 10px; border-left-style: solid; border-color: #ddd; border-left-width: 5px;"> + <b><?= $absence["reason"] ?></b><?php if (!$absence["justified"]): ?> <span class="btn btn-danger">Non justifiée</span><?php elseif (!$absence["solved"]): ?> <span class="btn btn-warning">Non résolue</span><?php endif; ?><br> + <?php + + $fmt = new \IntlDateFormatter('fr_FR'); + $fmt->setPattern('d MMM yyyy, H:m'); + + $fmt1 = new \IntlDateFormatter('fr_FR'); + $fmt1->setPattern('d MMM yyyy'); + + $fmt2 = new \IntlDateFormatter('fr_FR'); + $fmt2->setPattern('H:m'); + + ?> + <?php if ($fmt1->format(new \DateTime(date("c", ($absence["from"] + 3600000) / 1000))) === $fmt1->format(new \DateTime(date("c", ($absence["to"] + 3600000) / 1000)))): ?> + le <?= $fmt1->format(new \DateTime(date("c", ($absence["from"] + 3600000) / 1000))) ?> de <?= $fmt2->format(new \DateTime(date("c", ($absence["from"] + 3600000) / 1000))) ?> à <?= $fmt2->format(new \DateTime(date("c", ($absence["to"] + 3600000) / 1000))) ?> + <?php else: ?> + du <?= $fmt->format(new \DateTime(date("c", ($absence["from"] + 3600000) / 1000))) ?> au <?= $fmt->format(new \DateTime(date("c", ($absence["to"] + 3600000) / 1000))) ?> + <?php endif; ?><br> + <?= $absence["hours"] ?> heure<?= $absence["hours"] > 1 ? "s" : "" ?> de cours manquée<?= $absence["hours"] > 1 ? "s" : "" ?> + </div> + <?php endforeach; ?> +</div> <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/footer.php"; ?> |