-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEvents.php
49 lines (39 loc) · 1.48 KB
/
Events.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
<?php
/**
* @author Philipp Horna <globefreak at web.de>
*/
namespace humhub\modules\game_server_query;
use Yii;
class Events {
public static function onDashboardSidebarInit($event) {
if (Yii::$app->hasModule('game_server_query')) {
$event->sender->addWidget(widgets\ServerPanel::className(), array(), array('sortOrder' => 1));
}
}
public static function onSpaceSidebarInit($event) {
if (Yii::$app->user->isGuest) {
return;
}
$space = $event->sender->space;
if ($space->isModuleEnabled('game_server_query') && Yii::$app->controller->id != 'server') {
$event->sender->addWidget(widgets\ServerPanel::className(), array(), array('sortOrder' => 1));
}
}
/*
* Show reputation menu in space menu
*
* @param type $event
*/
public static function onSpaceMenuInit($event) {
if ($event->sender->space !== null && $event->sender->space->isModuleEnabled('game_server_query')) {
$event->sender->addItem(array(
'label' => Yii::t('GameServerQueryModule.base', 'Server'),
'url' => $event->sender->space->createUrl('/game_server_query/server'),
'icon' => '<i class="fa fa-server"></i>',
'isActive' => (Yii::$app->controller->module && Yii::$app->controller->module->id == 'game_server_query'),
'group' => 'modules',
'sortOrder' => 1000,
));
}
}
}