From efe1f83a7cc419df700dfe36ef11da20607d8eae Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sun, 8 Nov 2015 14:40:30 +0100 Subject: implement mandator handling, supporting different styles per mandantor --- model/Conferences.php | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 model/Conferences.php (limited to 'model/Conferences.php') diff --git a/model/Conferences.php b/model/Conferences.php new file mode 100644 index 0000000..05d3c52 --- /dev/null +++ b/model/Conferences.php @@ -0,0 +1,59 @@ +isClosed(); + unset($GLOBALS['CONFIG']); + + if(isset($saved_config)) + $GLOBALS['CONFIG'] = $saved_config; + + return $active; + } + + public static function hasCustomStyles($mandator) { + return file_exists(Conferences::getCustomStyles($mandator)); + } + public static function getCustomStyles($mandator) { + return forceslash(Conferences::getCustomStylesDir($mandator)).'main.less'; + } + public static function getCustomStylesDir($mandator) { + return forceslash(Conferences::MANDATOR_DIR).forceslash($mandator); + } + + public static function load($mandator) { + $GLOBALS['MANDATOR'] = $mandator; + include(forceslash(Conferences::MANDATOR_DIR).forceslash($mandator).'config.php'); + } +} -- cgit v1.2.3 From a0b2129479ba10561811847c0651df8b55c8a6ba Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sun, 8 Nov 2015 15:15:53 +0100 Subject: Support an All-Conference-Closed Screen and mutliple Schedules & Relive-URLs --- model/Conferences.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'model/Conferences.php') diff --git a/model/Conferences.php b/model/Conferences.php index 05d3c52..9f87388 100644 --- a/model/Conferences.php +++ b/model/Conferences.php @@ -54,6 +54,6 @@ class Conferences extends ModelBase public static function load($mandator) { $GLOBALS['MANDATOR'] = $mandator; - include(forceslash(Conferences::MANDATOR_DIR).forceslash($mandator).'config.php'); + require(forceslash(Conferences::MANDATOR_DIR).forceslash($mandator).'config.php'); } } -- cgit v1.2.3 From 0d91cc5f111fac882f1bb375c2bf426195c9cae2 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sun, 8 Nov 2015 16:31:29 +0100 Subject: finish overview-page --- model/Conferences.php | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'model/Conferences.php') diff --git a/model/Conferences.php b/model/Conferences.php index 9f87388..10a3172 100644 --- a/model/Conferences.php +++ b/model/Conferences.php @@ -5,9 +5,16 @@ class Conferences extends ModelBase const MANDATOR_DIR = 'configs/conferences/'; public static function getConferences() { - return array_values(array_filter(scandir(forceslash(Conferences::MANDATOR_DIR)), function($el) { - return $el[0] != '.'; - })); + $conferences = []; + foreach(scandir(forceslash(Conferences::MANDATOR_DIR)) as $el) + { + if($el[0] == '.') + continue; + + $conferences[$el] = Conferences::getConferenceInformation($el); + } + + return $conferences; } public static function getConferencesCount() { return count(Conferences::getConferences()); @@ -15,7 +22,10 @@ class Conferences extends ModelBase public static function getActiveConferences() { return array_values(array_filter( - Conferences::getConferences(), ['Conferences', 'isActive'] + Conferences::getConferences(), + function($info) { + return $info['active']; + } )); } @@ -24,22 +34,28 @@ class Conferences extends ModelBase } public static function exists($mandator) { - return in_array($mandator, Conferences::getConferences()); + return array_key_exists($mandator, Conferences::getConferences()); } - public static function isActive($mandator) { + public static function getConferenceInformation($mandator) { if(isset($GLOBALS['CONFIG'])) $saved_config = $GLOBALS['CONFIG']; Conferences::load($mandator); $conf = new Conference(); - $active = !$conf->isClosed(); + $info = [ + 'slug' => $mandator, + 'link' => forceslash($mandator), + 'active' => !$conf->isClosed(), + 'title' => $conf->getTitle(), + 'description' => $conf->getDescription(), + ]; unset($GLOBALS['CONFIG']); if(isset($saved_config)) $GLOBALS['CONFIG'] = $saved_config; - return $active; + return $info; } public static function hasCustomStyles($mandator) { -- cgit v1.2.3 From aec65f8a241d3810d5e7a029f861bc6090b65cb9 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sun, 8 Nov 2015 17:17:16 +0100 Subject: better exception-handling in mandator-code --- model/Conferences.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'model/Conferences.php') diff --git a/model/Conferences.php b/model/Conferences.php index 10a3172..885c2c8 100644 --- a/model/Conferences.php +++ b/model/Conferences.php @@ -69,7 +69,7 @@ class Conferences extends ModelBase } public static function load($mandator) { - $GLOBALS['MANDATOR'] = $mandator; - require(forceslash(Conferences::MANDATOR_DIR).forceslash($mandator).'config.php'); + include(forceslash(Conferences::MANDATOR_DIR).forceslash($mandator).'config.php'); + return isset($GLOBALS['CONFIG']); } } -- cgit v1.2.3 From 61c9cf52b0c015951351b47148cdecb47c680bfa Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sun, 8 Nov 2015 20:36:34 +0100 Subject: global streams api --- model/Conferences.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'model/Conferences.php') diff --git a/model/Conferences.php b/model/Conferences.php index 885c2c8..9396a48 100644 --- a/model/Conferences.php +++ b/model/Conferences.php @@ -49,6 +49,8 @@ class Conferences extends ModelBase 'active' => !$conf->isClosed(), 'title' => $conf->getTitle(), 'description' => $conf->getDescription(), + + 'CONFIG' => $GLOBALS['CONFIG'], ]; unset($GLOBALS['CONFIG']); -- cgit v1.2.3