diff options
Diffstat (limited to 'pages/byfront.inc')
-rw-r--r-- | pages/byfront.inc | 43 |
1 files changed, 2 insertions, 41 deletions
diff --git a/pages/byfront.inc b/pages/byfront.inc index beb9275..0974091 100644 --- a/pages/byfront.inc +++ b/pages/byfront.inc @@ -12,52 +12,13 @@ global $app; global $_PROFILE; <h2>Members by last fronted</h2> <select id="selected-system" class="form-select" style="margin-bottom: 20px;" onchange="refreshList()"> <option value="gdapd" <?= $_PROFILE["login"] === "raindrops" ? "select" : "" ?>>Raindrops System</option> - <option value="hrbom" <?= $_PROFILE["login"] === "Moonwind" ? "select" : "" ?>>Moonglow</option> - <option value="<?= $app["other"]["id"] ?>" <?= $_PROFILE["login"] !== "raindrops" && $_PROFILE["login"] !== "cloudburst" && $_PROFILE["login"] !== "Moonwind" ? "select" : "" ?>><?= $app["other"]["name"] ?></option> - <option value="ynmuc" <?= $_PROFILE["login"] === "cloudburst" ? "select" : "" ?>>Cloudburst System</option> + <option value="hrbom" <?= $_PROFILE["login"] === "Moonglow" ? "select" : "" ?>>Moonglow</option> + <option value="<?= $app["other"]["id"] ?>" <?= $_PROFILE["login"] === $app["other"]["user"] ? "select" : "" ?>><?= $app["other"]["name"] ?></option> <option value="">(all systems)</option> </select> <?php $members = [ ...array_map(function ($i) { - $system = "ynmuc"; - $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) { - return $i["_system"] === "ynmuc"; - }))), - ...array_map(function ($i) { $system = "gdapd"; $i["_lastFronted"] = -1; $id = $i["id"]; |