forked from marjanapesic/Most-Active-Users
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MostActiveUsersModule.php
50 lines (42 loc) · 1.21 KB
/
MostActiveUsersModule.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
<?php
class MostActiveUsersModule extends HWebModule
{
private $assetsUrl;
public function getAssetsUrl()
{
if ($this->assetsUrl === null)
$this->assetsUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('mostactiveusers.assets'));
return $this->assetsUrl;
}
public function init()
{}
/**
* On build of the dashboard sidebar widget, add the mostactiveusers widget if module is enabled.
*
* @param type $event
*/
public static function onSidebarInit($event)
{
if (Yii::app()->moduleManager->isEnabled('mostactiveusers')) {
$event->sender->addWidget('application.modules.mostactiveusers.widgets.MostActiveUsersSidebarWidget', array(), array(
'sortOrder' => 0
));
}
}
public function getConfigUrl()
{
return Yii::app()->createUrl('//mostactiveusers/config/config');
}
/**
* Enables this module
*/
public function enable()
{
if (! $this->isEnabled()) {
// set default config values
HSetting::Set('noUsers', 5, 'mostactiveusers');
}
parent::enable();
}
}
?>