diff options
author | MaZderMind | 2015-04-01 21:03:21 +0200 |
---|---|---|
committer | MaZderMind | 2015-04-01 21:03:21 +0200 |
commit | 759184ba0519acfa7d695e44c2af6c2d2a27794e (patch) | |
tree | f5589350ab4a809d1e0efedc93e715bd4026f345 | |
parent | 7428fbab25ed89d3f1189e1e1117abf1fb86a6ec (diff) |
Allow Filtering Rooms from the Schedule
-rw-r--r-- | config.php | 7 | ||||
-rw-r--r-- | model/Schedule.php | 16 |
2 files changed, 23 insertions, 0 deletions
@@ -455,6 +455,13 @@ $GLOBALS['CONFIG']['SCHEDULE'] = array( 'URL' => 'http://events.ccc.de/congress/2014/Fahrplan/schedule.xml', /** + * Nur die angegebenen Räume aus dem Fahrplan beachten + * + * Wird diese Zeile auskommentiert, werden alle Räume angezeigt + */ + 'ROOMFILTER' => array('SAAL', 'Tagungsraum 1'), + + /** * APCU-Cache-Zeit in Sekunden * Wird diese Zeile auskommentiert, werden die apc_*-Methoden nicht verwendet und * der Fahrplan bei jedem Request von der Quelle geladen und geparst diff --git a/model/Schedule.php b/model/Schedule.php index 5c7858a..db93c4d 100644 --- a/model/Schedule.php +++ b/model/Schedule.php @@ -6,6 +6,15 @@ class Schedule extends ModelBase return $this->has('SCHEDULE'); } + private function isRoomFiltered($room) + { + if(!$this->has('SCHEDULE.ROOMFILTER')) + return false; + + $rooms = $this->get('SCHEDULE.ROOMFILTER'); + return !in_array($room, $rooms); + } + public function getSimulationOffset() { return $this->get('SCHEDULE.SIMULATE_OFFSET', 0); } @@ -53,6 +62,10 @@ class Schedule extends ModelBase foreach($day->room as $room) { + $name = (string)$room['name']; + if($this->isRoomFiltered($name)) + continue; + foreach($room->event as $event) { $start = strtotime((string)$event->date); @@ -82,6 +95,9 @@ class Schedule extends ModelBase $lastend = false; $name = (string)$room['name']; + if($this->isRoomFiltered($name)) + continue; + if(isset($mapping[$name])) $name = $mapping[$name]; |