summaryrefslogtreecommitdiff
path: root/pages/fronting.php
diff options
context:
space:
mode:
Diffstat (limited to 'pages/fronting.php')
-rw-r--r--pages/fronting.php875
1 files changed, 3 insertions, 872 deletions
diff --git a/pages/fronting.php b/pages/fronting.php
index 359deb7..21d6691 100644
--- a/pages/fronting.php
+++ b/pages/fronting.php
@@ -1,879 +1,10 @@
-<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; if (!$isLoggedIn) header("Location: /login") and die(); $title = "Front Planner"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php';
-
-$cloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-planner.json"), true);
-$raindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-planner.json"), true);
-
-?>
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; if (!$isLoggedIn) header("Location: /login") and die(); $title = "Front Planner"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?>
<br>
<div class="container">
<div>
- <h2>Front Planner</h2>
- <table id="planner">
- <tbody>
- <tr class="planner-day">
- <td colspan="4" id="planner-header-0">Today</td>
- <?php
-
- if (!$cloudburst[date('Y-m-d')]) $cloudburst[date('Y-m-d')] = [];
- $dayCloudburst = $cloudburst[date('Y-m-d')];
- if (!$raindrops[date('Y-m-d')]) $raindrops[date('Y-m-d')] = [];
- $dayRaindrops = $raindrops[date('Y-m-d')];
-
- $index = 0;
- $lengthCloudburst = count($dayCloudburst);
- $lengthRaindrops = count($dayRaindrops);
- $biggest = max($lengthCloudburst, $lengthRaindrops);
-
- ?>
- </tr>
- <tr class="planner-header">
- <td colspan="2">Cloudburst System</td>
- <td colspan="2">Raindrops System</td>
- </tr>
- <?php for ($i = 0; $i <= $biggest; $i++): ?>
- <tr class="planner-member">
- <?php if (isset($dayCloudburst[$index])): ?>
- <td class="planner-member-id">
- <?= $index + 1 ?>
- </td>
- <td class="planner-link">
- <?php $member = getSystemMember("ynmuc", $dayCloudburst[$index]); ?>
- <a class="member-link" onclick="openEditFronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d') ?>')"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a>
- </td>
- <?php elseif ($index === count($dayCloudburst)): ?>
- <td class="planner-add-inner planner-link" colspan="2">
- <a href="#" onclick="addFronter('cloudburst', 0);" class="planner-add-link">
- <img src="/assets/icons/add.svg" alt="" class="planner-add-icon">
- <span class="planner-add-text">Add new fronter</span>
- </a>
- </td>
- <?php else: ?>
- <td colspan="2" class="planner-empty"></td>
- <?php endif; ?>
- <?php if (isset($dayRaindrops[$index])): ?>
- <td class="planner-member-id">
- <?= $index + 1 ?>
- </td>
- <?php $member = getSystemMember("gdapd", $dayRaindrops[$index]); ?>
- <td class="planner-link">
- <a class="member-link" onclick="openEditFronter('raindrops', <?= $index ?>, '<?= date('Y-m-d') ?>')"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a>
- </td>
- <?php elseif ($index === count($dayRaindrops)): ?>
- <td class="planner-add-inner planner-link" colspan="2">
- <a href="#" onclick="addFronter('raindrops', 0);" class="planner-add-link">
- <img src="/assets/icons/add.svg" alt="" class="planner-add-icon">
- <span class="planner-add-text">Add new fronter</span>
- </a>
- </td>
- <?php else: ?>
- <td colspan="2" class="planner-empty"></td>
- <?php endif; ?>
- </tr>
- <?php $index++; endfor; ?>
- <tr class="planner-day planner-end-of-day">
- <td colspan="4">
- <?php if (count($dayCloudburst) > 0 && count($dayRaindrops) > 0): ?>
- <?= getMiniName(getSystemMember("ynmuc", $dayCloudburst[count($dayCloudburst) - 1])["display_name"] ?? getSystemMember("ynmuc", $dayCloudburst[count($dayCloudburst) - 1])["name"]) ?> will sleep with <?= getMiniName(getSystemMember("gdapd", $dayRaindrops[count($dayRaindrops) - 1])["display_name"] ?? getSystemMember("gdapd", $dayRaindrops[count($dayRaindrops) - 1])["name"]) ?>
- <?php else: ?>
- Unable to calculate who will sleep with who
- <?php endif; ?>
- </td>
- </tr>
- <tr class="planner-separator"></tr>
-
- <tr class="planner-day" id="planner-header-1">
- <td colspan="4">Tomorrow</td>
- <?php
-
- if (!$cloudburst[date('Y-m-d', time() + 86400)]) $cloudburst[date('Y-m-d', time() + 86400)] = [];
- $dayCloudburst = $cloudburst[date('Y-m-d', time() + 86400)];
- if (!$raindrops[date('Y-m-d', time() + 86400)]) $raindrops[date('Y-m-d', time() + 86400)] = [];
- $dayRaindrops = $raindrops[date('Y-m-d', time() + 86400)];
-
- $index = 0;
- $lengthCloudburst = count($dayCloudburst);
- $lengthRaindrops = count($dayRaindrops);
- $biggest = max($lengthCloudburst, $lengthRaindrops);
-
- ?>
- </tr>
- <tr class="planner-header">
- <td colspan="2">Cloudburst System</td>
- <td colspan="2">Raindrops System</td>
- </tr>
- <?php for ($i = 0; $i <= $biggest; $i++): ?>
- <tr class="planner-member">
- <?php if (isset($dayCloudburst[$index])): ?>
- <td class="planner-member-id">
- <?= $index + 1 ?>
- </td>
- <td class="planner-link">
- <?php $member = getSystemMember("ynmuc", $dayCloudburst[$index]); ?>
- <a class="member-link" onclick="openEditFronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + 86400) ?>')"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a>
- </td>
- <?php elseif ($index === count($dayCloudburst)): ?>
- <td class="planner-add-inner planner-link" colspan="2">
- <a href="#" onclick="addFronter('cloudburst', 1);" class="planner-add-link">
- <img src="/assets/icons/add.svg" alt="" class="planner-add-icon">
- <span class="planner-add-text">Add new fronter</span>
- </a>
- </td>
- <?php else: ?>
- <td colspan="2" class="planner-empty"></td>
- <?php endif; ?>
- <?php if (isset($dayRaindrops[$index])): ?>
- <td class="planner-member-id">
- <?= $index + 1 ?>
- </td>
- <?php $member = getSystemMember("gdapd", $dayRaindrops[$index]); ?>
- <td class="planner-link">
- <a class="member-link" onclick="openEditFronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + 86400) ?>')"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a>
- </td>
- <?php elseif ($index === count($dayRaindrops)): ?>
- <td class="planner-add-inner planner-link" colspan="2">
- <a href="#" onclick="addFronter('raindrops', 1);" class="planner-add-link">
- <img src="/assets/icons/add.svg" alt="" class="planner-add-icon">
- <span class="planner-add-text">Add new fronter</span>
- </a>
- </td>
- <?php else: ?>
- <td colspan="2" class="planner-empty"></td>
- <?php endif; ?>
- </tr>
- <?php $index++; endfor; ?>
- <tr class="planner-day planner-end-of-day">
- <td colspan="4">
- <?php if (count($dayCloudburst) > 0 && count($dayRaindrops) > 0): ?>
- <?= getMiniName(getSystemMember("ynmuc", $dayCloudburst[count($dayCloudburst) - 1])["display_name"] ?? getSystemMember("ynmuc", $dayCloudburst[count($dayCloudburst) - 1])["name"]) ?> will sleep with <?= getMiniName(getSystemMember("gdapd", $dayRaindrops[count($dayRaindrops) - 1])["display_name"] ?? getSystemMember("gdapd", $dayRaindrops[count($dayRaindrops) - 1])["name"]) ?>
- <?php else: ?>
- Unable to calculate who will sleep with who
- <?php endif; ?>
- </td>
- </tr>
- <tr class="planner-separator"></tr>
-
- <tr class="planner-day" id="planner-header-2">
- <td colspan="4"><?= date('l', time() + (86400 * 2)) ?></td>
- <?php
-
- if (!$cloudburst[date('Y-m-d', time() + (86400 * 2))]) $cloudburst[date('Y-m-d', time() + (86400 * 2))] = [];
- $dayCloudburst = $cloudburst[date('Y-m-d', time() + (86400 * 2))];
- if (!$raindrops[date('Y-m-d', time() + (86400 * 2))]) $raindrops[date('Y-m-d', time() + (86400 * 2))] = [];
- $dayRaindrops = $raindrops[date('Y-m-d', time() + (86400 * 2))];
-
- $index = 0;
- $lengthCloudburst = count($dayCloudburst);
- $lengthRaindrops = count($dayRaindrops);
- $biggest = max($lengthCloudburst, $lengthRaindrops);
-
- ?>
- </tr>
- <tr class="planner-header">
- <td colspan="2">Cloudburst System</td>
- <td colspan="2">Raindrops System</td>
- </tr>
- <?php for ($i = 0; $i <= $biggest; $i++): ?>
- <tr class="planner-member">
- <?php if (isset($dayCloudburst[$index])): ?>
- <td class="planner-member-id">
- <?= $index + 1 ?>
- </td>
- <td class="planner-link">
- <?php $member = getSystemMember("ynmuc", $dayCloudburst[$index]); ?>
- <a class="member-link" onclick="openEditFronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * 2)) ?>')"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a>
- </td>
- <?php elseif ($index === count($dayCloudburst)): ?>
- <td class="planner-add-inner planner-link" colspan="2">
- <a href="#" onclick="addFronter('cloudburst', 2);" class="planner-add-link">
- <img src="/assets/icons/add.svg" alt="" class="planner-add-icon">
- <span class="planner-add-text">Add new fronter</span>
- </a>
- </td>
- <?php else: ?>
- <td colspan="2" class="planner-empty"></td>
- <?php endif; ?>
- <?php if (isset($dayRaindrops[$index])): ?>
- <td class="planner-member-id">
- <?= $index + 1 ?>
- </td>
- <?php $member = getSystemMember("gdapd", $dayRaindrops[$index]); ?>
- <td class="planner-link">
- <a class="member-link" onclick="openEditFronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * 2)) ?>')"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a>
- </td>
- <?php elseif ($index === count($dayRaindrops)): ?>
- <td class="planner-add-inner planner-link" colspan="2">
- <a href="#" onclick="addFronter('raindrops', 2);" class="planner-add-link">
- <img src="/assets/icons/add.svg" alt="" class="planner-add-icon">
- <span class="planner-add-text">Add new fronter</span>
- </a>
- </td>
- <?php else: ?>
- <td colspan="2" class="planner-empty"></td>
- <?php endif; ?>
- </tr>
- <?php $index++; endfor; ?>
- <tr class="planner-day planner-end-of-day">
- <td colspan="4">
- <?php if (count($dayCloudburst) > 0 && count($dayRaindrops) > 0): ?>
- <?= getMiniName(getSystemMember("ynmuc", $dayCloudburst[count($dayCloudburst) - 1])["display_name"] ?? getSystemMember("ynmuc", $dayCloudburst[count($dayCloudburst) - 1])["name"]) ?> will sleep with <?= getMiniName(getSystemMember("gdapd", $dayRaindrops[count($dayRaindrops) - 1])["display_name"] ?? getSystemMember("gdapd", $dayRaindrops[count($dayRaindrops) - 1])["name"]) ?>
- <?php else: ?>
- Unable to calculate who will sleep with who
- <?php endif; ?>
- </td>
- </tr>
- <tr class="planner-separator"></tr>
-
- <tr class="planner-day">
- <td colspan="4" id="planner-header-3"><?= date('l', time() + (86400 * 3)) ?></td>
- <?php
-
- if (!$cloudburst[date('Y-m-d', time() + (86400 * 3))]) $cloudburst[date('Y-m-d', time() + (86400 * 3))] = [];
- $dayCloudburst = $cloudburst[date('Y-m-d', time() + (86400 * 3))];
- if (!$raindrops[date('Y-m-d', time() + (86400 * 3))]) $raindrops[date('Y-m-d', time() + (86400 * 3))] = [];
- $dayRaindrops = $raindrops[date('Y-m-d', time() + (86400 * 3))];
-
- $index = 0;
- $lengthCloudburst = count($dayCloudburst);
- $lengthRaindrops = count($dayRaindrops);
- $biggest = max($lengthCloudburst, $lengthRaindrops);
-
- ?>
- </tr>
- <tr class="planner-header">
- <td colspan="2">Cloudburst System</td>
- <td colspan="2">Raindrops System</td>
- </tr>
- <?php for ($i = 0; $i <= $biggest; $i++): ?>
- <tr class="planner-member">
- <?php if (isset($dayCloudburst[$index])): ?>
- <td class="planner-member-id">
- <?= $index + 1 ?>
- </td>
- <td class="planner-link">
- <?php $member = getSystemMember("ynmuc", $dayCloudburst[$index]); ?>
- <a class="member-link" onclick="openEditFronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * 3)) ?>')"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a>
- </td>
- <?php elseif ($index === count($dayCloudburst)): ?>
- <td class="planner-add-inner planner-link" colspan="2">
- <a href="#" onclick="addFronter('cloudburst', 3);" class="planner-add-link">
- <img src="/assets/icons/add.svg" alt="" class="planner-add-icon">
- <span class="planner-add-text">Add new fronter</span>
- </a>
- </td>
- <?php else: ?>
- <td colspan="2" class="planner-empty"></td>
- <?php endif; ?>
- <?php if (isset($dayRaindrops[$index])): ?>
- <td class="planner-member-id">
- <?= $index + 1 ?>
- </td>
- <?php $member = getSystemMember("gdapd", $dayRaindrops[$index]); ?>
- <td class="planner-link">
- <a class="member-link" onclick="openEditFronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * 3)) ?>')"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a>
- </td>
- <?php elseif ($index === count($dayRaindrops)): ?>
- <td class="planner-add-inner planner-link" colspan="2">
- <a href="#" onclick="addFronter('raindrops', 3);" class="planner-add-link">
- <img src="/assets/icons/add.svg" alt="" class="planner-add-icon">
- <span class="planner-add-text">Add new fronter</span>
- </a>
- </td>
- <?php else: ?>
- <td colspan="2" class="planner-empty"></td>
- <?php endif; ?>
- </tr>
- <?php $index++; endfor; ?>
- <tr class="planner-day planner-end-of-day">
- <td colspan="4">
- <?php if (count($dayCloudburst) > 0 && count($dayRaindrops) > 0): ?>
- <?= getMiniName(getSystemMember("ynmuc", $dayCloudburst[count($dayCloudburst) - 1])["display_name"] ?? getSystemMember("ynmuc", $dayCloudburst[count($dayCloudburst) - 1])["name"]) ?> will sleep with <?= getMiniName(getSystemMember("gdapd", $dayRaindrops[count($dayRaindrops) - 1])["display_name"] ?? getSystemMember("gdapd", $dayRaindrops[count($dayRaindrops) - 1])["name"]) ?>
- <?php else: ?>
- Unable to calculate who will sleep with who
- <?php endif; ?>
- </td>
- </tr>
- <tr class="planner-separator"></tr>
-
- <tr class="planner-day">
- <td colspan="4" id="planner-header-4"><?= date('l', time() + (86400 * 4)) ?></td>
- <?php
-
- if (!$cloudburst[date('Y-m-d', time() + (86400 * 4))]) $cloudburst[date('Y-m-d', time() + (86400 * 4))] = [];
- $dayCloudburst = $cloudburst[date('Y-m-d', time() + (86400 * 4))];
- if (!$raindrops[date('Y-m-d', time() + (86400 * 4))]) $raindrops[date('Y-m-d', time() + (86400 * 4))] = [];
- $dayRaindrops = $raindrops[date('Y-m-d', time() + (86400 * 4))];
-
- $index = 0;
- $lengthCloudburst = count($dayCloudburst);
- $lengthRaindrops = count($dayRaindrops);
- $biggest = max($lengthCloudburst, $lengthRaindrops);
-
- ?>
- </tr>
- <tr class="planner-header">
- <td colspan="2">Cloudburst System</td>
- <td colspan="2">Raindrops System</td>
- </tr>
- <?php for ($i = 0; $i <= $biggest; $i++): ?>
- <tr class="planner-member">
- <?php if (isset($dayCloudburst[$index])): ?>
- <td class="planner-member-id">
- <?= $index + 1 ?>
- </td>
- <td class="planner-link">
- <?php $member = getSystemMember("ynmuc", $dayCloudburst[$index]); ?>
- <a class="member-link" onclick="openEditFronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * 4)) ?>')"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a>
- </td>
- <?php elseif ($index === count($dayCloudburst)): ?>
- <td class="planner-add-inner planner-link" colspan="2">
- <a href="#" onclick="addFronter('cloudburst', 4);" class="planner-add-link">
- <img src="/assets/icons/add.svg" alt="" class="planner-add-icon">
- <span class="planner-add-text">Add new fronter</span>
- </a>
- </td>
- <?php else: ?>
- <td colspan="2" class="planner-empty"></td>
- <?php endif; ?>
- <?php if (isset($dayRaindrops[$index])): ?>
- <td class="planner-member-id">
- <?= $index + 1 ?>
- </td>
- <?php $member = getSystemMember("gdapd", $dayRaindrops[$index]); ?>
- <td class="planner-link">
- <a class="member-link" onclick="openEditFronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * 4)) ?>')"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a>
- </td>
- <?php elseif ($index === count($dayRaindrops)): ?>
- <td class="planner-add-inner planner-link" colspan="2">
- <a href="#" onclick="addFronter('raindrops', 4);" class="planner-add-link">
- <img src="/assets/icons/add.svg" alt="" class="planner-add-icon">
- <span class="planner-add-text">Add new fronter</span>
- </a>
- </td>
- <?php else: ?>
- <td colspan="2" class="planner-empty"></td>
- <?php endif; ?>
- </tr>
- <?php $index++; endfor; ?>
- <tr class="planner-day planner-end-of-day">
- <td colspan="4">
- <?php if (count($dayCloudburst) > 0 && count($dayRaindrops) > 0): ?>
- <?= getMiniName(getSystemMember("ynmuc", $dayCloudburst[count($dayCloudburst) - 1])["display_name"] ?? getSystemMember("ynmuc", $dayCloudburst[count($dayCloudburst) - 1])["name"]) ?> will sleep with <?= getMiniName(getSystemMember("gdapd", $dayRaindrops[count($dayRaindrops) - 1])["display_name"] ?? getSystemMember("gdapd", $dayRaindrops[count($dayRaindrops) - 1])["name"]) ?>
- <?php else: ?>
- Unable to calculate who will sleep with who
- <?php endif; ?>
- </td>
- </tr>
- <tr class="planner-separator"></tr>
-
- <tr class="planner-day">
- <td colspan="4" id="planner-header-5"><?= date('l', time() + (86400 * 5)) ?></td>
- <?php
-
- if (!$cloudburst[date('Y-m-d', time() + (86400 * 5))]) $cloudburst[date('Y-m-d', time() + (86400 * 5))] = [];
- $dayCloudburst = $cloudburst[date('Y-m-d', time() + (86400 * 5))];
- if (!$raindrops[date('Y-m-d', time() + (86400 * 5))]) $raindrops[date('Y-m-d', time() + (86400 * 5))] = [];
- $dayRaindrops = $raindrops[date('Y-m-d', time() + (86400 * 5))];
-
- $index = 0;
- $lengthCloudburst = count($dayCloudburst);
- $lengthRaindrops = count($dayRaindrops);
- $biggest = max($lengthCloudburst, $lengthRaindrops);
-
- ?>
- </tr>
- <tr class="planner-header">
- <td colspan="2">Cloudburst System</td>
- <td colspan="2">Raindrops System</td>
- </tr>
- <?php for ($i = 0; $i <= $biggest; $i++): ?>
- <tr class="planner-member">
- <?php if (isset($dayCloudburst[$index])): ?>
- <td class="planner-member-id">
- <?= $index + 1 ?>
- </td>
- <td class="planner-link">
- <?php $member = getSystemMember("ynmuc", $dayCloudburst[$index]); ?>
- <a class="member-link" onclick="openEditFronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * 5)) ?>')"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a>
- </td>
- <?php elseif ($index === count($dayCloudburst)): ?>
- <td class="planner-add-inner planner-link" colspan="2">
- <a href="#" onclick="addFronter('cloudburst', 5);" class="planner-add-link">
- <img src="/assets/icons/add.svg" alt="" class="planner-add-icon">
- <span class="planner-add-text">Add new fronter</span>
- </a>
- </td>
- <?php else: ?>
- <td colspan="2" class="planner-empty"></td>
- <?php endif; ?>
- <?php if (isset($dayRaindrops[$index])): ?>
- <td class="planner-member-id">
- <?= $index + 1 ?>
- </td>
- <?php $member = getSystemMember("gdapd", $dayRaindrops[$index]); ?>
- <td class="planner-link">
- <a class="member-link" onclick="openEditFronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * 5)) ?>')"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a>
- </td>
- <?php elseif ($index === count($dayRaindrops)): ?>
- <td class="planner-add-inner planner-link" colspan="2">
- <a href="#" onclick="addFronter('raindrops', 5);" class="planner-add-link">
- <img src="/assets/icons/add.svg" alt="" class="planner-add-icon">
- <span class="planner-add-text">Add new fronter</span>
- </a>
- </td>
- <?php else: ?>
- <td colspan="2" class="planner-empty"></td>
- <?php endif; ?>
- </tr>
- <?php $index++; endfor; ?>
- <tr class="planner-day planner-end-of-day">
- <td colspan="4">
- <?php if (count($dayCloudburst) > 0 && count($dayRaindrops) > 0): ?>
- <?= getMiniName(getSystemMember("ynmuc", $dayCloudburst[count($dayCloudburst) - 1])["display_name"] ?? getSystemMember("ynmuc", $dayCloudburst[count($dayCloudburst) - 1])["name"]) ?> will sleep with <?= getMiniName(getSystemMember("gdapd", $dayRaindrops[count($dayRaindrops) - 1])["display_name"] ?? getSystemMember("gdapd", $dayRaindrops[count($dayRaindrops) - 1])["name"]) ?>
- <?php else: ?>
- Unable to calculate who will sleep with who
- <?php endif; ?>
- </td>
- </tr>
- <tr class="planner-separator"></tr>
-
- <tr class="planner-day">
- <td colspan="4" id="planner-header-6"><?= date('l', time() + (86400 * 6)) ?></td>
- <?php
-
- if (!$cloudburst[date('Y-m-d', time() + (86400 * 6))]) $cloudburst[date('Y-m-d', time() + (86400 * 6))] = [];
- $dayCloudburst = $cloudburst[date('Y-m-d', time() + (86400 * 6))];
- if (!$raindrops[date('Y-m-d', time() + (86400 * 6))]) $raindrops[date('Y-m-d', time() + (86400 * 6))] = [];
- $dayRaindrops = $raindrops[date('Y-m-d', time() + (86400 * 6))];
-
- $index = 0;
- $lengthCloudburst = count($dayCloudburst);
- $lengthRaindrops = count($dayRaindrops);
- $biggest = max($lengthCloudburst, $lengthRaindrops);
-
- ?>
- </tr>
- <tr class="planner-header">
- <td colspan="2">Cloudburst System</td>
- <td colspan="2">Raindrops System</td>
- </tr>
- <?php for ($i = 0; $i <= $biggest; $i++): ?>
- <tr class="planner-member">
- <?php if (isset($dayCloudburst[$index])): ?>
- <td class="planner-member-id">
- <?= $index + 1 ?>
- </td>
- <td class="planner-link">
- <?php $member = getSystemMember("ynmuc", $dayCloudburst[$index]); ?>
- <a class="member-link" onclick="openEditFronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * 6)) ?>')"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a>
- </td>
- <?php elseif ($index === count($dayCloudburst)): ?>
- <td class="planner-add-inner planner-link" colspan="2">
- <a href="#" onclick="addFronter('cloudburst', 6);" class="planner-add-link">
- <img src="/assets/icons/add.svg" alt="" class="planner-add-icon">
- <span class="planner-add-text">Add new fronter</span>
- </a>
- </td>
- <?php else: ?>
- <td colspan="2" class="planner-empty"></td>
- <?php endif; ?>
- <?php if (isset($dayRaindrops[$index])): ?>
- <td class="planner-member-id">
- <?= $index + 1 ?>
- </td>
- <?php $member = getSystemMember("gdapd", $dayRaindrops[$index]); ?>
- <td class="planner-link">
- <a class="member-link" onclick="openEditFronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * 6)) ?>')"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a>
- </td>
- <?php elseif ($index === count($dayRaindrops)): ?>
- <td class="planner-add-inner planner-link" colspan="2">
- <a href="#" onclick="addFronter('raindrops', 6);" class="planner-add-link">
- <img src="/assets/icons/add.svg" alt="" class="planner-add-icon">
- <span class="planner-add-text">Add new fronter</span>
- </a>
- </td>
- <?php else: ?>
- <td colspan="2" class="planner-empty"></td>
- <?php endif; ?>
- </tr>
- <?php $index++; endfor; ?>
- <tr class="planner-day planner-end-of-day">
- <td colspan="4">
- <?php if (count($dayCloudburst) > 0 && count($dayRaindrops) > 0): ?>
- <?= getMiniName(getSystemMember("ynmuc", $dayCloudburst[count($dayCloudburst) - 1])["display_name"] ?? getSystemMember("ynmuc", $dayCloudburst[count($dayCloudburst) - 1])["name"]) ?> will sleep with <?= getMiniName(getSystemMember("gdapd", $dayRaindrops[count($dayRaindrops) - 1])["display_name"] ?? getSystemMember("gdapd", $dayRaindrops[count($dayRaindrops) - 1])["name"]) ?>
- <?php else: ?>
- Unable to calculate who will sleep with who
- <?php endif; ?>
- </td>
- </tr>
- <tr class="planner-separator"></tr>
- </tbody>
- </table>
- </div>
-
- <style>
- #planner {
- margin-top: 10px;
- border-collapse: collapse;
- width: 100%;
- }
-
- .planner-header {
- font-weight: bold;
- text-align: center;
- }
-
- .planner-header td {
- width: 50%;
- }
-
- td {
- border: 1px solid rgba(255, 255, 255, .25);
- padding: 5px 10px;
- }
-
- .planner-day {
- text-align: center;
- color: rgba(255, 255, 255, .5);
- font-weight: bold;
- }
-
- .planner-end-of-day {
- font-weight: normal;
- }
-
- .planner-end-of-day td {
- border-bottom-left-radius: 10px;
- }
-
- .planner-separator {
- height: 20px;
- }
-
- .planner-member-id {
- width: 10%;
- text-align: right;
- }
-
- .planner-link {
- padding: 0;
- }
-
- .planner-link a {
- padding: 5px 10px;
- display: block;
- }
-
- .planner-add-link {
- color: rgba(255, 255, 255, .75);
- text-decoration: none;
- }
-
- .planner-add-link:hover {
- color: rgba(255, 255, 255, .75);
- }
-
- .planner-link:hover {
- background-color: rgba(255, 255, 255, .125);
- }
-
- .planner-link:active {
- background-color: rgba(255, 255, 255, .25);
- }
-
- .planner-add-icon {
- filter: invert(1);
- width: 24px;
- vertical-align: middle;
- opacity: .75;
- }
-
- .planner-add-text {
- vertical-align: middle;
- }
-
- .modal-header {
- border-bottom: 1px solid #353738;
- }
-
- .modal-content {
- border: 1px solid rgba(255, 255, 255, .2);
- background-color: #111;
- }
-
- .btn-close {
- filter: invert(1);
- }
-
- .list-group-item {
- color: #fff;
- background-color: #222;
- border: 1px solid rgba(255, 255, 255, .125);
- }
-
- .list-group-item.disabled {
- color: #fff;
- background-color: #222;
- border-color: rgba(255, 255, 255, .125);
- opacity: .75;
- }
-
- .list-group-item:hover {
- background-color: #252525;
- color: #ddd;
- }
-
- .list-group-item:active, .list-group-item:focus {
- background-color: #272727;
- color: #bbb;
- }
-
- .member-link, .list-group-item-action {
- cursor: pointer !important;
- }
-
- </style>
-</div>
-
-<!--suppress JSUnresolvedVariable, JSUnresolvedFunction -->
-<script>
- window.currentWorkingDate;
- window.fronting = JSON.parse(window.atob(`<?= base64_encode(json_encode([
- "raindrops" => $raindrops,
- "cloudburst" => $cloudburst
- ])) ?>`));
- window.names = JSON.parse(window.atob(`<?php
-
- $names = [];
- foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true) as $member) {
- $names[$member['id']] = $member['display_name'] ?? $member['name'];
- }
- foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true) as $member) {
- $names[$member['id']] = $member['display_name'] ?? $member['name'];
- }
-
- echo(base64_encode(json_encode($names))) ?>`));
-
- function ordinal(n) {
- let s = ["th", "st", "nd", "rd"];
- let v = n % 100;
- return n + (s[(v - 20) % 10] || s[v] || s[0]);
- }
-
- function openEditFronter(system, id, date) {
- let display;
-
- switch (date) {
- case "<?= date('Y-m-d') ?>":
- display = "today";
- break;
-
- case "<?= date('Y-m-d', time() + 86400) ?>":
- display = "tomorrow";
- break;
-
- case "<?= date('Y-m-d', time() + (86400 * 2)) ?>":
- display = "on <?= date('l', time() + (86400 * 2)) ?>";
- break;
-
- case "<?= date('Y-m-d', time() + (86400 * 3)) ?>":
- display = "on <?= date('l', time() + (86400 * 3)) ?>";
- break;
-
- case "<?= date('Y-m-d', time() + (86400 * 4)) ?>":
- display = "on <?= date('l', time() + (86400 * 4)) ?>";
- break;
-
- case "<?= date('Y-m-d', time() + (86400 * 5)) ?>":
- display = "on <?= date('l', time() + (86400 * 5)) ?>";
- break;
-
- case "<?= date('Y-m-d', time() + (86400 * 6)) ?>":
- display = "on <?= date('l', time() + (86400 * 6)) ?>";
- break;
- }
-
- window.selectedFronting = {
- system: system === "cloudburst" ? "ynmuc" : "gdapd",
- date: date,
- index: id
- }
-
- document.getElementById("edit-fronter-name").innerText = names[fronting[system][date][id]] ?? fronting[system][date][id];
- document.getElementById("edit-fronter-date").innerText = display;
- document.getElementById("edit-fronter-pos").innerText = ordinal(id + 1);
- document.getElementById("edit-fronter-system").innerText = system === "cloudburst" ? "Cloudburst System" : "Raindrops System";
-
- let modal = new bootstrap.Modal(document.getElementById('edit-fronter'));
- modal.show();
- }
-
- function addFronter(system, offset) {
- let date;
- let display;
-
- switch (offset) {
- case 0:
- date = "<?= date('Y-m-d') ?>";
- display = "today";
- break;
-
- case 1:
- date = "<?= date('Y-m-d', time() + 86400) ?>";
- display = "tomorrow";
- break;
-
- case 2:
- date = "<?= date('Y-m-d', time() + (86400 * 2)) ?>";
- display = "on <?= date('l', time() + (86400 * 2)) ?>";
- break;
-
- case 3:
- date = "<?= date('Y-m-d', time() + (86400 * 3)) ?>";
- display = "on <?= date('l', time() + (86400 * 3)) ?>";
- break;
-
- case 4:
- date = "<?= date('Y-m-d', time() + (86400 * 4)) ?>";
- display = "on <?= date('l', time() + (86400 * 4)) ?>";
- break;
-
- case 5:
- date = "<?= date('Y-m-d', time() + (86400 * 5)) ?>";
- display = "on <?= date('l', time() + (86400 * 5)) ?>";
- break;
-
- case 6:
- date = "<?= date('Y-m-d', time() + (86400 * 6)) ?>";
- display = "on <?= date('l', time() + (86400 * 6)) ?>";
- break;
- }
-
- window.currentWorkingDate = date;
- document.getElementById("new-fronter-date").innerText = display;
- document.getElementById("new-fronter-system").innerText = system === "cloudburst" ? "Cloudburst System" : "Raindrops System";
- document.getElementById("list-" + system).style.display = "";
- document.getElementById("list-" + (system === "cloudburst" ? "raindrops" : "cloudburst")).style.display = "none";
-
- let modal = new bootstrap.Modal(document.getElementById('new-fronter'));
- modal.show();
- }
-
- function confirmFronterAdd(system, id) {
- Array.from(document.getElementsByClassName("new-fronter-link")).forEach((i) => {
- i.classList.add("disabled");
- });
-
- document.getElementById("new-fronter-close").classList.add("disabled");
-
- window.fetch("/api/fronter?t=add&d=" + window.currentWorkingDate + "&m=" + id + "&s=" + system).then(() => {
- location.reload();
- });
- }
-
- function deleteFronter() {
- Array.from(document.getElementsByClassName("edit-fronter-link")).forEach((i) => {
- i.classList.add("disabled");
- });
-
- document.getElementById("edit-fronter-close").classList.add("disabled");
-
- window.fetch("/api/fronter?t=delete&d=" + window.selectedFronting["date"] + "&i=" + window.selectedFronting["index"] + "&s=" + window.selectedFronting["system"]).then(() => {
- location.reload();
- });
- }
-
- function moveFronterDown() {
- Array.from(document.getElementsByClassName("edit-fronter-link")).forEach((i) => {
- i.classList.add("disabled");
- });
-
- document.getElementById("edit-fronter-close").classList.add("disabled");
-
- window.fetch("/api/fronter?t=down&d=" + window.selectedFronting["date"] + "&i=" + window.selectedFronting["index"] + "&s=" + window.selectedFronting["system"]).then(() => {
- location.reload();
- });
- }
-
- function moveFronterUp() {
- Array.from(document.getElementsByClassName("edit-fronter-link")).forEach((i) => {
- i.classList.add("disabled");
- });
-
- document.getElementById("edit-fronter-close").classList.add("disabled");
-
- window.fetch("/api/fronter?t=up&d=" + window.selectedFronting["date"] + "&i=" + window.selectedFronting["index"] + "&s=" + window.selectedFronting["system"]).then(() => {
- location.reload();
- });
- }
-</script>
-
-<div class="modal fade" id="new-fronter" data-bs-backdrop="static" data-bs-keyboard="false">
- <div class="modal-dialog">
- <div class="modal-content">
-
- <div class="modal-header">
- <h4 class="modal-title">Add new fronter <span id="new-fronter-date">n/a</span></h4>
- <button id="new-fronter-close" type="button" class="btn-close" data-bs-dismiss="modal"></button>
- </div>
-
- <div class="modal-body">
- <p class="text-muted">Adding for the <span id="new-fronter-system">n/a</span></p>
-
- <div class="list-group" id="list-raindrops">
- <?php foreach (scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true), "gdapd") as $member): ?>
- <a onclick="confirmFronterAdd('gdapd', '<?= $member['id'] ?>');" class="new-fronter-link member-link list-group-item list-group-item-action" href="#"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a>
- <?php endforeach; ?>
- </div>
-
- <div class="list-group" id="list-cloudburst">
- <?php foreach (scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true), "ynmuc") as $member): ?>
- <a onclick="confirmFronterAdd('ynmuc', '<?= $member['id'] ?>');" class="new-fronter-link member-link list-group-item list-group-item-action" href="#"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a>
- <?php endforeach; ?>
- </div>
- </div>
-
- </div>
+ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/planner.php"; ?>
</div>
</div>
-<div class="modal fade" id="edit-fronter" data-bs-backdrop="static" data-bs-keyboard="false">
- <div class="modal-dialog">
- <div class="modal-content">
-
- <div class="modal-header">
- <h4 class="modal-title">Edit <span id="edit-fronter-name">n/a</span> fronting in <span id="edit-fronter-pos">n/a</span> <span id="edit-fronter-date">n/a</span></h4>
- <button id="edit-fronter-close" type="button" class="btn-close" data-bs-dismiss="modal"></button>
- </div>
-
- <div class="modal-body">
- <p class="text-muted">Editing for the <span id="edit-fronter-system">n/a</span></p>
-
- <div class="list-group" id="list-cloudburst">
- <a class="list-group-item list-group-item-action edit-fronter-link" onclick="deleteFronter();">
- <img src="/assets/icons/delete.svg" style="width:24px;filter:invert(1);vertical-align: middle;">
- <span style="vertical-align: middle;">Delete</span>
- </a>
- <a class="list-group-item list-group-item-action edit-fronter-link" onclick="moveFronterUp();">
- <img src="/assets/icons/up.svg" style="width:24px;filter:invert(1);vertical-align: middle;">
- <span style="vertical-align: middle;">Move up</span>
- </a>
- <a class="list-group-item list-group-item-action edit-fronter-link" onclick="moveFronterDown();">
- <img src="/assets/icons/down.svg" style="width:24px;filter:invert(1);vertical-align: middle;">
- <span style="vertical-align: middle;">Move down</span>
- </a>
- </div>
- </div>
-
- </div>
- </div>
-</div>
-
-<?php
-
-file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-planner.json", json_encode($cloudburst));
-file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-planner.json", json_encode($raindrops));
-
-require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php';
-
-?>
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?>