Projects/nettsiden-old
Projects
/
nettsiden-old
Archived
8
0
Fork 0

Move agenda creation to single include

This is to minimize problems arizing from adding and removing recurring events
This commit is contained in:
Peder Bergebakken Sundt 2018-02-10 18:33:36 +01:00
parent 8b148fe0e3
commit 9f38e2af1a
3 changed files with 14 additions and 20 deletions

11
inc/agenda.php Normal file
View File

@ -0,0 +1,11 @@
<?php
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([
new \pvv\side\social\NerdepitsaActivity,
new \pvv\side\social\AnimekveldActivity,
new \pvv\side\DBActivity($pdo),
]);

View File

@ -2,17 +2,9 @@
date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'nb_NO');
require __DIR__ . '/../inc/navbar.php';
require __DIR__ . '/../src/_autoload.php';
require __DIR__ . '/../sql_config.php';
require __DIR__ . '/../inc/agenda.php';
$translation = ['i dag', 'i morgen', 'denne uka', 'neste uke', 'denne måneden', 'neste måned'];
$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$agenda = new \pvv\side\Agenda([
new \pvv\side\social\NerdepitsaActivity,
new \pvv\side\social\AnimekveldActivity,
new \pvv\side\DBActivity($pdo),
]);
?>
<!DOCTYPE html>
<html lang="no">

View File

@ -1,19 +1,10 @@
<?php
date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'nb_NO');
require_once __DIR__ . '/../../inc/navbar.php';
require_once __DIR__ . '/../../src/_autoload.php';
require_once __DIR__ . '/../../sql_config.php';
require __DIR__ . '/../../inc/navbar.php';
require __DIR__ . '/../../inc/agenda.php';
use \pvv\side\Agenda;
$months_translations = ['januar', 'februar', 'mars', 'april', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'desember'];
$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$agenda = new \pvv\side\Agenda([
new \pvv\side\social\NerdepitsaActivity,
new \pvv\side\social\AnimekveldActivity,
new \pvv\side\DBActivity($pdo),
]);
$year = (isset($_GET['year']))
? $_GET['year']