The SRA Website https://socialistra.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

119 lines
3.5 KiB

<?php
// Copyright (C) 2021 Socialist Rifle Association
//
// This file is part of SRA Website.
//
// website is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// website is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with website. If not, see <http://www.gnu.org/licenses/>.
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Socialist Rifle Association</title>
<?php include("../res/php/headtags.php") ?>
<style type="text/css">
p {
font-weight: 200;
font-family: 'Heebo', sans-serif;
}
ul.resolutions {
list-style-type: none;
}
li.reso {
background: #fff;
border-radius: 4px;
padding: 10px;
}
li.reso:nth-child(odd) {
background: #e6e6e6;
}
li.reso:hover {
background-color: #f5c739;
}
/* GRID OF FOUR */
.span_4_of_4 {
width: 100%;
}
.span_3_of_4 {
width: 74.6%;
}
.span_2_of_4 {
width: 49.2%;
}
.footer_1_of_4 {
width: 23.8%;
vertical-align: middle;
}
.footer-decal {
padding-top: 1em;
}
/* GO FULL WIDTH BELOW 480 PIXELS */
@media only screen and (max-width: 480px) {
.col { margin: 1% 0 1% 0%; }
.footer_1_of_4, .span_2_of_4, .span_3_of_4, .span_4_of_4 { width: 100%; }
}
</style>
</head>
<body>
<?php include("../res/php/top.php") ?>
<div id="section-title">Resolutions</div>
<hr>
<?php
// Constant values
$CDNPATH = "https://srastatic.nyc3.cdn.digitaloceanspaces.com/docs/Resolutions/";
// Retrieve resolution information from JSON
$resolutions = json_decode(file_get_contents("resolutions.json"), true);
// Define placeholder variable for month separation
$currentYear = NULL;
$currentMonth = NULL;
$dateChanged = FALSE;
// Render them onto the page
foreach ($resolutions as $object) {
$objectDate = explode("/", $object["date"]);
// Create a new <ul> tag if the date has changed since the last entry
if ($currentYear != $objectDate[0] || $currentMonth != $objectDate[1]) {
$dateChanged = TRUE;
echo "</ul>";
}
// Print year header if year has changed
if ($currentYear != $objectDate[0]) {
$currentYear = $objectDate[0];
echo "<h3>$currentYear</h3>";
}
// Print month header if month has changed
if ($currentMonth != $objectDate[1]) {
$currentMonth = $objectDate[1];
// Turn month number into human readable month name
$monthName = date("F", mktime(0, 0, 0, $currentMonth, 10));
echo "<h4>$monthName</h4>";
}
if ($dateChanged) {
echo "<ul class=\"resolutions\">";
$dateChanged = FALSE;
}
// Create resolution object
$resolutionUrl = $CDNPATH . $object["date"] . "/" . $object["file"];
echo "
<li class=\"reso\">
<a href=" . $resolutionUrl . ">" . $object["name"] . "</a>
</li>
";
}
?>
<?php include("../res/php/bottom.php") ?>
</body>
</html>