summaryrefslogtreecommitdiff
path: root/pages/byfront.inc
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-11-11 23:47:49 +0100
committerMinteck <contact@minteck.org>2022-11-11 23:47:49 +0100
commit209356b8ade1920b50d1d3a1a5e121c6623d167b (patch)
tree5301396987d1510f715a0b1c24754873af19e1dc /pages/byfront.inc
parent2c4ae43e688a9873e86211ea0e7aeb9ba770dd77 (diff)
downloadpluralconnect-209356b8ade1920b50d1d3a1a5e121c6623d167b.tar.gz
pluralconnect-209356b8ade1920b50d1d3a1a5e121c6623d167b.tar.bz2
pluralconnect-209356b8ade1920b50d1d3a1a5e121c6623d167b.zip
Update
Diffstat (limited to 'pages/byfront.inc')
-rw-r--r--pages/byfront.inc188
1 files changed, 88 insertions, 100 deletions
diff --git a/pages/byfront.inc b/pages/byfront.inc
index 280d981..77556a2 100644
--- a/pages/byfront.inc
+++ b/pages/byfront.inc
@@ -11,52 +11,100 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ
<div id="page-content">
<h2>Members by last fronted</h2>
- <h4>Cloudburst System</h4>
- <?php $system = "ynmuc"; $members = array_map(function ($i) use ($system) {
- $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];
+ <?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"]);
+ }
}
- 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"];
+ $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";
- }))); uasort($members, function ($a, $b) {
+ return $i;
+ }, array_values(array_filter(scoreOrderGlobal(), function ($i) {
+ return $i["_system"] === "gdapd";
+ })))
+ ]; uasort($members, function ($a, $b) {
return $b["_lastFronted"] - $a["_lastFronted"];
- }); foreach ($members as $member): ?>
- <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1fr 2fr max-content;">
+ }); $members = array_reverse($members); foreach ($members as $member): if ($member["_lastFronted"] !== -1 && $member["_lastFronted"] !== time()): ?>
+ <div class="relation" style="background-color:<?php if ($member["_lastFronted"] > time() - (86400 * 14)): ?>rgba(255, 255, 255, .1)<?php else: ?><?php if ($member["_lastFronted"] > time() - (86400 * 30)): ?>rgba(255, 227, 0, 0.17)<?php else: ?>rgba(255,55,55,0.17)<?php endif; ?>;<?php endif; ?>;margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1fr 2fr max-content;<?php if ($travelling[$member['id']]["travelling"]): ?>opacity: 0.75;<?php endif; ?>">
<a class="relation-intro" style="background-color:rgba(255, 255, 255, .05);border-right:1px solid rgba(255, 255, 255, .1);margin:-10px;padding:10px;border-top-left-radius:10px;border-bottom-left-radius:10px;color: white;display:flex;align-items:center;text-decoration: none;" href="/<?= $member["name"] ?>">
<img src="<?= getAsset($member['system'], $member["id"], "heads") ?>" style="width:24px;">&nbsp;<?= $member["display_name"] ?? $member["name"] ?>
- <?php if ($member["_metadata"]["shared_memory"] !== 2): ?>
- &nbsp;<span class="badge text-black bg-warning rounded-pill">Not sharing memory</span>
- <?php endif; ?>
+ <span style="display: inline-block;margin-left: auto;">
+ <?php if ($member["_metadata"]["shared_memory"] !== 2): ?>
+ <span class="badge text-black bg-warning rounded-pill">Memory</span>
+ <?php endif; ?>
+ <?php if ($travelling[$member['id']]["travelling"]): ?>
+ <span class="badge text-white bg-secondary rounded-pill">Travelling</span>
+ <?php endif; ?>
+ <?php if ($member["_lastFronted"] < time() - (86400 * 30)): ?>
+ <span class="badge text-white bg-danger rounded-pill">Must front</span>
+ <?php endif; ?>
+ </span>
</a>
<div class="relation-item" style="display:flex;align-items:center;margin-left:10px;padding:0 20px;">
@@ -67,67 +115,7 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ
<?php endif; ?>
</div>
</div>
- <?php endforeach; ?>
-
- <br>
- <h4>Raindrops System</h4>
- <?php $system = "gdapd"; $members = array_map(function ($i) use ($system) {
- $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"] === "gdapd";
- }))); uasort($members, function ($a, $b) {
- return $b["_lastFronted"] - $a["_lastFronted"];
- }); foreach ($members as $member): ?>
- <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1fr 2fr max-content;">
- <a class="relation-intro" style="background-color:rgba(255, 255, 255, .05);border-right:1px solid rgba(255, 255, 255, .1);margin:-10px;padding:10px;border-top-left-radius:10px;border-bottom-left-radius:10px;color: white;display:flex;align-items:center;text-decoration: none;" href="/<?= $member["name"] ?>">
- <img src="<?= getAsset($member['system'], $member["id"], "heads") ?>" style="width:24px;">&nbsp;<?= $member["display_name"] ?? $member["name"] ?>
- <?php if ($member["_metadata"]["shared_memory"] !== 2): ?>
- &nbsp;<span class="badge text-black bg-warning rounded-pill">Not sharing memory</span>
- <?php endif; ?>
- </a>
-
- <div class="relation-item" style="display:flex;align-items:center;margin-left:10px;padding:0 20px;">
- <?php if ($member["_lastFronted"] === -1): ?>
- Never fronted
- <?php else: ?>
- Last fronted <?= timeAgo($member["_lastFronted"]) ?><?php if ($member["_lastFronted"] !== time()): ?> (<?= date('l j F Y', $member["_lastFronted"]) ?>)<?php endif; ?>
- <?php endif; ?>
- </div>
- </div>
- <?php endforeach; ?>
- </div>
+ <?php endif; endforeach; ?>
<style>
@media (max-width: 991px) {