示例#1
0
 /**
  * Static method for initialization with MVC support
  *
  * @param  string|array|Zend_Config $options
  * @return Zend_Layout
  */
 public static function startMvc($options = null)
 {
     if (null === self::$_mvcInstance) {
         self::$_mvcInstance = new self($options, true);
     }
     if (is_string($options)) {
         self::$_mvcInstance->setLayoutPath($options);
     } elseif (is_array($options) || $options instanceof Zend_Config) {
         self::$_mvcInstance->setOptions($options);
     }
     return self::$_mvcInstance;
 }
示例#2
0
 /**
  * Get layout object
  *
  * @return Zend_Layout
  */
 public function getLayout()
 {
     if (null === $this->_layout) {
         require_once 'Zend/Layout.php';
         $this->_layout = Axis_Layout::getMvcInstance();
         if (null === $this->_layout) {
             // Implicitly creates layout object
             $this->_layout = new Zend_Layout();
         }
     }
     return $this->_layout;
 }
示例#3
0
 public function __construct($config = array())
 {
     if (null === self::$_view) {
         $this->setView(Axis_Layout::getMvcInstance()->getView());
     }
     list($namespace, $module, , $name) = explode('_', get_class($this));
     $this->_enabled = in_array($namespace . '_' . $module, array_keys(Axis::app()->getModules()));
     if (!$this->_enabled) {
         return;
     }
     $this->_data = array('box_namespace' => $namespace, 'box_module' => $module, 'box_name' => $name);
     $this->_enabled = $this->refresh()->setFromArray($config);
     if (!isset($config['supress_init'])) {
         // used at backend box configuration
         $this->init();
     }
 }
示例#4
0
 /**
  *  Main init
  */
 public function init()
 {
     parent::init();
     $this->db = Axis::db();
     $this->layout = Axis_Layout::getMvcInstance();
 }
示例#5
0
 protected function _initLayout()
 {
     $this->bootstrap('View');
     $layout = Axis_Layout::startMvc();
     $view = $this->getResource('View');
     $layout->setView($view);
     $front = $this->getResource('FrontController');
     $front->unregisterPlugin('Zend_Layout_Controller_Plugin_Layout');
     $front->registerPlugin(new Axis_Controller_Plugin_Layout($layout), 99);
     $layoutActionHelper = new Axis_Controller_Action_Helper_Layout($layout);
     Zend_Controller_Action_HelperBroker::addHelper($layoutActionHelper);
     return $layout;
 }
示例#6
0
 /**
  *
  * @return Zend_View
  */
 public function getView()
 {
     if (null === self::$_view) {
         $this->setView(Axis_Layout::getMvcInstance()->getView());
     }
     return self::$_view;
 }