BaseEventTypeController::beforeAction PHP 메소드

beforeAction() 보호된 메소드

Setup base css/js etc requirements for the eventual action render.
protected beforeAction ( $action ) : boolean
$action
리턴 boolean
    protected function beforeAction($action)
    {
        // Automatic file inclusion unless it's an ajax call
        if ($this->assetPath && !Yii::app()->getRequest()->getIsAjaxRequest()) {
            if (!$this->isPrintAction($action->id)) {
                // nested elements behaviour
                //TODO: possibly put this into standard js library for events
                Yii::app()->getClientScript()->registerScript('nestedElementJS', 'var moduleName = "' . $this->getModule()->name . '";', CClientScript::POS_HEAD);
                Yii::app()->assetManager->registerScriptFile('js/nested_elements.js');
            }
        }
        $this->setFirmFromSession();
        if (!isset($this->firm)) {
            // No firm selected, reject
            throw new CHttpException(403, 'You are not authorised to view this page without selecting a firm.');
        }
        $this->initAction($action->id);
        $this->verifyActionAccess($action);
        return parent::beforeAction($action);
    }

Usage Example

예제 #1
0
 /**
  * Loads the split event type javascript libraries.
  *
  * @param CAction $action
  *
  * @return bool
  */
 protected function beforeAction($action)
 {
     Yii::app()->assetManager->registerScriptFile('js/spliteventtype.js', null, null, AssetManager::OUTPUT_SCREEN);
     return parent::beforeAction($action);
 }
All Usage Examples Of BaseEventTypeController::beforeAction
BaseEventTypeController