diff options
Diffstat (limited to 'includes/system')
-rw-r--r-- | includes/system/compare.inc | 187 |
1 files changed, 187 insertions, 0 deletions
diff --git a/includes/system/compare.inc b/includes/system/compare.inc new file mode 100644 index 0000000..6eec002 --- /dev/null +++ b/includes/system/compare.inc @@ -0,0 +1,187 @@ +<?php return; global $system; global $lang; global $pages; global $systemCommonName; global $systemID; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:compare"]["name"][$lang["_name"]] . " ยท " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; global $travelling; global $app; + +$members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true); + +?> + + <br> + <div class="container"> + <h2><?= $lang["compare"]["title"] ?> <?= $systemCommonName ?></h2> + <div class="comparison" style="<?php if ($systemID === $app["other"]["id"]): ?>grid-template-columns: 3fr 1.5fr 2fr repeat(4, 1fr);<?php endif; ?>"> + <span class="comparison-header comparison-item"> + <span class="comparison-header-l0"><abbr title="<?= $lang["compare"]["member"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["member"][0] ?></abbr></span> + <span class="comparison-header-l1"><abbr title="<?= $lang["compare"]["member"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["member"][1] ?></abbr></span> + <span class="comparison-header-l2"><abbr title="<?= $lang["compare"]["member"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["member"][2] ?></abbr></span> + <span class="comparison-header-l3"><abbr title="<?= $lang["compare"]["member"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["member"][3] ?></abbr></span> + <span class="comparison-header-l4"><abbr title="<?= $lang["compare"]["member"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["member"][4] ?></abbr></span> + <span class="comparison-header-l5"><abbr title="<?= $lang["compare"]["member"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["member"][5] ?></abbr></span> + </span> + <span class="comparison-header comparison-item"> + <span class="comparison-header-l0"><abbr title="<?= $lang["compare"]["species"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["species"][0] ?></abbr></span> + <span class="comparison-header-l1"><abbr title="<?= $lang["compare"]["species"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["species"][1] ?></abbr></span> + <span class="comparison-header-l2"><abbr title="<?= $lang["compare"]["species"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["species"][2] ?></abbr></span> + <span class="comparison-header-l3"><abbr title="<?= $lang["compare"]["species"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["species"][3] ?></abbr></span> + <span class="comparison-header-l4"><abbr title="<?= $lang["compare"]["species"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["species"][4] ?></abbr></span> + <span class="comparison-header-l5"><abbr title="<?= $lang["compare"]["species"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["species"][5] ?></abbr></span> + </span> + <?php if ($systemID !== $app["other"]["id"]): ?> + <span class="comparison-header comparison-item"> + <span class="comparison-header-l0"><abbr title="Code" data-bs-toggle="tooltip">Code</abbr></span> + <span class="comparison-header-l1"><abbr title="Code" data-bs-toggle="tooltip">Code</abbr></span> + <span class="comparison-header-l2"><abbr title="Code" data-bs-toggle="tooltip">Code</abbr></span> + <span class="comparison-header-l3"><abbr title="Code" data-bs-toggle="tooltip">Code</abbr></span> + <span class="comparison-header-l4"><abbr title="Code" data-bs-toggle="tooltip">Code</abbr></span> + <span class="comparison-header-l5"><abbr title="Code" data-bs-toggle="tooltip">Code</abbr></span> + </span> + <?php endif; ?> + <span class="comparison-header comparison-item"> + <span class="comparison-header-l0"><abbr title="<?= $lang["compare"]["relations"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["relations"][0] ?></abbr></span> + <span class="comparison-header-l1"><abbr title="<?= $lang["compare"]["relations"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["relations"][1] ?></abbr></span> + <span class="comparison-header-l2"><abbr title="<?= $lang["compare"]["relations"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["relations"][2] ?></abbr></span> + <span class="comparison-header-l3"><abbr title="<?= $lang["compare"]["relations"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["relations"][3] ?></abbr></span> + <span class="comparison-header-l4"><abbr title="<?= $lang["compare"]["relations"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["relations"][4] ?></abbr></span> + <span class="comparison-header-l5"><abbr title="<?= $lang["compare"]["relations"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["relations"][5] ?></abbr></span> + </span> + <span class="comparison-header comparison-item"> + <span class="comparison-header-l0"><abbr title="<?= $lang["compare"]["memory"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["memory"][0] ?></abbr></span> + <span class="comparison-header-l1"><abbr title="<?= $lang["compare"]["memory"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["memory"][1] ?></abbr></span> + <span class="comparison-header-l2"><abbr title="<?= $lang["compare"]["memory"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["memory"][2] ?></abbr></span> + <span class="comparison-header-l3"><abbr title="<?= $lang["compare"]["memory"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["memory"][3] ?></abbr></span> + <span class="comparison-header-l4"><abbr title="<?= $lang["compare"]["memory"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["memory"][4] ?></abbr></span> + <span class="comparison-header-l5"><abbr title="<?= $lang["compare"]["memory"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["memory"][5] ?></abbr></span> + </span> + <span class="comparison-header comparison-item"> + <span class="comparison-header-l0"><abbr title="<?= $lang["compare"]["fictive"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["fictive"][0] ?></abbr></span> + <span class="comparison-header-l1"><abbr title="<?= $lang["compare"]["fictive"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["fictive"][1] ?></abbr></span> + <span class="comparison-header-l2"><abbr title="<?= $lang["compare"]["fictive"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["fictive"][2] ?></abbr></span> + <span class="comparison-header-l3"><abbr title="<?= $lang["compare"]["fictive"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["fictive"][3] ?></abbr></span> + <span class="comparison-header-l4"><abbr title="<?= $lang["compare"]["fictive"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["fictive"][4] ?></abbr></span> + <span class="comparison-header-l5"><abbr title="<?= $lang["compare"]["fictive"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["fictive"][5] ?></abbr></span> + </span> + <span class="comparison-header comparison-item"> + <span class="comparison-header-l0"><abbr title="<?= $lang["compare"]["little"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["little"][0] ?></abbr></span> + <span class="comparison-header-l1"><abbr title="<?= $lang["compare"]["little"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["little"][1] ?></abbr></span> + <span class="comparison-header-l2"><abbr title="<?= $lang["compare"]["little"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["little"][2] ?></abbr></span> + <span class="comparison-header-l3"><abbr title="<?= $lang["compare"]["little"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["little"][3] ?></abbr></span> + <span class="comparison-header-l4"><abbr title="<?= $lang["compare"]["little"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["little"][4] ?></abbr></span> + <span class="comparison-header-l5"><abbr title="<?= $lang["compare"]["little"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["little"][5] ?></abbr></span> + </span> + <span class="comparison-header comparison-item"> + <span class="comparison-header-l0"><abbr title="<?= $lang["compare"]["protector"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["protector"][0] ?></abbr></span> + <span class="comparison-header-l1"><abbr title="<?= $lang["compare"]["protector"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["protector"][1] ?></abbr></span> + <span class="comparison-header-l2"><abbr title="<?= $lang["compare"]["protector"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["protector"][2] ?></abbr></span> + <span class="comparison-header-l3"><abbr title="<?= $lang["compare"]["protector"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["protector"][3] ?></abbr></span> + <span class="comparison-header-l4"><abbr title="<?= $lang["compare"]["protector"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["protector"][4] ?></abbr></span> + <span class="comparison-header-l5"><abbr title="<?= $lang["compare"]["protector"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["protector"][5] ?></abbr></span> + </span> + + <?php foreach (scoreOrder($members, $systemID) as $member): + + $metadata = $member["_metadata"]; + + ?> + <a title="<?= $member["display_name"] ?? $member["name"] ?>" data-bs-toggle="tooltip" class="member-link comparison-item comparison-item-clickable" href="/<?= $member["name"] ?>"> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" 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": + if ($metadata["robot"]) echo $lang["species"]["earth"][0]; else if ($metadata["plush"]) echo $lang["species"]["earth"][1]; else echo $lang["species"]["earth"][2]; + break; + + case "alicorn": + if ($metadata["robot"]) echo $lang["species"]["alicorn"][0]; else if ($metadata["plush"]) echo $lang["species"]["alicorn"][1]; else echo $lang["species"]["alicorn"][2]; + break; + + case "crystal": + if ($metadata["robot"]) echo $lang["species"]["crystal"][0]; else if ($metadata["plush"]) echo $lang["species"]["crystal"][1]; else echo $lang["species"]["crystal"][2]; + break; + + case "pegasus": + if ($metadata["robot"]) echo $lang["species"]["pegasus"][0]; else if ($metadata["plush"]) echo $lang["species"]["pegasus"][1]; else echo $lang["species"]["pegasus"][2]; + break; + + case "batpony": + if ($metadata["robot"]) echo $lang["species"]["batpony"][0]; else if ($metadata["plush"]) echo $lang["species"]["batpony"][1]; else echo $lang["species"]["batpony"][2]; + break; + + case "unicorn": + if ($metadata["robot"]) echo $lang["species"]["unicorn"][0]; else if ($metadata["plush"]) echo $lang["species"]["unicorn"][1]; else echo $lang["species"]["unicorn"][2]; + break; + + default: + echo $species . "_" . $metadata["robot"]; + break; + } ?>" style="width:24px;vertical-align: middle;position:relative;top:-5px;" src="/assets/species/<?= $species ?><?= $metadata["robot"] ? "-robot" : ($metadata["plush"] ? "-plush" : "") ?>.png" alt="<?= $species ?>"> + <?php endforeach; ?> + </span> + <?php if ($systemID !== $app["other"]["id"]): ?> + <span class="comparison-item"> + <?php if (isset($metadata["code"]) && trim($metadata["code"]) !== ""): ?> + <code style="color: white;"><?= strtoupper(substr($metadata["code"], 0, 3)) ?></code> + <?php else: ?>-<?php endif; ?> + </span> + <?php endif; ?> + <span class="comparison-item"> + <?= count($metadata["marefriends"]) + count($metadata["sisters"]) + count($metadata["caretakers"]) === 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 global $isLowerLoggedIn; global $isLoggedIn; $index = 0; foreach ($metadata["marefriends"] as $marefriend): $mfSystem = explode("/", $marefriend)[0]; if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)): $mfMemberID = explode("/", $marefriend)[1]; $mfMember = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$mfSystem/members.json"), true), function ($item) use ($mfSystem) { + global $mfMemberID; global $app; global $isLoggedIn; global $isLowerLoggedIn; + return $item["id"] === $mfMemberID && !($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn); + }); sort($mfMember); $mfMember = $mfMember[0]; ?><a title="<b><?= $mfMember["display_name"] ?? $mfMember["name"] ?></b><br><?= $lang["compare"]["status"][0] ?>" data-bs-toggle="tooltip" data-bs-html="true" class="member-link tooltip-nohelp" href="/<?= $mfMember["name"] ?>"><img src="<?= getAsset($mfSystem, $mfMember["id"], "heads") ?>" style="width:24px;"></a><?php endif; $index++; endforeach; ?><?php $index = 0; foreach ($metadata["sisters"] as $marefriend): $mfSystem = explode("/", $marefriend)[0]; if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)): $mfMemberID = explode("/", $marefriend)[1]; $mfMember = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$mfSystem/members.json"), true), function ($item) use ($mfSystem) { + global $mfMemberID; global $app; global $isLoggedIn; global $isLowerLoggedIn; + return $item["id"] === $mfMemberID && !($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn); + }); sort($mfMember); $mfMember = $mfMember[0]; ?><a title="<b><?= $mfMember["display_name"] ?? $mfMember["name"] ?></b><br><?= $lang["compare"]["status"][1] ?>" data-bs-toggle="tooltip" data-bs-html="true" class="member-link tooltip-nohelp" href="/<?= $mfMember["name"] ?>"><img src="<?= getAsset($mfSystem, $mfMember["id"], "heads") ?>" style="width:24px;"></a><?php endif; $index++; endforeach; ?><?php $index = 0; foreach ($metadata["caretakers"] as $marefriend): $mfSystem = explode("/", $marefriend)[0]; if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)): $mfMemberID = explode("/", $marefriend)[1]; $mfMember = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$mfSystem/members.json"), true), function ($item) use ($mfSystem) { + global $mfMemberID; global $app; global $isLoggedIn; global $isLowerLoggedIn; + return $item["id"] === $mfMemberID && !($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn); + }); sort($mfMember); $mfMember = $mfMember[0]; ?><a title="<b><?= $mfMember["display_name"] ?? $mfMember["name"] ?></b><br><?= $lang["compare"]["status"][2] ?>" data-bs-toggle="tooltip" data-bs-html="true" class="member-link tooltip-nohelp" href="/<?= $mfMember["name"] ?>"><img src="<?= getAsset($mfSystem, $mfMember["id"], "heads") ?>" style="width:24px;"></a><?php endif; $index++; endforeach; ?> + </span> + </span> + <span class="comparison-item"> + <?php if ($metadata["shared_memory"] > 0): ?> + <?php if ($metadata["shared_memory"] === 1): ?> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][5] ?>" src="/assets/icons/partial.svg" alt="<?= $lang["compare"]["state"][5] ?>" style="width:24px;"> + <?php else: ?> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][6] ?>" src="/assets/icons/complete.svg" alt="<?= $lang["compare"]["state"][6] ?>" style="width:24px;"> + <?php endif; ?> + <?php else: ?> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][2] ?>" src="/assets/icons/none.svg" alt="<?= $lang["compare"]["state"][2] ?>" style="width:24px;"> + <?php endif; ?> + </span> + <span class="comparison-item"> + <?php if ($metadata["fictive"]): ?> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][0] ?>" src="/assets/icons/complete.svg" alt="<?= $lang["compare"]["state"][0] ?>" style="width:24px;"> + <?php else: ?> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][2] ?>" src="/assets/icons/none.svg" alt="<?= $lang["compare"]["state"][2] ?>" style="width:24px;"> + <?php endif; ?> + </span> + <span class="comparison-item"> + <?php if ($metadata["little"] === 2): ?> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][0] ?>" src="/assets/icons/complete.svg" alt="<?= $lang["compare"]["state"][0] ?>" style="width:24px;"> + <?php elseif ($metadata["little"] === 3): ?> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][3] ?>" src="/assets/icons/partial.svg" alt="<?= $lang["compare"]["state"][1] ?>" style="width:24px;"> + <?php else: ?> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][2] ?>" src="/assets/icons/none.svg" alt="<?= $lang["compare"]["state"][2] ?>" style="width:24px;"> + <?php endif; ?> + </span> + <span class="comparison-item"> + <?php if ($metadata["protector"]): ?> + <?php if ($travelling[$member["id"]]["travelling"]): ?> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][4] ?>" src="/assets/icons/partial.svg" alt="<?= $lang["compare"]["state"][4] ?>" style="width:24px;"> + <?php else: ?> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][0] ?>" src="/assets/icons/complete.svg" alt="<?= $lang["compare"]["state"][0] ?>" style="width:24px;"> + <?php endif; ?> + <?php else: ?> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][2] ?>" src="/assets/icons/none.svg" alt="<?= $lang["compare"]["state"][2] ?>" style="width:24px;"> + <?php endif; ?> + </span> + <?php endforeach; ?> + </div> + </div> + +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?>
\ No newline at end of file |