aboutsummaryrefslogtreecommitdiff
path: root/model/Conferences.php
diff options
context:
space:
mode:
authorBenjamin Peter2017-12-09 23:44:47 +0100
committerdedeibel2017-12-10 18:25:21 +0100
commitbe515f5150f20c773371f680efad58f2d0fcaaf0 (patch)
tree2035fa3a60399686b6c5f6e381124be68c5c667e /model/Conferences.php
parent65397e5734b1439df4d68be40ffe994f26e551ec (diff)
Added multple translation tracks with configurable endpoints and labels
Diffstat (limited to 'model/Conferences.php')
-rw-r--r--model/Conferences.php38
1 files changed, 28 insertions, 10 deletions
diff --git a/model/Conferences.php b/model/Conferences.php
index f7276ac..eb07327 100644
--- a/model/Conferences.php
+++ b/model/Conferences.php
@@ -72,16 +72,34 @@ class Conferences
return in_array($mandator, Conferences::listConferences());
}
- public static function loadConferenceConfig($mandator) {
- $configfile = forceslash(Conferences::MANDATOR_DIR).forceslash($mandator).'config.php';
- $config = include($configfile);
-
- if(!is_array($config)) {
- throw new ConfigException("Loading $configfile did not return an array. Maybe it's missing a return-statement?");
- }
-
- return $config;
- }
+ public static function loadConferenceConfig($mandator) {
+ $configfile = forceslash(Conferences::MANDATOR_DIR).forceslash($mandator).'config.php';
+ $config = include($configfile);
+
+ if(!is_array($config)) {
+ throw new ConfigException("Loading $configfile did not return an array. Maybe it's missing a return-statement?");
+ }
+
+ // Allow setting TRANSLATION simply to true and fill in default values for uniformity
+ $rooms = $config['ROOMS'];
+ foreach ($rooms as $slug => $room) {
+ if (!isset($room['TRANSLATION'])) {
+ $config['ROOMS'][$slug]['TRANSLATION'] = [];
+ }
+ elseif (! is_array($room['TRANSLATION'])) {
+ if ($room['TRANSLATION'] === true) {
+ $config['ROOMS'][$slug]['TRANSLATION'] = [[
+ 'endpoint' => 'translated',
+ 'label' => 'Translated'
+ ]];
+ }
+ else {
+ $config['ROOMS'][$slug]['TRANSLATION'] = [];
+ }
+ }
+ }
+ return $config;
+ }
public static function getConference($mandator) {
return new Conference(Conferences::loadConferenceConfig($mandator), $mandator);