Beispiel #1
0
 public function __construct($params)
 {
     if (Vi_Registry::isRegistered('EDIT_LAYOUT_MODE')) {
         $this->_sampleMode = Vi_Registry::get('EDIT_LAYOUT_MODE');
     }
     $this->_name = $params['name'];
     if (isset($params['title'])) {
         $this->_title = $params['title'];
         $this->_holderId = $params['holder_id'];
     }
     $this->_params = $params;
     $view = Vi_Layout::getMvcInstance()->getView();
     $this->view = clone $view;
     $this->db = Vi_Registry::get('db');
     $this->session = Vi_Registry::getSession();
     $this->auth = Vi_Registry::getAuth();
     $this->aclFront = Vi_Registry::getAclFront();
     $this->aclAdmin = Vi_Registry::getAclAdmin();
     $this->view->setEngine(clone $view->getEngine());
     $this->_langCode = Vi_Language::getCurrentLangCode();
     $config = Vi_Registry::getConfig();
     $this->_compileDir = $config['viewConfig']['compile_dir'];
     $this->_cacheDir = $config['viewConfig']['cache_dir'];
     /*
     * set up dir for smarty
     * 'template_dir' => 'stickers/$stickerName',
     			'compile_dir' => 'tmp/compile/stickers/$stickerName/$langCode',
     			'cache_dir' => 'tmp/cache/stickers/$stickerName/$langCode',
     */
     $this->view->setScriptPath('./');
     $this->view->setCompilePath($config['viewConfig']['compile_dir']);
     $this->view->setCachePath($config['viewConfig']['cache_dir']);
     /*
      * call main funtion
      */
     $this->_saveInfo['currentType'] = Vi_Language::$currentType;
     $this->_saveInfo['currentName'] = Vi_Language::$currentName;
     Vi_Language::$currentType = Vi_Language::TYPE_STICKER;
     Vi_Language::$currentName = $this->_name;
     $this->view->STICKER_URL = Vi_Registry::getBaseUrl() . "stickers/{$this->_name}/";
     $this->view->HELPER_URL = $this->view->STICKER_URL . 'helpers/';
     $this->init();
     $this->run();
 }
Beispiel #2
0
 /**
  * Modify postDispatch() function of Zend_Controller_Action.
  * This function will set variable for the View after Action executed
  */
 public function postDispatch()
 {
     $this->view->BASE_URL = Vi_Registry::get('BASE_URL');
     $this->view->APP_NAME = Vi_Registry::get('APP_NAME');
     $this->view->APP_BASE_URL = Vi_Registry::get('APP_BASE_URL');
     $this->view->HELPER_URL = $this->view->BASE_URL . 'modules/' . $this->getRequest()->getModuleName() . '/views/helpers/';
     $this->view->LAYOUT_NAME = Vi_Layout::getMvcInstance()->getLayout();
     $layoutCollectionDir = Vi_Layout::getMvcInstance()->getLayoutPath();
     $layoutCollectionUrl = substr($layoutCollectionDir, strlen(Vi_Registry::get('BASE_DIR')));
     $this->view->LAYOUT_URL = $this->view->BASE_URL . $layoutCollectionUrl . '/';
     $this->view->LAYOUT_HELPER_URL = $this->view->LAYOUT_URL . 'helpers/';
     if (Vi_Constant::PRODUCT_MODE != $this->_config['currentMode']) {
         $this->view->isProductMode = false;
     } else {
         $this->view->isProductMode = true;
     }
     $this->view->synchronize();
     /**
      * Registry two variables for using in Vi_Controller_Action_Helper_ViewRenderer::postDispatch()
      */
     Vi_Registry::set('controllerCurrentType', $this->_currentType);
     Vi_Registry::set('controllerCurrentName', $this->_currentName);
 }
Beispiel #3
0
 public static function getView()
 {
     return Vi_Layout::getMvcInstance()->getView();
 }