diff options
Diffstat (limited to 'includes/system/compare.php')
-rw-r--r-- | includes/system/compare.php | 189 |
1 files changed, 189 insertions, 0 deletions
diff --git a/includes/system/compare.php b/includes/system/compare.php new file mode 100644 index 0000000..96eb5d9 --- /dev/null +++ b/includes/system/compare.php @@ -0,0 +1,189 @@ +<?php global $system; global $systemCommonName; global $systemID; $title = "Compare members ยท " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; + +$members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-members.json"), true); + +function getMember(string $id) { + global $systemID; + global $members; + + $member = null; + + foreach ($members as $m) { + if ($m["id"] === $id) $member = $m; + } + + return $member; +} + +?> + + <br> + <div class="container"> + <h2>Compare members of the <?= $systemCommonName ?></h2> + <div class="comparison"> + <span class="comparison-header comparison-item"> + <span class="comparison-header-l0">Member</span> + <span class="comparison-header-l1">Member</span> + <span class="comparison-header-l2">Member</span> + <span class="comparison-header-l3">Member</span> + <span class="comparison-header-l4">Member</span> + <span class="comparison-header-l5">Mmbr.</span> + </span> + <span class="comparison-header comparison-item"> + <span class="comparison-header-l0">Species</span> + <span class="comparison-header-l1">Species</span> + <span class="comparison-header-l2">Species</span> + <span class="comparison-header-l3">Species</span> + <span class="comparison-header-l4">Spec.</span> + <span class="comparison-header-l5">Spec.</span> + </span> + <span class="comparison-header comparison-item"> + <span class="comparison-header-l0">Relations</span> + <span class="comparison-header-l1">Relations</span> + <span class="comparison-header-l2">Relations</span> + <span class="comparison-header-l3">Relations</span> + <span class="comparison-header-l4">Relt.</span> + <span class="comparison-header-l5">Relt.</span> + </span> + <span class="comparison-header comparison-item"> + <span class="comparison-header-l0">Host</span> + <span class="comparison-header-l1">Host</span> + <span class="comparison-header-l2">Host</span> + <span class="comparison-header-l3">Host</span> + <span class="comparison-header-l4">Hst.</span> + <span class="comparison-header-l5">Hst.</span> + </span> + <span class="comparison-header comparison-item"> + <span class="comparison-header-l0">Fictive</span> + <span class="comparison-header-l1">Fictive</span> + <span class="comparison-header-l2">Fictive</span> + <span class="comparison-header-l3">Fictive</span> + <span class="comparison-header-l4">Fic.</span> + <span class="comparison-header-l5">Fic.</span> + </span> + <span class="comparison-header comparison-item"> + <span class="comparison-header-l0">Little</span> + <span class="comparison-header-l1">Little</span> + <span class="comparison-header-l2">Little</span> + <span class="comparison-header-l3">Little</span> + <span class="comparison-header-l4">Ltl.</span> + <span class="comparison-header-l5">Ltl.</span> + </span> + <span class="comparison-header comparison-item"> + <span class="comparison-header-l0">Not talking</span> + <span class="comparison-header-l1">No talk</span> + <span class="comparison-header-l2">No talk</span> + <span class="comparison-header-l3">NT.</span> + <span class="comparison-header-l4">NT.</span> + <span class="comparison-header-l5">NT.</span> + </span> + <span class="comparison-header comparison-item"> + <span class="comparison-header-l0">Protector</span> + <span class="comparison-header-l1">Protector</span> + <span class="comparison-header-l2">Protect.</span> + <span class="comparison-header-l3">Protect.</span> + <span class="comparison-header-l4">Prt.</span> + <span class="comparison-header-l5">Prt.</span> + </span> + + <?php foreach (scoreOrder($members, $systemID) as $member): + + $metadata = $member["_metadata"]; + + if ($member["name"] === "scootaloo") { + if ((int)date('j') % 2 === 0) { + $metadata["marefriends"] = array_reverse($metadata["marefriends"]); + } + } + + ?> + <a title="<?= $member["display_name"] ?? $member["name"] ?>" data-bs-toggle="tooltip" class="member-link comparison-item comparison-item-clickable" href="/<?= $systemID === "gdapd" ? "raindrops" : "cloudburst" ?>/<?= $member["name"] ?>"> + <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <span style="vertical-align: middle;"><span class="comparison-name-full"><?= $member["display_name"] ?? $member["name"] ?></span><span class="comparison-name-small"><?= getMiniName($member["display_name"] ?? $member["name"]) ?></span></span> + <span class="comparison-colors" style="background-color: #<?= $member["color"] ?? "ffffff" ?>; height: 16px; width: 16px;display: inline-block;vertical-align: middle;border-radius:2px;"></span> + </a> + <span class="comparison-item"> + <?php foreach ($metadata["species"] ?? [] as $species): ?> + <img data-bs-toggle="tooltip" title="<?php switch ($species) { + case "earth": + echo "Earth pony"; + break; + + case "alicorn": + echo "Alicorn"; + break; + + case "pegasus": + echo "Pegasus"; + break; + + case "batpony": + echo "Bat pony"; + break; + + case "unicorn": + echo "Unicorn"; + break; + + default: + echo $species; + break; + } ?>" style="width:24px;vertical-align: middle;position:relative;top:-5px;" src="/assets/species/<?= $species ?>.png" alt="<?= $species ?>"> + <?php endforeach; ?> + </span> + <span class="comparison-item"> + <?= count($metadata["marefriends"]) + count($metadata["sisters"]) === 0 ? "-" : "" ?> + <span class="comparison-relations-count"> + <?= count($metadata["marefriends"]) + count($metadata["sisters"]) > 0 ? count($metadata["marefriends"]) + count($metadata["sisters"]) : "" ?> + </span> + <span class="comparison-relations-full"> + <?php $index = 0; foreach ($metadata["marefriends"] as $marefriend): $mfSystem = explode("/", $marefriend)[0]; $mfMemberID = explode("/", $marefriend)[1]; $mfMember = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$mfSystem-members.json"), true), function ($item) { + global $mfMemberID; + return $item["id"] === $mfMemberID; + }); sort($mfMember); $mfMember = $mfMember[0]; ?><a title="<b><?= $mfMember["display_name"] ?? $mfMember["name"] ?></b><br>Marefriend" data-bs-toggle="tooltip" data-bs-html="true" class="member-link" href="/<?= $mfSystem === "gdapd" ? "raindrops" : "cloudburst" ?>/<?= $mfMember["name"] ?>"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $mfMember['name'] . ".png") ? "-" . $mfMember['name'] : "" ?>.png" style="width:24px;"></a><?php $index++; endforeach; ?><?php $index = 0; foreach ($metadata["sisters"] as $marefriend): $mfSystem = explode("/", $marefriend)[0]; $mfMemberID = explode("/", $marefriend)[1]; $mfMember = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$mfSystem-members.json"), true), function ($item) { + global $mfMemberID; + return $item["id"] === $mfMemberID; + }); sort($mfMember); $mfMember = $mfMember[0]; ?><a title="<b><?= $mfMember["display_name"] ?? $mfMember["name"] ?></b><br>Sister" data-bs-toggle="tooltip" data-bs-html="true" class="member-link" href="/<?= $mfSystem === "gdapd" ? "raindrops" : "cloudburst" ?>/<?= $mfMember["name"] ?>"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $mfMember['name'] . ".png") ? "-" . $mfMember['name'] : "" ?>.png" style="width:24px;"></a><?php $index++; endforeach; ?> + </span> + </span> + <span class="comparison-item"> + <?php if ($metadata["host"]): ?> + <img data-bs-toggle="tooltip" title="Yes" src="/assets/icons/complete.svg" alt="Yes" style="width:24px;"> + <?php else: ?> + <img data-bs-toggle="tooltip" title="No" src="/assets/icons/none.svg" alt="No" style="width:24px;"> + <?php endif; ?> + </span> + <span class="comparison-item"> + <?php if ($metadata["fictive"]): ?> + <img data-bs-toggle="tooltip" title="Yes" src="/assets/icons/complete.svg" alt="Yes" style="width:24px;"> + <?php else: ?> + <img data-bs-toggle="tooltip" title="No" src="/assets/icons/none.svg" alt="No" style="width:24px;"> + <?php endif; ?> + </span> + <span class="comparison-item"> + <?php if ($metadata["little"] >= 2): ?> + <img data-bs-toggle="tooltip" title="Yes" src="/assets/icons/complete.svg" alt="Yes" style="width:24px;"> + <?php elseif ($metadata["little"] === 1): ?> + <img data-bs-toggle="tooltip" title="Age regressor" src="/assets/icons/partial.svg" alt="Partial" style="width:24px;"> + <?php else: ?> + <img data-bs-toggle="tooltip" title="No" src="/assets/icons/none.svg" alt="No" style="width:24px;"> + <?php endif; ?> + </span> + <span class="comparison-item"> + <?php if ($metadata["not_talking"]): ?> + <img data-bs-toggle="tooltip" title="Yes" src="/assets/icons/complete.svg" alt="Yes" style="width:24px;"> + <?php else: ?> + <img data-bs-toggle="tooltip" title="No" src="/assets/icons/none.svg" alt="No" style="width:24px;"> + <?php endif; ?> + </span> + <span class="comparison-item"> + <?php if ($metadata["protector"]): ?> + <img data-bs-toggle="tooltip" title="Yes" src="/assets/icons/complete.svg" alt="Yes" style="width:24px;"> + <?php else: ?> + <img data-bs-toggle="tooltip" title="No" src="/assets/icons/none.svg" alt="No" style="width:24px;"> + <?php endif; ?> + </span> + <?php endforeach; ?> + </div> + </div> + +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?>
\ No newline at end of file |