<?php

require_once "common.php";

$Content = get_template('/termine.htm');

date_default_timezone_set('Europe/Vienna');

$st_mi = mktime(22,50,50,3,14,2018);
$st_do = mktime(22,50,50,3,22,2018);

while ($st_mi < time()) {
	$st_mi = $st_mi + (60 * 60 * 24 * 14); // +2 Wochen, ToDo: ich weis nicht ob das mit Schaltsekunden über die nächsten 1000 Jahre usw. auch funktioniert
}

while ($st_do < time()) {
	$st_do = $st_do + (60 * 60 * 24 * 14);
}

if ($st_mi < $st_do) {
	$d = $st_mi;
} else {
	$d = $st_do;
}

$Content = str_replace('<@NextStammtischDate@>',date('d.m.Y',$d),$Content);

$Styles = '<link rel="stylesheet" href="assets/css/leaflet.css" />';

$Scripts = '<script src="assets/js/leaflet.js"></script>';
$Scripts .= get_template ('/stammtisch_map.js');

$template = get_template('/main.htm');
$template = str_replace('<@Styles@>',$Styles,$template);
$template = str_replace('<@Sidebar@>',get_template('/sidebar.htm'),$template);
$template = str_replace('<@CalendarRange@>',gen_calendar_header(),$template);
$template = str_replace('<@CalendarContent@>',gen_calendar_content(),$template);
$template = str_replace('<@Content@>',$Content,$template);
$template = str_replace('<@Scripts@>',$Scripts,$template);
print_template($template);

?>
