summaryrefslogtreecommitdiff
path: root/pages/nicknames.inc
diff options
context:
space:
mode:
Diffstat (limited to 'pages/nicknames.inc')
-rw-r--r--pages/nicknames.inc115
1 files changed, 115 insertions, 0 deletions
diff --git a/pages/nicknames.inc b/pages/nicknames.inc
new file mode 100644
index 0000000..434477f
--- /dev/null
+++ b/pages/nicknames.inc
@@ -0,0 +1,115 @@
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn;
+require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
+
+$members = scoreOrderGlobal();
+$relations = [];
+
+foreach ($members as $member) {
+ foreach ([
+ ...array_map(function ($i) {
+ $r = [
+ "name" => $i
+ ];
+ $r["type"] = "marefriends";
+ return $r;
+ }, $member["_metadata"]["marefriends"] ?? []),
+ ...array_map(function ($i) {
+ $r = [
+ "name" => $i
+ ];
+ $r["type"] = "sisters";
+ return $r;
+ }, $member["_metadata"]["sisters"] ?? []),
+ ...array_map(function ($i) {
+ $r = [
+ "name" => $i
+ ];
+ $r["type"] = "caretaking";
+ return $r;
+ }, $member["_metadata"]["caretakers"] ?? [])
+ ] as $rel) {
+ $id = $rel["name"];
+ $otherMember = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]);
+
+ $parts = [
+ $member["id"],
+ $otherMember["id"]
+ ];
+
+ asort($parts);
+
+ $relations[implode("-", $parts)] = [
+ "id" => implode("", $parts),
+ "name" => getMiniName($member["display_name"] ?? $member["name"]) . " and " . getMiniName($otherMember["display_name"] ?? $otherMember["name"]),
+ "type" => $rel["type"],
+ "images" => [
+ getAsset($member['system'], $member["id"], "heads"),
+ getAsset($otherMember['system'], $otherMember["id"], "heads")
+ ]
+ ];
+ }
+}
+
+$nicknames = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/nicknames/nicknames.json"), true);
+
+?>
+
+<br>
+<div class="container">
+ <div id="page-content">
+ <h2>Relations nicknames</h2>
+ <?php foreach ($relations as $relation): ?>
+ <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1fr 3fr;">
+ <a class="relation-intro" title="<?= $relation["id"] ?>" data-bs-toggle="tooltip" style="background-color:rgba(255, 255, 255, .05);border-right:1px solid rgba(255, 255, 255, .1);margin:-10px;padding:10px;border-top-left-radius:10px;border-bottom-left-radius:10px;color: white;text-decoration: none;">
+ <span style="vertical-align: middle;"><img src="<?= $relation["images"][0] ?>" style="width:24px;"><img src="<?= $relation["images"][1] ?>" style="width:24px;"></span> <span style="vertical-align: middle;"><?= $relation["name"] ?></span>
+ </a>
+ <div class="relation-item relation-item-marefriends" style="text-align:left;margin-left:10px;padding:0 20px;">
+ <?php if (isset($nicknames[$relation["id"]])): ?>
+ "<?= implode('", "', $nicknames[$relation["id"]]) ?>"
+ <?php else: ?>
+ <span class="text-muted">No nickname for this relation</span>
+ <?php endif; ?>
+ </div>
+ </div>
+ <?php endforeach; ?>
+ </div>
+</div>
+
+<style>
+ .relation-intro {
+ opacity: 1 !important;
+ }
+
+ @media (max-width: 991px) {
+ .relation {
+ grid-template-columns: 1fr !important;
+ }
+
+ .relation-intro {
+ text-align: center;
+ border-bottom-left-radius: 0 !important;
+ border-top-right-radius: 10px;
+ border-right: none !important;
+ border-bottom: 1px solid rgba(255, 255, 255, .1);
+ }
+
+ .relation-item-marefriends {
+ margin-top: 20px !important;
+ text-align: center !important;
+ }
+
+ .relation-item {
+ margin-top: 10px;
+ margin-left: 0 !important;
+ padding: 10px 0 !important;
+ }
+ }
+
+ .relation-item {
+ text-align: center;
+ }
+</style>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>