From db0a85ea97096af4529b0ea3b903d182144c1310 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Mon, 3 Nov 2014 21:53:30 +0100 Subject: experimental program view --- lib/config.php | 31 ++++++++++++++++ lib/helper.php | 8 +++++ lib/program.php | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 146 insertions(+) create mode 100644 lib/config.php create mode 100644 lib/program.php (limited to 'lib') diff --git a/lib/config.php b/lib/config.php new file mode 100644 index 0000000..2b6b78e --- /dev/null +++ b/lib/config.php @@ -0,0 +1,31 @@ + 'Saal 1', + 'saal2' => 'Saal 2', + 'saalg' => 'Saal G', + 'saal6' => 'Saal 6', + + 'lounge' => 'Lounge', + 'ambient' => 'Ambient', + + 'sendezentrum' => 'Sendezentrum', +); + +$GLOBALS['CONFIG']['FORMATS'] = array( + 'hd' => 'FullHD', + 'hq' => 'High Quality', + 'lq' => 'Low Quality', + 'audio' => 'Audio', + 'slides' => 'Slide-Images', +); + +?> diff --git a/lib/helper.php b/lib/helper.php index 8951948..4dc6f69 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -1,5 +1,7 @@ day as $day) + { + $dayidx++; + $daystart = strtotime((string)$day['start']); + $dayend = strtotime((string)$day['end']); + + $roomidx = 0; + foreach($day->room as $room) + { + $roomidx++; + $name = (string)$room['name']; + $lastend = false; + + foreach ($room->event as $event) + { + $start = strtotime((string)$event->date); + $duration = strtoduration((string)$event->duration); + $end = $start + $duration; + + if($lastend && $lastend < $start) + { + // synthesize pause event + $pauseduration = $start - $lastend; + $program[$name][] = array( + 'special' => 'pause', + 'title' => round($pauseduration / 60).' minutes pause', + + 'fstart' => date('c', $lastend), + 'fend' => date('c', $start), + + 'start' => $lastend, + 'end' => $start, + 'duration' => $pauseduration, + ); + } + else if(!$lastend && $daystart < $start) + { + $program[$name][] = array( + 'special' => 'gap', + + 'fstart' => date('c', $daystart), + 'fend' => date('c', $start), + + 'start' => $daystart, + 'end' => $start, + 'duration' => $start - $daystart, + ); + } + + $program[$name][] = array( + 'title' => (string)$event->title, + + 'fstart' => date('c', $start), + 'fend' => date('c', $end), + + 'start' => $start, + 'end' => $end, + 'duration' => $duration, + ); + + $lastend = $end; + } + + // synthesize daychange event + if(!$lastend) $lastend = $daystart; + if($lastend < $dayend) + { + $program[$name][] = array( + 'special' => 'gap', + + 'fstart' => date('c', $lastend), + 'fend' => date('c', $dayend), + + 'start' => $lastend, + 'end' => $dayend, + 'duration' => $dayend - $lastend, + ); + } + + if($dayidx < count($schedule->day)) + { + $program[$name][] = array( + 'special' => 'daychange', + 'title' => 'Daychange from Day '.$dayidx.' to '.($dayidx+1), + ); + } + } + } + + if(function_exists('apc_store')) + apc_store($cacheidx, $program, $GLOBALS['CONFIG']['SCHEDULE_CACHE_TTL']); + + return $program; +} -- cgit v1.2.3