/**
  * Initialize Controller paths 
  * 
  * @return void
  */
 public function initControllers()
 {
     /**
      * Controller directory will be:
      * 
      *     'aliasName'  => 'moduleName'
      *     'moduleName' => 'moduleName'	
      * 
      * Alias-name will have higher priority than module-name	
      */
     $arrayModule = Vi_Initializer::$_config['module'];
     $arrayModule = array_merge(Vi_Initializer::$_config['requiredModule'], $arrayModule);
     $moduleAlisases = $arrayModule;
     foreach ($arrayModule as $key => $item) {
         $arrayModule[$key] = 'modules/' . $item . '/controllers/';
         if (array_key_exists($item, $arrayModule)) {
             continue;
         }
         $arrayModule[$item] = 'modules/' . $item . '/controllers/';
         $moduleAlisases[$item] = $item;
     }
     //        echo Vi_Registry::get('APP_BASE_URL');die;
     Vi_Registry::set('moduleAliases', $moduleAlisases);
     $this->_front->setDefaultModule(Vi_Initializer::$_config['defaultModule']);
     $this->_front->setDefaultControllerName(Vi_Initializer::$_config['defaultController']);
     $this->_front->setDefaultAction(Vi_Initializer::$_config['defaultAction']);
     $this->_front->setControllerDirectory($arrayModule);
     $this->_front->setBaseUrl(Vi_Registry::get('APP_BASE_URL'));
     $this->_front->setParam('prefixDefaultModule', true);
 }
Exemple #2
0
 */
//try {
//    date_default_timezone_set('America/Toronto');
date_default_timezone_set('Asia/Ho_Chi_Minh');
set_include_path('.' . PATH_SEPARATOR . 'libs' . PATH_SEPARATOR . get_include_path());
require_once 'Vi/Constant.php';
require_once 'Zend/Loader.php';
require_once 'Vi/Registry.php';
require_once 'Vi/Db.php';
require_once 'Vi/Layout.php';
require_once 'Vi/Initializer.php';
// Set up autoload.
//Zend_Loader::registerAutoload();
/**  
 * TODO TEST LINUX FILE
 */
umask(0);
//ini_set('magic_quotes_gpc', 'Off');
// Change 'currentMode' in config.php to Vi_Constant::PRODUCT_MODE under production environment
$initializer = new Vi_Initializer();
$initializer->run();
// Prepare the front controller.
$frontController = Vi_Controller_Front::getInstance();
// Dispatch the request using the front controller.
$frontController->dispatch();
//} catch (Exception $e) {
//    /**
//     * TODO Redirect to error page
//     */
//    include_once 'error.php';
//}
 /**
  * get router object
  * @return Zend_Controller_Router_Abstract
  */
 public static function getRouter()
 {
     return Vi_Controller_Front::getInstance()->getRouter();
 }