nettsiden/www/aktiviteter/index.php

73 lines
2.0 KiB
PHP
Raw Normal View History

2018-02-13 19:19:32 +01:00
<?php namespace pvv\side;
2018-02-13 19:10:15 +01:00
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
2017-10-07 23:03:53 +02:00
$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">
2017-10-07 23:04:23 +02:00
<title>Aktivitetsverkstedet</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<link rel="stylesheet" href="../css/normalize.css">
<link rel="stylesheet" href="../css/style.css">
<link rel="stylesheet" href="../css/events.css">
2017-10-07 23:04:23 +02:00
<header>Aktivitets&shy;verk&shy;stedet</header>
<main>
2017-10-07 23:03:53 +02:00
<?php
use \DateTimeImmutable;
2017-10-07 23:03:53 +02:00
$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"));
2017-10-07 23:03:53 +02:00
$limit = 0;
foreach($events as $event) {
?>
<article>
<h2>
<?php if ($event->getImageURL()) { ?>
<img src="<?= $event->getImageURL() ?>">
<?php } ?>
2018-02-13 19:19:32 +01:00
<?php if (Agenda::isToday($event->getStart())) { ?><strong><?php } ?>
<em><?= $event->getRelativeDate() ?></em>
2018-02-13 19:19:32 +01:00
<?php if (Agenda::isToday($event->getStart())) { ?></strong><?php } ?>
2017-10-22 14:15:11 +02:00
<?php if ($event->getURL()) { ?>
<a href="<?= $event->getURL() ?>"><?= $event->getName() ?></a>
2017-10-22 14:15:11 +02:00
<?php } else { ?>
<?= $event->getName() ?>
2017-10-22 14:15:11 +02:00
<?php } ?>
</h2>
<ul class="subtext">
<li>Tid: <strong><?= Agenda::getFormattedDate($event->getStart()) ?></strong>
<li>Sted: <strong><?= $event->getLocation() ?></strong>
<li>Arrangør: <strong><?= $event->getOrganiser() ?></strong>
</ul>
<?php $description = $event->getDescription(); ?>
<?php if ($limit) array_splice($description, $limit); ?>
2016-08-29 18:24:21 +02:00
<?= implode($description, "</p>\n<p>") ?>
</article>
<?php if (!$limit || $limit > 4) {$limit = 4;} else $limit = 2; ?>
<?php } ?>
</main>
<nav>
<?= navbar(1, 'aktiviteter'); ?>
2018-02-13 19:08:41 +01:00
<?= loginbar($sp, $pdo); ?>
</nav>