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/subsysbanner.inc | |
parent | 2162eaa06f7e4764eb3dcfe130ec2c711d0c62ab (diff) | |
download | pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.tar.gz pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.tar.bz2 pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.zip |
Update
Diffstat (limited to 'includes/subsysbanner.inc')
-rw-r--r-- | includes/subsysbanner.inc | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/includes/subsysbanner.inc b/includes/subsysbanner.inc new file mode 100644 index 0000000..176380f --- /dev/null +++ b/includes/subsysbanner.inc @@ -0,0 +1,70 @@ +<?php + +global $memberData; +global $memberCommonName; +global $memberID; +global $systemCommonName; +global $systemID; +global $system; +global $subsystemData; +global $subsystemID; +global $subsystem; + +$fronters = array_map(function ($item) { + return $item["id"]; +}, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/fronters.json"), true)["members"]); + +?> + +<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/ss-<?= $subsystemID ?>.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;"><?= $subsystemData["name"] ?></h3> + <div style="height:max-content;display:grid;grid-template-columns: repeat(4, 1fr);" id="member-card"> + <span> + <b>Fronter:</b> + <?php if (in_array($fronters[0], $subsystem["members"])): $member = getMember($fronters[0]); ?> + <a class="member-link" href="/<?= $member["name"] ?>"><img src="<?= getAsset($member['system'], $member["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a> + <?php else: ?> + <span class="text-muted">N/A</span> + <?php endif; ?> + </span> + <span> + <?php + + $subsystem = getSubsystemByID($subsystemID); + $arr = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/switches.json"), true), function ($i) use ($subsystem) { + return isset($i["members"][0]) && in_array($i["members"][0], $subsystem["members"]); + }); + sort($arr); + $previousID = $arr[in_array($fronters[0], $subsystem["members"]) ? 1 : 0]["members"][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; + } + } + + ?> + <b>Last fronter: </b><a class="member-link" href="/<?= $member["name"] ?>"><img src="<?= getAsset($systemID + , $member["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a> + </span> + <span> + <b>Members:</b> <?= count($subsystem["members"]) ?> + </span> + <span> + <b>Parent system:</b> <a class="member-link" href="/<?= $system ?>"><img style="width:24px;border-radius:5px;" src="/assets/uploads/<?= $system ?>.png"> <?= getMiniName($systemCommonName) ?></a> + </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;"> + <div style="padding: 5px 10px;text-align: center;"> + You are viewing the page of a subsystem of the <b><a style="color:white;text-decoration: none;" href="/<?= $system ?>"><?= $systemCommonName ?></a></b>. + </div> +</div>
\ No newline at end of file |