Index: . =================================================================== --- . (revision 7752) +++ . (working copy) @@ -233,36 +233,28 @@ * @param array $params * @return void */ - public function setGoto($action, $controller = null, $module = null, array $params = array()) - { - $dispatcher = Zend_Controller_Front::getInstance()->getDispatcher(); - $request = $this->getRequest(); - - if (null === $module) { - $module = $request->getModuleName(); - if ($module == $dispatcher->getDefaultModule()) { - $module = ''; - } - } - - if (null === $controller) { - $controller = $request->getControllerName(); - if (empty($controller)) { - $controller = $dispatcher->getDefaultControllerName(); - } +public function setGoto ($action, $controller = null, $module = null, array $params = array()) { + $front = Zend_Controller_Front::getInstance(); + $router = $front->getRouter(); + + try { + $name = $router->getCurrentRouteName(); + } catch (Zend_Controller_Router_Exception $e) { + $name = 'default'; } - - $paramsNormalized = array(); - foreach ($params as $key => $value) { - $paramsNormalized[] = $key . '/' . $value; + + $urlOptions = array('module' => $module, + 'controller' => $controller, + 'action' => $action); + + foreach ($params as $key => $option) { + $urlOptions[$key] = urlencode($option); } - $paramsString = implode('/', $paramsNormalized); - - $url = $module . '/' . $controller . '/' . $action . '/' . $paramsString; - $url = '/' . trim($url, '/'); - - $url = $this->_prependBase($url); - + $route = $router->getRoute($name); + + $url = rtrim($front->getBaseUrl(), '/') . '/'; + $url .= $route->assemble($urlOptions, true); + $this->_redirect($url); }