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