Exemplo n.º 1
0
 protected function _initView()
 {
     // Start initail view
     $this->bootstrap('layout');
     $config = $this->getOption('views');
     $resources = $this->getOption('resources');
     $view = new Zend_View();
     if (isset($resources['layout']['layoutPath'])) {
         $view->assign('layoutRootPath', $resources['layout']['layoutPath']);
     }
     $this->bootstrap('db');
     Zend_Loader::loadClass('Ht_Utils_SystemSetting');
     $sysSetting = Ht_Utils_SystemSetting::getSettings();
     $view->assign('sysSetting', $sysSetting);
     $view->assign('profile', Zend_Auth::getInstance()->getIdentity());
     Zend_Loader::loadClass("Ht_Model_SystemSetting");
     $this->setSystemLogConfiguration($sysSetting);
     // use the viewrenderer to keep the code DRY
     // instantiate and add the helper in one go
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
     $viewRenderer->setView($view);
     $viewRenderer->setViewSuffix('phtml');
     // add it to the action helper broker
     Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
     /**
      * Set inflector for Zend_Layout
      */
     $inflector = new Zend_Filter_Inflector(':script.:suffix');
     $inflector->addRules(array(':script' => array('Word_CamelCaseToDash', 'StringToLower'), 'suffix' => 'phtml'));
     // Initialise Zend_Layout's MVC helpers
     $this->getResource('layout')->setLayoutPath(realpath($resources['layout']['layoutPath']))->setView($view)->setContentKey('content')->setInflector($inflector);
     return $this->getResource('layout')->getView();
 }