Make days clickable in kalender
This commit is contained in:
parent
34e09667e5
commit
aef3488c80
|
@ -5,7 +5,6 @@ require __DIR__ . '/../../src/_autoload.php';
|
|||
require __DIR__ . '/../../sql_config.php';
|
||||
$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
|
||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
use \pvv\side\Agenda;
|
||||
$agenda = new \pvv\side\Agenda([
|
||||
new \pvv\side\social\NerdepitsaActivity,
|
||||
|
@ -13,6 +12,17 @@ $agenda = new \pvv\side\Agenda([
|
|||
new \pvv\side\social\BrettspillActivity,
|
||||
new \pvv\side\DBActivity($pdo),
|
||||
]);
|
||||
|
||||
$year = (isset($_GET['year']))
|
||||
? $_GET['year']
|
||||
: date("Y");
|
||||
$month = (isset($_GET['month']))
|
||||
? $_GET['month']
|
||||
: date("m");
|
||||
$day = (isset($_GET['day']))
|
||||
? $_GET['day']
|
||||
: -1;
|
||||
|
||||
?><!DOCTYPE html>
|
||||
<html lang="no">
|
||||
<title>Aktivitetverkstedet</title>
|
||||
|
@ -26,9 +36,16 @@ $agenda = new \pvv\side\Agenda([
|
|||
|
||||
<main>
|
||||
|
||||
<?php $limit = 0; ?>
|
||||
<?php foreach($agenda->getNextOfEach(new \DateTimeImmutable) as $event) { ?>
|
||||
<?php
|
||||
$events = ($day==-1)
|
||||
? $agenda->getNextOfEach(new \DateTimeImmutable)
|
||||
: $agenda->getEventsBetween(
|
||||
new DateTimeImmutable("$year-$month-$day 00:00:00"),
|
||||
new DateTimeImmutable("$year-$month-$day 23:59:59"));
|
||||
|
||||
$limit = 0;
|
||||
foreach($events as $event) {
|
||||
?>
|
||||
<article>
|
||||
<h2>
|
||||
<?php if ($event->getImageURL()) { ?>
|
||||
|
|
|
@ -12,6 +12,14 @@ figure.calendar {
|
|||
grid-template-rows: auto;
|
||||
}
|
||||
|
||||
.calendar ul a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
.calendar ul a div {
|
||||
min-height: 4.8em;
|
||||
}
|
||||
|
||||
|
||||
.calendar ul li {
|
||||
margin: 2px;
|
||||
|
@ -28,7 +36,6 @@ figure.calendar {
|
|||
font-size: 0.8em;
|
||||
color: #444;
|
||||
|
||||
transition: 0.1s;
|
||||
}
|
||||
|
||||
.calendar ul li.header {
|
||||
|
|
|
@ -72,19 +72,24 @@ $days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year));
|
|||
<?php } ?>
|
||||
|
||||
<?php for ($day=1; $day <= $days_in_month; $day++) { ?>
|
||||
|
||||
<?php $events = $agenda->getEventsBetween(
|
||||
new DateTimeImmutable("$year-$month-$day 00:00:00"),
|
||||
new DateTimeImmutable("$year-$month-$day 23:59:59")); ?>
|
||||
<?php if ($day==$day_of_month) { ?>
|
||||
<li class="active"><?= $day ?>.
|
||||
<?php } else { ?>
|
||||
<li><?= $day ?>.
|
||||
<?php } ?>
|
||||
|
||||
<?php foreach($events as $event) { ?>
|
||||
<section><?=$event->getName()?></section>
|
||||
<?php } ?>
|
||||
<?php $events = $agenda->getEventsBetween(
|
||||
new DateTimeImmutable("$year-$month-$day 00:00:00"),
|
||||
new DateTimeImmutable("$year-$month-$day 23:59:59")); ?>
|
||||
<?php if ($day==$day_of_month) { ?>
|
||||
<li class="active">
|
||||
<?php } else { ?>
|
||||
<li>
|
||||
<?php } ?>
|
||||
<?php if (sizeof($events)!=0) { ?>
|
||||
<a href="../aktiviteter/?<?="year=$year&month=$month&day=$day"?>"><div>
|
||||
<?= $day ?>.
|
||||
<?php foreach($events as $event) { ?>
|
||||
<section><?=$event->getName()?></section>
|
||||
<?php } ?>
|
||||
</div></a>
|
||||
<?php } else { ?>
|
||||
<?= $day ?>.
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue