/teachings.txt'); class Teachings { private static $instance = false; private $list = array(); public static function instance() { if (self::$instance === false) self::$instance = new Teachings(TEACHINGS); return self::$instance; } private function __construct($path) { $this->import($path); } private function import($path) { if (($f = fopen($path, 'r')) === false) return; while ($line = fgets($f)) { $a = explode('|', chop($line)); $this->list[] = new Storage(array('start' => $a[0], 'end' => $a[1], 'location' => $a[2], 'title' => $a[3], 'url' => $a[4])); } fclose($f); } public function getCurrent() { } public function getList() { $html = ''; foreach ($this->list as $row) { if ($row->location != 'Linuxhotel') continue; $dstart = explode('-', $row->start); $dend = explode('-', $row->end); if ($dstart[1] == $dend[1]) $date = sprintf('%d.-%d.%d.%d', $dstart[2], $dend[2], $dstart[1], $dstart[0]); else $date = sprintf('%d.%d.-%d.%d.%d', $dstart[2], $dstart[1], $dend[2], $dstart[1], $dstart[0]); $link = strlen($row->url) ? sprintf('Details / Buchen', $row->url) : ''; $html .= sprintf('
Datum | ' . 'Beschreibung | ' . 'Link | ' . '
---|---|---|