forked from humhub-contrib/birthday
/
Module.php
51 lines (42 loc) · 987 Bytes
/
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
<?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
{
/**
* 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;
}
$event->sender->addWidget(BirthdaySidebarWidget::className(), array(), array('sortOrder' => 200));
}
/**
* @inheritdoc
*/
public function getConfigUrl()
{
return Url::to(['/birthday/config']);
}
/**
* @inheritdoc
*/
public function enable()
{
parent::enable();
Setting::Set('shownDays', 2, 'birthday');
}
}
?>