blob: 9f873882c4b0f725e8e28136da4dea2ee1448f9b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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;
require(forceslash(Conferences::MANDATOR_DIR).forceslash($mandator).'config.php');
}
}
|