summaryrefslogtreecommitdiff
path: root/pages/byspecies.inc
blob: e3bdcc4f97b69171c2148ecba121dbe62bafcdbc (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
<?php global $system; global $systemCommonName; global $lang; global $pages; global $systemID; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:species"]["name"][$lang["_name"]]; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; global $travelling;

$members = scoreOrderGlobal();

function species(array $members, string $id, string $name) { global $systemID; global $travelling; ?>
    <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 4fr;">
        <div class="relation-intro" 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;">
            <img src="/assets/species/<?= $id ?>.png" style="width:24px;"><span class="species-name"> <?= $name ?></span> (<?= count($members) ?>)
        </div>

        <div class="relation-item" style="margin-left:10px;padding:0 20px;">
            <?php if (count($members) > 0): ?>
                <?php $index = 0; foreach ($members as $member): ?><a class="member-link" href="/<?= $member["name"] ?>"><img src="<?= getAsset($member["_system"], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?></a><?php if ($index + 2 <= count($members)) echo('<span class="list-separator-desktop">, </span><span class="list-separator-mobile"><br></span>'); $index++; endforeach; ?>
            <?php else: ?>-<?php endif; ?>
        </div>
    </div>
<?php }

?>

    <br>
    <div class="container" id="page-content">
        <h2><?= str_replace("%1", "All", $lang["species_compare"]["title"]) ?></h2>
        <?php

        $earth = [];
        $pegasus = [];
        $unicorn = [];
        $alicorn = [];
        $batpony = [];
        $crystal = [];
        $changeling = [];
        $merpony = [];

        foreach ($members as $member) {
            foreach ($member["_metadata"]["species"] as $species) {
                if ($species === "earth")      $earth[] = $member;
                if ($species === "pegasus")    $pegasus[] = $member;
                if ($species === "unicorn")    $unicorn[] = $member;
                if ($species === "alicorn")    $alicorn[] = $member;
                if ($species === "batpony")    $batpony[] = $member;
                if ($species === "crystal")    $crystal[] = $member;
                if ($species === "changeling") $changeling[] = $member;
                if ($species === "merpony")    $merpony[] = $member;
            }
        }

        ?>

        <?php species($earth,   "earth",   $lang["species"]["earth"][3]); ?>
        <?php species($pegasus, "pegasus", $lang["species"]["pegasus"][3]); ?>
        <?php species($unicorn, "unicorn", $lang["species"]["unicorn"][3]); ?>
        <?php species($alicorn, "alicorn", $lang["species"]["alicorn"][3]); ?>
        <?php species($batpony, "batpony", $lang["species"]["batpony"][3]); ?>
        <?php species($crystal, "crystal", $lang["species"]["crystal"][3]); ?>
        <?php species($changeling, "changeling", "Changelings"); ?>
        <?php species($merpony, "merpony", "Merponies"); ?>
    </div>

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