예제 #1
0
 public function redirect()
 {
     $id = $this->request->get('id');
     $params = array();
     if ($this->isAjax()) {
         $params['query'] = array('ajax' => 1);
     }
     switch ($id) {
         case 401:
             $response = new ActionRedirectResponse('backend.session', 'index', $params);
             if ($this->isAjax()) {
                 return new JSONResponse(array('__redirect' => $response->getUrl($this->router)));
             } else {
                 return $response;
             }
         case 403:
         case 404:
             $params['id'] = $id;
             return new ActionRedirectResponse('backend.err', 'index', $params);
         default:
             return new RawResponse('error ' . $this->request->get('id'));
     }
 }
예제 #2
0
파일: Application.php 프로젝트: saiber/www
 public function getActionRedirectResponseUrl(ActionRedirectResponse $response)
 {
     $paramList = array("controller" => $response->getControllerName(), "action" => $response->getActionName());
     $paramList = array_merge($paramList, $response->getParamList());
     $response->setRedirectURL($this->router->createURL($paramList));
     return $response->getRedirectURL();
 }