|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @package org.openpsa.widgets |
|
4
|
|
|
* @author CONTENT CONTROL http://www.contentcontrol-berlin.de/ |
|
5
|
|
|
* @copyright CONTENT CONTROL http://www.contentcontrol-berlin.de/ |
|
6
|
|
|
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* fullcandar-based calendar widget |
|
11
|
|
|
* |
|
12
|
|
|
* @package org.openpsa.widgets |
|
13
|
|
|
*/ |
|
14
|
|
|
class org_openpsa_widgets_calendar extends midcom_baseclasses_components_purecode |
|
15
|
|
|
{ |
|
16
|
|
|
private static $prefix = '/org.openpsa.widgets/fullcalendar-4.4.0/'; |
|
17
|
|
|
|
|
18
|
4 |
|
public static function add_head_elements(array $views) |
|
19
|
|
|
{ |
|
20
|
4 |
|
$head = midcom::get()->head; |
|
21
|
4 |
|
$head->add_jsfile(MIDCOM_STATIC_URL . self::$prefix . 'core/main.min.js'); |
|
22
|
4 |
|
$head->add_jsfile(MIDCOM_STATIC_URL . self::$prefix . 'interaction/main.min.js'); |
|
23
|
4 |
|
foreach ($views as $view) { |
|
24
|
4 |
|
$head->add_jsfile(MIDCOM_STATIC_URL . self::$prefix . $view . '/main.min.js'); |
|
25
|
|
|
} |
|
26
|
4 |
|
if ($lang = self::get_lang()) { |
|
27
|
|
|
$head->add_jsfile(MIDCOM_STATIC_URL . self::$prefix . "core/locales/{$lang}.js"); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
4 |
|
$head->add_stylesheet(MIDCOM_STATIC_URL . self::$prefix . 'core/main.min.css'); |
|
31
|
4 |
|
foreach ($views as $view) { |
|
32
|
4 |
|
$head->add_stylesheet(MIDCOM_STATIC_URL . self::$prefix . $view . '/main.min.css'); |
|
33
|
|
|
} |
|
34
|
4 |
|
$head->add_stylesheet(MIDCOM_STATIC_URL . '/org.openpsa.calendar/calendar.css'); |
|
35
|
|
|
|
|
36
|
4 |
|
$head->add_jsfile(MIDCOM_STATIC_URL . '/org.openpsa.calendar/calendar.js'); |
|
37
|
4 |
|
} |
|
38
|
|
|
|
|
39
|
4 |
|
public static function get_lang() : ?string |
|
40
|
|
|
{ |
|
41
|
4 |
|
$lang = midcom::get()->i18n->get_current_language(); |
|
42
|
4 |
|
if (file_exists(MIDCOM_STATIC_ROOT . self::$prefix . "core/locales/{$lang}.js")) { |
|
43
|
|
|
return $lang; |
|
44
|
|
|
} |
|
45
|
4 |
|
$lang = midcom::get()->i18n->get_fallback_language(); |
|
46
|
4 |
|
if (file_exists(MIDCOM_STATIC_ROOT . self::$prefix . "core/locales/{$lang}.js")) { |
|
47
|
|
|
return $lang; |
|
48
|
|
|
} |
|
49
|
4 |
|
return null; |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|