diff options
author | Minteck <contact@minteck.org> | 2022-10-10 20:51:39 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-10-10 20:51:39 +0200 |
commit | 108525534c28013cfe1897c30e4565f9893f3766 (patch) | |
tree | dd3e5132971f96ab5f05e7f3f8f6dbbf379a19bd /includes/sysbanner.inc | |
parent | 2162eaa06f7e4764eb3dcfe130ec2c711d0c62ab (diff) | |
download | pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.tar.gz pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.tar.bz2 pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.zip |
Update
Diffstat (limited to 'includes/sysbanner.inc')
-rw-r--r-- | includes/sysbanner.inc | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/includes/sysbanner.inc b/includes/sysbanner.inc new file mode 100644 index 0000000..d3caecd --- /dev/null +++ b/includes/sysbanner.inc @@ -0,0 +1,132 @@ +<?php + +global $memberData; +global $memberCommonName; +global $memberID; +global $systemCommonName; +global $systemID; +global $system; + +$travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); + +?> + +<div id="system-info" style="background:rgba(255, 255, 255, .1);border-radius:10px;display:grid;grid-template-columns: 128px 1fr;"> + <img src="/assets/uploads/<?= $system ?>.png" alt="" style="height:128px;border-top-left-radius:10px;border-bottom-left-radius:10px;"> + <div style="padding:10px 10px 10px 20px;text-align:center;"> + <div style="display: grid; grid-template-columns: 1fr;height:100%;grid-template-rows: max-content max-content 1fr;"> + <h3 style="height:max-content;"><?= $systemCommonName ?></h3> + <div style="height:max-content;display:grid;grid-template-columns: repeat(4, 1fr);" id="member-card"> + <!--<span> + <b><abbr title="Most common fronter" data-bs-toggle="tooltip">MCF</abbr>: </b><?php + + $foundHost = false; + $hostGoneTravelling = false; + + $members = array_filter(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true), $systemID), function ($i) use ($travelling) { + global $hostGoneTravelling; + if ($travelling[$i['id']]['travelling'] && $i["_metadata"]["host"]) $hostGoneTravelling = true; + return true; + }); + foreach ($members as $member) { + $data = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json"), true)); + if ($data["host"]): $foundHost = true; ?> + <a class="member-link" href="/<?= $member["name"] ?>"><img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a> + <?php endif; + } + + if (!$foundHost) echo("-"); + if ($hostGoneTravelling) echo("<br>(travelling)"); + + ?> + + </span>--> + <span> + <?php $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/fronters.json"), true); ?> + <b>Fronter: </b> + <?php if (isset($fronters["members"][0])): ?> + <?php $member = $fronters["members"][0]; ?> + <a class="member-link" href="/<?= $member["name"] ?>"><img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member["display_name"] ?? ($member["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member["name"])) ?></a> + <?php if (isset($fronters["members"][1])): ?> + <?php $member2 = $fronters["members"][1]; ?> + <br>(with + <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member2["name"])) ?></a>) + <?php endif; ?> + <?php else: ?>-<?php endif; ?> + </span> + <span> + <b>Last fronter: </b> + <?php + + $previous = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/switches.json"), true)[1]["members"]; + + if (isset($previous[0])): + $previousID = $previous[0]; + $member = null; + + foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true) as $members) { + if ($members["id"] === $previousID) { + $member = $members; + break; + } + } + + ?> + <a class="member-link" href="/<?= $member["name"] ?>"><img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member["display_name"] ?? ($member["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member["name"])) ?></a> + <?php if (isset($previous[1])): + $previousID = $previous[1]; + $member2 = null; + + foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true) as $members) { + if ($members["id"] === $previousID) { + $member2 = $members; + break; + } + } ?> + <br>(with + <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member2["name"])) ?></a>) + <?php endif; ?> + <?php else: ?>-<?php endif; ?> + </span> + <span> + <?php + + $travellers = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "/members.json"), true), function ($i) use ($travelling) { + return $travelling[$i['id']]['travelling']; + }); + + ?> + <b>Members: </b><?= count(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true), $systemID)) ?><?php + + if (count($travellers) > 0) { + echo("<br>+ " . count($travellers) . " traveller" . (count($travellers) > 1 ? "s" : "")); + } + + ?> + </span> + <span> + <b>Last switch: </b><span data-bs-toggle="tooltip" title="<?= date("D j M Y, G:i:s (e)", strtotime(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/fronters.json"), true)["timestamp"])) ?>"><?= timeAgo(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/fronters.json"), true)["timestamp"]) ?></span> + </span> + </div> + </div> + </div> +</div> + +<div id="system-actions" style="margin-top:10px;padding:5px 10px;background:rgba(255, 255, 255, .1);border-radius:10px;display:grid;grid-template-columns: 1fr 1fr 1fr 1fr;"> + <a title="Front history" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action" href="/<?= $system ?>/-/history"> + <img src="/assets/icons/history.svg" style="vertical-align: middle;height: 24px;width: 24px;filter: invert(1)" alt=""> + <span style="vertical-align: middle;" class="list-separator-desktop">Front history</span> + </a> + <a title="Compare members" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action" href="/<?= $system ?>/-/compare"> + <img src="/assets/icons/compare.svg" style="vertical-align: middle;height: 24px;width: 24px;filter: invert(1)" alt=""> + <span style="vertical-align: middle;" class="list-separator-desktop">Compare members</span> + </a> + <a title="System tree" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action" href="/<?= $system ?>/-/tree"> + <img src="/assets/icons/tree.svg" style="vertical-align: middle;height: 24px;width: 24px;filter: invert(1)" alt=""> + <span style="vertical-align: middle;" class="list-separator-desktop">System tree</span> + </a> + <a title="Members by species" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action" href="/<?= $system ?>/-/species"> + <img src="/assets/icons/species.svg" style="vertical-align: middle;height: 24px;width: 24px;filter: invert(1)" alt=""> + <span style="vertical-align: middle;" class="list-separator-desktop">Members by species</span> + </a> +</div>
\ No newline at end of file |