2016-08-26 23:16:51 +02:00
|
|
|
<?php
|
|
|
|
date_default_timezone_set('Europe/Oslo');
|
|
|
|
setlocale(LC_ALL, 'no_NO');
|
2017-11-11 22:10:05 +01:00
|
|
|
require_once __DIR__ . '/../../inc/navbar.php';
|
|
|
|
require_once __DIR__ . '/../../src/_autoload.php';
|
|
|
|
require_once __DIR__ . '/../../sql_config.php';
|
2017-10-28 17:19:40 +02:00
|
|
|
|
2017-10-07 22:21:30 +02:00
|
|
|
$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
|
|
|
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
2016-09-02 14:49:48 +02:00
|
|
|
use \pvv\side\Agenda;
|
2016-08-26 23:16:51 +02:00
|
|
|
$agenda = new \pvv\side\Agenda([
|
|
|
|
new \pvv\side\social\NerdepitsaActivity,
|
|
|
|
new \pvv\side\social\AnimekveldActivity,
|
2017-10-07 22:21:30 +02:00
|
|
|
new \pvv\side\DBActivity($pdo),
|
2016-08-26 23:56:06 +02:00
|
|
|
]);
|
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;
|
|
|
|
|
2017-10-28 17:19:40 +02:00
|
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
2016-08-26 23:16:51 +02:00
|
|
|
<html lang="no">
|
2017-10-07 23:04:23 +02:00
|
|
|
<title>Aktivitetsverkstedet</title>
|
2016-08-26 23:16:51 +02:00
|
|
|
<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­verk­stedet</header>
|
2016-08-26 23:16:51 +02:00
|
|
|
|
|
|
|
<main>
|
|
|
|
|
2017-10-07 23:03:53 +02:00
|
|
|
<?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"));
|
2016-08-26 23:16:51 +02:00
|
|
|
|
2017-10-07 23:03:53 +02:00
|
|
|
$limit = 0;
|
|
|
|
foreach($events as $event) {
|
|
|
|
?>
|
2016-08-26 23:16:51 +02:00
|
|
|
<article>
|
2016-08-26 23:30:32 +02:00
|
|
|
<h2>
|
|
|
|
<?php if ($event->getImageURL()) { ?>
|
|
|
|
<img src="<?= $event->getImageURL() ?>">
|
|
|
|
<?php } ?>
|
2016-08-27 00:14:12 +02:00
|
|
|
<?php if (\pvv\side\Agenda::isToday($event->getStart())) { ?><strong><?php } ?>
|
2016-08-26 23:30:32 +02:00
|
|
|
<em><?= $event->getRelativeDate() ?></em>
|
2016-08-27 00:14:12 +02:00
|
|
|
<?php if (\pvv\side\Agenda::isToday($event->getStart())) { ?></strong><?php } ?>
|
2017-10-22 14:15:11 +02:00
|
|
|
<?php if ($event->getURL()) { ?>
|
2016-08-26 23:30:32 +02:00
|
|
|
<a href="<?= $event->getURL() ?>"><?= $event->getName() ?></a>
|
2017-10-22 14:15:11 +02:00
|
|
|
<?php } else { ?>
|
|
|
|
<?= $event->getName() ?>
|
|
|
|
<?php } ?>
|
2016-08-26 23:30:32 +02:00
|
|
|
</h2>
|
2016-08-26 23:16:51 +02:00
|
|
|
<ul class="subtext">
|
2016-09-02 14:49:48 +02:00
|
|
|
<li>Tid: <strong><?= Agenda::getFormattedDate($event->getStart()) ?></strong>
|
2016-08-26 23:16:51 +02:00
|
|
|
<li>Sted: <strong><?= $event->getLocation() ?></strong>
|
|
|
|
<li>Arrangør: <strong><?= $event->getOrganiser() ?></strong>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<?php $description = $event->getDescription(); ?>
|
2016-08-26 23:30:32 +02:00
|
|
|
<?php if ($limit) array_splice($description, $limit); ?>
|
2016-08-29 18:24:21 +02:00
|
|
|
<?= implode($description, "</p>\n<p>") ?>
|
2016-08-26 23:16:51 +02:00
|
|
|
</article>
|
|
|
|
|
2016-08-26 23:30:32 +02:00
|
|
|
<?php if (!$limit || $limit > 4) {$limit = 4;} else $limit = 2; ?>
|
2016-08-26 23:16:51 +02:00
|
|
|
<?php } ?>
|
|
|
|
|
|
|
|
</main>
|
2016-08-29 19:37:49 +02:00
|
|
|
|
2017-10-28 17:19:40 +02:00
|
|
|
<nav>
|
2017-11-11 15:20:58 +01:00
|
|
|
<?= navbar(1, 'aktiviteter'); ?>
|
|
|
|
<?= loginbar(); ?>
|
2016-08-29 19:37:49 +02:00
|
|
|
</nav>
|