mirror of
https://github.com/voc/streaming-website
synced 2024-11-10 14:44:21 +00:00
Allow Filtering Rooms from the Schedule
This commit is contained in:
parent
7428fbab25
commit
759184ba05
2 changed files with 23 additions and 0 deletions
|
@ -454,6 +454,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
|
||||
|
|
|
@ -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];
|
||||
|
||||
|
|
Loading…
Reference in a new issue