summaryrefslogtreecommitdiff
path: root/pages/byfront.inc
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-10-10 20:51:39 +0200
committerMinteck <contact@minteck.org>2022-10-10 20:51:39 +0200
commit108525534c28013cfe1897c30e4565f9893f3766 (patch)
treedd3e5132971f96ab5f05e7f3f8f6dbbf379a19bd /pages/byfront.inc
parent2162eaa06f7e4764eb3dcfe130ec2c711d0c62ab (diff)
downloadpluralconnect-108525534c28013cfe1897c30e4565f9893f3766.tar.gz
pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.tar.bz2
pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.zip
Update
Diffstat (limited to 'pages/byfront.inc')
-rw-r--r--pages/byfront.inc160
1 files changed, 160 insertions, 0 deletions
diff --git a/pages/byfront.inc b/pages/byfront.inc
new file mode 100644
index 0000000..280d981
--- /dev/null
+++ b/pages/byfront.inc
@@ -0,0 +1,160 @@
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn;
+require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
+$travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true);
+
+?>
+
+<br>
+<div class="container">
+ <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];
+ }
+
+ 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 $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; ?>
+
+ <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>
+
+ <style>
+ @media (max-width: 991px) {
+ .relation {
+ grid-template-columns: 1fr !important;
+ }
+
+ .relation-intro {
+ text-align: center;
+ border-bottom-left-radius: 0 !important;
+ border-top-right-radius: 10px;
+ border-right: none !important;
+ border-bottom: 1px solid rgba(255, 255, 255, .1);
+ }
+
+ .relation-item-marefriends {
+ margin-top: 20px !important;
+ }
+
+ .relation-item {
+ margin-top: 10px;
+ margin-left: 0 !important;
+ padding: 10px 0 !important;
+ text-align: center;
+ }
+ }
+ </style>
+</div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>