-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModule.php
79 lines (70 loc) · 2.49 KB
/
Module.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
namespace panix\mod\fcm;
use Yii;
use yii\base\BootstrapInterface;
use yii\base\InvalidConfigException;
use yii\db\ActiveRecord;
use yii\web\GroupUrlRule;
use panix\engine\WebModule;
use panix\mod\user\models\forms\SettingsForm;
use app\web\themes\dashboard\sidebar\BackendNav;
/**
* Class Module
* @package panix\mod\fcm
*
*/
class Module extends WebModule implements BootstrapInterface
{
public $icon = 'users';
public function bootstrap($app)
{
$config = $app->settings->get($this->id);
// add rules for admin/copy/auth controllers
$groupUrlRule = new GroupUrlRule([
'prefix' => $this->id,
'rules' => [
'profile/<id:\d+>' => 'default/view',
'<controller:(admin|copy|auth)>' => '<controller>',
'<controller:(admin|copy|auth)>/<action:\w+>' => '<controller>/<action>',
'<action:[0-9a-zA-Z\-]+>/authclient/<authclient:[0-9a-zA-Z\-]+>' => 'default/<action>',
'<action:[0-9a-zA-Z\-]+>' => 'default/<action>',
],
]);
$app->getUrlManager()->addRules($groupUrlRule->rules, false);
$app->setComponents([
'fcm' => [
'class' => 'panix\mod\fcm\FcmComponent',
'tokens'=>[
'ccDr-wRIT-Cn-eCboSww4P:APA91bE6MildSU3fmFP9s7iJj8CeiI_YA7bMHitd0IxiSqxwxuxELkiTB2KRu8D4PZCP7f-HdoCDOW_ZakiRp35yc1mhfJ23LF0s5l75MWS_Yx_WPzCrC-UHJ8dcDhhcsAHYS7J4iB_z'
]
],
]);
}
public function getAdminMenu()
{
return [
'modules' => [
'items' => [
[
'label' => Yii::t($this->id . '/default', 'MODULE_NAME'),
'url' => '#',
'icon' => $this->icon,
'visible' => true,
'items' => [
[
'label' => Yii::t('app/default', 'Send message'),
'url' => ['/admin/fcm/settings/send'],
'icon' => 'settings',
],
[
'label' => Yii::t('app/default', 'SETTINGS'),
'url' => ['/admin/fcm/settings'],
'icon' => 'settings',
],
]
],
],
],
];
}
}