aboutsummaryrefslogtreecommitdiff
path: root/model
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--model/Conference.php84
-rw-r--r--model/Conferences.php67
-rw-r--r--model/Feedback.php22
-rw-r--r--model/GenericConference.php5
-rw-r--r--model/ModelBase.php20
-rw-r--r--model/Overview.php15
-rw-r--r--model/Relive.php17
-rw-r--r--model/Room.php85
-rw-r--r--model/RoomSelection.php10
-rw-r--r--model/RoomTab.php8
-rw-r--r--model/Schedule.php39
-rw-r--r--model/Subtitles.php21
12 files changed, 250 insertions, 143 deletions
diff --git a/model/Conference.php b/model/Conference.php
index c6afa98..07d72dd 100644
--- a/model/Conference.php
+++ b/model/Conference.php
@@ -2,6 +2,18 @@
class Conference extends ModelBase
{
+ private $slug;
+
+ public function __construct($config, $slug)
+ {
+ parent::__construct($config);
+ $this->slug = $slug;
+ }
+
+ public function getSlug() {
+ return $this->slug;
+ }
+
public function getTitle() {
return $this->get('CONFERENCE.TITLE', 'C3VOC');
}
@@ -20,6 +32,14 @@ class Conference extends ModelBase
return !$this->hasBegun() || $this->hasEnded();
}
+ public function startsAt() {
+ return $this->get('CONFERENCE.STARTS_AT');
+ }
+
+ public function endsAt() {
+ return $this->get('CONFERENCE.ENDS_AT');
+ }
+
public function hasBegun() {
// on the preview-domain all conferences are always open
if($this->isPreviewEnabled())
@@ -101,10 +121,10 @@ class Conference extends ModelBase
}
public function getLink() {
- return url_params();
+ return forceslash($this->getSlug()).url_params();
}
public function getAboutLink() {
- return 'about/'.url_params();
+ return joinpath([$this->getSlug(), 'about']).url_params();
}
public function hasRelive() {
@@ -112,12 +132,26 @@ class Conference extends ModelBase
}
public function getReliveUrl() {
if($this->has('CONFERENCE.RELIVE_JSON'))
- return 'relive/'.url_params();
+ return joinpath([$this->getSlug(), 'relive']).url_params();
else
return null;
}
+ public function hasFeedback() {
+ return $this->has('FEEDBACK');
+ }
+ public function getFeedbackUrl() {
+ return joinpath([$this->getSlug(), 'feedback']).url_params();
+ }
+ public function getFeedbackReadUrl() {
+ return joinpath([$this->getSlug(), 'feedback', 'read']).url_params();
+ }
+
+ public function getScheduleJsonUrl() {
+ return joinpath([$this->getSlug(), 'schedule.json']).url_params();
+ }
+
public function hasBannerHtml() {
return $this->has('CONFERENCE.BANNER_HTML');
}
@@ -131,4 +165,48 @@ class Conference extends ModelBase
public function getFooterHtml() {
return $this->get('CONFERENCE.FOOTER_HTML');
}
+
+
+ public function getRooms()
+ {
+ $rooms = array();
+ foreach($this->get('ROOMS') as $slug => $room)
+ $rooms[] = $this->getRoom($slug);
+
+ return $rooms;
+ }
+
+ public function getRoomIfExists($room)
+ {
+ if($this->hasRoom($room))
+ return $this->getRoom($room);
+
+ return null;
+ }
+
+ public function hasRoom($slug)
+ {
+ return $this->has('ROOMS.'.$slug);
+ }
+
+ public function getRoom($room) {
+ return new Room($this, $room);
+ }
+
+
+ public function getFeedback() {
+ return new Feedback($this);
+ }
+ public function getSchedule() {
+ return new Schedule($this);
+ }
+ public function getSubtitles() {
+ return new Subtitles($this);
+ }
+ public function getOverview() {
+ return new Overview($this);
+ }
+ public function getRelive() {
+ return new Relive($this);
+ }
}
diff --git a/model/Conferences.php b/model/Conferences.php
index 461186f..4919345 100644
--- a/model/Conferences.php
+++ b/model/Conferences.php
@@ -4,27 +4,38 @@ class Conferences extends ModelBase
{
const MANDATOR_DIR = 'configs/conferences/';
+ public static function listConferences() {
+ $directories = scandir(forceslash(Conferences::MANDATOR_DIR));
+ $conferences = array_filter($directories, function($dirname) {
+ return $dirname[0] != '.';
+ });
+
+ return $conferences;
+ }
+
public static function getConferences() {
$conferences = [];
- foreach(scandir(forceslash(Conferences::MANDATOR_DIR)) as $el)
+ foreach(Conferences::listConferences() as $conference)
{
- if($el[0] == '.')
- continue;
-
- $conferences[$el] = Conferences::getConferenceInformation($el);
+ try {
+ $conferences[$conference] = Conferences::getConference($conference);
+ }
+ catch(Exception $e) {
+ // ignore unloadable conferences
+ }
}
return $conferences;
}
public static function getConferencesCount() {
- return count(Conferences::getConferences());
+ return count(Conferences::listConferences());
}
public static function getActiveConferences() {
return array_values(array_filter(
Conferences::getConferences(),
- function($info) {
- return $info['active'];
+ function($conference) {
+ return !$conference->isClosed();
}
));
}
@@ -37,7 +48,7 @@ class Conferences extends ModelBase
$sorted = Conferences::getConferences();
usort($sorted, function($a, $b) {
- return @$b['CONFIG']['CONFERENCE']['STARTS_AT'] - @$a['CONFIG']['CONFERENCE']['STARTS_AT'];
+ return $b->startsAt() - $a->endsAt();
});
return $sorted;
@@ -47,7 +58,7 @@ class Conferences extends ModelBase
$sorted = Conferences::getConferencesSorted();
$finished = array_values(array_filter($sorted, function($c) {
- return @$c['CONFIG']['CONFERENCE']['ENDS_AT'] < time();
+ return $c->hasEnded();
}));
return $finished;
@@ -58,33 +69,16 @@ class Conferences extends ModelBase
}
public static function exists($mandator) {
- return array_key_exists($mandator, Conferences::getConferences());
+ return in_array($mandator, Conferences::listConferences());
}
- public static function getConferenceInformation($mandator) {
- if(isset($GLOBALS['CONFIG']))
- $saved_config = $GLOBALS['CONFIG'];
-
- Conferences::load($mandator);
- $conf = new Conference();
- $info = [
- 'slug' => $mandator,
- 'link' => forceslash($mandator).url_params(),
- 'active' => !$conf->isClosed(),
- 'title' => $conf->getTitle(),
- 'description' => $conf->getDescription(),
-
- 'relive' => $conf->hasRelive() ? forceslash($mandator).$conf->getReliveUrl() : null,
- 'releases' => $conf->hasReleases() ? $conf->getReleasesUrl() : null,
-
- 'CONFIG' => $GLOBALS['CONFIG'],
- ];
- unset($GLOBALS['CONFIG']);
-
- if(isset($saved_config))
- $GLOBALS['CONFIG'] = $saved_config;
+ public static function loadConferenceConfig($mandator) {
+ $config = forceslash(Conferences::MANDATOR_DIR).forceslash($mandator).'config.php';
+ return include($config);
+ }
- return $info;
+ public static function getConference($mandator) {
+ return new Conference(Conferences::loadConferenceConfig($mandator), $mandator);
}
public static function hasCustomStyles($mandator) {
@@ -96,9 +90,4 @@ class Conferences extends ModelBase
public static function getCustomStylesDir($mandator) {
return forceslash(Conferences::MANDATOR_DIR).forceslash($mandator);
}
-
- public static function load($mandator) {
- include(forceslash(Conferences::MANDATOR_DIR).forceslash($mandator).'config.php');
- return isset($GLOBALS['CONFIG']);
- }
}
diff --git a/model/Feedback.php b/model/Feedback.php
index 578650a..9475fe8 100644
--- a/model/Feedback.php
+++ b/model/Feedback.php
@@ -1,12 +1,16 @@
<?php
-class Feedback extends ModelBase
+class Feedback
{
- public function isEnabled() {
- return $this->has('FEEDBACK');
+ private $conference;
+
+ public function __construct(Conference $conference)
+ {
+ $this->conference = $conference;
}
- public function getUrl() {
- return 'feedback/';
+
+ public function getConference() {
+ return $this->conference;
}
public function validate($info)
@@ -23,7 +27,7 @@ class Feedback extends ModelBase
public function store($info)
{
- $db = new PDO($this->get('FEEDBACK.DSN'));
+ $db = new PDO($this->getConference()->get('FEEDBACK.DSN'));
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stm = $db->prepare('
@@ -50,8 +54,8 @@ class Feedback extends ModelBase
{
return
isset($_SERVER['PHP_AUTH_USER']) &&
- $_SERVER['PHP_AUTH_USER'] == $this->get('FEEDBACK.USERNAME') &&
- $_SERVER['PHP_AUTH_PW'] == $this->get('FEEDBACK.PASSWORD');
+ $_SERVER['PHP_AUTH_USER'] == $this->getConference()->get('FEEDBACK.USERNAME') &&
+ $_SERVER['PHP_AUTH_PW'] == $this->getConference()->get('FEEDBACK.PASSWORD');
}
public function requestLogin()
@@ -64,7 +68,7 @@ class Feedback extends ModelBase
public function read($from, $to)
{
- $db = new PDO($this->get('FEEDBACK.DSN'));
+ $db = new PDO($this->getConference()->get('FEEDBACK.DSN'));
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stm = $db->prepare('
diff --git a/model/GenericConference.php b/model/GenericConference.php
index 5f134fc..63faf8f 100644
--- a/model/GenericConference.php
+++ b/model/GenericConference.php
@@ -2,6 +2,11 @@
class GenericConference extends Conference
{
+ public function __construct()
+ {
+ $this->config = null;
+ }
+
public function hasBegun() {
return true;
}
diff --git a/model/ModelBase.php b/model/ModelBase.php
index 7b1370b..41f329b 100644
--- a/model/ModelBase.php
+++ b/model/ModelBase.php
@@ -2,14 +2,17 @@
class ModelBase
{
- protected function has($keychain)
+ protected $config;
+ public function __construct($config)
{
- return ModelBase::_has($GLOBALS['CONFIG'], $keychain);
+ $this->config = $config;
}
- protected static function staticHas($keychain)
+
+ public function has($keychain)
{
- return ModelBase::_has($GLOBALS['CONFIG'], $keychain);
+ return ModelBase::_has($this->config, $keychain);
}
+
private static function _has($array, $keychain)
{
if(!is_array($keychain))
@@ -25,14 +28,11 @@ class ModelBase
return ModelBase::_has($array[$key], array_slice($keychain, 1));
}
- protected function get($keychain, $default = null)
+ public function get($keychain, $default = null)
{
- return ModelBase::_get($GLOBALS['CONFIG'], $keychain, $default);
- }
- protected static function staticGet($keychain, $default = null)
- {
- return ModelBase::_get($GLOBALS['CONFIG'], $keychain, $default);
+ return ModelBase::_get($this->config, $keychain, $default);
}
+
private static function _get($array, $keychain, $default)
{
if(!is_array($keychain))
diff --git a/model/Overview.php b/model/Overview.php
index 03ef8b4..8a467bc 100644
--- a/model/Overview.php
+++ b/model/Overview.php
@@ -1,16 +1,25 @@
<?php
-class Overview extends ModelBase
+class Overview
{
+ public function __construct(Conference $conference)
+ {
+ $this->conference = $conference;
+ }
+
+ public function getConference() {
+ return $this->conference;
+ }
+
public function getGroups() {
$groups = array();
- foreach($this->get('OVERVIEW.GROUPS') as $group => $rooms)
+ foreach($this->getConference()->get('OVERVIEW.GROUPS') as $group => $rooms)
{
foreach($rooms as $room)
{
try {
- $groups[$group][] = new Room($room);
+ $groups[$group][] = $this->getConference()->getRoom($room);
}
catch(NotFoundException $e)
{
diff --git a/model/Relive.php b/model/Relive.php
index d0e7522..ca32f19 100644
--- a/model/Relive.php
+++ b/model/Relive.php
@@ -1,16 +1,27 @@
<?php
-class Relive extends ModelBase
+class Relive
{
+ private $conference;
+
+ public function __construct($conference)
+ {
+ $this->conference = $conference;
+ }
+
+ public function getConference() {
+ return $this->conference;
+ }
+
public function isEnabled()
{
// having CONFERENCE.RELIVE is not enough!
- return $this->has('CONFERENCE.RELIVE_JSON');
+ return $this->getConference()->has('CONFERENCE.RELIVE_JSON');
}
public function getJsonUrl()
{
- return $this->get('CONFERENCE.RELIVE_JSON');
+ return $this->getConference()->get('CONFERENCE.RELIVE_JSON');
}
public function getTalks()
diff --git a/model/Room.php b/model/Room.php
index df3d92c..aa72630 100644
--- a/model/Room.php
+++ b/model/Room.php
@@ -1,107 +1,92 @@
<?php
-class Room extends ModelBase
+class Room
{
private $slug;
+ private $conference;
- public function __construct($slug)
+ public function __construct(Conference $conference, $slug)
{
+ $this->conference = $conference;
+
if(preg_match('/[^a-z0-9_\-]/i', $slug))
throw new Exception('Room Slug contains invalid Characters: "'.$slug.'"');
- if(! $this->has('ROOMS.'.$slug))
+ if(!$this->getConference()->hasRoom($slug))
throw new NotFoundException('Room '.$slug);
$this->slug = $slug;
}
- public static function exists($slug)
- {
- return ModelBase::staticHas('ROOMS.'.$slug);
- }
-
- public static function createIfExists($room)
- {
- if(Room::exists($room))
- return new Room($room);
-
- return null;
- }
-
- public static function rooms()
- {
- $rooms = array();
- foreach(ModelBase::staticGet('ROOMS') as $slug => $room)
- $rooms[] = new Room($slug);
- return $rooms;
+ public function getConference() {
+ return $this->conference;
}
-
public function getSlug() {
return $this->slug;
}
public function getThumb() {
- return '../thumbs/'.$this->getStream().'.png';
+ return joinpath(['/', 'thumbs', $this->getStream().'.png']);
}
public function getLink() {
- return rawurlencode($this->getSlug()).'/'.url_params();
+ return joinpath([$this->getConference()->getSlug(), $this->getSlug()]).url_params();
}
public function getStream() {
- return $this->get('ROOMS.'.$this->getSlug().'.STREAM', $this->getSlug());
+ return $this->getConference()->get('ROOMS.'.$this->getSlug().'.STREAM', $this->getSlug());
}
public function getScheduleName() {
- return $this->get('ROOMS.'.$this->getSlug().'.SCHEDULE_NAME', $this->getSlug());
+ return $this->getConference()->get('ROOMS.'.$this->getSlug().'.SCHEDULE_NAME', $this->getSlug());
}
public function getDisplay() {
- return $this->get('ROOMS.'.$this->getSlug().'.DISPLAY', $this->getSlug());
+ return $this->getConference()->get('ROOMS.'.$this->getSlug().'.DISPLAY', $this->getSlug());
}
public function hasStereo() {
- return $this->get('ROOMS.'.$this->getSlug().'.STEREO');
+ return $this->getConference()->get('ROOMS.'.$this->getSlug().'.STEREO');
}
public function hasPreview() {
- return $this->get('ROOMS.'.$this->getSlug().'.PREVIEW');
+ return $this->getConference()->get('ROOMS.'.$this->getSlug().'.PREVIEW');
}
public function requestsWide() {
- return $this->get('ROOMS.'.$this->getSlug().'.WIDE');
+ return $this->getConference()->get('ROOMS.'.$this->getSlug().'.WIDE');
}
public function hasSchedule() {
- return $this->get('ROOMS.'.$this->getSlug().'.SCHEDULE') && $this->has('SCHEDULE');
+ return $this->getConference()->get('ROOMS.'.$this->getSlug().'.SCHEDULE') && $this->getConference()->has('SCHEDULE');
}
public function hasSubtitles() {
return
- $this->get('ROOMS.'.$this->getSlug().'.SUBTITLES') &&
- $this->has('ROOMS.'.$this->getSlug().'.SUBTITLES_ROOM_ID') &&
- $this->has('SUBTITLES');
+ $this->getConference()->get('ROOMS.'.$this->getSlug().'.SUBTITLES') &&
+ $this->getConference()->has('ROOMS.'.$this->getSlug().'.SUBTITLES_ROOM_ID') &&
+ $this->getConference()->has('SUBTITLES');
}
public function getSubtitlesRoomId() {
- return $this->get('ROOMS.'.$this->getSlug().'.SUBTITLES_ROOM_ID');
+ return $this->getConference()->get('ROOMS.'.$this->getSlug().'.SUBTITLES_ROOM_ID');
}
public function hasFeedback() {
- return $this->get('ROOMS.'.$this->getSlug().'.FEEDBACK') && $this->has('FEEDBACK');
+ return $this->getConference()->get('ROOMS.'.$this->getSlug().'.FEEDBACK') && $this->getConference()->has('FEEDBACK');
}
public function hasTwitter() {
- return $this->get('ROOMS.'.$this->getSlug().'.TWITTER') && $this->has('TWITTER');
+ return $this->getConference()->get('ROOMS.'.$this->getSlug().'.TWITTER') && $this->getConference()->has('TWITTER');
}
public function getTwitterDisplay() {
return sprintf(
- $this->get('ROOMS.'.$this->getSlug().'.TWITTER_CONFIG.DISPLAY', $this->get('TWITTER.DISPLAY')),
+ $this->getConference()->get('ROOMS.'.$this->getSlug().'.TWITTER_CONFIG.DISPLAY', $this->getConference()->get('TWITTER.DISPLAY')),
$this->getSlug()
);
}
@@ -115,26 +100,26 @@ class Room extends ModelBase
public function getTwitterText() {
return sprintf(
- $this->get('ROOMS.'.$this->getSlug().'.TWITTER_CONFIG.TEXT', $this->get('TWITTER.TEXT')),
+ $this->getConference()->get('ROOMS.'.$this->getSlug().'.TWITTER_CONFIG.TEXT', $this->getConference()->get('TWITTER.TEXT')),
$this->getSlug()
);
}
public function hasIrc() {
- return $this->get('ROOMS.'.$this->getSlug().'.IRC') && $this->has('IRC');
+ return $this->getConference()->get('ROOMS.'.$this->getSlug().'.IRC') && $this->getConference()->has('IRC');
}
public function getIrcDisplay() {
return sprintf(
- $this->get('ROOMS.'.$this->getSlug().'.IRC_CONFIG.DISPLAY', $this->get('IRC.DISPLAY')),
+ $this->getConference()->get('ROOMS.'.$this->getSlug().'.IRC_CONFIG.DISPLAY', $this->getConference()->get('IRC.DISPLAY')),
$this->getSlug()
);
}
public function getIrcUrl() {
return sprintf(
- $this->get('ROOMS.'.$this->getSlug().'.IRC_CONFIG.URL', $this->get('IRC.URL')),
+ $this->getConference()->get('ROOMS.'.$this->getSlug().'.IRC_CONFIG.URL', $this->getConference()->get('IRC.URL')),
rawurlencode($this->getSlug())
);
}
@@ -146,16 +131,16 @@ class Room extends ModelBase
public function hasEmbed() {
- return $this->get('ROOMS.'.$this->getSlug().'.EMBED') && $this->get('EMBED');
+ return $this->getConference()->get('ROOMS.'.$this->getSlug().'.EMBED') && $this->getConference()->get('EMBED');
}
public function hasSdVideo() {
- return $this->get('ROOMS.'.$this->getSlug().'.SD_VIDEO');
+ return $this->getConference()->get('ROOMS.'.$this->getSlug().'.SD_VIDEO');
}
public function hasHdVideo() {
- return $this->get('ROOMS.'.$this->getSlug().'.HD_VIDEO');
+ return $this->getConference()->get('ROOMS.'.$this->getSlug().'.HD_VIDEO');
}
public function hasVideo() {
@@ -163,19 +148,19 @@ class Room extends ModelBase
}
public function hasAudio() {
- return $this->get('ROOMS.'.$this->getSlug().'.AUDIO');
+ return $this->getConference()->get('ROOMS.'.$this->getSlug().'.AUDIO');
}
public function hasSlides() {
- return $this->get('ROOMS.'.$this->getSlug().'.SLIDES');
+ return $this->getConference()->get('ROOMS.'.$this->getSlug().'.SLIDES');
}
public function hasMusic() {
- return $this->get('ROOMS.'.$this->getSlug().'.MUSIC');
+ return $this->getConference()->get('ROOMS.'.$this->getSlug().'.MUSIC');
}
public function hasTranslation() {
- return $this->get('ROOMS.'.$this->getSlug().'.TRANSLATION');
+ return $this->getConference()->get('ROOMS.'.$this->getSlug().'.TRANSLATION');
}
public function getSelectionNames()
diff --git a/model/RoomSelection.php b/model/RoomSelection.php
index 9f0b16d..9211c31 100644
--- a/model/RoomSelection.php
+++ b/model/RoomSelection.php
@@ -20,16 +20,18 @@ class RoomSelection
public function getLink()
{
+ $path = [$this->getRoom()->getConference()->getSlug(), $this->getRoom()->getSlug()];
+
$selection = $this->getRoom()->getSelectionNames();
- if($selection[0] == $this->getSelection())
- return rawurlencode($this->getRoom()->getSlug()).'/';
+ if($selection[0] != $this->getSelection())
+ $path[] = $this->getSelection();
- return rawurlencode($this->getRoom()->getSlug()).'/'.rawurlencode($this->getSelection()).'/';
+ return joinpath($path).url_params();
}
public function getTranslatedLink()
{
- return $this->getLink().'translated/';
+ return joinpath([$this->getLink(), 'translated']);
}
public function getDisplay()
diff --git a/model/RoomTab.php b/model/RoomTab.php
index 16a8359..c7b564f 100644
--- a/model/RoomTab.php
+++ b/model/RoomTab.php
@@ -20,11 +20,13 @@ class RoomTab
public function getLink()
{
+ $path = [$this->getRoom()->getConference()->getSlug(), $this->getRoom()->getSlug()];
+
$tabs = $this->getRoom()->getTabNames();
- if($tabs[0] == $this->getTab())
- return rawurlencode($this->getRoom()->getSlug()).'/'.url_params();
+ if($tabs[0] != $this->getTab())
+ $path[] = $this->getTab();
- return rawurlencode($this->getRoom()->getSlug()).'/'.rawurlencode($this->getTab()).'/'.url_params();
+ return joinpath($path).url_params();
}
public function getDisplay()
diff --git a/model/Schedule.php b/model/Schedule.php
index c0ff69b..0b789f2 100644
--- a/model/Schedule.php
+++ b/model/Schedule.php
@@ -1,26 +1,37 @@
<?php
-class Schedule extends ModelBase
+class Schedule
{
+ private $conference;
+
+ public function __construct($conference)
+ {
+ $this->conference = $conference;
+ }
+
+ public function getConference() {
+ return $this->conference;
+ }
+
public function isEnabled() {
- return $this->has('SCHEDULE');
+ return $this->getConference()->has('SCHEDULE');
}
private function isRoomFiltered($room)
{
- if(!$this->has('SCHEDULE.ROOMFILTER'))
+ if(!$this->getConference()->has('SCHEDULE.ROOMFILTER'))
return false;
- $rooms = $this->get('SCHEDULE.ROOMFILTER');
+ $rooms = $this->getConference()->get('SCHEDULE.ROOMFILTER');
return !in_array($room, $rooms);
}
public function getSimulationOffset() {
- return $this->get('SCHEDULE.SIMULATE_OFFSET', 0);
+ return $this->getConference()->get('SCHEDULE.SIMULATE_OFFSET', 0);
}
public function getScale() {
- return floatval($this->get('SCHEDULE.SCALE', 7));
+ return floatval($this->getConference()->get('SCHEDULE.SCALE', 7));
}
private function fetchSchedule()
@@ -35,7 +46,7 @@ class Schedule extends ModelBase
$schedule = file_get_contents($this->getScheduleUrl(), false, $context);
if(!$schedule)
- throw new ScheduleException("Error Downloading Schedule from ".$this->getScheduleUrl());
+ throw new ScheduleException("Error Downloading Schedule from ".$this->getConference()->getScheduleUrl());
return simplexml_load_string($schedule);
}
@@ -49,10 +60,10 @@ class Schedule extends ModelBase
}
catch(Exception $e)
{
- return array();
+ return array('_error' => (string)$e);
}
- $mapping = $this->getScheduleToRoomSlugMapping();
+ $mapping = $this->getConference()->getScheduleToRoomSlugMapping();
$program = array();
// re-calculate day-ends
@@ -220,10 +231,10 @@ class Schedule extends ModelBase
}
- if($this->has('SCHEDULE.ROOMFILTER'))
+ if($this->getConference()->has('SCHEDULE.ROOMFILTER'))
{
// sort by roomfilter
- $roomfilter = $this->get('SCHEDULE.ROOMFILTER');
+ $roomfilter = $this->getConference()->get('SCHEDULE.ROOMFILTER');
// map roomfilter-rooms to room-slugs
$roomfilter = array_map(function($e) use ($mapping) {
@@ -246,7 +257,7 @@ class Schedule extends ModelBase
public function getDurationSum()
{
$sum = 0;
- $schedule = $this->getSchedule();
+ $schedule = $this->getConference()->getSchedule();
foreach(reset($schedule) as $event)
$sum += $event['duration'];
@@ -263,13 +274,13 @@ class Schedule extends ModelBase
private function getScheduleUrl()
{
- return $this->get('SCHEDULE.URL');
+ return $this->getConference()->get('SCHEDULE.URL');
}
public function getScheduleToRoomSlugMapping()
{
$mapping = array();
- foreach($this->get('ROOMS') as $slug => $room)
+ foreach($this->getConference()->get('ROOMS') as $slug => $room)
{
if(isset($room['SCHEDULE_NAME']))
$mapping[ $room['SCHEDULE_NAME'] ] = $slug;
diff --git a/model/Subtitles.php b/model/Subtitles.php
index e1878f2..1d401b8 100644
--- a/model/Subtitles.php
+++ b/model/Subtitles.php
@@ -1,14 +1,25 @@
<?php
-class Subtitles extends ModelBase
+class Subtitles
{
+ private $conference;
+
+ public function __construct(Conference $conference)
+ {
+ $this->conference = $conference;
+ }
+
+ public function getConference() {
+ return $this->conference;
+ }
+
public function isEnabled() {
- return $this->has('SUBTITLES');
+ return $this->getConference()->has('SUBTITLES');
}
public function getEnabledRooms($slug) {
$rooms = [];
- foreach(Room::rooms() as $room)
+ foreach($this->getConference()->getOverview()->getRooms() as $room)
{
if($room->hasSubtitles())
$rooms[] = $room;
@@ -18,9 +29,9 @@ class Subtitles extends ModelBase
}
public function getPrimusURL() {
- return $this->get('SUBTITLES.PRIMUS_URL');
+ return $this->getConference()->get('SUBTITLES.PRIMUS_URL');
}
public function getFrontendURL() {
- return $this->get('SUBTITLES.FRONTEND_URL');
+ return $this->getConference()->get('SUBTITLES.FRONTEND_URL');
}
}