1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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'; ?>
|