コード例 #1
0
ファイル: Abstract.php プロジェクト: BGCX262/zym-svn-to-git
 /**
  * Load the model
  * 
  * @throws Exception
  * @param string $modelName
  * @param string $module
  * @param string $modelPrefix
  */
 public function loadModel($modelName, $module = null, $modelPrefix = null)
 {
     $modelName = ucfirst($modelName);
     $fileName = $modelName . '.php';
     if (!$module) {
         $module = $this->_request->getModuleName();
     }
     if (!$modelPrefix) {
         $modelPrefix = $this->_modelPrefix;
     }
     if ($modelPrefix) {
         $modelName = ucfirst($modelPrefix) . '_' . $modelName;
     }
     $modelName = str_ireplace('_', '/', $modelName);
     if (class_exists($modelName, false)) {
         return true;
     }
     $controllerDirectory = $this->_dispatcher->getControllerDirectory($module);
     $moduleDirectory = dirname($controllerDirectory);
     $modelDirectory = $moduleDirectory . '/' . $this->_modelDirectory;
     Zend_Loader::loadFile($fileName, $modelDirectory, true);
     if (!class_exists($modelName, false)) {
         throw new Zym_Loader_Exception('Failed to load class "' . $modelName . '"');
     }
     return true;
 }
コード例 #2
0
 public function dispatch(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response)
 {
     if (false == self::$_isChangeDispatch) {
         $this->_changeDispatch($request, $response);
         self::$_isChangeDispatch = true;
     }
     parent::dispatch($request, $response);
 }
コード例 #3
0
ファイル: Dispatcher.php プロジェクト: cfrancois7/aksw.org
 public function __construct($params = array())
 {
     if (array_key_exists('url_base', $params)) {
         $urlBase = (string) $params['url_base'];
         unset($params['url_base']);
     }
     parent::__construct($params);
     $this->urlBase = $urlBase;
 }
コード例 #4
0
 public function formatClassName($moduleName, $className)
 {
     // this control make it possible to add an own IndexController in web controllers
     if ($this->_curModule == 'kwf_controller_action_welcome' && $className == 'WelcomeController' && class_exists('WelcomeController')) {
         return $className;
     }
     if ($moduleName == 'kwf_test' || $moduleName == 'tests') {
         return $className;
     } else {
         return parent::formatClassName($moduleName, $className);
     }
 }
コード例 #5
0
ファイル: Bootstrap.php プロジェクト: hartum/basezf
 protected function _initFrontController()
 {
     // init standart router
     $router = new Zend_Controller_Router_Rewrite();
     // init dispatcher with modules controllers
     $dispatcher = new Zend_Controller_Dispatcher_Standard();
     // init controllers modules
     $controllerModules = array();
     foreach ($this->_controllerModules as $controllerModule) {
         $controllerModules[strtolower($controllerModule)] = PATH_TO_CONTROLLERS . '/' . ucfirst(strtolower($controllerModule));
     }
     $dispatcher->setControllerDirectory($controllerModules);
     // init front controller
     $frontController = Zend_Controller_Front::getInstance();
     $frontController->setRouter($router)->setDispatcher($dispatcher);
     // init routes
     $routes = $this->_getRoutes();
     foreach ($routes as $name => &$route) {
         $router->addRoute($name, $route);
     }
 }
コード例 #6
0
ファイル: Abstract.php プロジェクト: BGCX262/zym-svn-to-git
 /**
  * Load the model
  *
  * @throws Exception
  * @param string $modelName
  * @param string $modelPrefix
  * @param string $module
  */
 public function loadModel($modelName, $modelPrefix = null, $module = null)
 {
     $modelName = ucfirst($modelName);
     if (!$module) {
         $module = $this->_request->getModuleName();
     }
     if (!$modelPrefix) {
         $modelPrefix = $this->_modelPrefix;
     }
     if ($modelPrefix) {
         $modelName = ucfirst($modelPrefix) . '/' . $modelName;
     }
     $modelName = str_ireplace('_', '/', $modelName);
     $controllerDirectory = $this->_dispatcher->getControllerDirectory($module);
     $moduleDirectory = dirname($controllerDirectory);
     $filePath = array($moduleDirectory, $this->_modelDirectory, $modelName);
     $file = implode('/', $filePath) . '.php';
     if (file_exists($file)) {
         require_once $file;
     } else {
         throw new Exception(sprintf('File "%s" could not be loaded', $file));
     }
 }
コード例 #7
0
ファイル: Standard.php プロジェクト: kytvi2p/ZettaFramework
 /**
  * Пробуем найти нужный контроллер
  * 
  * cначала ищем в модулях HEAP_PATH
  * eсли контроллер не найден ищем его в MODULES_PATH
  *
  * @param string $className
  * @return string Class name loaded
  * @throws Zend_Controller_Dispatcher_Exception if class not loaded
  */
 private function _DELETEloadClass($className)
 {
     try {
         $finalClass = parent::loadClass($className);
     } catch (Exception $e) {
         /* защита от рекурсии - ищем в MODULES_PATH только один раз */
         if (false == strstr($this->_curDirectory, MODULES_PATH)) {
             $systemControllerDir = $this->_modulesControllerDirectory();
             /* если контроллер найден пробуем его подключить */
             if (file_exists($systemControllerDir . DS . $this->classToFilename($className))) {
                 $this->_curDirectory = $systemControllerDir;
                 $this->setControllerDirectory($this->_curDirectory, $this->_curModule);
                 require_once $systemControllerDir . DS . $this->classToFilename($className);
                 return parent::loadClass($className);
             }
         }
         throw new Exception($e->getMessage());
     }
     return $finalClass;
 }
コード例 #8
0
ファイル: Dispatcher.php プロジェクト: epixa/Epixa
 /**
  * Formats a string from a URI into a PHP-friendly name.
  *
  * By default, replaces words separated by the word separator character(s)
  * with camelCaps. If $isAction is false, it also preserves replaces words
  * separated by the path separation character with a backslash, making
  * the following word Title cased. All non-alphanumeric characters are
  * removed.
  *
  * @param  string  $unformatted
  * @param  boolean $isAction Defaults to false
  * @return string
  */
 protected function _formatName($unformatted, $isAction = false)
 {
     $implodedSegments = parent::_formatName($unformatted, $isAction);
     return str_replace('_', '\\', $implodedSegments);
 }
コード例 #9
0
ファイル: Standard.php プロジェクト: KasaiDot/FansubCMS
 /**
  * Dispatch to a controller/action
  *
  * By default, if a controller is not dispatchable, dispatch() will throw
  * an exception. If you wish to use the default controller instead, set the
  * param 'useDefaultControllerAlways' via {@link setParam()}.
  *
  * @param Zend_Controller_Request_Abstract $request
  * @param Zend_Controller_Response_Abstract $response
  * @return void
  * @throws Zend_Controller_Dispatcher_Exception
  */
 public function dispatch(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response)
 {
     $this->_handleRequest($request);
     parent::dispatch($request, $response);
 }
コード例 #10
0
ファイル: Dispatcher.php プロジェクト: esandre/CoeurDeTruffes
 public function __construct(array $params = array())
 {
     parent::__construct($params);
     $this->_autoloader = new Zend_Application_Module_Autoloader(array('namespace' => 'Application', 'basePath' => APPLICATION_PATH, 'resourceTypes' => array('patch' => array('path' => 'patchs', 'namespace' => 'Patch'))));
 }