'strip', 'allow_unsafe_links' => false, ]); $util = new Util(); $pageloader = new FilesystemLoader(__DIR__ . '/pages'); $templateloader = new FilesystemLoader(__DIR__ . '/templates'); $twig_pages = new Environment($pageloader); $twig_templates = new Environment($templateloader); $title = ''; $content = ''; $topictreff = $twig_templates->render('topictreff.html.twig'); $nextevents = $twig_templates->render('nextevents.html.twig'); $raumstatus_b = $util->raumstatus(); $raumstatus = 'unbekannt'; $pages = array('index', 'about', 'treff', 'blog', 'events', 'kontakt', 'support', 'verein'); $page_names = array('index', 'über uns', 'zeiten & location', 'blog', 'events', 'kontakt', 'support', 'verein'); $active_page = ''; if(gettype($raumstatus_b) == "boolean") { if($raumstatus_b) $raumstatus = $util->html_link('https://status.ctdo.de/', 'green-text', 'offen', TRUE); else $raumstatus = $util->html_link('https://status.ctdo.de/', 'red-text', 'geschlossen', TRUE); } $topic = $util->get_next_topic(); $treff = $util->get_next_treff(); $repaircafe = $util->get_next_repaircafe(); $repaircafelink = 'RepairCafe'; switch ($repaircafe->days) { case 0: $repaircafe_output = '
Das nächste '.$repaircafelink.' findet heute statt!
'; break; case 1: $repaircafe_output = 'Das nächste '.$repaircafelink.' findet morgen statt!
'; break; default: $repaircafe_output = 'Das nächste '.$repaircafelink.' findet in '.$repaircafe->days.' Tagen ['.$repaircafe->date.'] statt.
'; break; } $brunch = $util->get_next_brunch(); $brunchlink = 'ChaosBrunch'; switch ($brunch->days) { case 0: $brunch_output = 'Das nächste '.$brunchlink.' findet heute statt!
'; break; case 1: $brunch_output = 'Das nächste '.$brunchlink.' findet morgen statt!
'; break; default: $brunch_output = 'Das nächste '.$brunchlink.' findet in '.$brunch->days.' Tagen ['.$brunch->date.'] statt.
'; break; } $css = ['main']; if(isset($_GET['page'])) { $page = $_GET['page']; $active_page = $util->str_mass_replace(array('adresse', 'irc', 'mail'), array('kontakt', 'kontakt', 'kontakt'), $page); $title = $page_names[array_search($active_page, $pages)]; switch ($page) { case 'index': $content = $twig_pages->render('index.html.twig', [ 'topic' => $topic_output, 'posts' => $util->generate_post_list(4) ]); $css[] = 'home'; $css[] = 'events'; break; case 'about': $content = $twig_pages->render('about.html.twig'); $css[] = 'about'; break; case 'treff': $content = $twig_pages->render('treff.html.twig'); break; case 'blog': if(!isset($_GET['id'])) { $content = $twig_pages->render('blog.html.twig', [ 'posts' => $util->generate_post_list() ]); $css[] = 'events'; } else { $content = $converter->convert($util->get_post_content($_GET['id'])); $css[] = 'event'; } break; case 'events': if(!isset($_GET['id'])) { $content = $twig_pages->render('events.html.twig', [ 'topic' => $topic, 'treff' => $treff, 'repaircafe' => $repaircafe, 'brunch' => $brunch, 'events' => $util->generate_event_list() ]); $css[] = 'events'; } else { $content = $util->str_mass_replace(array('{{ topicdatum }}', 'Chaostreff Dortmund e.V.', '{{ treffdatum }}', '{{ repaircafedatum }}', '{{ brunchdatum }}'), array($util->get_next_topic()->date, $util->html_link('/?page=treff', '', 'Chaostreff Dortmund e.V.', FALSE), $util->get_next_treff()->date, $util->get_next_repaircafe()->date, $util->get_next_brunch()->date), $converter->convert($util->get_event_content($_GET['id']))); $css[] = 'event'; } break; case 'kontakt': $content = $twig_pages->render('kontakt.html.twig'); $css[] = 'kontakt'; break; case 'adresse': $content = $twig_pages->render('kontakt/adresse.html.twig'); break; case 'irc': $content = $twig_pages->render('kontakt/irc.html.twig'); break; case 'mail': $content = $twig_pages->render('kontakt/mail.html.twig'); break; case 'tel': $content = $twig_pages->render('kontakt/tel.html.twig'); break; case 'support': $content = $twig_pages->render('support.html.twig'); break; case 'verein': $content = $twig_pages->render('verein.html.twig'); break; case 'impressum': $title = 'impressum'; $content = $twig_pages->render('impressum.html.twig'); break; case 'datenschutz': $title = 'datenschutz'; $content = $twig_pages->render('datenschutz.html.twig'); break; default: $content = $twig_pages->render('404.html.twig', ['page' => $_GET['page']]); break; } } else { $active_page = 'index'; $title = $active_page; $content = $twig_pages->render('index.html.twig', [ 'posts' => $util->generate_post_list(4) ]); $css[] = 'home'; $css[] = 'events'; } $nav = $util->generate_nav($active_page, $pages, $page_names); echo $twig_templates->render('html5struct.html.twig', ['title' => $title, 'css' => $css, 'nav' => $nav, 'raumstatus' => $raumstatus, 'main' => $content]); ?>