示例#1
0
 /**
  * Override Smarty::_read_file
  * Read template email from database
  *
  * @param string $filename
  * @return string|bool Return false if not found
  */
 function _read_file($filename)
 {
     //        if ( file_exists($filename) && is_readable($filename) && ($fd = @fopen($filename, 'rb')) ) {
     //            $contents = '';
     //            while (!feof($fd)) {
     //                $contents .= fread($fd, 8192);
     //            }
     //            fclose($fd);
     //            return $contents;
     //        } else {
     //            return false;
     //        }
     //        echo $filename . "<hr/>HERE";die;
     $objMail = new Objects_Mail();
     if (Vi_Registry::isRegistered('emailLangCode')) {
         $langCode = Vi_Registry::get('emailLangCode');
     } else {
         $langCode = Vi_Registry::getLangCode();
     }
     $template = $objMail->getMailTemplate($filename, $langCode);
     if (null == $template) {
         return false;
     } else {
         return $template['content'];
     }
 }
示例#2
0
 /**
  * postDispatch - auto render a view
  *
  * Override Zend_Controller_Action_Helper_ViewRenderer::postDispatch()
  * @return void
  */
 public function postDispatch()
 {
     /**
      * Get module name, controller name, action name
      */
     $request = $this->getRequest();
     $module = $request->getModuleName();
     if (null === $module) {
         $module = $this->getFrontController()->getDispatcher()->getDefaultModule();
     }
     $controller = $request->getControllerName();
     if (null === $controller) {
         $controller = $this->getFrontController()->getDispatcher()->getDefaultControllerName();
     }
     $action = $request->getActionName();
     if (null == $action) {
         $action = $this->getFrontController()->getDispatcher()->getDefaultAction();
     }
     /**
      * Set cacheId for Smarty's caching
      */
     $langCode = Vi_Registry::get('langCode');
     $this->view->cacheId = Vi_Registry::getAppName() . '|' . $langCode . '|module|' . $module . '_' . $controller . '_' . $action . ($this->view->cacheId ? '_' . $this->view->cacheId : '');
     /**
      * Call parent's postDispatch() function
      */
     $result = parent::postDispatch();
     /**
      * Revive Vi_Language::$currentType and Vi_Language::$currentName
      */
     Vi_Language::$currentType = Vi_Registry::get('controllerCurrentType');
     Vi_Language::$currentName = Vi_Registry::get('controllerCurrentName');
     return $result;
 }
 public function run()
 {
     $langCode = Vi_Registry::get('langCode');
     $loggedUser = Vi_Registry::getLoggedInUser();
     $isLoggedIn = true;
     if (false == $loggedUser) {
         $isLoggedIn = false;
     }
     $this->view->loggedUser = $loggedUser;
     $this->view->isLoggedIn = $isLoggedIn;
     $this->view->fqaUrl = Vi_Registry::getContentUrl(15);
 }
 public function run()
 {
     $langCode = Vi_Registry::get('langCode');
     //	    if ($langCode) {
     //		    $this->view->baseContentUrl = Vi_Registry::get('APP_BASE_URL') . "content/$langCode/";
     //		    $this->view->baseProductUrl = Vi_Registry::get('APP_BASE_URL') . "mit/product/index/lang/$langCode/";
     //	    } else {
     //	        $this->view->baseContentUrl = Vi_Registry::get('APP_BASE_URL') . 'content/';
     //	        $this->view->baseProductUrl = Vi_Registry::get('APP_BASE_URL') . 'mit/product/index/';
     //	    }
     $menus = array(0 => array('url' => Vi_Registry::getBaseUrl(), 'name' => 'Find a restaurant', 'id' => 'home'), 1 => array('url' => Vi_Registry::getContentUrl(1), 'name' => 'How it works', 'id' => 1), 2 => array('url' => Vi_Registry::getContentUrl(2), 'name' => 'Coropporate Accounts', 'id' => 2), 4 => array('url' => Vi_Registry::getContentUrl(4), 'name' => 'Refer a Restaurant', 'id' => 4), 5 => array('url' => Vi_Registry::getContentUrl(5), 'name' => 'Refer a friend', 'id' => 5), 6 => array('url' => Vi_Registry::getContentUrl(6), 'name' => 'About us', 'id' => 6), 7 => array('url' => Vi_Registry::getBaseUrl() . 'contact-us.html', 'name' => 'Contact us', 'id' => 'contactus'));
     $this->view->menus = $menus;
 }
 public function run()
 {
     $langCode = Vi_Registry::get('langCode');
     $menus1 = array(0 => array('url' => Vi_Registry::getContentUrl(6), 'name' => 'About Us', 'id' => 6), 1 => array('url' => Vi_Registry::getContentUrl(1), 'name' => 'How it Works', 'id' => 1), 2 => array('url' => Vi_Registry::getBaseUrl() . 'restaurant?mark=pickup', 'name' => 'Browse Restaurants', 'id' => 'home'), 3 => array('url' => Vi_Registry::getContentUrl(9), 'name' => 'Newsroom', 'id' => 9));
     $menus2 = array(0 => array('url' => Vi_Registry::getContentUrl(3), 'name' => 'Share the Bounty', 'id' => 3), 1 => array('url' => Vi_Registry::getContentUrl(13), 'name' => 'Fundraising', 'id' => 13), 2 => array('url' => Vi_Registry::getContentUrl(5), 'name' => 'Refer a Friend', 'id' => 5), 3 => array('url' => Vi_Registry::getContentUrl(4), 'name' => 'Refer a Restaurant', 'id' => 4));
     $menus3 = array(0 => array('url' => Vi_Registry::getContentUrl(2), 'name' => 'Corporate Accounts', 'id' => 2), 1 => array('url' => Vi_Registry::getBaseUrl() . 'restaurant-owner-register.html', 'name' => 'Restaurant Owners', 'id' => 'restaurant_owners'), 2 => array('url' => Vi_Registry::getContentUrl(18), 'name' => 'Business Partners', 'id' => 18));
     $menus4 = array(0 => array('url' => Vi_Registry::getContentUrl(10), 'name' => 'Term of Use', 'id' => 10), 1 => array('url' => Vi_Registry::getContentUrl(14), 'name' => 'Privacy Policy', 'id' => 14), 2 => array('url' => Vi_Registry::getContentUrl(16), 'name' => 'Copyright', 'id' => 16));
     $menus5 = array(0 => array('url' => Vi_Registry::getContentUrl(15), 'name' => 'FAQs', 'id' => 15), 1 => array('url' => Vi_Registry::getBaseUrl() . 'contact-us.html', 'name' => 'Contact Us', 'id' => 'contactus'));
     $this->view->menus1 = $menus1;
     $this->view->menus2 = $menus2;
     $this->view->menus3 = $menus3;
     $this->view->menus4 = $menus4;
     $this->view->menus5 = $menus5;
 }
示例#6
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();
 }
示例#7
0
 /**
  * Init Model
  */
 public function init()
 {
     parent::init();
     /**
      * Init string primary key
      */
     if (is_array($this->_primary)) {
         $this->_sPrimary = current($this->_primary);
     } else {
         $this->_sPrimary = $this->_primary;
     }
     /**
      * Init database prefix
      */
     $config = Vi_Registry::get('config');
     if (isset($config['database']['params']['prefix']) && null != $config['database']['params']['prefix']) {
         $this->_prefix = $config['database']['params']['prefix'];
     }
 }
示例#8
0
 public function run()
 {
     $langCode = Vi_Registry::get('langCode');
     $this->view->loginError = $this->session->loginError;
     $this->session->loginError = false;
 }
示例#9
0
 /**
  * Change alias name to module name in URI
  * 
  * @return void
  * @throws Exception if module's alias point to empty module's name
  */
 public function changeAliasToModuleName()
 {
     $appBaseUrl = Vi_Registry::get('APP_BASE_URL');
     $params = substr($_SERVER['REQUEST_URI'], strlen($appBaseUrl));
     $params = explode('/', trim($params, '/'));
     $alias = $params[0];
     if (null == $alias) {
         return null;
     } else {
         if (Vi_Registry::isRegistered('moduleAliases')) {
             $moduleAliases = @Vi_Registry::get('moduleAliases');
             if (!array_key_exists($alias, $moduleAliases)) {
                 return null;
             }
             $module = $moduleAliases[$alias];
             if (null == $module) {
                 throw new Exception("Module's alias ({$alias}) point to empty module's name");
             }
             $params[0] = $module;
             $params = implode('/', $params);
             $_SERVER['REDIRECT_URL'] = $appBaseUrl . $params;
             $_SERVER['REQUEST_URI'] = $appBaseUrl . $params;
         }
     }
     //        /**
     //         * Reset server params
     //         */
     //        echo '<pre>';print_r($_SERVER);
     //        $params = implode('/', $params);
     //        $_SERVER['REDIRECT_URL'] = $appBaseUrl . $params;
     //        $_SERVER['REQUEST_URI']  = $appBaseUrl . $params;
     //        echo '<pre>';print_r($_SERVER);die;
 }
 public function run()
 {
     $langCode = Vi_Registry::get('langCode');
     $menus = array(0 => array('url' => Vi_Registry::getContentUrl(6), 'name' => 'About us', 'id' => 6), 1 => array('url' => Vi_Registry::getContentUrl(1), 'name' => 'How it works', 'id' => 1), 2 => array('url' => Vi_Registry::getContentUrl(7), 'name' => 'Meet the team', 'id' => 7), 3 => array('url' => Vi_Registry::getContentUrl(8), 'name' => 'Careers', 'id' => 8), 4 => array('url' => Vi_Registry::getContentUrl(9), 'name' => 'News room', 'id' => 9));
     $this->view->menus = $menus;
 }
示例#11
0
 public static function getCurrentLangCode()
 {
     return Vi_Registry::get('langCode');
 }
示例#12
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);
 }
示例#13
0
 public static function getStatistic()
 {
     return Vi_Registry::get('statistic');
 }
示例#14
0
 public function getData()
 {
     if ($this->_data != "") {
         $this->preHolderContent = str_replace('{name}', $this->_name, $this->preHolderContent);
         if (isset($this->_params['customClass'])) {
             $this->preHolderContent = str_replace('{class}', $this->_params['customClass'], $this->preHolderContent);
         } else {
             $this->preHolderContent = str_replace('{class}', "", $this->preHolderContent);
         }
         $this->postHolderContent = str_replace('{name}', $this->_name, $this->postHolderContent);
         $this->_data = $this->preHolderContent . $this->_data . $this->postHolderContent;
     }
     $editLayoutMode = false;
     if (Vi_Registry::isRegistered('EDIT_LAYOUT_MODE')) {
         $editLayoutMode = Vi_Registry::get('EDIT_LAYOUT_MODE');
     }
     if ($editLayoutMode && $this->_name != "allstickers") {
         $this->preHolderContent = str_replace('{name}', $this->_name, $this->preHolderContent);
         $this->postHolderContent = str_replace('{name}', $this->_name, $this->postHolderContent);
         $this->_data = $this->preHolderContent . $this->_data . $this->postHolderContent;
     }
     return $this->_data;
 }