summaryrefslogtreecommitdiff
path: root/projects/archive/index.php
blob: b6929b79ff58dd13bb36d745bb8c2666d111d5ea (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
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/lang.php"; $title = l("lang.archive.title"); require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/header.php"; ?>

<div id="archive-decoration"></div>

<div class="container" id="archive-container">
    <h1><?= l("lang.archive.title") ?></h1>
    <table id="archive-table">
        <?php $lastYear = null; $lastMonth = null; $projects = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/projects.json"), true); uasort($projects, function ($a, $b) {
            return $b["commit"] - $a["commit"];
        }); foreach ($projects as $project): if ($project["archive"]): ?>
        <tr>
            <td class="archive-table-year"><?php

                $year = date('Y', $project["commit"]);

                if ($year !== $lastYear) {
                    $lastYear = $year;
                    $lastMonth = null;
                    echo("<b>$year</b>");
                }

                ?></td>
            <td class="archive-table-month"><?php

                $month = month((int)date('n', $project["commit"]));

                if ($month !== $lastMonth) {
                    $lastMonth = $month;
                    echo("<b>$month</b>");
                }

                ?></td>
            <td>
                <a class="archive-table-link" href="/projects/<?= $project["name"] ?? $project["id"] ?>">
                    <?php if (isset($project["icon"])): ?><img class="archive-table-icon" src="/assets/projects/<?= $project["id"] ?>.png" alt="Project icon"><?php else: ?><i class="archive-table-icon bi bi-journal-code"></i><?php endif; ?>
                    <span class="archive-table-title"><?= $project["display_name"] ?? $project["name"] ?></span>
                </a>
            </td>
        </tr>
        <?php endif; endforeach; ?>
    </table>
</div>

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