Beispiel #1
0
 /**
  * Forward request with next action
  * 
  * @param  array $next 
  * @return void
  */
 public function forward(EvHttp_Controller_Request_Abstract $next)
 {
     $this->getRequest()->setModuleName($next->getModuleName())->setControllerName($next->getControllerName())->setActionName($next->getActionName())->setParams($next->getParams())->setDispatched(false);
 }
Beispiel #2
0
 /**
  * Get controller class name
  *
  * Try request first; if not found, try pulling from request parameter;
  * if still not found, fallback to default
  *
  * @param EvHttp_Controller_Request_Abstract $request
  * @return string|false Returns class name on success
  */
 public function getControllerClass(EvHttp_Controller_Request_Abstract $request)
 {
     $controllerName = $request->getControllerName();
     if (empty($controllerName)) {
         if (!$this->getParam('useDefaultControllerAlways')) {
             return false;
         }
         $controllerName = $this->getDefaultControllerName();
         $request->setControllerName($controllerName);
     }
     $className = $this->formatControllerName($controllerName);
     $controllerDirs = $this->getControllerDirectory();
     $module = $request->getModuleName();
     if ($this->isValidModule($module)) {
         $this->_curModule = $module;
         $this->_curDirectory = $controllerDirs[$module];
     } elseif ($this->isValidModule($this->_defaultModule)) {
         $request->setModuleName($this->_defaultModule);
         $this->_curModule = $this->_defaultModule;
         $this->_curDirectory = $controllerDirs[$this->_defaultModule];
     } else {
         require_once 'EvHttp/Controller/Exception.php';
         throw new EvHttp_Controller_Exception('No default module defined for this application');
     }
     return $className;
 }