2017-10-07 21:25:51 +02:00
|
|
|
<?php
|
2018-02-13 19:10:15 +01:00
|
|
|
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
2017-10-07 21:25:51 +02:00
|
|
|
|
|
|
|
$year = (isset($_GET['year']))
|
|
|
|
? $_GET['year']
|
|
|
|
: date("Y");
|
|
|
|
$month = (isset($_GET['month']))
|
|
|
|
? $_GET['month']
|
|
|
|
: date("m");
|
|
|
|
$days_before_the_first = (new DateTime($year."-".$month."-01"))->format("w") - 1;
|
|
|
|
if ($days_before_the_first==-1) {$days_before_the_first = 6;}
|
|
|
|
$day_of_month = ($month == date("m"))
|
|
|
|
? date("j")
|
|
|
|
: -1;
|
|
|
|
$days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year));
|
|
|
|
|
|
|
|
?><!DOCTYPE html>
|
|
|
|
<html lang="no">
|
|
|
|
|
2018-02-10 16:23:17 +01:00
|
|
|
<head>
|
|
|
|
<title>Kalenderverkstedet</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">
|
|
|
|
<link rel="stylesheet" href="../css/calendar.css">
|
|
|
|
</head>
|
2017-10-07 21:25:51 +02:00
|
|
|
|
2018-02-10 16:23:17 +01:00
|
|
|
<body>
|
|
|
|
<nav>
|
2018-08-09 22:28:34 +02:00
|
|
|
<?php echo navbar(1, 'hendelser'); ?>
|
2018-02-24 17:02:00 +01:00
|
|
|
<?php echo loginbar(null, $pdo); ?>
|
2018-02-10 16:23:17 +01:00
|
|
|
</nav>
|
2017-10-07 21:25:51 +02:00
|
|
|
|
2018-02-10 16:23:17 +01:00
|
|
|
<main>
|
2018-08-06 23:27:45 +02:00
|
|
|
<h2 style="text-align:center;">PVV Kalender for <?=$months_translations[$month-1]?> <?=$year?></h2>
|
2017-10-07 21:25:51 +02:00
|
|
|
|
2018-08-12 03:55:41 +02:00
|
|
|
<div class="pagination_bar"><?php
|
2018-02-10 16:23:17 +01:00
|
|
|
$pmonth = $month-1;
|
|
|
|
$nmonth = $month+1;
|
|
|
|
$pyear=$year;
|
|
|
|
$nyear=$year;
|
|
|
|
if ($pmonth==0) {$pmonth=12; $pyear--;}
|
|
|
|
if ($nmonth==13) {$nmonth=1; $nyear++;}
|
|
|
|
?>
|
|
|
|
<a class="btn noselect" href="../kalender?year=<?=$pyear?>&month=<?=$pmonth?>">Forrige måned</a>
|
2018-08-12 03:55:41 +02:00
|
|
|
<a class="btn noselect" href="../kalender?year=<?=$nyear?>&month=<?=$nmonth?>">Neste måned</a>
|
|
|
|
</div>
|
2017-10-07 21:25:51 +02:00
|
|
|
|
2018-02-10 16:23:17 +01:00
|
|
|
<figure class="calendar">
|
2018-02-24 16:53:17 +01:00
|
|
|
<ul>
|
|
|
|
<li class="header noselect">mandag
|
|
|
|
<li class="header noselect">tirsdag
|
|
|
|
<li class="header noselect">onsdag
|
|
|
|
<li class="header noselect">torsdag
|
|
|
|
<li class="header noselect">fredag
|
|
|
|
<li class="header noselect">lørdag
|
|
|
|
<li class="header noselect">søndag
|
2017-10-07 21:25:51 +02:00
|
|
|
|
2018-02-24 16:53:17 +01:00
|
|
|
<?php if ($days_before_the_first != 0) { ?>
|
|
|
|
<li class="outOfMonth" style="grid-column: 1/<?=$days_before_the_first+1?>;">
|
2017-10-07 23:03:53 +02:00
|
|
|
<?php } ?>
|
2017-10-07 21:25:51 +02:00
|
|
|
|
2018-02-24 16:53:17 +01:00
|
|
|
<?php for ($day=1; $day <= $days_in_month; $day++) { ?>
|
|
|
|
<?php $events = $agenda->getEventsBetween(
|
|
|
|
new DateTimeImmutable("$year-$month-$day 00:00:00"),
|
|
|
|
new DateTimeImmutable("$year-$month-$day 23:59:59")); ?>
|
|
|
|
<?php if ($day==$day_of_month) { ?>
|
|
|
|
<li class="active">
|
|
|
|
<?php } else { ?>
|
|
|
|
<li>
|
|
|
|
<?php } ?>
|
|
|
|
<?php if (sizeof($events)!=0) { ?>
|
|
|
|
<a href="../aktiviteter/?<?="year=$year&month=$month&day=$day"?>"><div>
|
|
|
|
<span class="noselect day"><?= $day ?>.</span>
|
|
|
|
<?php foreach($events as $event) { ?>
|
|
|
|
<section style="background: <?=$event->getColor()?>"><?=$event->getName()?></section>
|
|
|
|
<?php } ?>
|
|
|
|
</div></a>
|
|
|
|
<?php } else { ?>
|
|
|
|
<span class="noselect day"><?= $day ?>.</span>
|
2018-02-10 16:23:17 +01:00
|
|
|
<?php } ?>
|
2018-02-24 16:53:17 +01:00
|
|
|
<?php } ?>
|
2017-10-07 21:25:51 +02:00
|
|
|
|
2018-02-24 16:53:17 +01:00
|
|
|
</ul>
|
2018-02-10 16:23:17 +01:00
|
|
|
</figure>
|
|
|
|
</main>
|
2018-02-24 16:53:17 +01:00
|
|
|
<body>
|