2024-04-15 23:07:29 +02:00
|
|
|
<?php
|
|
|
|
|
2024-04-22 15:38:22 +02:00
|
|
|
use WoWPress\Frontend\Icon;
|
2024-04-15 23:07:29 +02:00
|
|
|
use WoWPress\Models\Raid;
|
|
|
|
|
|
|
|
global $widget_area;
|
|
|
|
|
|
|
|
global $year;
|
|
|
|
global $month;
|
2024-09-20 09:43:17 +02:00
|
|
|
|
2024-04-16 15:25:22 +02:00
|
|
|
set_sidebar_status('top', false);
|
2024-04-15 23:07:29 +02:00
|
|
|
|
2024-04-22 15:38:22 +02:00
|
|
|
switch ($month) {
|
|
|
|
case "01":
|
|
|
|
$prev_month = 12;
|
|
|
|
$prev_year = $year - 1;
|
|
|
|
$next_month = $month + 1;
|
|
|
|
$next_year = $year;
|
|
|
|
break;
|
|
|
|
case "12":
|
|
|
|
$prev_month = $month - 1;
|
|
|
|
$prev_year = $year;
|
|
|
|
$next_month = "01";
|
|
|
|
$next_year = $year + 1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$prev_month = $month - 1;
|
|
|
|
$prev_year = $year;
|
|
|
|
$next_month = $month + 1;
|
|
|
|
$next_year = $year;
|
|
|
|
break;
|
|
|
|
}
|
2024-04-15 23:07:29 +02:00
|
|
|
|
2024-04-22 15:38:22 +02:00
|
|
|
$raids = Raid::where("start", ">", "$year-$month-01 00:00:00")->where("start", "<", "$year-$next_month-01 00:00:00")->orderBy('start')->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))">
|
2024-04-22 15:38:22 +02:00
|
|
|
<a href="/raids/<?= $prev_year ?>/<?= $prev_month ?>" class="bg-glass shadow p-3 flex flex-col items-center justify-center"><?= Icon::get('o-chevron-double-left') ?></a>
|
|
|
|
<div class="text-3xl font-bold bg-glass shadow p-3 text-center w-full">
|
|
|
|
Raids
|
|
|
|
</div>
|
|
|
|
<a href="/raids/<?= $next_year ?>/<?= $next_month ?>" class="bg-glass shadow p-3 flex flex-col items-center justify-center"><?= Icon::get('o-chevron-double-right') ?></a>
|
|
|
|
|
2024-04-16 15:25:22 +02:00
|
|
|
</div>
|
2024-04-15 23:07:29 +02:00
|
|
|
|
|
|
|
<section id="primary">
|
|
|
|
<main id="main">
|
2024-04-22 15:38:22 +02:00
|
|
|
<div class="bg-glass shadow p-auto hidden lg:block">
|
|
|
|
<div class="text-xl font-bold bg-glass text-white text-center"><?= format_date("$year-$month-1", 'MMMM yyyy') ?></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-23 22:43:54 +02:00
|
|
|
<div class="bg-glass p-auto text-center aspect-[1/0.8] <?php if (count($has_raid) > 0) { ?> glow shadow-<?= $has_raid[0]->color ?> <?php } ?> grid grid-cols-2 grid-rows-2" <?php if (count($has_raid) > 0) { ?> style="background-position:center;background-size: cover;background-image:url('<?=$has_raid[0]->thumbnail?>')" <?php } ?>>
|
2024-04-16 15:25:22 +02:00
|
|
|
<div class="text-left"><?= date('d', strtotime("$year-$month-$i")) ?></div>
|
|
|
|
<div class="text-right"><?= format_date("$year-$month-$i", 'E') ?></div>
|
|
|
|
|
|
|
|
<?php
|
2024-04-22 15:38:22 +02:00
|
|
|
foreach ($has_raid as $raid) {
|
2024-04-16 15:25:22 +02:00
|
|
|
?>
|
2024-04-22 15:38:22 +02:00
|
|
|
<a href="<?= $raid->link ?>" class="group" style="grid-area: 2 / 1 / 3 / 3;">
|
2024-08-07 22:34:54 +02:00
|
|
|
<div class="group-hover:text-<?= $raid->color ?> bg-<?= $raid->color ?> bg-opacity-50"><?= $raid->title ?></div>
|
2024-04-22 15:38:22 +02:00
|
|
|
<?php if ($raid->difficulty) : ?><div class="text-sm text-slate-500">(<?= $raid->difficulty ?>)</div><?php endif; ?>
|
|
|
|
</a>
|
2024-04-16 15:25:22 +02:00
|
|
|
<?php
|
2024-04-22 15:38:22 +02:00
|
|
|
|
2024-04-16 15:25:22 +02:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
<?php
|
2024-04-15 23:07:29 +02:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-04-22 15:38:22 +02:00
|
|
|
<div class="bg-glass shadow p-auto block lg:hidden">
|
|
|
|
<div class="text-xl font-bold bg-glass text-white text-center"><?= format_date("$year-$month-1", 'MMMM yyyy') ?></div>
|
|
|
|
<div class="flex flex-col gap-2">
|
|
|
|
<?php foreach ($raids as $raid) : ?>
|
|
|
|
<a href="<?= $raid->link ?>" class="group text-center p-2 border border-<?= $raid->color ?>">
|
|
|
|
<div class="group-hover:text-<?= $raid->color ?> bg-<?= $raid->color ?>-200"><?= $raid->title ?></div>
|
2024-04-23 22:43:54 +02:00
|
|
|
<div><?= format_date($raid->start, 'dd.MM.yyyy HH:mm') ?></div>
|
2024-04-22 15:38:22 +02:00
|
|
|
|
|
|
|
<?php if ($raid->difficulty) : ?><div class="text-sm text-slate-500">(<?= $raid->difficulty ?>)</div><?php endif; ?>
|
|
|
|
</a>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-04-15 23:07:29 +02:00
|
|
|
</main>
|
|
|
|
</section>
|
2024-04-23 00:44:42 +02:00
|
|
|
<?php if (current_user_can('wowpress_edit_characters')) : ?>
|
|
|
|
<div x-data="{addRaid:true}">
|
|
|
|
<template x-teleport="#sidebar_right">
|
|
|
|
<div class="bg-glass shadow p-auto order-1 hidden lg:block">
|
|
|
|
<div class="flex flex-col gap-2">
|
2024-04-23 22:43:54 +02:00
|
|
|
<h4 class="text-xl font-bold text-center mb-2">Raid importieren</h4>
|
|
|
|
<form action="/request" method="POST">
|
|
|
|
<div class="flex flex-col gap-2">
|
|
|
|
<?php wp_nonce_field('importRaid', 'importRaid_nonce'); ?>
|
|
|
|
<input type="hidden" name="action" value="importRaid">
|
|
|
|
<input type="text" name="id_wowaudit" placeholder="WoW-Audit ID" class="text-black">
|
|
|
|
<button type="submit" class="btn btn-outline btn-hunter">Importieren</a>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<!--
|
2024-04-23 00:44:42 +02:00
|
|
|
<div class="text-sm text-center">- oder -</div>
|
|
|
|
<h4 class="text-xl font-bold text-center mb-2 mt-2">Termin erstellen</h4>
|
|
|
|
<form action="/request" method="POST">
|
|
|
|
<div class="flex flex-col gap-2">
|
|
|
|
<?php wp_nonce_field('addRaid', 'addRaid_nonce'); ?>
|
|
|
|
<input type="hidden" name="action" value="addRaid">
|
|
|
|
<input type="text" name="name" placeholder="Titel" class="text-black">
|
|
|
|
<input type="text" name="difficulty" placeholder="Schwierigkeit" class="text-black">
|
|
|
|
<label for="start_date">Datum</label>
|
|
|
|
<input type="date" id="start_date" name="start_date" class="text-black">
|
|
|
|
<label for="start_time">Start</label>
|
|
|
|
<input type="time" name="start_time" id="start_time" class="text-black">
|
|
|
|
<label for="end_time">Datum</label>
|
|
|
|
<input type="time" name="end_time" id="end_time" class="text-black">
|
|
|
|
|
|
|
|
|
|
|
|
<button type="submit" class="btn btn-outline btn-hunter">Hinzufügen</a>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
2024-04-23 22:43:54 +02:00
|
|
|
-->
|
|
|
|
</div>
|
2024-04-23 00:44:42 +02:00
|
|
|
</template>
|
|
|
|
</div>
|
2024-04-15 23:07:29 +02:00
|
|
|
|
|
|
|
<?php
|
2024-04-23 00:44:42 +02:00
|
|
|
endif;
|
|
|
|
|
2024-04-16 15:25:22 +02:00
|
|
|
get_footer();
|