Add PDO-activity for reading events from database.

This commit is contained in:
2016-08-18 22:43:32 +02:00
parent 2949aba2bb
commit 72b3a1f535
4 changed files with 92 additions and 18 deletions

View File

@@ -1,4 +1,8 @@
<?php require '../src/_autoload.php'; date_default_timezone_set('Europe/Oslo') ?><!DOCTYPE html>
<?php
require '../src/_autoload.php';
date_default_timezone_set('Europe/Oslo');
//include __DIR__.'/../sql_config.php';
?><!DOCTYPE html>
<html lang="no">
<title>Programvareverkstedet</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
@@ -40,7 +44,12 @@
<?php $translation = ['i dag', 'i morgen', 'denne uka', 'denne måned', 'neste måned'] ?>
<?php $counter1 = 0; ?>
<?php $counter2 = 0; ?>
<?php foreach((new \pvv\side\Agenda())->getNextDays() as $period => $events) if ($events && $counter1 < 2 && $counter2 < 10) { $counter1++ ?>
<?php $agenda = new \pvv\side\Agenda([
new \pvv\side\social\NerdepitsaActivity,
new \pvv\side\social\AnimekveldActivity,
new \pvv\side\DBActivity('sqlite:../pvv.sqlite', null, null),
]); ?>
<?php foreach($agenda->getNextDays() as $period => $events) if ($events && $counter1 < 2 && $counter2 < 10) { $counter1++ ?>
<li><p><?= $translation[$period] ?> <span><?= reset($events)->getStart()->format('Y-m-d'); ?></span></p>
<ul>
<?php foreach($events as $event) { $counter2++ ?>