'; } 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_posts() { $s = scandir(__DIR__ . '/../posts/', SCANDIR_SORT_DESCENDING); $output = array(); foreach ($s as $f) { if(count(str_split($f)) >= 4) $output[] = $f; } return $output; } function generate_post_list($limit = -1) { $events = $this->scan_for_posts(); $output = ""; if ($limit == -1) { foreach ($events as $event) { $lines = file(__DIR__ . '/../posts/' . $event); $title = $lines[0]; $desc = $lines[1]; $date = $lines[2]; $signatur = $lines[3]; $output .= '

'.$signatur.'
'.$date.'

'.$title.'

'.$desc.'

'; } } else { if($limit > count($events)) $limit = count($events); for ($i = 0; $i < $limit; $i++) { $lines = file(__DIR__ . '/../posts/' . $events[$i]); $title = $lines[0]; $desc = $lines[1]; $date = $lines[2]; $signatur = $lines[3]; $output .= '

'.$signatur.'

'.$date.'

'.$title.'

'.$desc.'

'; } } return $output; } function get_post_content($id) { $lines = file(__DIR__ . '/../posts/' . str_replace('.', '', $id) . '.md'); $output = ""; for ($i = 5; $i < count($lines); $i++) $output .= $lines[$i] . "\n"; return $output; } function get_next_topic() { $output = new stdClass(); $currentDate = new DateTime(); $next_topic = clone $currentDate; $next_topic->modify('second Tuesday of this month +1 week'); while ($next_topic->format('N') !== '2') { $next_topic->add(new DateInterval('P1D')); } $output->days = $currentDate->diff($next_topic)->days+1; $output->date = $next_topic->format('Y-m-d'); return $output; } } ?>