aboutsummaryrefslogtreecommitdiff
path: root/model/Conferences.php
diff options
context:
space:
mode:
authorMaZderMind2015-11-08 14:40:30 +0100
committerMaZderMind2015-11-08 14:40:30 +0100
commitefe1f83a7cc419df700dfe36ef11da20607d8eae (patch)
tree409bea306e44a8decbb8b5fee127b863e0c5e99f /model/Conferences.php
parent4c52028f555c361c232cbee166fa62522c66af5b (diff)
implement mandator handling, supporting different styles per mandantor
Diffstat (limited to 'model/Conferences.php')
-rw-r--r--model/Conferences.php59
1 files changed, 59 insertions, 0 deletions
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 @@
+<?php
+
+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] != '.';
+ }));
+ }
+ public static function getConferencesCount() {
+ return count(Conferences::getConferences());
+ }
+
+ public static function getActiveConferences() {
+ return array_values(array_filter(
+ Conferences::getConferences(), ['Conferences', 'isActive']
+ ));
+ }
+
+ public static function getActiveConferencesCount() {
+ return count(Conferences::getActiveConferences());
+ }
+
+ public static function exists($mandator) {
+ return in_array($mandator, Conferences::getConferences());
+ }
+
+ public static function isActive($mandator) {
+ if(isset($GLOBALS['CONFIG']))
+ $saved_config = $GLOBALS['CONFIG'];
+
+ Conferences::load($mandator);
+ $conf = new Conference();
+ $active = !$conf->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');
+ }
+}