'; } function generate_nav($active_page, $pages, $page_names) { $output = ''; return $output; } function html_link($href, $class, $innerHTML, $blank) { if($blank) return ''.$innerHTML.''; else return ''.$innerHTML.''; } function raumstatus() { $url = 'https://status.ctdo.de/api/simple/v2'; $data = json_decode(file_get_contents($url), true); return $data['state']; } function str_mass_replace($searchs, $replacers, $string) { foreach ($searchs as $key => $search) { $string = str_replace($search, $replacers[$key], $string); } return $string; } function scan_for_events() { $s = scandir('events/'); $output = array(); foreach ($s as $f) { if(count(str_split($f)) == 13) $output[] = $f; } return $output; } function generate_event_list() { $events = $this->scan_for_events(); $output = ""; foreach ($events as $event) { $date = str_replace('.md', '', $event); $lines = file(__DIR__ . '/../events/' . $event); $title = $lines[0]; $desc = $lines[1]; $output .= '

'.$date.'

'.$title.'

'.$desc.'

'; } return $output; } function get_event_content($date) { $lines = file(__DIR__ . '/../events/' . $date . '.md'); $output = ""; for ($i = 3; $i < count($lines); $i++) $output .= $lines[$i] . "\n"; return $output; } function get_next_topic() { $output = new stdClass(); $currentDate = new DateTime(); // Find the next fourth Tuesday $nextFourthTuesday = clone $currentDate; $nextFourthTuesday->modify('next Tuesday')->modify('next Tuesday')->modify('next Tuesday'); while ($nextFourthTuesday->format('N') !== '2') { $nextFourthTuesday->add(new DateInterval('P1D')); } $output->days = $currentDate->diff($nextFourthTuesday)->days+1; $output->date = $nextFourthTuesday->format('Y-m-d'); return $output; } } ?>