WowPress-Tailwind/theme/pages/raids.php

63 lines
2.3 KiB
PHP
Raw Normal View History

2024-04-15 23:07:29 +02:00
<?php
use WoWPress\Models\Raid;
global $widget_area;
global $year;
global $month;
2024-04-16 15:25:22 +02:00
set_sidebar_status('top', false);
2024-04-15 23:07:29 +02:00
2024-04-16 15:25:22 +02:00
$raids = Raid::where("start", ">", "$year-$month-01 00:00:00")->get();
2024-04-15 23:07:29 +02:00
get_header();
?>
2024-04-16 15:25:22 +02:00
<div class="top-title flex flex-row gap-2" style="margin-top:calc(-1 * var(--wowp-gap))">
<div class="text-3xl font-bold bg-glass shadow p-3 text-center w-full">
<?= $GLOBALS['wowpress']['page_title'] ?>
</div>
</div>
2024-04-15 23:07:29 +02:00
<section id="primary">
<main id="main">
<div class="bg-glass shadow p-auto">
2024-04-16 15:25:22 +02:00
<div class="text-xl font-bold bg-glass text-white text-center"><?= format_date("$year-$month-1", 'MMMM') ?></div>
2024-04-15 23:07:29 +02:00
<div class="grid grid-cols-7 gap-1 pt-1" style="grid-auto-rows: 1fr">
<?php
2024-04-16 15:25:22 +02:00
for ($i = 1; $i <= date("t", strtotime("$year-$month-01")); $i++) {
$has_raid = [];
foreach ($raids as $raid) {
if (format_date($raid->start) == format_date("$year-$month-$i")) {
$has_raid[] = $raid;
}
}
2024-04-15 23:07:29 +02:00
?>
2024-04-16 15:25:22 +02:00
<div class="bg-glass p-auto text-center <?php if (count($has_raid) > 0) { ?> glow shadow-<?=$has_raid[0]->color?> <?php } ?> grid grid-cols-2 grid-rows-2">
<div class="text-left"><?= date('d', strtotime("$year-$month-$i")) ?></div>
<div class="text-right"><?= format_date("$year-$month-$i", 'E') ?></div>
<?php
foreach($has_raid as $raid){
?>
<a href="<?=$raid->link?>" class="group" style="grid-area: 2 / 1 / 3 / 3;">
<div class="group-hover:text-<?=$raid->color?> bg-<?=$raid->color?>-200"><?=$raid->title?></div>
<?php if($raid->difficulty): ?><div class="text-sm text-slate-500">(<?=$raid->difficulty?>)</div><?php endif; ?>
</a>
<?php
}
?>
</div>
<?php
2024-04-15 23:07:29 +02:00
}
?>
</div>
</div>
</main>
</section>
<?php
2024-04-16 15:25:22 +02:00
get_footer();