-
Notifications
You must be signed in to change notification settings - Fork 0
/
AdvertModule.php
executable file
·45 lines (35 loc) · 1.05 KB
/
AdvertModule.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
<?php
namespace modules\advert;
use core\modules\control\interfaces\ModuleInterface;
use modules\advert\rbac\Rbac;
use Yii;
/**
* AdvertModule module definition class
*/
class AdvertModule extends \yii\base\Module implements ModuleInterface
{
public $cache = 0;
/**
* @inheritdoc
*/
public function init()
{
parent::init();
$app = Yii::$app;
// SetUP Components
foreach($this->components as $componentName=>$componentValue) {
$this->$componentName = Yii::createObject($componentValue);
}
$this->controllerNamespace = $app->id . '\controllers\modules\\' . $this->id;
$this->viewPath = \Yii::$app->params['themesPath'] . Yii::$app->template->getName() . '/modules/' . $this->id;
}
/**
* Bootstrap method to be called during application bootstrap stage.
* @param yii\web\Application $app
*/
public static function bootstrap($app) {}
public function canView()
{
return Yii::$app->user->can(Rbac::PERM_ADVERT_ZONE_VIEW);
}
}