This repository has been archived by the owner on Sep 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSimpleBBBConnector.class.php
61 lines (55 loc) · 2.57 KB
/
SimpleBBBConnector.class.php
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
60
61
<?php
/**
* @author David Siegfried <[email protected]>
* @license GPL2 or any later version
*/
require __DIR__ . '/bootstrap.php';
class SimpleBBBConnector extends StudIPPlugin implements SystemPlugin
{
const BBB_ADMIN_ROLE = 'BBB_ADMIN_ROLE';
public $meeting_plugin_installed;
public function __construct()
{
parent::__construct();
$this->meeting_plugin_installed = PluginEngine::getPlugin('MeetingPlugin') !== null;
if ($this->isAdmin()) {
$navigation = new Navigation(_('BigBlueButton'));
$navigation->setURL(PluginEngine::getURL($this, [], 'show/index'));
$navigation->setImage(Icon::create('video', Icon::ROLE_NAVIGATION));
Navigation::addItem('/simplebbbconnector/', $navigation);
$navigation = new Navigation(_('Serverübersicht'));
$navigation->setURL(PluginEngine::getURL($this, [], 'show/index'));
Navigation::addItem('/simplebbbconnector/overview', $navigation);
$navigation = new Navigation(_('Serverübersicht'));
$navigation->setURL(PluginEngine::getURL($this, [], 'show/index'));
Navigation::addItem('/simplebbbconnector/overview/index', $navigation);
$crobjob_active = CronjobSchedule::countBySql(
'INNER JOIN cronjobs_tasks ON cronjobs_tasks.task_id = cronjobs_schedules.task_id
WHERE cronjobs_tasks.class = ?
AND cronjobs_tasks.active = 1
AND cronjobs_schedules.active = 1',
['BBBCollector']
) > 0;
if ($crobjob_active) {
$navigation = new Navigation(_('Statistik'));
$navigation->setURL(PluginEngine::getURL($this, [], 'statistics/index'));
Navigation::addItem('/simplebbbconnector/statistics', $navigation);
$navigation = new Navigation(_('Übersicht'));
$navigation->setURL(PluginEngine::getURL($this, [], 'statistics/index'));
Navigation::addItem('/simplebbbconnector/statistics/index', $navigation);
}
}
}
public function perform($unconsumed_path)
{
$this->addStylesheet('assets/bbb-connector.less');
PageLayout::addScript($this->getPluginURL() . '/assets/bbb-connector-app.js');
parent::perform($unconsumed_path);
}
public function isAdmin(): bool
{
return is_object($GLOBALS['user'])
&& $GLOBALS['user']->id !== 'nobody'
&& $GLOBALS['user']->getAuthenticatedUser()->hasRole(self::BBB_ADMIN_ROLE);
}
}