From 5f18267c7ebbbb55288d793e84402f5ee86fcafd Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Fri, 22 Dec 2023 21:45:24 +0100 Subject: Updated pages/byfront.inc (automated) --- pages/byfront.inc | 121 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 103 insertions(+), 18 deletions(-) (limited to 'pages') diff --git a/pages/byfront.inc b/pages/byfront.inc index d3b8bf0..beb9275 100644 --- a/pages/byfront.inc +++ b/pages/byfront.inc @@ -2,7 +2,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; -$travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); +global $app; global $_PROFILE; ?> @@ -10,6 +10,13 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ

Members by last fronted

+ 0) { + $thisIndex = array_search($thisMember[0], $switches); + + $frontingStart = $thisMember[0]; + $frontingEnd = $switches[$thisIndex - 1]; + } + + if ($frontingEnd !== null && isset($frontingStart)) { + $i["_lastFronted"] = strtotime($frontingEnd["timestamp"]); + } + } + + return $i; + }, array_values(array_filter(scoreOrderGlobal(), function ($i) { + return $i["_system"] === "hrbom"; + }))), + ...array_map(function ($i) { + global $app; + $system = $app["other"]["id"]; + $i["_lastFronted"] = -1; + $id = $i["id"]; + $memberData = $i; + + $fronters = array_map(function ($item) { + return $item["id"]; + }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json"), true)["members"]); + + if (in_array($id, $fronters)) { + $i["_lastFronted"] = time(); + } else { + $switches = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/switches.json"), true); + + $thisMember = array_filter($switches, function ($item) use ($memberData) { + return in_array($memberData["id"], $item["members"]); + }); + + $thisMember = array_values($thisMember); + $frontingEnd = null; + + if (count($thisMember) > 0) { + $thisIndex = array_search($thisMember[0], $switches); + + $frontingStart = $thisMember[0]; + $frontingEnd = $switches[$thisIndex - 1]; + } + + if ($frontingEnd !== null && isset($frontingStart)) { + $i["_lastFronted"] = strtotime($frontingEnd["timestamp"]); + } + } + + return $i; + }, array_values(array_filter(scoreOrderGlobal(), function ($i) { + global $app; + return $i["_system"] === $app["other"]["id"]; }))) ]; uasort($members, function ($a, $b) { return $b["_lastFronted"] - $a["_lastFronted"]; - }); $members = array_reverse($members); foreach ($members as $member): if ($member["_lastFronted"] <= time() - 86400 * 21): + }); $members = array_reverse($members); foreach ($members as $member): $metadata = $member["_metadata"];?> -
+
" class="relation" style="display: none; margin-bottom:10px;padding:10px;border-radius:10px;grid-template-columns: 1fr 2fr max-content;"> "> " style="width:24px;">  @@ -106,23 +191,23 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ
-
time() - 86400 * 21): + - $metadata = $member["_metadata"];?> -
- "> - " style="width:24px;">  - +