forked from humhub-contrib/birthday
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Module.php
57 lines (47 loc) · 1.17 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
<?php
namespace humhub\modules\birthday;
use Yii;
use humhub\modules\birthday\widgets\BirthdaySidebarWidget;
use humhub\models\Setting;
use yii\helpers\Url;
/**
* BirthdayModule is responsible for the the birthday functions.
*
* @author Sebastian Stumpf
*/
class Module extends \humhub\components\Module
{
/** *
* @var int the sort order for the birthdays sidebar widget
*/
public $sidebarSortOrder = 200;
/**
* On build of the dashboard sidebar widget, add the birthday widget if module is enabled.
*
* @param type $event
*/
public static function onSidebarInit($event)
{
if (Yii::$app->user->isGuest) {
return;
}
$module = Yii::$app->getModule('birthday');
$event->sender->addWidget(BirthdaySidebarWidget::className(), array(), array('sortOrder' => $module->sidebarSortOrder));
}
/**
* @inheritdoc
*/
public function getConfigUrl()
{
return Url::to(['/birthday/config']);
}
/**
* @inheritdoc
*/
public function enable()
{
parent::enable();
Setting::Set('shownDays', 2, 'birthday');
}
}
?>