/
SdashboardModule.php
50 lines (43 loc) · 1.88 KB
/
SdashboardModule.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 SdashboardModule extends CWebModule
{
public $defaultController = 'dashboard';
public $allowAjax = true;
public function init()
{
$this->registerAssets();
$this->setImport(array(
'sdashboard.models.*',
'sdashboard.components.*',
));
}
public function beforeControllerAction($controller, $action)
{
if(parent::beforeControllerAction($controller, $action))
{
// this method is called before any module controller action is performed
// you may place customized code here
return true;
}
else
return false;
}
public function registerAssets()
{
$assets =Yii::app()->basePath.'/modules/sdashboard/assets';
$baseUrl = Yii::app() -> assetManager -> publish($assets);
//the css to use
Yii::app() -> clientScript -> registerCssFile($baseUrl . '/css/sdashboard.css');
Yii::app() -> clientScript -> registerCssFile('http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/start/jquery-ui.css');
Yii::app() -> clientScript -> registerCssFile($baseUrl . '/css/jquery.toastmessage.css');
Yii::app() -> clientScript -> registerCssFile($baseUrl . '/markitup/skins/markitup/style.css');
Yii::app() -> clientScript -> registerCssFile($baseUrl . '/markitup/sets/bbcode/style.css');
// the js to use
Yii::app()->getClientScript()->registerCoreScript( 'jquery.ui' );
Yii::app() -> clientScript -> registerScriptFile($baseUrl . "/js/jquery.toastmessage.js", CClientScript::POS_END);
Yii::app() -> clientScript -> registerScriptFile($baseUrl . "/js/bootbox.min.js", CClientScript::POS_END);
Yii::app() -> clientScript -> registerScriptFile($baseUrl . "/markitup/sets/bbcode/set.js", CClientScript::POS_BEGIN);
Yii::app() -> clientScript -> registerScriptFile($baseUrl . "/markitup/jquery.markitup.js", CClientScript::POS_BEGIN);
Yii::app() -> clientScript -> registerScriptFile($baseUrl . "/js/sdashboard.js", CClientScript::POS_END);
}
}