diff options
author | RaindropsSys <contact@minteck.org> | 2023-06-07 19:11:33 +0200 |
---|---|---|
committer | RaindropsSys <contact@minteck.org> | 2023-06-07 19:11:33 +0200 |
commit | 45486dece3efa0af8d0d426898b6b191672f02fb (patch) | |
tree | 07c55bd36d80b385d510ca39a4532030600faae9 /includes/components | |
parent | e5f50fb2ee79d26fec2c14b5e4dff0b5e3b481fa (diff) | |
download | pluralconnect-45486dece3efa0af8d0d426898b6b191672f02fb.tar.gz pluralconnect-45486dece3efa0af8d0d426898b6b191672f02fb.tar.bz2 pluralconnect-45486dece3efa0af8d0d426898b6b191672f02fb.zip |
Updated includes/components/planner.inc (automated)
Diffstat (limited to 'includes/components')
-rw-r--r-- | includes/components/planner.inc | 1746 |
1 files changed, 876 insertions, 870 deletions
diff --git a/includes/components/planner.inc b/includes/components/planner.inc index 37687a3..f005f52 100644 --- a/includes/components/planner.inc +++ b/includes/components/planner.inc @@ -1,157 +1,158 @@ -<?php +<div id="ch-front-planner"> + <?php + + require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/travelling.inc"; global $travelling; + require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/score.inc"; + require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/pronouns.inc"; + require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/bitset.inc"; + require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isUserLoggedIn; global $isLowerLoggedIn; + require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/banner.inc"; + require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/rainbow.inc"; + require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; + global $_PROFILE; -require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/travelling.inc"; global $travelling; -require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/score.inc"; -require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/pronouns.inc"; -require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/bitset.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isUserLoggedIn; global $isLowerLoggedIn; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/banner.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/rainbow.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; -global $_PROFILE; + $cloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/ynmuc.json"), true); + $raindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/gdapd.json"), true); -$cloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/ynmuc.json"), true); -$raindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/gdapd.json"), true); + function fronterBadges($id) { + global $isLowerLoggedIn; -function fronterBadges($id) { - global $isLowerLoggedIn; + $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $id . ".json"), true)); - $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $id . ".json"), true)); + if (isset($metadata["pacifier"]) && $metadata["pacifier"] && !$isLowerLoggedIn) { + return "<img title='This pony likes to sleep with a pacifier.' data-bs-toggle='tooltip' src='/assets/logo/pacifier.png' style='margin-left:auto;float: right;opacity:.75;width:24px;height:24px;vertical-align: middle; filter: invert(1);'>"; + } - if (isset($metadata["pacifier"]) && $metadata["pacifier"] && !$isLowerLoggedIn) { - return "<img title='This pony likes to sleep with a pacifier.' data-bs-toggle='tooltip' src='/assets/logo/pacifier.png' style='margin-left:auto;float: right;opacity:.75;width:24px;height:24px;vertical-align: middle; filter: invert(1);'>"; - } + if (isset($metadata["sleep_plush"]) && $metadata["sleep_plush"] && !$isLowerLoggedIn) { + return "<img title='This pony likes to sleep with a plush.' data-bs-toggle='tooltip' src='/assets/logo/plush.png' style='margin-left:auto;float: right;opacity:.75;width:24px;height:24px;vertical-align: middle; filter: invert(1);'>"; + } - if (isset($metadata["sleep_plush"]) && $metadata["sleep_plush"] && !$isLowerLoggedIn) { - return "<img title='This pony likes to sleep with a plush.' data-bs-toggle='tooltip' src='/assets/logo/plush.png' style='margin-left:auto;float: right;opacity:.75;width:24px;height:24px;vertical-align: middle; filter: invert(1);'>"; + return ""; } - return ""; -} - -foreach ($cloudburst as $id => $day) { - foreach ($day as $index => $fronter) { - if (is_string($fronter)) { - $cloudburst[$id][$index] = [$fronter]; - } else if (is_array($fronter)) { - if (count($fronter) < 2) { - if (!isset($cloudburst[$id][$index][0])) $cloudburst[$id][$index][0] = null; - $cloudburst[$id][$index][1] = null; - } else if (count($fronter) > 2) { - $array = []; - - if (isset($cloudburst[$id][$index][0])) { - $array[0] = $cloudburst[$id][$index][0]; - } else { - $array[0] = null; - } + foreach ($cloudburst as $id => $day) { + foreach ($day as $index => $fronter) { + if (is_string($fronter)) { + $cloudburst[$id][$index] = [$fronter]; + } else if (is_array($fronter)) { + if (count($fronter) < 2) { + if (!isset($cloudburst[$id][$index][0])) $cloudburst[$id][$index][0] = null; + $cloudburst[$id][$index][1] = null; + } else if (count($fronter) > 2) { + $array = []; - if (isset($cloudburst[$id][$index][1])) { - $array[1] = $cloudburst[$id][$index][1]; - } else { - $array[1] = null; - } + if (isset($cloudburst[$id][$index][0])) { + $array[0] = $cloudburst[$id][$index][0]; + } else { + $array[0] = null; + } + + if (isset($cloudburst[$id][$index][1])) { + $array[1] = $cloudburst[$id][$index][1]; + } else { + $array[1] = null; + } - $cloudburst[$id][$index] = $array; + $cloudburst[$id][$index] = $array; + } } } } -} - -foreach ($raindrops as $id => $day) { - foreach ($day as $index => $fronter) { - if (is_string($fronter)) { - $raindrops[$id][$index] = [$fronter]; - } else if (is_array($fronter)) { - if (count($fronter) < 2) { - if (!isset($raindrops[$id][$index][0])) $raindrops[$id][$index][0] = null; - $raindrops[$id][$index][1] = null; - } else if (count($fronter) > 2) { - $array = []; - - if (isset($raindrops[$id][$index][0])) { - $array[0] = $raindrops[$id][$index][0]; - } else { - $array[0] = null; - } - if (isset($raindrops[$id][$index][1])) { - $array[1] = $raindrops[$id][$index][1]; - } else { - $array[1] = null; - } + foreach ($raindrops as $id => $day) { + foreach ($day as $index => $fronter) { + if (is_string($fronter)) { + $raindrops[$id][$index] = [$fronter]; + } else if (is_array($fronter)) { + if (count($fronter) < 2) { + if (!isset($raindrops[$id][$index][0])) $raindrops[$id][$index][0] = null; + $raindrops[$id][$index][1] = null; + } else if (count($fronter) > 2) { + $array = []; + + if (isset($raindrops[$id][$index][0])) { + $array[0] = $raindrops[$id][$index][0]; + } else { + $array[0] = null; + } + + if (isset($raindrops[$id][$index][1])) { + $array[1] = $raindrops[$id][$index][1]; + } else { + $array[1] = null; + } - $raindrops[$id][$index] = $array; + $raindrops[$id][$index] = $array; + } } } } -} -$school = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/school.json"), true); + $school = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/school.json"), true); -function formatTime($time) { - if ($time === "0:00") return "midnight"; - if ($time === "12:00") return "noon"; + function formatTime($time) { + if ($time === "0:00") return "midnight"; + if ($time === "12:00") return "noon"; - $parts = explode(":", $time); - $hours = (int)$parts[0]; - $ampm = ""; + $parts = explode(":", $time); + $hours = (int)$parts[0]; + $ampm = ""; - if ($hours === 0 || $hours === 12) { - $ampm = ($hours === 0 ? "am" : "pm"); - $hours = 12; - } else { - if ($hours > 12) { - $ampm = "pm"; - $hours = $hours - 12; + if ($hours === 0 || $hours === 12) { + $ampm = ($hours === 0 ? "am" : "pm"); + $hours = 12; } else { - $ampm = "am"; + if ($hours > 12) { + $ampm = "pm"; + $hours = $hours - 12; + } else { + $ampm = "am"; + } } - } - if ((int)$parts[1] > 0) { - return $hours . ":" . $parts[1] . $ampm; - } else { - return $hours . $ampm; + if ((int)$parts[1] > 0) { + return $hours . ":" . $parts[1] . $ampm; + } else { + return $hours . $ampm; + } } -} -function school($time, $first = false) { - global $school; - global $_PROFILE; - global $isLowerLoggedIn; + function school($time, $first = false) { + global $school; + global $_PROFILE; + global $isLowerLoggedIn; - $day = date('Y-m-d', $time); - $parts = []; + $day = date('Y-m-d', $time); + $parts = []; - if (isset($school[$day])) { - if (isset($school[$day]["wakeUp"]["timestamp"])) { - $parts[] = "waking up at " . formatTime($school[$day]["wakeUp"][$_PROFILE["login"]]); - } + if (isset($school[$day])) { + if (isset($school[$day]["wakeUp"]["timestamp"])) { + $parts[] = "waking up at " . formatTime($school[$day]["wakeUp"][$_PROFILE["login"]]); + } - if (isset($school[$day]["sleep"]["timestamp"])) { - $parts[] = "sleeping at " . formatTime($school[$day]["sleep"][$_PROFILE["login"]]); + if (isset($school[$day]["sleep"]["timestamp"])) { + $parts[] = "sleeping at " . formatTime($school[$day]["sleep"][$_PROFILE["login"]]); + } } - } - if ($isLowerLoggedIn) $parts = []; + if ($isLowerLoggedIn) $parts = []; - if (count($parts) > 0) { - if ($first) { - return ucfirst(implode(", ", $parts)); - } else { - return "<br>" . ucfirst(implode(", ", $parts)); - } - } else { - if ($first) { - return "-"; + if (count($parts) > 0) { + if ($first) { + return ucfirst(implode(", ", $parts)); + } else { + return "<br>" . ucfirst(implode(", ", $parts)); + } } else { - return ""; + if ($first) { + return "-"; + } else { + return ""; + } } } -} -function day($display, $diff): void { if ($diff < 0) $disabled = true; else $disabled = false; global $cloudburst; global $raindrops; global $isLowerLoggedIn; ?> + function day($display, $diff): void { if ($diff < 0) $disabled = true; else $disabled = false; global $cloudburst; global $raindrops; global $isLowerLoggedIn; ?> <?php if (!isset($display)) { $display = date('l', time() + (86400 * $diff)); } @@ -164,322 +165,326 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis } ?> - <tr class="planner-day" id="planner-header-<?= $diff ?>" <?php if ($disabled): ?>style="opacity: .75; pointer-events: none;"<?php endif; ?>> - <td colspan="10" style="border:none;padding:0;"> - <div style="padding:5px 10px;margin:-0.5px;border-top:1px solid #404040;border-left:1px solid #404040;border-right:1px solid #404040;border-top-left-radius: 10px; border-top-right-radius: 10px;"><?= $display ?></div> - </td> - <?php - - if (!isset($cloudburst[date('Y-m-d', time() + (86400 * $diff))])) $cloudburst[date('Y-m-d', time() + (86400 * $diff))] = []; - $dayCloudburst = $cloudburst[date('Y-m-d', time() + (86400 * $diff))]; - if (!isset($raindrops[date('Y-m-d', time() + (86400 * $diff))])) $raindrops[date('Y-m-d', time() + (86400 * $diff))] = []; - $dayRaindrops = $raindrops[date('Y-m-d', time() + (86400 * $diff))]; - - $index = 0; - $lengthCloudburst = count($dayCloudburst); - $lengthRaindrops = count($dayRaindrops); - $biggest = max($lengthCloudburst, $lengthRaindrops); - - ?> - </tr> - <tr class="planner-header" <?php if ($disabled): ?>style="opacity: .75; pointer-events: none;"<?php endif; ?>> - <td colspan="5" style="border-top-color:transparent;border-right-color: transparent;">Cloudburst System</td> - <td colspan="5" style="border-top-color:transparent;border-left-color: transparent;">Raindrops System</td> - </tr> - <?php for ($i = 0; $i <= $biggest; $i++): ?> - <tr class="planner-member" <?php if ($disabled): ?>style="opacity: .75; pointer-events: none;"<?php endif; ?>> - <?php if (isset($dayCloudburst[$index])): ?> - <td class="planner-member-id" style="border-right-color: transparent;border-bottom-color: transparent;"> - <?= $index + 1 ?> - </td> - <td class="planner-link" style="width:50vw;border-right-color: transparent;border-bottom-color: transparent;" <?php if (!isset($dayCloudburst[$index][1])): ?>colspan="3" <?php else: ?>colspan="2"<?php endif; ?>> - <?php $member = getMemberWithoutSystem($dayCloudburst[$index][0]); ?> - <?php if ($member["name"] === "fusion"): ?> - <a class="member-link" onclick="openEditFronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Multiple merged members</span></span></span></a> - <?php elseif ($member["name"] === "unknown"): ?> - <a class="member-link" onclick="openEditFronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Other/unknown/fallback pony</span></span></span></a> - <?php else: ?> - <a class="member-link" onclick="openEditFronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <span class="member-link-text"><?= !isset($dayCloudburst[$index][1]) ? $member["display_name"] ?? $member["name"] : getMiniName($member["display_name"] ?? $member["name"]) ?></span><?= $index === count($dayCloudburst) - 1 ? fronterBadges($member["id"]) : "" ?></span></a> - <?php endif; ?> - </td> - <?php if (!isset($dayCloudburst[$index][1])): ?> - <td class="planner-cofronter-inner planner-link" style="width:5%;text-align:center;border-left-color: transparent;border-bottom-color: transparent;"><?php if (!$isLowerLoggedIn): ?> - <a onclick="addCofronter('cloudburst', <?= $diff ?>, <?= $index ?>);" class="planner-add-link planner-add-link-cofronter"> - <span class="planner-add-link-cofronter-inner"><img src="/assets/icons/add.svg" alt="" class="planner-add-icon"></span> - </a><?php endif; ?> - </td> - <?php else: ?> - <td class="planner-link" style="border-bottom-color: transparent;width:41.35vw;" colspan="2"> - <?php $member = getMemberWithoutSystem($dayCloudburst[$index][1]); ?> + <tr class="planner-day" id="planner-header-<?= $diff ?>" <?php if ($disabled): ?>style="opacity: .75; pointer-events: none;"<?php endif; ?>> + <td colspan="10" style="border:none;padding:0;"> + <div style="padding:5px 10px;margin:-0.5px;border-top:1px solid #404040;border-left:1px solid #404040;border-right:1px solid #404040;border-top-left-radius: 10px; border-top-right-radius: 10px;"><?= $display ?></div> + </td> + <?php + + if (!isset($cloudburst[date('Y-m-d', time() + (86400 * $diff))])) $cloudburst[date('Y-m-d', time() + (86400 * $diff))] = []; + $dayCloudburst = $cloudburst[date('Y-m-d', time() + (86400 * $diff))]; + if (!isset($raindrops[date('Y-m-d', time() + (86400 * $diff))])) $raindrops[date('Y-m-d', time() + (86400 * $diff))] = []; + $dayRaindrops = $raindrops[date('Y-m-d', time() + (86400 * $diff))]; + + $index = 0; + $lengthCloudburst = count($dayCloudburst); + $lengthRaindrops = count($dayRaindrops); + $biggest = max($lengthCloudburst, $lengthRaindrops); + + ?> + </tr> + <tr class="planner-header" <?php if ($disabled): ?>style="opacity: .75; pointer-events: none;"<?php endif; ?>> + <td colspan="5" style="border-top-color:transparent;border-right-color: transparent;">Cloudburst System</td> + <td colspan="5" style="border-top-color:transparent;border-left-color: transparent;">Raindrops System</td> + </tr> + <?php for ($i = 0; $i <= $biggest; $i++): ?> + <tr class="planner-member" <?php if ($disabled): ?>style="opacity: .75; pointer-events: none;"<?php endif; ?>> + <?php if (isset($dayCloudburst[$index])): ?> + <td class="planner-member-id" style="border-right-color: transparent;border-bottom-color: transparent;"> + <?= $index + 1 ?> + </td> + <td class="planner-link" style="width:50vw;border-right-color: transparent;border-bottom-color: transparent;" <?php if (!isset($dayCloudburst[$index][1])): ?>colspan="3" <?php else: ?>colspan="2"<?php endif; ?>> + <?php $member = getMemberWithoutSystem($dayCloudburst[$index][0]); ?> <?php if ($member["name"] === "fusion"): ?> - <a class="member-link" onclick="openEditCofronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Multiple merged members</span></span></span></a> + <a class="member-link" onclick="openEditFronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Multiple merged members</span></span></span></a> <?php elseif ($member["name"] === "unknown"): ?> - <a class="member-link" onclick="openEditCofronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Other/unknown/fallback pony</span></span></span></a> + <a class="member-link" onclick="openEditFronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Other/unknown/fallback pony</span></span></span></a> <?php else: ?> - <a class="member-link" onclick="openEditCofronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <span class="member-link-text"><?= !isset($dayCloudburst[$index][1]) ? $member["display_name"] ?? $member["name"] : getMiniName($member["display_name"] ?? $member["name"]) ?></span><?= $index === count($dayCloudburst) - 1 ? fronterBadges($member["id"]) : "" ?></span></a> + <a class="member-link" onclick="openEditFronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <span class="member-link-text"><?= !isset($dayCloudburst[$index][1]) ? $member["display_name"] ?? $member["name"] : getMiniName($member["display_name"] ?? $member["name"]) ?></span><?= $index === count($dayCloudburst) - 1 ? fronterBadges($member["id"]) : "" ?></span></a> <?php endif; ?> </td> - <?php endif; ?> - <?php elseif ($index === count($dayCloudburst)): if (!$isLowerLoggedIn): ?> - <td class="planner-add-inner planner-link" colspan="5" style="border-top-color: transparent;border-bottom-color: transparent;"> - <a onclick="addFronter('cloudburst', <?= $diff ?>, <?= $index ?>);" id="planner-add-link-cloudburst-<?= $diff ?>" class="planner-add-link"> - <div class="planner-add-link-inner"> - <img src="/assets/icons/add.svg" alt="" class="planner-add-icon"> - <span class="planner-add-text">Add new fronter</span> - </div> - </a> - </td> - <?php endif; else: ?> - <td colspan="5" class="planner-empty" style="border-top-color:transparent;border-bottom-color:transparent;"></td> - <?php endif; ?> - <?php if (isset($dayRaindrops[$index])): ?> - <td class="planner-member-id" style="border-bottom-color: transparent;border-right-color: transparent;"> - <?= $index + 1 ?> - </td> - <?php $member = getMemberWithoutSystem($dayRaindrops[$index][0]); ?> - <td class="planner-link" style="border-right-color:transparent;border-bottom-color: transparent;width:50vw;" <?php if (!isset($dayRaindrops[$index][1])): ?>colspan="3" <?php else: ?>colspan="2"<?php endif; ?>> - <?php if ($member["name"] === "fusion"): ?> - <a class="member-link" onclick="openEditFronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Multiple merged members</span></span></span></a> - <?php elseif ($member["name"] === "unknown"): ?> - <a class="member-link" onclick="openEditFronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Other/unknown/fallback pony</span></span></span></a> + <?php if (!isset($dayCloudburst[$index][1])): ?> + <td class="planner-cofronter-inner planner-link" style="width:5%;text-align:center;border-left-color: transparent;border-bottom-color: transparent;"><?php if (!$isLowerLoggedIn): ?> + <a onclick="addCofronter('cloudburst', <?= $diff ?>, <?= $index ?>);" class="planner-add-link planner-add-link-cofronter"> + <span class="planner-add-link-cofronter-inner"><img src="/assets/icons/add.svg" alt="" class="planner-add-icon"></span> + </a><?php endif; ?> + </td> <?php else: ?> - <a class="member-link" onclick="openEditFronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <span class="member-link-text"><?= !isset($dayRaindrops[$index][1]) ? $member["display_name"] ?? $member["name"] : getMiniName($member["display_name"] ?? $member["name"]) ?></span><?= $index === count($dayRaindrops) - 1 ? fronterBadges($member["id"]) : "" ?></span></a> + <td class="planner-link" style="border-bottom-color: transparent;width:41.35vw;" colspan="2"> + <?php $member = getMemberWithoutSystem($dayCloudburst[$index][1]); ?> + <?php if ($member["name"] === "fusion"): ?> + <a class="member-link" onclick="openEditCofronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Multiple merged members</span></span></span></a> + <?php elseif ($member["name"] === "unknown"): ?> + <a class="member-link" onclick="openEditCofronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Other/unknown/fallback pony</span></span></span></a> + <?php else: ?> + <a class="member-link" onclick="openEditCofronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <span class="member-link-text"><?= !isset($dayCloudburst[$index][1]) ? $member["display_name"] ?? $member["name"] : getMiniName($member["display_name"] ?? $member["name"]) ?></span><?= $index === count($dayCloudburst) - 1 ? fronterBadges($member["id"]) : "" ?></span></a> + <?php endif; ?> + </td> <?php endif; ?> - </td> - <?php if (!isset($dayRaindrops[$index][1])): ?> - <td class="planner-cofronter-inner planner-link" style="border-bottom-color: transparent;border-left-color: transparent;width:5%;text-align:center;"><?php if (!$isLowerLoggedIn): ?> - <a onclick="addCofronter('raindrops', <?= $diff ?>, <?= $index ?>);" class="planner-add-link planner-add-link-cofronter"> - <span class="planner-add-link-cofronter-inner"><img src="/assets/icons/add.svg" alt="" class="planner-add-icon"></span> - </a><?php endif; ?> - </td> - <?php else: ?> - <td class="planner-link" style="border-bottom-color:transparent;width:41.35vw;" colspan="2"> - <?php $member = getMemberWithoutSystem($dayRaindrops[$index][1]); ?> + <?php elseif ($index === count($dayCloudburst)): if (!$isLowerLoggedIn): ?> + <td class="planner-add-inner planner-link" colspan="5" style="border-top-color: transparent;border-bottom-color: transparent;"> + <a onclick="addFronter('cloudburst', <?= $diff ?>, <?= $index ?>);" id="planner-add-link-cloudburst-<?= $diff ?>" class="planner-add-link"> + <div class="planner-add-link-inner"> + <img src="/assets/icons/add.svg" alt="" class="planner-add-icon"> + <span class="planner-add-text">Add new fronter</span> + </div> + </a> + </td> + <?php endif; else: ?> + <td colspan="5" class="planner-empty" style="border-top-color:transparent;border-bottom-color:transparent;"></td> + <?php endif; ?> + <?php if (isset($dayRaindrops[$index])): ?> + <td class="planner-member-id" style="border-bottom-color: transparent;border-right-color: transparent;"> + <?= $index + 1 ?> + </td> + <?php $member = getMemberWithoutSystem($dayRaindrops[$index][0]); ?> + <td class="planner-link" style="border-right-color:transparent;border-bottom-color: transparent;width:50vw;" <?php if (!isset($dayRaindrops[$index][1])): ?>colspan="3" <?php else: ?>colspan="2"<?php endif; ?>> <?php if ($member["name"] === "fusion"): ?> - <a class="member-link" onclick="openEditCofronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Multiple merged members</span></span></span></a> + <a class="member-link" onclick="openEditFronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Multiple merged members</span></span></span></a> <?php elseif ($member["name"] === "unknown"): ?> - <a class="member-link" onclick="openEditCofronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Other/unknown/fallback pony</span></span></span></a> + <a class="member-link" onclick="openEditFronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Other/unknown/fallback pony</span></span></span></a> <?php else: ?> - <a class="member-link" onclick="openEditCofronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <span class="member-link-text"><?= !isset($dayRaindrops[$index][1]) ? $member["display_name"] ?? $member["name"] : getMiniName($member["display_name"] ?? $member["name"]) ?></span><?= $index === count($dayRaindrops) - 1 ? fronterBadges($member["id"]) : "" ?></span></a> + <a class="member-link" onclick="openEditFronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <span class="member-link-text"><?= !isset($dayRaindrops[$index][1]) ? $member["display_name"] ?? $member["name"] : getMiniName($member["display_name"] ?? $member["name"]) ?></span><?= $index === count($dayRaindrops) - 1 ? fronterBadges($member["id"]) : "" ?></span></a> <?php endif; ?> </td> + <?php if (!isset($dayRaindrops[$index][1])): ?> + <td class="planner-cofronter-inner planner-link" style="border-bottom-color: transparent;border-left-color: transparent;width:5%;text-align:center;"><?php if (!$isLowerLoggedIn): ?> + <a onclick="addCofronter('raindrops', <?= $diff ?>, <?= $index ?>);" class="planner-add-link planner-add-link-cofronter"> + <span class="planner-add-link-cofronter-inner"><img src="/assets/icons/add.svg" alt="" class="planner-add-icon"></span> + </a><?php endif; ?> + </td> + <?php else: ?> + <td class="planner-link" style="border-bottom-color:transparent;width:41.35vw;" colspan="2"> + <?php $member = getMemberWithoutSystem($dayRaindrops[$index][1]); ?> + <?php if ($member["name"] === "fusion"): ?> + <a class="member-link" onclick="openEditCofronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Multiple merged members</span></span></span></a> + <?php elseif ($member["name"] === "unknown"): ?> + <a class="member-link" onclick="openEditCofronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Other/unknown/fallback pony</span></span></span></a> + <?php else: ?> + <a class="member-link" onclick="openEditCofronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <span class="member-link-text"><?= !isset($dayRaindrops[$index][1]) ? $member["display_name"] ?? $member["name"] : getMiniName($member["display_name"] ?? $member["name"]) ?></span><?= $index === count($dayRaindrops) - 1 ? fronterBadges($member["id"]) : "" ?></span></a> + <?php endif; ?> + </td> + <?php endif; ?> + <?php elseif ($index === count($dayRaindrops)): if (!$isLowerLoggedIn): ?> + <td class="planner-add-inner planner-link" colspan="5" style="border-top-color: transparent;border-bottom-color: transparent;"> + <a onclick="addFronter('raindrops', <?= $diff ?>, <?= $index ?>);" id="planner-add-link-raindrops-<?= $diff ?>" class="planner-add-link"> + <div class="planner-add-link-inner"> + <img src="/assets/icons/add.svg" alt="" class="planner-add-icon"> + <span class="planner-add-text">Add new fronter</span> + </div> + </a> + </td> + <?php endif; else: ?> + <td colspan="5" class="planner-empty" style="border-top-color:transparent;border-bottom-color:transparent;"></td> <?php endif; ?> - <?php elseif ($index === count($dayRaindrops)): if (!$isLowerLoggedIn): ?> - <td class="planner-add-inner planner-link" colspan="5" style="border-top-color: transparent;border-bottom-color: transparent;"> - <a onclick="addFronter('raindrops', <?= $diff ?>, <?= $index ?>);" id="planner-add-link-raindrops-<?= $diff ?>" class="planner-add-link"> - <div class="planner-add-link-inner"> - <img src="/assets/icons/add.svg" alt="" class="planner-add-icon"> - <span class="planner-add-text">Add new fronter</span> - </div> - </a> - </td> - <?php endif; else: ?> - <td colspan="5" class="planner-empty" style="border-top-color:transparent;border-bottom-color:transparent;"></td> - <?php endif; ?> + </tr> + <?php $index++; endfor; ?> + <tr class="planner-day planner-end-of-day" <?php if ($disabled): ?>style="opacity: .75; pointer-events: none;"<?php endif; ?>> + <td colspan="10" style="padding: 0;border:none;"> + <div style="padding: 5px 10px;border: 1px solid #404040;margin:-1px;border-bottom-left-radius: 10px;border-bottom-right-radius: 10px;"> + <?php if (count($dayCloudburst) > 0 && count($dayRaindrops) > 0): ?> + <?= getMemberWithoutSystem($dayCloudburst[count($dayCloudburst) - 1][0])["display_name"] ?? getMemberWithoutSystem($dayCloudburst[count($dayCloudburst) - 1][0])["name"] ?><?php if (isset($dayCloudburst[count($dayCloudburst) - 1][1])): echo(" and " . getMemberWithoutSystem($dayCloudburst[count($dayCloudburst) - 1][1])["display_name"] ?? getMemberWithoutSystem($dayCloudburst[count($dayCloudburst) - 1][1])["name"]); endif; ?> will sleep with <?= getMemberWithoutSystem($dayRaindrops[count($dayRaindrops) - 1][0])["display_name"] ?? getMemberWithoutSystem($dayRaindrops[count($dayRaindrops) - 1][0])["name"] ?><?php if (isset($dayRaindrops[count($dayRaindrops) - 1][1])): echo(" and " . getMemberWithoutSystem($dayRaindrops[count($dayRaindrops) - 1][1])["display_name"] ?? getMemberWithoutSystem($dayRaindrops[count($dayRaindrops) - 1][1])["name"]); endif; ?> + <?php else: ?> + <?= school(time() + 86400 * $diff, true) ?> + <?php endif; ?> + </div> + </td> </tr> - <?php $index++; endfor; ?> - <tr class="planner-day planner-end-of-day" <?php if ($disabled): ?>style="opacity: .75; pointer-events: none;"<?php endif; ?>> - <td colspan="10" style="padding: 0;border:none;"> - <div style="padding: 5px 10px;border: 1px solid #404040;margin:-1px;border-bottom-left-radius: 10px;border-bottom-right-radius: 10px;"> - <?php if (count($dayCloudburst) > 0 && count($dayRaindrops) > 0): ?> - <?= getMemberWithoutSystem($dayCloudburst[count($dayCloudburst) - 1][0])["display_name"] ?? getMemberWithoutSystem($dayCloudburst[count($dayCloudburst) - 1][0])["name"] ?><?php if (isset($dayCloudburst[count($dayCloudburst) - 1][1])): echo(" and " . getMemberWithoutSystem($dayCloudburst[count($dayCloudburst) - 1][1])["display_name"] ?? getMemberWithoutSystem($dayCloudburst[count($dayCloudburst) - 1][1])["name"]); endif; ?> will sleep with <?= getMemberWithoutSystem($dayRaindrops[count($dayRaindrops) - 1][0])["display_name"] ?? getMemberWithoutSystem($dayRaindrops[count($dayRaindrops) - 1][0])["name"] ?><?php if (isset($dayRaindrops[count($dayRaindrops) - 1][1])): echo(" and " . getMemberWithoutSystem($dayRaindrops[count($dayRaindrops) - 1][1])["display_name"] ?? getMemberWithoutSystem($dayRaindrops[count($dayRaindrops) - 1][1])["name"]); endif; ?> - <?php else: ?> - <?= school(time() + 86400 * $diff, true) ?> - <?php endif; ?> - </div> - </td> - </tr> - <tr class="planner-separator"></tr> -<?php -} - - if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/planner.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/planner.json", "{}"); - $cache = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/planner.json"), true); - - if (!isset($cache["content"]) || date('Y-m-d') !== $cache["day"]) { - ob_start(); ?> - -<style> - #planner { - margin-top: 10px; - border-collapse: collapse; - width: 100%; + <tr class="planner-separator"></tr> + <?php } - .planner-header { - font-weight: bold; - text-align: center; - } + if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/planner.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/planner.json", "{}"); + $cache = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/planner.json"), true); - .planner-header td { - width: 50%; - } + if (!isset($cache["content"]) || date('Y-m-d') !== $cache["day"]) { + ob_start(); ?> - td { - border: 1px solid #404040; - padding: 5px 10px; - } + <style> + #ch-front-planner img { + border-radius: 5px; + } - .planner-day { - text-align: center; - color: rgba(255, 255, 255, .5); - font-weight: bold; - } + #planner { + margin-top: 10px; + border-collapse: collapse; + width: 100%; + } - .planner-end-of-day { - font-weight: normal; - } + .planner-header { + font-weight: bold; + text-align: center; + } - .planner-end-of-day td { - border-bottom-left-radius: 10px; - } + .planner-header td { + width: 50%; + } - .planner-separator { - height: 20px; - } + td { + border: 1px solid #404040; + padding: 5px 10px; + } - .planner-member-id { - width: 10%; - text-align: right; - } + .planner-day { + text-align: center; + color: rgba(255, 255, 255, .5); + font-weight: bold; + } - .planner-link { - padding: 0; - } + .planner-end-of-day { + font-weight: normal; + } - .planner-link a { - padding: 5px 10px; - display: block; - } + .planner-end-of-day td { + border-bottom-left-radius: 10px; + } - .planner-add-link { - color: rgba(255, 255, 255, .75); - text-decoration: none; - cursor: pointer; - } + .planner-separator { + height: 20px; + } - .planner-add-link:hover { - color: rgba(255, 255, 255, .75); - } + .planner-member-id { + width: 10%; + text-align: right; + } - .planner-link:hover { - background-color: rgba(255, 255, 255, .125); - } + .planner-link { + padding: 0; + } - .planner-link:active { - background-color: rgba(255, 255, 255, .25); - } + .planner-link a { + padding: 5px 10px; + display: block; + } - .planner-add-icon { - filter: invert(1); - width: 24px; - vertical-align: middle; - opacity: .75; - } + .planner-add-link { + color: rgba(255, 255, 255, .75); + text-decoration: none; + cursor: pointer; + } - .planner-add-text { - vertical-align: middle; - } + .planner-add-link:hover { + color: rgba(255, 255, 255, .75); + } - .modal-header { - border-bottom: 1px solid #353738; - } + .planner-link:hover { + background-color: rgba(255, 255, 255, .125); + } - .modal-content { - border: 1px solid rgba(255, 255, 255, .2); - background-color: #111; - } + .planner-link:active { + background-color: rgba(255, 255, 255, .25); + } - .btn-close { - filter: invert(1); - } + .planner-add-icon { + filter: invert(1); + width: 24px; + vertical-align: middle; + opacity: .75; + } - .list-group-item { - color: #fff; - background-color: #222; - border: 1px solid rgba(255, 255, 255, .125); - } + .planner-add-text { + vertical-align: middle; + } - .list-group-item.disabled { - color: #fff; - background-color: #222; - border-color: rgba(255, 255, 255, .125); - opacity: .75; - } + .modal-header { + border-bottom: 1px solid #353738; + } - .list-group-item:hover { - background-color: #252525; - color: #ddd; - } + .modal-content { + border: 1px solid rgba(255, 255, 255, .2); + background-color: #111; + } - .list-group-item:active, .list-group-item:focus { - background-color: #272727; - color: #bbb; - } + .btn-close { + filter: invert(1); + } - .member-link, .list-group-item-action { - cursor: pointer !important; - } + .list-group-item { + color: #fff; + background-color: #222; + border: 1px solid rgba(255, 255, 255, .125); + } - .merge-mobile { - display: none; - } + .list-group-item.disabled { + color: #fff; + background-color: #222; + border-color: rgba(255, 255, 255, .125); + opacity: .75; + } - @media (max-width: 768px) { - .merge-desktop { - display: none; - } + .list-group-item:hover { + background-color: #252525; + color: #ddd; + } - .merge-mobile { - display: inline; - } - } + .list-group-item:active, .list-group-item:focus { + background-color: #272727; + color: #bbb; + } - @media (max-width: 991px) { - .member-link-text { - display: none; - } + .member-link, .list-group-item-action { + cursor: pointer !important; + } - .planner-link .member-link { - text-align: center; - } - } + .merge-mobile { + display: none; + } - .member-link, .planner-link { - background-color: transparent !important; - } + @media (max-width: 768px) { + .merge-desktop { + display: none; + } - .member-link-inner, .planner-add-link-inner, .planner-add-link-cofronter-inner { - display: block; - padding: 3px 7px; - border-radius: 5px; - } + .merge-mobile { + display: inline; + } + } - .planner-add-link-cofronter-inner { - border-radius: 100%; - width: max-content; - margin-left: auto; - margin-right: auto; - } + @media (max-width: 991px) { + .member-link-text { + display: none; + } - .planner-add-link-cofronter-inner .planner-add-icon { - margin-top: -2px; - } + .planner-link .member-link { + text-align: center; + } + } - .member-link, .planner-add-link-inner, .planner-add-link-cofronter-inner { - padding: 2px 3px !important; - } + .member-link, .planner-link { + background-color: transparent !important; + } - .member-link:hover .member-link-inner, .planner-add-link:hover .planner-add-link-inner, .planner-add-link-cofronter:hover .planner-add-link-cofronter-inner { - background-color: rgba(255, 255, 255, .125); - } + .member-link-inner, .planner-add-link-inner, .planner-add-link-cofronter-inner { + display: block; + padding: 3px 7px; + border-radius: 5px; + } -</style> + .planner-add-link-cofronter-inner { + border-radius: 100%; + width: max-content; + margin-left: auto; + margin-right: auto; + } -<h2>Front planner</h2> -<table id="planner"> - <tbody> - <?php + .planner-add-link-cofronter-inner .planner-add-icon { + margin-top: -2px; + } + + .member-link, .planner-add-link-inner, .planner-add-link-cofronter-inner { + padding: 2px 3px !important; + } + + .member-link:hover .member-link-inner, .planner-add-link:hover .planner-add-link-inner, .planner-add-link-cofronter:hover .planner-add-link-cofronter-inner { + background-color: rgba(255, 255, 255, .125); + } + + </style> + + <h2>Front planner</h2> + <table id="planner"> + <tbody> + <?php day("Yesterday", -1); day("Today", 0); day("Tomorrow", 1); @@ -495,611 +500,612 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis day(date('l j', time() + 86400 * 11), 11); day(date('l j', time() + 86400 * 12), 12); - ?> - </tbody> -</table> - -<!--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']; - } + ?> + </tbody> + </table> + + <!--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))) ?>`)); - window.relations = JSON.parse(window.atob(`<?php + echo(base64_encode(json_encode($names))) ?>`)); + window.relations = JSON.parse(window.atob(`<?php - $relations = []; - foreach (scoreOrderGlobal() as $member) { - $relations[$member['id']] = array_values(array_unique(array_map(function ($i) { - return explode("/", $i)[1]; - }, [...($member["_metadata"]["marefriends"] ?? []), ...($member["_metadata"]["sisters"] ?? []), ...($member["_metadata"]["caretakers"] ?? []), ...($member["_metadata"]["friends"] ?? []), ...($member["_metadata"]["sexfriends"] ?? [])]))); - } + $relations = []; + foreach (scoreOrderGlobal() as $member) { + $relations[$member['id']] = array_values(array_unique(array_map(function ($i) { + return explode("/", $i)[1]; + }, [...($member["_metadata"]["marefriends"] ?? []), ...($member["_metadata"]["sisters"] ?? []), ...($member["_metadata"]["caretakers"] ?? []), ...($member["_metadata"]["friends"] ?? []), ...($member["_metadata"]["sexfriends"] ?? [])]))); + } - echo(base64_encode(json_encode($relations))) ?>`)); + echo(base64_encode(json_encode($relations))) ?>`)); - function getSuggestedPonies() { - if (window.fronting[window.addSystem === "gdapd" ? "cloudburst" : "raindrops"][window.currentWorkingDate][window.addIndex]) { - let otherPony = window.fronting[window.addSystem === "gdapd" ? "cloudburst" : "raindrops"][window.currentWorkingDate][window.addIndex][0]; - let availablePonies = window.relations[window.fronting[window.addSystem === "gdapd" ? "cloudburst" : "raindrops"][window.currentWorkingDate][window.addIndex][0]]; + function getSuggestedPonies() { + if (window.fronting[window.addSystem === "gdapd" ? "cloudburst" : "raindrops"][window.currentWorkingDate][window.addIndex]) { + let otherPony = window.fronting[window.addSystem === "gdapd" ? "cloudburst" : "raindrops"][window.currentWorkingDate][window.addIndex][0]; + let availablePonies = window.relations[window.fronting[window.addSystem === "gdapd" ? "cloudburst" : "raindrops"][window.currentWorkingDate][window.addIndex][0]]; - if (availablePonies) { - document.getElementById("associated-results").innerHTML = ""; + if (availablePonies) { + document.getElementById("associated-results").innerHTML = ""; - for (let pony of availablePonies) { - if (document.getElementById("list-pony-" + pony)) { - document.getElementById("associated-results").innerHTML += document.getElementById("list-pony-" + pony).outerHTML; + for (let pony of availablePonies) { + if (document.getElementById("list-pony-" + pony)) { + document.getElementById("associated-results").innerHTML += document.getElementById("list-pony-" + pony).outerHTML; + } + } + + document.getElementById("list").style.display = "none"; + document.getElementById("associated-results").style.display = ""; } } + } - document.getElementById("list").style.display = "none"; - document.getElementById("associated-results").style.display = ""; + function ordinal(n) { + let s = ["th", "st", "nd", "rd"]; + let v = n % 100; + return n + (s[(v - 20) % 10] || s[v] || s[0]); } - } - } - 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 = formatDate(date).display; - function openEditFronter(system, id, date) { - let display = formatDate(date).display; + window.selectedFronting = { + system: system === "cloudburst" ? "ynmuc" : "gdapd", + date: date, + index: id + } - window.selectedFronting = { - system: system === "cloudburst" ? "ynmuc" : "gdapd", - date: date, - index: id - } + if (fronting[system][date][id][0] === "lzlaq" || fronting[system][date][id][0] === "irxyh") { + document.getElementById("edit-fronter-name").innerText = "merged members"; + } else { + document.getElementById("edit-fronter-name").innerText = names[fronting[system][date][id][0]] ?? fronting[system][date][id][0]; + } - if (fronting[system][date][id][0] === "lzlaq" || fronting[system][date][id][0] === "irxyh") { - document.getElementById("edit-fronter-name").innerText = "merged members"; - } else { - document.getElementById("edit-fronter-name").innerText = names[fronting[system][date][id][0]] ?? fronting[system][date][id][0]; - } + 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"; - 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(); + } - let modal = new bootstrap.Modal(document.getElementById('edit-fronter')); - modal.show(); - } + function openEditCofronter(system, id, date) { + let display = formatDate(date).display; - function openEditCofronter(system, id, date) { - let display = formatDate(date).display; + window.selectedFronting = { + system: system === "cloudburst" ? "ynmuc" : "gdapd", + date: date, + index: id + } - window.selectedFronting = { - system: system === "cloudburst" ? "ynmuc" : "gdapd", - date: date, - index: id - } + document.getElementById("edit-cofronter-name").innerText = names[fronting[system][date][id][1]] ?? fronting[system][date][id][1]; + document.getElementById("edit-cofronter-name2").innerText = names[fronting[system][date][id][0]] ?? fronting[system][date][id][0]; - document.getElementById("edit-cofronter-name").innerText = names[fronting[system][date][id][1]] ?? fronting[system][date][id][1]; - document.getElementById("edit-cofronter-name2").innerText = names[fronting[system][date][id][0]] ?? fronting[system][date][id][0]; + document.getElementById("edit-cofronter-date").innerText = display; + document.getElementById("edit-cofronter-pos").innerText = ordinal(id + 1); + document.getElementById("edit-cofronter-system").innerText = system === "cloudburst" ? "Cloudburst System" : "Raindrops System"; - document.getElementById("edit-cofronter-date").innerText = display; - document.getElementById("edit-cofronter-pos").innerText = ordinal(id + 1); - document.getElementById("edit-cofronter-system").innerText = system === "cloudburst" ? "Cloudburst System" : "Raindrops System"; + let modal = new bootstrap.Modal(document.getElementById('edit-cofronter')); + modal.show(); + } - let modal = new bootstrap.Modal(document.getElementById('edit-cofronter')); - modal.show(); - } + function formatDate(offset) { + let date; + let display; + + switch (offset) { + case 0: + case "<?= date('Y-m-d', time()) ?>": + date = "<?= date('Y-m-d') ?>"; + display = "today"; + break; + + case 1: + case "<?= date('Y-m-d', time() + (86400)) ?>": + date = "<?= date('Y-m-d', time() + 86400) ?>"; + display = "tomorrow"; + break; + + case 2: + case "<?= date('Y-m-d', time() + (86400 * 2)) ?>": + date = "<?= date('Y-m-d', time() + (86400 * 2)) ?>"; + display = "on <?= date('l', time() + (86400 * 2)) ?>"; + break; + + case 3: + case "<?= date('Y-m-d', time() + (86400 * 3)) ?>": + date = "<?= date('Y-m-d', time() + (86400 * 3)) ?>"; + display = "on <?= date('l', time() + (86400 * 3)) ?>"; + break; + + case 4: + case "<?= date('Y-m-d', time() + (86400 * 4)) ?>": + date = "<?= date('Y-m-d', time() + (86400 * 4)) ?>"; + display = "on <?= date('l', time() + (86400 * 4)) ?>"; + break; + + case 5: + case "<?= date('Y-m-d', time() + (86400 * 5)) ?>": + date = "<?= date('Y-m-d', time() + (86400 * 5)) ?>"; + display = "on <?= date('l', time() + (86400 * 5)) ?>"; + break; + + case 6: + case "<?= date('Y-m-d', time() + (86400 * 6)) ?>": + date = "<?= date('Y-m-d', time() + (86400 * 6)) ?>"; + display = "on <?= date('l', time() + (86400 * 6)) ?>"; + break; + + case 7: + case "<?= date('Y-m-d', time() + (86400 * 7)) ?>": + date = "<?= date('Y-m-d', time() + (86400 * 7)) ?>"; + display = "on <?= date('l', time() + (86400 * 7)) ?>"; + break; + + case 8: + case "<?= date('Y-m-d', time() + (86400 * 8)) ?>": + date = "<?= date('Y-m-d', time() + (86400 * 8)) ?>"; + display = "on <?= date('l', time() + (86400 * 8)) ?>"; + break; + + case 9: + case "<?= date('Y-m-d', time() + (86400 * 9)) ?>": + date = "<?= date('Y-m-d', time() + (86400 * 9)) ?>"; + display = "on <?= date('l', time() + (86400 * 9)) ?>"; + break; + + case 10: + case "<?= date('Y-m-d', time() + (86400 * 10)) ?>": + date = "<?= date('Y-m-d', time() + (86400 * 10)) ?>"; + display = "on <?= date('l', time() + (86400 * 10)) ?>"; + break; + + case 11: + case "<?= date('Y-m-d', time() + (86400 * 11)) ?>": + date = "<?= date('Y-m-d', time() + (86400 * 11)) ?>"; + display = "on <?= date('l', time() + (86400 * 11)) ?>"; + break; + } - function formatDate(offset) { - let date; - let display; - - switch (offset) { - case 0: - case "<?= date('Y-m-d', time()) ?>": - date = "<?= date('Y-m-d') ?>"; - display = "today"; - break; - - case 1: - case "<?= date('Y-m-d', time() + (86400)) ?>": - date = "<?= date('Y-m-d', time() + 86400) ?>"; - display = "tomorrow"; - break; - - case 2: - case "<?= date('Y-m-d', time() + (86400 * 2)) ?>": - date = "<?= date('Y-m-d', time() + (86400 * 2)) ?>"; - display = "on <?= date('l', time() + (86400 * 2)) ?>"; - break; - - case 3: - case "<?= date('Y-m-d', time() + (86400 * 3)) ?>": - date = "<?= date('Y-m-d', time() + (86400 * 3)) ?>"; - display = "on <?= date('l', time() + (86400 * 3)) ?>"; - break; - - case 4: - case "<?= date('Y-m-d', time() + (86400 * 4)) ?>": - date = "<?= date('Y-m-d', time() + (86400 * 4)) ?>"; - display = "on <?= date('l', time() + (86400 * 4)) ?>"; - break; - - case 5: - case "<?= date('Y-m-d', time() + (86400 * 5)) ?>": - date = "<?= date('Y-m-d', time() + (86400 * 5)) ?>"; - display = "on <?= date('l', time() + (86400 * 5)) ?>"; - break; - - case 6: - case "<?= date('Y-m-d', time() + (86400 * 6)) ?>": - date = "<?= date('Y-m-d', time() + (86400 * 6)) ?>"; - display = "on <?= date('l', time() + (86400 * 6)) ?>"; - break; - - case 7: - case "<?= date('Y-m-d', time() + (86400 * 7)) ?>": - date = "<?= date('Y-m-d', time() + (86400 * 7)) ?>"; - display = "on <?= date('l', time() + (86400 * 7)) ?>"; - break; - - case 8: - case "<?= date('Y-m-d', time() + (86400 * 8)) ?>": - date = "<?= date('Y-m-d', time() + (86400 * 8)) ?>"; - display = "on <?= date('l', time() + (86400 * 8)) ?>"; - break; - - case 9: - case "<?= date('Y-m-d', time() + (86400 * 9)) ?>": - date = "<?= date('Y-m-d', time() + (86400 * 9)) ?>"; - display = "on <?= date('l', time() + (86400 * 9)) ?>"; - break; - - case 10: - case "<?= date('Y-m-d', time() + (86400 * 10)) ?>": - date = "<?= date('Y-m-d', time() + (86400 * 10)) ?>"; - display = "on <?= date('l', time() + (86400 * 10)) ?>"; - break; - - case 11: - case "<?= date('Y-m-d', time() + (86400 * 11)) ?>": - date = "<?= date('Y-m-d', time() + (86400 * 11)) ?>"; - display = "on <?= date('l', time() + (86400 * 11)) ?>"; - break; - } + return {date, display}; + } - return {date, display}; - } + function addCofronter(system, offset, index) { + let date = formatDate(offset).date; + let display = formatDate(offset).display; - function addCofronter(system, offset, index) { - let date = formatDate(offset).date; - let display = formatDate(offset).display; + window.selectedFronting = { + system: system === "cloudburst" ? "ynmuc" : "gdapd", + date: date, + index: index + } - window.selectedFronting = { - system: system === "cloudburst" ? "ynmuc" : "gdapd", - date: date, - index: index - } + window.currentWorkingDate = date; + document.getElementById("new-cofronter-date").innerText = display; + document.getElementById("new-cofronter-system").innerText = system === "cloudburst" ? "Cloudburst System" : "Raindrops System"; + window.addSystem = system === "raindrops" ? "gdapd" : "ynmuc"; - window.currentWorkingDate = date; - document.getElementById("new-cofronter-date").innerText = display; - document.getElementById("new-cofronter-system").innerText = system === "cloudburst" ? "Cloudburst System" : "Raindrops System"; - window.addSystem = system === "raindrops" ? "gdapd" : "ynmuc"; + if (fronting[system][date][index][0] === "lzlaq" || fronting[system][date][index][0] === "irxyh") { + document.getElementById("new-cofronter-main").innerText = "merged members"; + } else { + document.getElementById("new-cofronter-main").innerText = names[fronting[system][date][index][0]] ?? fronting[system][date][index][0]; + } - if (fronting[system][date][index][0] === "lzlaq" || fronting[system][date][index][0] === "irxyh") { - document.getElementById("new-cofronter-main").innerText = "merged members"; - } else { - document.getElementById("new-cofronter-main").innerText = names[fronting[system][date][index][0]] ?? fronting[system][date][index][0]; - } + document.getElementById("list2").style.display = "block"; + document.getElementById("search2-results").style.display = "none"; + document.getElementById("search2").value = ""; - document.getElementById("list2").style.display = "block"; - document.getElementById("search2-results").style.display = "none"; - document.getElementById("search2").value = ""; + let modal = new bootstrap.Modal(document.getElementById('new-cofronter')); + modal.show(); + document.getElementById("search2").focus(); + } - let modal = new bootstrap.Modal(document.getElementById('new-cofronter')); - modal.show(); - document.getElementById("search2").focus(); - } + function addFronter(system, offset, index) { + let date = formatDate(offset).date; + let display = formatDate(offset).display; - function addFronter(system, offset, index) { - let date = formatDate(offset).date; - let display = formatDate(offset).display; + window.currentWorkingDate = date; + window.addIndex = index; + document.getElementById("new-fronter-date").innerText = display; + document.getElementById("new-fronter-system").innerText = system === "cloudburst" ? "Cloudburst System" : "Raindrops System"; + window.addSystem = system === "raindrops" ? "gdapd" : "ynmuc"; - window.currentWorkingDate = date; - window.addIndex = index; - document.getElementById("new-fronter-date").innerText = display; - document.getElementById("new-fronter-system").innerText = system === "cloudburst" ? "Cloudburst System" : "Raindrops System"; - window.addSystem = system === "raindrops" ? "gdapd" : "ynmuc"; + document.getElementById("list").style.display = "block"; + getSuggestedPonies(); + document.getElementById("search-results").style.display = "none"; + document.getElementById("search").value = ""; - document.getElementById("list").style.display = "block"; - getSuggestedPonies(); - document.getElementById("search-results").style.display = "none"; - document.getElementById("search").value = ""; + let modal = new bootstrap.Modal(document.getElementById('new-fronter')); + modal.show(); + document.getElementById("search").focus(); + } - let modal = new bootstrap.Modal(document.getElementById('new-fronter')); - modal.show(); - document.getElementById("search").focus(); - } + function confirmFronterAdd(system, id) { + Array.from(document.getElementsByClassName("new-fronter-link")).forEach((i) => { + i.classList.add("disabled"); + }); - 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"); - document.getElementById("new-fronter-close").classList.add("disabled"); + window.fetch("/api/fronter?t=add&d=" + window.currentWorkingDate + "&m=" + id + "&s=" + system).then(() => { + location.reload(); + }); + } - window.fetch("/api/fronter?t=add&d=" + window.currentWorkingDate + "&m=" + id + "&s=" + system).then(() => { - location.reload(); - }); - } + function confirmCofronterAdd(system, id) { + Array.from(document.getElementsByClassName("new-cofronter-link")).forEach((i) => { + i.classList.add("disabled"); + }); - function confirmCofronterAdd(system, id) { - Array.from(document.getElementsByClassName("new-cofronter-link")).forEach((i) => { - i.classList.add("disabled"); - }); + document.getElementById("new-cofronter-close").classList.add("disabled"); - document.getElementById("new-cofronter-close").classList.add("disabled"); + window.fetch("/api/fronter?t=cofront&d=" + window.selectedFronting["date"] + "&m=" + id + "&s=" + system + "&i=" + window.selectedFronting["index"]).then(() => { + location.reload(); + }); + } - window.fetch("/api/fronter?t=cofront&d=" + window.selectedFronting["date"] + "&m=" + id + "&s=" + system + "&i=" + window.selectedFronting["index"]).then(() => { - location.reload(); - }); - } + function deleteFronter() { + Array.from(document.getElementsByClassName("edit-fronter-link")).forEach((i) => { + i.classList.add("disabled"); + }); - function deleteFronter() { - Array.from(document.getElementsByClassName("edit-fronter-link")).forEach((i) => { - i.classList.add("disabled"); - }); + document.getElementById("edit-fronter-close").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(); + }); + } - window.fetch("/api/fronter?t=delete&d=" + window.selectedFronting["date"] + "&i=" + window.selectedFronting["index"] + "&s=" + window.selectedFronting["system"]).then(() => { - location.reload(); - }); - } + function deleteCofronter() { + Array.from(document.getElementsByClassName("edit-cofronter-link")).forEach((i) => { + i.classList.add("disabled"); + }); - function deleteCofronter() { - Array.from(document.getElementsByClassName("edit-cofronter-link")).forEach((i) => { - i.classList.add("disabled"); - }); + document.getElementById("edit-cofronter-close").classList.add("disabled"); - document.getElementById("edit-cofronter-close").classList.add("disabled"); + window.fetch("/api/fronter?t=codelete&d=" + window.selectedFronting["date"] + "&i=" + window.selectedFronting["index"] + "&s=" + window.selectedFronting["system"]).then(() => { + location.reload(); + }); + } - window.fetch("/api/fronter?t=codelete&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"); + }); - function moveFronterDown() { - Array.from(document.getElementsByClassName("edit-fronter-link")).forEach((i) => { - i.classList.add("disabled"); - }); + document.getElementById("edit-fronter-close").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(); + }); + } - window.fetch("/api/fronter?t=down&d=" + window.selectedFronting["date"] + "&i=" + window.selectedFronting["index"] + "&s=" + window.selectedFronting["system"]).then(() => { - location.reload(); - }); - } + function moveFronterBottom() { + Array.from(document.getElementsByClassName("edit-fronter-link")).forEach((i) => { + i.classList.add("disabled"); + }); - function moveFronterBottom() { - Array.from(document.getElementsByClassName("edit-fronter-link")).forEach((i) => { - i.classList.add("disabled"); - }); + document.getElementById("edit-fronter-close").classList.add("disabled"); - document.getElementById("edit-fronter-close").classList.add("disabled"); + window.fetch("/api/fronter?t=bottom&d=" + window.selectedFronting["date"] + "&i=" + window.selectedFronting["index"] + "&s=" + window.selectedFronting["system"]).then(() => { + location.reload(); + }); + } - window.fetch("/api/fronter?t=bottom&d=" + window.selectedFronting["date"] + "&i=" + window.selectedFronting["index"] + "&s=" + window.selectedFronting["system"]).then(() => { - location.reload(); - }); - } + function viewFronterPage() { + let id = fronting[window.selectedFronting["system"] === "ynmuc" ? "cloudburst" : "raindrops"][window.selectedFronting["date"]][window.selectedFronting["index"]][0]; + location.href = "/" + id; + } - function viewFronterPage() { - let id = fronting[window.selectedFronting["system"] === "ynmuc" ? "cloudburst" : "raindrops"][window.selectedFronting["date"]][window.selectedFronting["index"]][0]; - location.href = "/" + id; - } + function viewCofronterPage() { + let id = fronting[window.selectedFronting["system"] === "ynmuc" ? "cloudburst" : "raindrops"][window.selectedFronting["date"]][window.selectedFronting["index"]][1]; + location.href = "/" + id; + } - function viewCofronterPage() { - let id = fronting[window.selectedFronting["system"] === "ynmuc" ? "cloudburst" : "raindrops"][window.selectedFronting["date"]][window.selectedFronting["index"]][1]; - location.href = "/" + id; - } + function moveFronterUp() { + Array.from(document.getElementsByClassName("edit-fronter-link")).forEach((i) => { + i.classList.add("disabled"); + }); - function moveFronterUp() { - Array.from(document.getElementsByClassName("edit-fronter-link")).forEach((i) => { - i.classList.add("disabled"); - }); + document.getElementById("edit-fronter-close").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(); + }); + } - window.fetch("/api/fronter?t=up&d=" + window.selectedFronting["date"] + "&i=" + window.selectedFronting["index"] + "&s=" + window.selectedFronting["system"]).then(() => { - location.reload(); - }); - } + function moveFronterTop() { + Array.from(document.getElementsByClassName("edit-fronter-link")).forEach((i) => { + i.classList.add("disabled"); + }); - function moveFronterTop() { - Array.from(document.getElementsByClassName("edit-fronter-link")).forEach((i) => { - i.classList.add("disabled"); - }); + document.getElementById("edit-fronter-close").classList.add("disabled"); - document.getElementById("edit-fronter-close").classList.add("disabled"); + window.fetch("/api/fronter?t=top&d=" + window.selectedFronting["date"] + "&i=" + window.selectedFronting["index"] + "&s=" + window.selectedFronting["system"]).then(() => { + location.reload(); + }); + } + </script> - window.fetch("/api/fronter?t=top&d=" + window.selectedFronting["date"] + "&i=" + window.selectedFronting["index"] + "&s=" + window.selectedFronting["system"]).then(() => { - location.reload(); - }); - } -</script> + <div class="modal" id="new-fronter" data-bs-backdrop="static" data-bs-keyboard="false"> + <div class="modal-dialog"> + <div class="modal-content"> -<div class="modal" 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-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="modal-body"> - <p class="text-muted">Adding for the <span id="new-fronter-system">n/a</span></p> + <input type="text" placeholder="Search for a pony..." class="form-control" style="margin-bottom:15px;color:white;background:#111;border-color:#222;" id="search"> - <input type="text" placeholder="Search for a pony..." class="form-control" style="margin-bottom:15px;color:white;background:#111;border-color:#222;" id="search"> + <div id="list"> + <div class="list-group"> + <?php foreach (array_filter(scoreOrderGlobal(), function ($i) { return $i["system"] === "gdapd" || $i["system"] === "ynmuc"; }) as $member): ?> + <a id="list-pony-<?= $member['id'] ?>" onclick="confirmFronterAdd(window.addSystem, '<?= $member['id'] ?>');" class="new-fronter-link list-group-item list-group-item-action"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?><peh-schedule-add></peh-schedule-add></a> + <?php endforeach; $member = getSystemMember("gdapd", "irxyh") ?> + <a id="list-pony-irxyh" onclick="confirmFronterAdd(window.addSystem, 'irxyh');" class="new-fronter-link list-group-item list-group-item-action"><img src="/assets/logo/newlogo3.png" style="filter:grayscale(1);width:24px;"> <span style="opacity:.75">Multiple merged members</span></a> + <a id="list-pony-zdtsg" onclick="confirmFronterAdd(window.addSystem, 'zdtsg');" class="new-fronter-link list-group-item list-group-item-action"><img src="/assets/logo/newlogo3.png" style="filter:grayscale(1);width:24px;"> <span style="opacity:.75">Other/unknown</span></a> + </div> + </div> - <div id="list"> - <div class="list-group"> - <?php foreach (array_filter(scoreOrderGlobal(), function ($i) { return $i["system"] === "gdapd" || $i["system"] === "ynmuc"; }) as $member): ?> - <a id="list-pony-<?= $member['id'] ?>" onclick="confirmFronterAdd(window.addSystem, '<?= $member['id'] ?>');" class="new-fronter-link list-group-item list-group-item-action"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?><peh-schedule-add></peh-schedule-add></a> - <?php endforeach; $member = getSystemMember("gdapd", "irxyh") ?> - <a id="list-pony-irxyh" onclick="confirmFronterAdd(window.addSystem, 'irxyh');" class="new-fronter-link list-group-item list-group-item-action"><img src="/assets/logo/newlogo3.png" style="filter:grayscale(1);width:24px;"> <span style="opacity:.75">Multiple merged members</span></a> - <a id="list-pony-zdtsg" onclick="confirmFronterAdd(window.addSystem, 'zdtsg');" class="new-fronter-link list-group-item list-group-item-action"><img src="/assets/logo/newlogo3.png" style="filter:grayscale(1);width:24px;"> <span style="opacity:.75">Other/unknown</span></a> + <div id="search-results" class="list-group"></div> + <div id="associated-results" class="list-group"></div> </div> - </div> - <div id="search-results" class="list-group"></div> - <div id="associated-results" class="list-group"></div> + </div> </div> - </div> - </div> -</div> -<div class="modal" id="new-cofronter" data-bs-backdrop="static" data-bs-keyboard="false"> - <div class="modal-dialog"> - <div class="modal-content"> + <div class="modal" id="new-cofronter" 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 co-fronter <span id="new-cofronter-date">n/a</span> with <span id="new-cofronter-main">n/a</span></h4> - <button id="new-cofronter-close" type="button" class="btn-close" data-bs-dismiss="modal"></button> - </div> + <div class="modal-header"> + <h4 class="modal-title">Add new co-fronter <span id="new-cofronter-date">n/a</span> with <span id="new-cofronter-main">n/a</span></h4> + <button id="new-cofronter-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-cofronter-system">n/a</span></p> + <div class="modal-body"> + <p class="text-muted">Adding for the <span id="new-cofronter-system">n/a</span></p> - <input type="text" placeholder="Search for a pony..." class="form-control" style="margin-bottom:15px;color:white;background:#111;border-color:#222;" id="search2"> + <input type="text" placeholder="Search for a pony..." class="form-control" style="margin-bottom:15px;color:white;background:#111;border-color:#222;" id="search2"> - <div id="list2"> - <div class="list-group"> - <?php foreach (array_filter(scoreOrderGlobal(), function ($i) { return $i["system"] === "gdapd" || $i["system"] === "ynmuc"; }) as $member): ?> - <a id="list2-pony-<?= $member['id'] ?>" onclick="confirmCofronterAdd(window.addSystem, '<?= $member['id'] ?>');" class="new-cofronter-link list-group-item list-group-item-action"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?><peh-schedule-add></peh-schedule-add></a> - <?php endforeach; $member = getSystemMember("gdapd", "irxyh") ?> + <div id="list2"> + <div class="list-group"> + <?php foreach (array_filter(scoreOrderGlobal(), function ($i) { return $i["system"] === "gdapd" || $i["system"] === "ynmuc"; }) as $member): ?> + <a id="list2-pony-<?= $member['id'] ?>" onclick="confirmCofronterAdd(window.addSystem, '<?= $member['id'] ?>');" class="new-cofronter-link list-group-item list-group-item-action"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?><peh-schedule-add></peh-schedule-add></a> + <?php endforeach; $member = getSystemMember("gdapd", "irxyh") ?> + </div> + </div> + + <div id="search2-results" class="list-group"></div> </div> - </div> - <div id="search2-results" class="list-group"></div> + </div> </div> - </div> - </div> -</div> -<div class="modal" id="edit-fronter" data-bs-backdrop="static" data-bs-keyboard="false"> - <div class="modal-dialog"> - <div class="modal-content"> + <div class="modal" 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-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 <?= $isLowerLoggedIn ? "disabled" : "" ?>" 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 <?= $isLowerLoggedIn ? "disabled" : "" ?>" onclick="moveFronterTop();"> + <img src="/assets/icons/top.svg" style="width:24px;filter:invert(1);vertical-align: middle;"> + <span style="vertical-align: middle;">Move to the top</span> + </a> + <a class="list-group-item list-group-item-action edit-fronter-link <?= $isLowerLoggedIn ? "disabled" : "" ?>" 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 <?= $isLowerLoggedIn ? "disabled" : "" ?>" 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> + <a class="list-group-item list-group-item-action edit-fronter-link <?= $isLowerLoggedIn ? "disabled" : "" ?>" onclick="moveFronterBottom();"> + <img src="/assets/icons/bottom.svg" style="width:24px;filter:invert(1);vertical-align: middle;"> + <span style="vertical-align: middle;">Move to the bottom</span> + </a> + <a class="list-group-item list-group-item-action edit-fronter-link" onclick="viewFronterPage();"> + <img src="/assets/icons/page.svg" style="width:24px;filter:invert(1);vertical-align: middle;"> + <span style="vertical-align: middle;">View page</span> + </a> + </div> + </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 <?= $isLowerLoggedIn ? "disabled" : "" ?>" 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 <?= $isLowerLoggedIn ? "disabled" : "" ?>" onclick="moveFronterTop();"> - <img src="/assets/icons/top.svg" style="width:24px;filter:invert(1);vertical-align: middle;"> - <span style="vertical-align: middle;">Move to the top</span> - </a> - <a class="list-group-item list-group-item-action edit-fronter-link <?= $isLowerLoggedIn ? "disabled" : "" ?>" 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 <?= $isLowerLoggedIn ? "disabled" : "" ?>" 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> - <a class="list-group-item list-group-item-action edit-fronter-link <?= $isLowerLoggedIn ? "disabled" : "" ?>" onclick="moveFronterBottom();"> - <img src="/assets/icons/bottom.svg" style="width:24px;filter:invert(1);vertical-align: middle;"> - <span style="vertical-align: middle;">Move to the bottom</span> - </a> - <a class="list-group-item list-group-item-action edit-fronter-link" onclick="viewFronterPage();"> - <img src="/assets/icons/page.svg" style="width:24px;filter:invert(1);vertical-align: middle;"> - <span style="vertical-align: middle;">View page</span> - </a> </div> </div> - </div> - </div> -</div> -<div class="modal" id="edit-cofronter" data-bs-backdrop="static" data-bs-keyboard="false"> - <div class="modal-dialog"> - <div class="modal-content"> + <div class="modal" id="edit-cofronter" 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-cofronter-name">n/a</span> fronting with <span id="edit-cofronter-name2">n/a</span> in <span id="edit-cofronter-pos">n/a</span> <span id="edit-cofronter-date">n/a</span></h4> - <button id="edit-cofronter-close" type="button" class="btn-close" data-bs-dismiss="modal"></button> - </div> + <div class="modal-header"> + <h4 class="modal-title">Edit <span id="edit-cofronter-name">n/a</span> fronting with <span id="edit-cofronter-name2">n/a</span> in <span id="edit-cofronter-pos">n/a</span> <span id="edit-cofronter-date">n/a</span></h4> + <button id="edit-cofronter-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-cofronter-system">n/a</span></p> + + <div class="list-group" id="list-cloudburst"> + <a class="list-group-item list-group-item-action edit-cofronter-link <?= $isLowerLoggedIn ? "disabled" : "" ?>" onclick="deleteCofronter();"> + <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-cofronter-link" onclick="viewCofronterPage();"> + <img src="/assets/icons/page.svg" style="width:24px;filter:invert(1);vertical-align: middle;"> + <span style="vertical-align: middle;">View page</span> + </a> + </div> + </div> - <div class="modal-body"> - <p class="text-muted">Editing for the <span id="edit-cofronter-system">n/a</span></p> - - <div class="list-group" id="list-cloudburst"> - <a class="list-group-item list-group-item-action edit-cofronter-link <?= $isLowerLoggedIn ? "disabled" : "" ?>" onclick="deleteCofronter();"> - <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-cofronter-link" onclick="viewCofronterPage();"> - <img src="/assets/icons/page.svg" style="width:24px;filter:invert(1);vertical-align: middle;"> - <span style="vertical-align: middle;">View page</span> - </a> </div> </div> - </div> - </div> -</div> - -<script src="/assets/editor/fuse.js"></script> -<!--suppress JSUnresolvedFunction --> -<script> - window.poniesList = JSON.parse(atob(`<?= base64_encode(json_encode(array_values(scoreOrderGlobal()))) ?>`)); - - const fuse = new Fuse(window.poniesList, { - includeScore: true, - keys: [ - { - name: 'name', - weight: 1 - }, - { - name: 'display_name', - weight: 1 - }, - { - name: 'id', - weight: 0.7 - }, - { - name: 'species', - weight: 0.5 - } - ] - }) - - function search(event) { - if (event.key === "Enter") { - return; - } - let query = document.getElementById("search").value; - let results = fuse.search(query).map((i) => { - return { - id: i.item.id, - score: i.score - }; - }); + <script src="/assets/editor/fuse.js"></script> + <!--suppress JSUnresolvedFunction --> + <script> + window.poniesList = JSON.parse(atob(`<?= base64_encode(json_encode(array_values(scoreOrderGlobal()))) ?>`)); + + const fuse = new Fuse(window.poniesList, { + includeScore: true, + keys: [ + { + name: 'name', + weight: 1 + }, + { + name: 'display_name', + weight: 1 + }, + { + name: 'id', + weight: 0.7 + }, + { + name: 'species', + weight: 0.5 + } + ] + }) - let unfiltered = results; + function search(event) { + if (event.key === "Enter") { + return; + } - results = results.filter((i) => { - return i.score < 0.7; - }); + let query = document.getElementById("search").value; + let results = fuse.search(query).map((i) => { + return { + id: i.item.id, + score: i.score + }; + }); - console.log("Before:", unfiltered, "After:", results); + let unfiltered = results; - document.getElementById("list").style.display = "none"; - document.getElementById("search-results").style.display = "block"; - document.getElementById("search-results").innerHTML = ""; + results = results.filter((i) => { + return i.score < 0.7; + }); - for (let result of results) { - if (document.getElementById("list-pony-" + result.id)) document.getElementById("search-results").innerHTML += document.getElementById("list-pony-" + result.id).outerHTML; - } + console.log("Before:", unfiltered, "After:", results); - console.log(results); + document.getElementById("list").style.display = "none"; + document.getElementById("search-results").style.display = "block"; + document.getElementById("search-results").innerHTML = ""; - if (query.trim() === "") { - document.getElementById("list").style.display = "block"; - getSuggestedPonies(); - document.getElementById("search-results").style.display = "none"; - } - } + for (let result of results) { + if (document.getElementById("list-pony-" + result.id)) document.getElementById("search-results").innerHTML += document.getElementById("list-pony-" + result.id).outerHTML; + } - document.getElementById("search").onchange = document.getElementById("search").onkeyup = document.getElementById("search").onkeydown = search; + console.log(results); - document.getElementById("search").addEventListener("keydown", (event) => { - if (event.key === "Enter") { - document.querySelector("#search-results .new-fronter-link").click(); - event.preventDefault(); - } - }); + if (query.trim() === "") { + document.getElementById("list").style.display = "block"; + getSuggestedPonies(); + document.getElementById("search-results").style.display = "none"; + } + } - function search2(event) { - if (event.key === "Enter") { - return; - } + document.getElementById("search").onchange = document.getElementById("search").onkeyup = document.getElementById("search").onkeydown = search; - let query = document.getElementById("search2").value; - let results = fuse.search(query).map((i) => { - return { - id: i.item.id, - score: i.score - }; - }); + document.getElementById("search").addEventListener("keydown", (event) => { + if (event.key === "Enter") { + document.querySelector("#search-results .new-fronter-link").click(); + event.preventDefault(); + } + }); - let unfiltered = results; + function search2(event) { + if (event.key === "Enter") { + return; + } - results = results.filter((i) => { - return i.score < 0.7; - }); + let query = document.getElementById("search2").value; + let results = fuse.search(query).map((i) => { + return { + id: i.item.id, + score: i.score + }; + }); - console.log("Before:", unfiltered, "After:", results); + let unfiltered = results; - document.getElementById("list2").style.display = "none"; - document.getElementById("search2-results").style.display = "block"; - document.getElementById("search2-results").innerHTML = ""; + results = results.filter((i) => { + return i.score < 0.7; + }); - for (let result of results) { - document.getElementById("search2-results").innerHTML += document.getElementById("list2-pony-" + result.id).outerHTML; - } + console.log("Before:", unfiltered, "After:", results); - console.log(results); + document.getElementById("list2").style.display = "none"; + document.getElementById("search2-results").style.display = "block"; + document.getElementById("search2-results").innerHTML = ""; - if (query.trim() === "") { - document.getElementById("list2").style.display = "block"; - document.getElementById("search2-results").style.display = "none"; - } - } + for (let result of results) { + document.getElementById("search2-results").innerHTML += document.getElementById("list2-pony-" + result.id).outerHTML; + } - document.getElementById("search2").onchange = document.getElementById("search2").onkeyup = document.getElementById("search2").onkeydown = search2; + console.log(results); - document.getElementById("search2").addEventListener("keydown", (event) => { - if (event.key === "Enter") { - document.querySelector("#search2-results .new-cofronter-link").click(); - event.preventDefault(); - } - }); -</script> + if (query.trim() === "") { + document.getElementById("list2").style.display = "block"; + document.getElementById("search2-results").style.display = "none"; + } + } + + document.getElementById("search2").onchange = document.getElementById("search2").onkeyup = document.getElementById("search2").onkeydown = search2; -<?php + document.getElementById("search2").addEventListener("keydown", (event) => { + if (event.key === "Enter") { + document.querySelector("#search2-results .new-cofronter-link").click(); + event.preventDefault(); + } + }); + </script> + + <?php $cache["content"] = ob_get_contents(); $cache["day"] = date('Y-m-d'); ob_end_clean(); } -echo($cache["content"]); -file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/planner.json", json_encode($cache)); + echo($cache["content"]); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/planner.json", json_encode($cache)); -file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/ynmuc.json", json_encode($cloudburst)); -file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/gdapd.json", json_encode($raindrops)); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/ynmuc.json", json_encode($cloudburst)); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/gdapd.json", json_encode($raindrops)); -?>
\ No newline at end of file + ?> +</div>
\ No newline at end of file |