<?php

class AdminModule extends CWebModule
{
	public function init()
	{
		// this method is called when the module is being created
		// you may place code here to customize the module or the application

		// import the module-level models and components
		$this->setImport(array(
			'admin.models.*',
			'admin.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;
	}
	//开始1，详细说明未写
	private $_assetsUrl;  
	public function getAssetsUrl()  
	{  
		if($this->_assetsUrl===null)  
			$sourceFolder=YiiBase::getPathOfAlias('application.modules.admin.myfiles');
			//$sourceFolder=YiiBase::getPathOfAlias('application.modules.admin.assets');
			//Yii::app()->assetManager->basePath=YiiBase::getPathOfAlias('application.modules.admin.assets');
			//Yii::app()->assetManager->baseUrl=Yii::app()->baseUrl.'/protected/modules/admin/assets/';
			/*如果已经发布使用下面这行 
			$this->_assetsUrl=Yii::app()->assetManager->getPublishedUrl($sourceFolder);
			 */
			$this->_assetsUrl=Yii::app()->assetManager->publish($sourceFolder,false,-1,false);
		return $this->_assetsUrl;  
	}  

	public function setAssetsUrl($value)  
	{  
		$this->_assetsUrl=$value;  
	}
	//结束1
}
