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/member/hierarchy.inc | |
parent | 2162eaa06f7e4764eb3dcfe130ec2c711d0c62ab (diff) | |
download | pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.tar.gz pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.tar.bz2 pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.zip |
Update
Diffstat (limited to 'includes/member/hierarchy.inc')
-rw-r--r-- | includes/member/hierarchy.inc | 177 |
1 files changed, 177 insertions, 0 deletions
diff --git a/includes/member/hierarchy.inc b/includes/member/hierarchy.inc new file mode 100644 index 0000000..dfb42c9 --- /dev/null +++ b/includes/member/hierarchy.inc @@ -0,0 +1,177 @@ +<?php global $system; +global $systemCommonName; +global $systemID; +global $member; +global $memberData; +global $memberCommonName; +global $memberID; +$title = "Member hierarchy · " . $memberCommonName . " · " . $systemCommonName; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; + +$travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); + +$metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $memberID . ".json"), true)); + +$allMembers = scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "/members.json"), true), $systemID); +$allMembers2 = scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "/members.json"), true), $systemID === "gdapd" ? "ynmuc" : "gdapd"); + +$systemCommonData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "/general.json"), true); + +if ($travelling[$memberID]["travelling"]) { + $allMembers = scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "/members.json"), true), $systemID === "gdapd" ? "ynmuc" : "gdapd"); + $allMembers2 = scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "/members.json"), true), $systemID); + + $systemCommonData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "/general.json"), true); + + $system = $systemID === "gdapd" ? "cloudburst" : "raindrops"; + $systemCommonName = $systemID === "gdapd" ? "Cloudburst System" : "Raindrops System"; +} + +?> + + <br> + <div class="container"> + <h2><?= getMiniName($memberCommonName) ?>'s hierarchy</h2> + <br> + + <?php + + $takingCare = [ + ...array_filter($allMembers, function ($i) use ($systemID, $memberData) { + return in_array($systemID . "/" . $memberData["id"], $i["_metadata"]["caretakers"]) && $i["id"] !== $memberData["id"]; + }), + ...array_filter($allMembers2, function ($i) use ($systemID, $memberData) { + return in_array($systemID . "/" . $memberData["id"], $i["_metadata"]["caretakers"]) && $i["id"] !== $memberData["id"]; + }) + ]; + + $protected = array_filter($allMembers, function ($i) use ($memberData) { + return $i["_metadata"]["protector"] && $i["id"] !== $memberData["id"]; + }); + + $caretakers = array_map(function ($i) { + return getSystemMember(explode("/", $i)[0], explode("/", $i)[1]); + }, $metadata["caretakers"]); + + ?> + + <p class="text-muted" style="text-align: center;"><b>Part of:</b></p> + <div class="row"> + <div class="cell" style="width:20%;display:inline-block;margin-left:auto;margin-right:auto;"> + <a href="/<?= $system ?>" style="text-decoration:none !important;filter:none !important;"> + <div class="hpd-item-card" + style="background-color:rgba(255, 255, 255, .1);border:1px solid #<?= $systemCommonData["color"] ?? "ffffff" ?>55;outline-color:#<?= $systemCommonData["color"] ?? "ffffff" ?>55;border-radius:10px;text-align:center;display:flex;align-items:center;justify-content:center;padding:5px;"> + <div> + <img alt="" + src="/assets/uploads/<?= $system ?>.png" + style="height:48px;display:block;margin-left:auto;margin-right:auto;"> + <div style="text-decoration:none;color:white;margin-top:5px;"><?= $systemCommonName ?></div> + </div> + </div> + </a> + </div> + </div> + + <hr> + + <?php if (count($protected) > 0): ?> + <p class="text-muted" style="text-align: center;"><b>Protected by:</b></p> + <div class="row"> + <?php foreach ($protected as $selectedMember): ?> + <div class="cell" style="width:20%;display:inline-block;margin-left:auto;margin-right:auto;"> + <?php showMembersFromList([$selectedMember]) ?> + </div> + <?php endforeach; ?> + </div> + + <hr> + <?php endif; ?> + + <?php if (count($caretakers) > 0): ?> + <p class="text-muted" style="text-align: center;"><b>Taken care of by:</b></p> + <div class="row"> + <?php foreach ($caretakers as $selectedMember): ?> + <div class="cell" style="width:20%;display:inline-block;margin-left:auto;margin-right:auto;"> + <?php showMembersFromList([$selectedMember]) ?> + </div> + <?php endforeach; ?> + </div> + + <hr> + <?php endif; ?> + + <p class="text-muted" style="text-align: center;"><b>Member:</b></p> + <div class="row"> + <div class="cell" style="width:20%;display:inline-block;margin-left:auto;margin-right:auto;"> + <?php showMembersFromList([$memberData]) ?> + </div> + </div> + + <?php if (count($takingCare) > 0): ?> + <hr> + + <p class="text-muted" style="text-align: center;"><b>Taking care of:</b></p> + <div class="row"> + <?php foreach ($takingCare as $selectedMember): ?> + <div class="cell" style="width:20%;display:inline-block;margin-left:auto;margin-right:auto;"> + <?php showMembersFromList([$selectedMember]) ?> + </div> + <?php endforeach; ?> + </div> + <?php endif; ?> + </div> + + <style> + .row { + margin-bottom: 20px; + } + + @media (max-width: 750px) { + #hpd-cloudburst > div, #hpd-raindrops > div { + grid-template-columns: repeat(1, 1fr) !important; + } + + .hpd-item-card img { + display: inline-block !important; + margin-right: 5px !important; + height: 32px !important; + } + + #hpd-cloudburst > div, #hpd-raindrops > div { + grid-gap: 5px !important; + } + + .hpd-item-card div { + display: inline-block !important; + } + + .hpd-item-card div:nth-child(3)::before { + content: "("; + padding-left: 5px; + color: white !important; + } + + .hpd-item-card div:nth-child(3)::after { + content: ")"; + color: white !important; + } + + div.cell { + grid-row-gap: 5px !important; + width: 100% !important; + margin-bottom: 5px; + } + + div.cell:nth-last-child(1) { + margin-bottom: 0 !important; + } + } + + @media (max-width: 997px) { + .cell { + width: 30% !important; + } + } + </style> + +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file |