summaryrefslogtreecommitdiff
path: root/pages/demo.php
blob: 381a7e466a10f0e125bcd0a51f194cc5934ae849 (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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn;
$demoHeader = true; $emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php';

?>

<script src="/app/banner.js"></script>
<br>
<div class="container">
    <div>
        <div id="header" style="text-align: center;">
            <img alt="" src="/assets/uploads/raindrops.png" style="width:128px;">
            <h3>Raindrops System</h3>
            <p>Système plural de <?= count(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true)) - 1 ?> poneys</p>
            <hr>
        </div>

        <div id="list">
            <p>Cliquez sur quelqu'un pour avoir plus d'information sur elle.</p>
            <div class="list-group">
                <?php foreach (scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true), "gdapd") as $member): ?>
                <a onclick="showMember('<?= $member["id"] ?>');" class="list-group-item">
                    <img src="/assets/uploads/pt-<?= $member["name"] ?>.png" style="width:32px;vertical-align: middle;">
                    <span style="vertical-align: middle;margin-left: 5px;">
                        <b><?= getMiniName($member["display_name"] ?? $member["name"]) ?></b>
                        <?= $member["_metadata"]["host"] ? "(hôte)" : "" ?><?= $member["_metadata"]["protector"] ? "(protectrice)" : "" ?><?= $member["_metadata"]["little"] === 2 ? (isset($member["_metadata"]["median"]) ? "(" . getMiniName(getSystemMember("gdapd", $member["_metadata"]["median"])["display_name"]) . " régressée en âge)" : "(petite)") : "" ?>
                    </span>
                </a>
                <?php endforeach; ?>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="member">
    <div class="modal-dialog modal-xl">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title">
                    <img id="modal-img" src="/assets/uploads/pt.png" style="width:32px;vertical-align: middle;">
                    <span style="vertical-align: middle;"><span id="modal-member">Member</span> · Raindrops System</span>
                </h4>
                <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
            </div>

            <div class="modal-body">
                <?php foreach (scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true), "gdapd") as $member): ?>
                    <div class="modal-member-content" id="modal-member-content-<?= $member["id"] ?>">
                        <script>
                            <?php global $memberData; $memberData = $member; ?>
                            window.currentMemberData = JSON.parse(atob(`<?= base64_encode(json_encode(getMemberBannerData($member["id"], "gdapd", true))) ?>`));
                        </script>
                        <div id="member-banner"></div>
                        <script>
                            refreshBanner(false, true);
                            document.getElementById("member-banner").id = "";
                        </script>
                    </div>
                <?php endforeach; ?>
            </div>
        </div>
    </div>
</div>

<style>
    .list-group-item {
        color: #fff;
        background-color: #222;
        border: 1px solid rgba(255, 255, 255, .125);
    }

    .list-group-item.disabled {
        color: #fff;
        background-color: #222;
        border-color: rgba(255, 255, 255, .125);
        opacity: .75;
    }

    .list-group-item:hover {
        background-color: #252525;
        color: #ddd;
    }

    .list-group-item:active, .list-group-item:focus {
        background-color: #272727;
        color: #bbb;
    }
    
    a {
        cursor: pointer;
    }

    .modal-header {
        border-bottom: 1px solid #353738;
    }

    .modal-content {
        border: 1px solid rgba(255, 255, 255, .2);
        background-color: #111;
    }

    .btn-close {
        filter: invert(1);
    }
</style>

<script>
    window._phpMembers = JSON.parse(atob(`<?= base64_encode(json_encode(array_values(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true), "gdapd")))) ?>`));
    window.members = {};

    for (let member of window._phpMembers) {
        window.members[member.id] = member;
    }

    function showMember(id) {
        let member = members[id];
        document.getElementById("modal-member").innerText = member["display_name"];
        document.getElementById("modal-img").src = "/assets/uploads/pt-" + member["name"] + ".png";

        Array.from(document.getElementsByClassName("modal-member-content")).forEach((i) => {
            i.style.display = "none";
        });
        document.getElementById("modal-member-content-" + id).style.display = "";

        let modal = new bootstrap.Modal(document.getElementById('member'));
        modal.show();
    }
</script>

<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?>