summaryrefslogtreecommitdiff
path: root/includes/components/planner.inc
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-04-24 14:03:36 +0200
committerRaindropsSys <contact@minteck.org>2023-04-24 14:03:36 +0200
commit633c92eae865e957121e08de634aeee11a8b3992 (patch)
tree09d881bee1dae0b6eee49db1dfaf0f500240606c /includes/components/planner.inc
parentc4657e4509733699c0f26a3c900bab47e915d5a0 (diff)
downloadpluralconnect-633c92eae865e957121e08de634aeee11a8b3992.tar.gz
pluralconnect-633c92eae865e957121e08de634aeee11a8b3992.tar.bz2
pluralconnect-633c92eae865e957121e08de634aeee11a8b3992.zip
Updated 18 files, added 1692 files and deleted includes/system/compare.inc (automated)
Diffstat (limited to 'includes/components/planner.inc')
-rw-r--r--includes/components/planner.inc42
1 files changed, 31 insertions, 11 deletions
diff --git a/includes/components/planner.inc b/includes/components/planner.inc
index 36a21ae..e82fdd6 100644
--- a/includes/components/planner.inc
+++ b/includes/components/planner.inc
@@ -288,7 +288,12 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis
<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 {
@@ -470,16 +475,23 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis
<h2>Front planner</h2>
<table id="planner">
<tbody>
- <?php day("Yesterday", -1) ?>
- <?php day("Today", 0) ?>
- <?php day("Tomorrow", 1) ?>
- <?php day(date('l', time() + 86400 * 2), 2) ?>
- <?php day(date('l', time() + 86400 * 3), 3) ?>
- <?php day(date('l', time() + 86400 * 4), 4) ?>
- <?php day(date('l', time() + 86400 * 5), 5) ?>
- <?php day(date('l', time() + 86400 * 6), 6) ?>
- <?php day(date('l', time() + 86400 * 7), 7) ?>
- <?php day(date('l', time() + 86400 * 8), 8) ?>
+ <?php
+ day("Yesterday", -1);
+ day("Today", 0);
+ day("Tomorrow", 1);
+ day(date('l j', time() + 86400 * 2), 2);
+ day(date('l j', time() + 86400 * 3), 3);
+ day(date('l j', time() + 86400 * 4), 4);
+ day(date('l j', time() + 86400 * 5), 5);
+ day(date('l j', time() + 86400 * 6), 6);
+ day(date('l j', time() + 86400 * 7), 7);
+ day(date('l j', time() + 86400 * 8), 8);
+ day(date('l j', time() + 86400 * 9), 9);
+ day(date('l j', time() + 86400 * 10), 10);
+ day(date('l j', time() + 86400 * 11), 11);
+ day(date('l j', time() + 86400 * 12), 12);
+
+ ?>
</tbody>
</table>
@@ -1075,6 +1087,14 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis
<?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));
+
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));