示例#1
0
 public static final function setCurrentAction($name)
 {
     self::$_currentAction = $name;
 }
示例#2
0
 /**
  *  run
  *
  *  run is used to execute the specified Controller
  *  @final
  *  @param Lynx_Registry $registry Used upon instanitation of the Controller objects
  *  @return void
  */
 public final function run(Lynx_Registry $registry)
 {
     $Router = Lynx_Router::getInstance();
     $Request = Lynx_Request::getInstance();
     // pass the current module, controller and action to the Registry
     $registry->set('module', $Request->currentModule())->set('controller', $Request->currentController())->set('action', $Request->currentAction())->set('modulesDirectory', $Router->getModulesDirectoryName());
     // load up the business logic ... module's controller
     $controllerDirectory = NULL;
     $controllerDirectory .= $Router->getModulesDirectoryName() ? $Router->getModulesDirectoryName() . DIRECTORY_SEPARATOR : '';
     $controllerDirectory .= $_REQUEST['module'] . DIRECTORY_SEPARATOR;
     $controllerDirectory .= $Router->getControllersDirectoryName() ? $Router->getControllersDirectoryName() . DIRECTORY_SEPARATOR : '';
     if (is_file($controllerDirectory . $_REQUEST['controller'] . 'Controller.php')) {
         require_once $controllerDirectory . $_REQUEST['controller'] . 'Controller.php';
     } else {
         exit('Undefined controller');
     }
     $controller = $_REQUEST['controller'] . 'Controller';
     $controller = new $controller($registry);
     if (method_exists($controller, $_REQUEST['action'] . 'Action')) {
         $controller->{$_REQUEST['action'] . 'Action'}();
     } else {
         exit('Undefined action');
     }
 }