summaryrefslogtreecommitdiff
path: root/includes/util/homepage.inc
blob: 45f91b6ff2c9f0bd4b07916ca06df0f5a3899d71 (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
<?php

global $app;
global $travelling;

function newHomepage($id, $page, $title) {
    global $travelling;
    $system = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $id . "/general.json"), true);

    ?>
    <div class="new-homepage-system" id="new-homepage-system-<?= $id ?>">
        <?php if ($title): ?>
        <a href="/<?= $page ?>" style="height: 48px; display: flex; align-items: center; justify-content: center; border-top-left-radius: 10px; border-top-right-radius: 10px; text-align: center; text-decoration: none; color: white; background-color: #<?= $system["color"] ?? "000000" ?>55; box-shadow: 0 20px 20px 0 #<?= $system["color"] ?? "000000" ?>55;" class="new-homepage-system-title" id="new-homepage-system-<?= $id ?>-title">
            <div>
                <img src="<?= getAsset($id) ?>" style="border-radius: 5px;width: 48px; vertical-align: middle;"><b style="vertical-align: middle; margin-left: 5px;"><?= $system["name"] ?></b>
            </div>
        </a>
        <?php endif; ?>

        <div class="new-homepage-system-list" id="new-homepage-system-<?= $id ?>-list">
            <?php $list = array_values(scoreOrder(withTravelers(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $id . "/members.json"), true), $id), $id)); foreach ($list as $index => $member): ?>
            <a href="/<?= $member["name"] ?>" class="new-homepage-link <?= $index === count($list) - 1 ? "new-homepage-link-last" : "" ?>" style="color: white; text-decoration: none !important; display: block; background-color: #<?= $member["color"] ?>22; padding: 5px 10px;">
                <img src="<?= getAsset($id, $member["id"]) ?>" style="width: 32px; height: 32px; vertical-align: middle; background-color: rgba(0, 0, 0, .25); border-radius: 999px;">
                <span style="width: calc(100% - 37px); vertical-align: middle; margin-left: 5px;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;"><?= $member["display_name"] ?? $member["name"] ?></span>
            </a>
            <?php endforeach; ?>
        </div>
    </div>
<?php }