From eb89b15c0f044673c1206a418a21d0baba1a675e Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Sun, 12 Mar 2023 19:16:53 +0100 Subject: Updated 104 files, added 3 files, deleted 4 files and renamed 36 files (automated) --- includes/components/planner.inc | 1046 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 1046 insertions(+) create mode 100644 includes/components/planner.inc (limited to 'includes/components/planner.inc') diff --git a/includes/components/planner.inc b/includes/components/planner.inc new file mode 100644 index 0000000..a7ec44f --- /dev/null +++ b/includes/components/planner.inc @@ -0,0 +1,1046 @@ +"; + } + + 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; + } + + if (isset($cloudburst[$id][$index][1])) { + $array[1] = $cloudburst[$id][$index][1]; + } else { + $array[1] = null; + } + + $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; + } + + $raindrops[$id][$index] = $array; + } + } + } +} + +$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"; + + $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; + } else { + $ampm = "am"; + } + } + + 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; + + $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"]]) . " (your time)"; + } + + if (isset($school[$day]["sleep"]["timestamp"])) { + $parts[] = "sleeping at " . formatTime($school[$day]["sleep"][$_PROFILE["login"]]) . " (your time)"; + } + } + + if ($isLowerLoggedIn) $parts = []; + + if (count($parts) > 0) { + if ($first) { + return ucfirst(implode(", ", $parts)); + } else { + return " ยท " . implode(", ", $parts); + } + } else { + if ($first) { + return "-"; + } else { + return ""; + } + } +} + +function day($display, $diff): void { if ($diff < 0) $disabled = true; else $disabled = false; global $cloudburst; global $raindrops; global $isLowerLoggedIn; ?> + + style="opacity: .75; pointer-events: none;"> + +
+ + + + style="opacity: .75; pointer-events: none;"> + Cloudburst System + Raindrops System + + + style="opacity: .75; pointer-events: none;"> + + + + + colspan="3" colspan="2"> + + + Multiple merged members + + Other/unknown/fallback pony + + " style="width:24px;"> + + + + + + + + + + + + + Multiple merged members + + Other/unknown/fallback pony + + " style="width:24px;"> + + + + + + + + + + + + + + + + + + colspan="3" colspan="2"> + + Multiple merged members + + Other/unknown/fallback pony + + " style="width:24px;"> + + + + + + + + + + + + + Multiple merged members + + Other/unknown/fallback pony + + " style="width:24px;"> + + + + + + + + + + + + + + + style="opacity: .75; pointer-events: none;"> + +
+ 0 && count($dayRaindrops) > 0): ?> + will sleep with + + + +
+ + + + + +

Front planner

+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit