/** * 设置图表的布局页面和视图页面 * * @see Zend_Controller_Action_Helper_Abstract::preDispatch() */ public function postDispatch() { $request = $this->getRequest(); if ($request->has('chart') && !$this->_inErrorHandler()) { $action = $request->getActionName(); try { $this->_actionController->render($action . 'Chart' . ucfirst($request->getParam('chart'))); Zend_Layout::getMvcInstance()->setLayout('chart'); ZtChart_Plugin_Layout::resetModuleLayout(); } catch (Zend_View_Exception $e) { $this->_actionController->render($action); } // 是否需要以JSONP格式返回数据 if ($request->has('callback')) { $response = $this->getResponse(); $jsonp = $request->getParam('callback') . '(' . $response->getBody() . ')'; $response->setBody($jsonp); } } }
/** * 设置本模块的子布局 * * @return void */ protected function _initLayout() { ZtChart_Plugin_Layout::addModuleLayout('kpi'); }
/** * 本模块禁止使用布局 * * @return void */ protected function _initLayout() { ZtChart_Plugin_Layout::addDisabledModules('demo'); }
/** * 设置需要禁止布局的模块 * * @static * @param array $modules * @return void */ public static function setDisabledModules(array $modules) { self::$_disabledModules = $modules; }