summaryrefslogtreecommitdiff
path: root/includes/system/history.php
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-08-21 17:31:56 +0200
committerMinteck <contact@minteck.org>2022-08-21 17:31:56 +0200
commita2df9a69dcc14cb70118cda2ded499055e7ee358 (patch)
tree6dd283e4e9452d38bce81ddaaae49b5335755842 /includes/system/history.php
parent84dd0735820b16b60f600284d35183d76547a71f (diff)
downloadpluralconnect-a2df9a69dcc14cb70118cda2ded499055e7ee358.tar.gz
pluralconnect-a2df9a69dcc14cb70118cda2ded499055e7ee358.tar.bz2
pluralconnect-a2df9a69dcc14cb70118cda2ded499055e7ee358.zip
m. update
Diffstat (limited to 'includes/system/history.php')
-rw-r--r--includes/system/history.php43
1 files changed, 31 insertions, 12 deletions
diff --git a/includes/system/history.php b/includes/system/history.php
index ad4e30e..8483e3a 100644
--- a/includes/system/history.php
+++ b/includes/system/history.php
@@ -21,7 +21,11 @@ function getMember(string $id) {
$switches = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-switches.json"), true);
uksort($switches, function ($a, $b) {
- return strtotime($b["timestamp"]) - strtotime($a["timestamp"]);
+ if (isset($b["timestamp"]) && isset($a["timestamp"])) {
+ return strtotime($b["timestamp"]) - strtotime($a["timestamp"]);
+ } else {
+ return null;
+ }
});
function getSwitchesForDay(int $day) {
@@ -33,7 +37,11 @@ function getMember(string $id) {
}));
uksort($filtered, function ($a, $b) {
- return strtotime($b["timestamp"]) - strtotime($a["timestamp"]);
+ if (isset($b["timestamp"]) && isset($a["timestamp"])) {
+ return strtotime($b["timestamp"]) - strtotime($a["timestamp"]);
+ } else {
+ return null;
+ }
});
return $filtered;
@@ -80,6 +88,13 @@ function getMember(string $id) {
?>
<h2>Front history in the <?= $systemCommonName ?></h2>
+ <div class="alert alert-warning" id="timezone" style="display: none;">
+ Times on this page are now shown using your local timezone (<span id="timezone-name">-</span>). Days start at <span id="day-start">-</span> (00:00 on UTC).
+ <script>
+ document.getElementById("day-start").innerText = new Date(<?= strtotime(date('Y-m-d')) ?> * 1000).toTimeString().substring(0, 5);
+ document.getElementById("timezone-name").innerText = new Date().toTimeString().split("(")[1].split(")")[0];
+ </script>
+ </div>
<h4>Today</h4>
<?php
@@ -100,7 +115,7 @@ function getMember(string $id) {
foreach ($fronters as $fronter): $member = getMember($fronter["member"]);
?>
<div class="fronter">
- <span class="fronter-date" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
+ <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 0) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
<?= isNotToday($fronter["date"], 0) ? "00:00" : date('H:i', $fronter["date"]) ?>
</span>
<span class="fronter-profile" style="vertical-align: middle;">
@@ -130,7 +145,7 @@ function getMember(string $id) {
foreach ($fronters as $fronter): $member = getMember($fronter["member"]);
?>
<div class="fronter">
- <span class="fronter-date" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
+ <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 1) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
<?= isNotToday($fronter["date"], 1) ? "00:00" : date('H:i', $fronter["date"]) ?>
</span>
<span class="fronter-profile" style="vertical-align: middle;">
@@ -160,7 +175,7 @@ function getMember(string $id) {
foreach ($fronters as $fronter): $member = getMember($fronter["member"]);
?>
<div class="fronter">
- <span class="fronter-date" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
+ <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 2) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
<?= isNotToday($fronter["date"], 2) ? "00:00" : date('H:i', $fronter["date"]) ?>
</span>
<span class="fronter-profile" style="vertical-align: middle;">
@@ -190,7 +205,7 @@ function getMember(string $id) {
foreach ($fronters as $fronter): $member = getMember($fronter["member"]);
?>
<div class="fronter">
- <span class="fronter-date" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
+ <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 3) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
<?= isNotToday($fronter["date"], 3) ? "00:00" : date('H:i', $fronter["date"]) ?>
</span>
<span class="fronter-profile" style="vertical-align: middle;">
@@ -220,7 +235,7 @@ function getMember(string $id) {
foreach ($fronters as $fronter): $member = getMember($fronter["member"]);
?>
<div class="fronter">
- <span class="fronter-date" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
+ <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 4) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
<?= isNotToday($fronter["date"], 4) ? "00:00" : date('H:i', $fronter["date"]) ?>
</span>
<span class="fronter-profile" style="vertical-align: middle;">
@@ -250,7 +265,7 @@ function getMember(string $id) {
foreach ($fronters as $fronter): $member = getMember($fronter["member"]);
?>
<div class="fronter">
- <span class="fronter-date" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
+ <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 5) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
<?= isNotToday($fronter["date"], 5) ? "00:00" : date('H:i', $fronter["date"]) ?>
</span>
<span class="fronter-profile" style="vertical-align: middle;">
@@ -280,7 +295,7 @@ function getMember(string $id) {
foreach ($fronters as $fronter): $member = getMember($fronter["member"]);
?>
<div class="fronter">
- <span class="fronter-date" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
+ <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 6) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
<?= isNotToday($fronter["date"], 6) ? "00:00" : date('H:i', $fronter["date"]) ?>
</span>
<span class="fronter-profile" style="vertical-align: middle;">
@@ -310,7 +325,7 @@ function getMember(string $id) {
foreach ($fronters as $fronter): $member = getMember($fronter["member"]);
?>
<div class="fronter">
- <span class="fronter-date" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
+ <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 7) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
<?= isNotToday($fronter["date"], 7) ? "00:00" : date('H:i', $fronter["date"]) ?>
</span>
<span class="fronter-profile" style="vertical-align: middle;">
@@ -340,7 +355,7 @@ function getMember(string $id) {
foreach ($fronters as $fronter): $member = getMember($fronter["member"]);
?>
<div class="fronter">
- <span class="fronter-date" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
+ <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 8) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
<?= isNotToday($fronter["date"], 8) ? "00:00" : date('H:i', $fronter["date"]) ?>
</span>
<span class="fronter-profile" style="vertical-align: middle;">
@@ -365,7 +380,7 @@ function getMember(string $id) {
foreach ($fronters as $fronter): $member = getMember($fronter["member"]);
?>
<div class="fronter">
- <span class="fronter-date" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
+ <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 9) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
<?= isNotToday($fronter["date"], 9) ? "00:00" : date('H:i', $fronter["date"]) ?>
</span>
<span class="fronter-profile" style="vertical-align: middle;">
@@ -376,5 +391,9 @@ function getMember(string $id) {
</div>
<?php endforeach; ?>
</div>
+ <script>
+ Array.from(document.getElementsByClassName("fronter-date")).forEach((i) => { i.innerText = new Date(parseInt(i.getAttribute("data-date-time").trim()) * 1000).toTimeString().split(" ")[0].substring(0, 5) + " " });
+ document.getElementById("timezone").style.display = "";
+ </script>
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> \ No newline at end of file