summaryrefslogtreecommitdiff
path: root/includes/components/timeline.inc
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-06-25 20:10:39 +0200
committerRaindropsSys <contact@minteck.org>2023-06-25 20:10:39 +0200
commit5adf2b8517c21845dd0b406dee910514ff78640d (patch)
tree433c26dd202a8e201cef5b2ea7786e038ffd84d7 /includes/components/timeline.inc
parent395cc068abf1aadb34be8b03e5567e24aa8a898d (diff)
downloadpluralconnect-5adf2b8517c21845dd0b406dee910514ff78640d.tar.gz
pluralconnect-5adf2b8517c21845dd0b406dee910514ff78640d.tar.bz2
pluralconnect-5adf2b8517c21845dd0b406dee910514ff78640d.zip
Updated 6 files and added 2 files (automated)
Diffstat (limited to 'includes/components/timeline.inc')
-rw-r--r--includes/components/timeline.inc112
1 files changed, 112 insertions, 0 deletions
diff --git a/includes/components/timeline.inc b/includes/components/timeline.inc
new file mode 100644
index 0000000..6c85472
--- /dev/null
+++ b/includes/components/timeline.inc
@@ -0,0 +1,112 @@
+<?php
+
+
+function displayTimeline($systems) { global $app; $showIcons = count($systems) > 1; ?>
+ <table style="margin-top: 10px; width: 100%; margin-bottom: 10px;table-layout:fixed;">
+ <thead>
+ <tr class="row-desktop">
+ <?php if ($showIcons): ?><th colspan="20"></th><?php endif; ?>
+ <th class="dynamic-time" data-time="<?= time() - 3600 * 6 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:i', time() - 3600 * 6) ?></th>
+ <th class="dynamic-time" data-time="<?= time() - 3600 * 5 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:i', time() - 3600 * 5) ?></th>
+ <th class="dynamic-time" data-time="<?= time() - 3600 * 4 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:i', time() - 3600 * 4) ?></th>
+ <th class="dynamic-time" data-time="<?= time() - 3600 * 3 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:i', time() - 3600 * 3) ?></th>
+ <th class="dynamic-time" data-time="<?= time() - 3600 * 2 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:i', time() - 3600 * 2) ?></th>
+ <th class="dynamic-time" data-time="<?= time() - 3600 * 1 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:i', time() - 3600 * 1) ?></th>
+ <th class="dynamic-time" data-time="<?= time() ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:i', time()) ?></th>
+ </tr>
+ <tr class="row-mobile">
+ <?php if ($showIcons): ?><th colspan="20"></th><?php endif; ?>
+ <th class="dynamic-time-mobile" data-time="<?= time() - 3600 * 6 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:', time() - 3600 * 6) ?></th>
+ <th class="dynamic-time-mobile" data-time="<?= time() - 3600 * 5 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:', time() - 3600 * 5) ?></th>
+ <th class="dynamic-time-mobile" data-time="<?= time() - 3600 * 4 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:', time() - 3600 * 4) ?></th>
+ <th class="dynamic-time-mobile" data-time="<?= time() - 3600 * 3 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:', time() - 3600 * 3) ?></th>
+ <th class="dynamic-time-mobile" data-time="<?= time() - 3600 * 2 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:', time() - 3600 * 2) ?></th>
+ <th class="dynamic-time-mobile" data-time="<?= time() - 3600 * 1 ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:', time() - 3600 * 1) ?></th>
+ <th class="dynamic-time-mobile" data-time="<?= time() ?>" colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);"><?= date('H:', time()) ?></th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach ($systems as $system): ?>
+ <tr style="height: <?= count($systems) === 1 ? 50 : 30 ?>px;">
+ <?php if ($showIcons): ?><td colspan="20">
+ <a href="/<?= $system === "gdapd" ? "raindrops" : ($system === "ynmuc" ? "cloudburst" : $app["other"]["slug"]) ?>" style="width: 100%; height: 30px; display: flex; align-items: center; justify-content: center;">
+ <img alt="" style="border-radius: 5px; height: 24px; text-align: center;" src="<?= getAsset($system) ?>">
+ </a>
+ </td><?php endif; ?>
+ <?php
+
+ $leftCols = 420;
+
+ $time = time() - 3600 * 7;
+ $switches = [
+ ...array_reverse(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/switches.json"), true)),
+ [
+ 'id' => '00000000-0000-0000-0000-000000000000',
+ 'timestamp' => date('c', time() + 60),
+ 'members' => []
+ ]
+ ];
+
+ foreach ($switches as $index => $switch) {
+ if (strtotime($switch["timestamp"]) >= $time) {
+ $correct = $switches[$index - 1];
+ $v = floor((strtotime($switch["timestamp"]) - $time) / 60);
+
+ echo('<td style="max-width: 100%; overflow: hidden; text-align: center; height: ' . 50 / count($systems) . 'px; background-color: #' . (getMemberWithoutSystem($correct["members"][0])["color"] ?? "000000") . '80;" colspan="' . ($v > $leftCols ? $leftCols : $v) . '"><a style="color: white; cursor: pointer; text-decoration: none; width: 100%; display: flex; height: ' . 50 / count($systems) . 'px; align-items: center; justify-content: center;" href="/' . getMemberWithoutSystem($correct["members"][0])["name"] . '">' . implode(", ", array_map(function ($i) {
+ return getMemberWithoutSystem($i)["display_name"] ?? getMemberWithoutSystem($i)["name"] ?? $i;
+ }, $correct["members"])) . '</a></td>');
+
+ $leftCols -= $v; if ($leftCols < 0) $leftCols = 0;
+ $time = strtotime($switch["timestamp"]);
+ }
+ }
+
+ ?>
+ </tr>
+ <?php endforeach; ?>
+ <tr class="row-desktop">
+ <?php if ($showIcons): ?><td colspan="20"></td><?php endif; ?>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">6 hours ago</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">5 hours ago</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">4 hours ago</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">3 hours ago</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">2 hours ago</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">1 hour ago</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">Now</td>
+ </tr>
+ <tr class="row-mobile">
+ <?php if ($showIcons): ?><td colspan="20"></td><?php endif; ?>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">-6h</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">-5h</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">-4h</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">-3h</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">-2</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">-1</td>
+ <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">Now</td>
+ </tr>
+ <tr>
+ <?php for ($i = 0; $i < 420; $i++): ?><td></td><?php endfor; ?>
+ </tr>
+ </tbody>
+ </table>
+
+ <style>
+ .row-mobile {
+ display: none !important;
+ }
+
+ .row-desktop {
+ display: table-row !important;
+ }
+
+ @media (max-width: 991px) {
+ .row-desktop {
+ display: none !important;
+ }
+
+ .row-mobile {
+ display: table-row !important;
+ }
+ }
+ </style>
+<?php } \ No newline at end of file