Add URL property to events.

This commit is contained in:
Yorin Anne De Jong 2016-08-26 17:22:11 +02:00
parent 8519c00a57
commit 328a2a31e6
5 changed files with 18 additions and 4 deletions

View File

@ -17,4 +17,6 @@ abstract class Event {
public abstract function getStop(); /* : DateTimeImmutable */
public abstract function getURL(); /* : string */
}

View File

@ -23,4 +23,8 @@ class AnimekveldEvent extends Event {
return "Liang Zhu";
}
public function getURL() /* : string */ {
return '/anime/';
}
}

View File

@ -23,4 +23,8 @@ class BrettspillEvent extends Event {
return "PVV";
}
public function getURL() /* : string */ {
return '/brettspill/';
}
}

View File

@ -23,4 +23,8 @@ class NerdepitsaEvent extends Event {
return "Anders Christensen";
}
public function getURL() /* : string */ {
return '/nerdepitsa/';
}
}

View File

@ -1,8 +1,8 @@
<?php
require '../src/_autoload.php';
date_default_timezone_set('Europe/Oslo');
require __DIR__ . '/../sql_config.php';
setlocale(LC_ALL, 'no_NO');
require __DIR__ . '/../src/_autoload.php';
require __DIR__ . '/../sql_config.php';
$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$agenda = new \pvv\side\Agenda([
@ -59,8 +59,8 @@ $agenda = new \pvv\side\Agenda([
<ul>
<?php foreach($events as $event) { $counter2++ ?>
<li>
<a><?= $event->getName(); ?></a>
<a class="icon subscribe" href="">+</a>
<a href="<?= htmlspecialchars($event->getURL()) ?>"><?= $event->getName(); ?></a>
<?php /* <a class="icon subscribe">+</a> */ ?>
<?php if ($period) {
if (\pvv\side\Agenda::isThisWeek($event->getStart()) || $event->getStart()->sub(new DateInterval('P3D'))->getTimestamp() < time()) {
echo '<span class="time">' . strftime('%a', $event->getStart()->getTimestamp()) . '</span>';