summaryrefslogtreecommitdiff
path: root/includes/subsysbanner.php
blob: 95c69424abce56069f36c815a9648f362d4c779c (plain)
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
<?php

global $memberData;
global $memberCommonName;
global $memberID;
global $systemCommonName;
global $systemID;
global $system;
global $subsystemData;
global $subsystemID;
global $subsystem;

$fronters = array_map(function ($item) {
    return $item["id"];
}, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-fronters.json"), true)["members"]);

?>

<div id="system-info" style="background:rgba(255, 255, 255, .1);border-radius:10px;display:grid;grid-template-columns: 128px 1fr;">
    <img src="/assets/uploads/ss-<?= $subsystemID ?>.png" alt="" style="height:128px;border-top-left-radius:10px;border-bottom-left-radius:10px;">
    <div style="padding:10px 10px 10px 20px;text-align:center;">
        <div style="display: grid; grid-template-columns: 1fr;height:100%;grid-template-rows: max-content max-content 1fr;">
            <h3 style="height:max-content;"><?= $subsystemData["name"] ?></h3>
            <div style="height:max-content;display:grid;grid-template-columns: repeat(4, 1fr);" id="member-card">
                <span>
                    <b>Fronter:</b>
                    <?php if (in_array($fronters[0], getSubsystemByID($subsystemID)["members"])): $member = getMember($fronters[0]); ?>
                        <a class="member-link" href="/<?= $system ?>/<?= $member["name"] ?>"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a>
                    <?php else: ?>
                        <span class="text-muted">N/A</span>
                    <?php endif; ?>
                    </span>
                <span>
                        <?php

                        $arr = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-switches.json"), true), function ($i) use ($subsystemID) {
                            return in_array($i["members"][0], getSubsystemByID($subsystemID)["members"]);
                        });
                        sort($arr);
                        $previousID = $arr[in_array($fronters[0], getSubsystemByID($subsystemID)["members"]) ? 1 : 0]["members"][0];
                        $member = null;

                        foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-members.json"), true) as $members) {
                            if ($members["id"] === $previousID) {
                                $member = $members;
                                break;
                            }
                        }

                        ?>
                        <b>Last Fronter: </b><a class="member-link" href="/<?= $system ?>/<?= $member["name"] ?>"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a>
                    </span>
                <span>
                        <b>Members:</b> <?= count(getSubsystemByID($subsystemID)["members"]) ?>
                    </span>
                <span>
                        <b>Parent System:</b> <a class="member-link" href="/<?= $system ?>"><img style="width:24px;border-radius:5px;" src="/assets/uploads/<?= $system ?>.png"> <?= getMiniName($systemCommonName) ?></a>
                </span>
            </div>
        </div>
    </div>
</div>

<div id="system-actions" style="margin-top:10px;padding:5px 10px;background:rgba(255, 255, 255, .1);border-radius:10px;">
    <div style="padding: 5px 10px;text-align: center;">
        You are viewing the page of a subsystem of the <b><a style="color:white;text-decoration: none;" href="/<?= $system ?>"><?= $systemCommonName ?></a></b>.
    </div>
</div>