/** * @throws CException */ public function initAjaxRequest() { if (!Yii::app()->getRequest()->getIsAjaxRequest() && Yii::app()->getRequest()->getParam('isYiiAjax')) { return; } Yii::import('ext.yii-ajax.lib.php.components.*'); Yii::import('ext.yii-ajax.lib.php.actions.*'); Yii::app()->attachEventHandler('onEndRequest', array($this, 'onEndRequest')); self::$_ajaxResponse = Yii::createComponent($this->ajaxResponse); if (!self::$_ajaxResponse instanceof IAjaxResponse) { throw new CException('AjaxResponse object should implements IAjaxResponse'); } }
public function __construct() { YiiAjax::getAjaxResponse()->addAction($this); }