public function redirect($controllerName, $action = "index", $arguments = array()) { $router = Strata::router(); if (is_null($router)) { return; } $router->abandonCurrent(); $route = new UrlRoute(); $route->action = $action; $route->arguments = $arguments; if ($controllerName !== $this->getShortName()) { $route->controller = Controller::factory($controllerName); $route->controller->request = $this->request; $route->controller->view = $this->view; } else { $route->controller = $this; $route->setDirectExecution(); } return $route->attemptCompletion(); }
/** * Gets a Controller instance form the dynamic information * @param array $match An AltoRouter answer * @return Controller A controller object */ private function getControllerFromDynamicMatch($match = array()) { try { if (array_key_exists("controller", $match["params"])) { return Controller::factory($match["params"]["controller"]); } } catch (Exception $e) { // The controller did not exist, we don't care at this point. // We'll just ignore the route. } return Controller::factory("App"); }
/** * {@inheritdoc} */ public function addPossibilities(array $route) { $this->controller = Controller::factory($route[0]); $this->action = $route[1]; }