当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::setPresenterName方法代码示例

本文整理汇总了PHP中Nette\Application\Request::setPresenterName方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::setPresenterName方法的具体用法?PHP Request::setPresenterName怎么用?PHP Request::setPresenterName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\Application\Request的用法示例。


在下文中一共展示了Request::setPresenterName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run(Nette\Application\Request $request)
 {
     $exception = $request->getParameter('exception');
     if ($exception instanceof Nette\Application\BadRequestException) {
         return new Responses\ForwardResponse($request->setPresenterName('Error4xx'));
     }
     $this->logger->log($exception, ILogger::EXCEPTION);
     return new Responses\CallbackResponse(function () {
         require __DIR__ . '/templates/Error/500.phtml';
     });
 }
开发者ID:fuchcz,项目名称:generator-myproject,代码行数:11,代码来源:ErrorPresenter.php

示例2: run

 /**
  * @return Nette\Application\IResponse
  */
 public function run(Nette\Application\Request $request)
 {
     $e = $request->getParameter('exception');
     if ($e instanceof Nette\Application\BadRequestException) {
         // $this->logger->log("HTTP code {$e->getCode()}: {$e->getMessage()} in {$e->getFile()}:{$e->getLine()}", 'access');
         return new Nette\Application\Responses\ForwardResponse($request->setPresenterName('Error4xx'));
     }
     $this->logger->log($e, ILogger::EXCEPTION);
     return new Nette\Application\Responses\CallbackResponse(function () {
         require __DIR__ . '/templates/Error/500.phtml';
     });
 }
开发者ID:TomasVotruba,项目名称:lekarna-se-skoli,代码行数:15,代码来源:ErrorPresenter.php

示例3: constructUrl

 /**
  * @param \Nette\Application\Request $appRequest
  * @param \Nette\Http\Url $refUrl
  * @return string|null
  */
 public function constructUrl(Request $appRequest, Url $refUrl)
 {
     $presenter = $appRequest->getPresenterName();
     if (!Strings::startsWith($presenter, self::SUBMODULE_NAME . ':')) {
         return null;
     }
     if (Strings::endsWith($presenter, ':' . self::DEFAULT_PRESENTER)) {
         $presenter = substr($presenter, 0, -strlen(':' . self::DEFAULT_PRESENTER));
     }
     $appRequest->setPresenterName(substr($presenter, strlen(self::SUBMODULE_NAME . ':')));
     return parent::constructUrl($appRequest, $refUrl);
 }
开发者ID:venne,项目名称:venne,代码行数:17,代码来源:AdminRoute.php

示例4: run

 /**
  * This method is usually implemented by the more complex UI\Presenter
  * But since an unhandled exception might have occurred,
  * it should be processed as simply as possible to avoid any further problems or even another exception.
  *
  * @param Nette\Application\Request $request
  * @return Responses\CallbackResponse|Responses\ForwardResponse
  */
 public function run(Nette\Application\Request $request)
 {
     $exception = $request->getParameter('exception');
     // if it's a simple BadRequestException, use the more powerful presenter
     if ($exception instanceof Nette\Application\BadRequestException) {
         return new Responses\ForwardResponse($request->setPresenterName('Error4xx'));
     }
     $this->logger->log($exception, ILogger::EXCEPTION);
     // the 500 means unhandled exception, which should translate to the simplest page possible
     return new Responses\CallbackResponse(function () {
         require __DIR__ . '/templates/Error/500.phtml';
     });
 }
开发者ID:martinmayer,项目名称:notejam,代码行数:21,代码来源:ErrorPresenter.php

示例5: setRequestParams

 /**
  * @param \Nette\Application\Request
  * @param array
  * @return \Nette\Application\Request
  */
 private function setRequestParams(\Nette\Application\Request $appRequest, array $params)
 {
     $metadata = $this->getDefaults();
     if (!isset($params[self::PRESENTER_KEY])) {
         throw new \InvalidStateException('Missing presenter in route definition.');
     }
     if (isset($metadata[self::MODULE_KEY])) {
         if (!isset($params[self::MODULE_KEY])) {
             throw new \InvalidStateException('Missing module in route definition.');
         }
         $presenter = $params[self::MODULE_KEY] . ':' . $params[self::PRESENTER_KEY];
         unset($params[self::MODULE_KEY], $params[self::PRESENTER_KEY]);
     } else {
         $presenter = $params[self::PRESENTER_KEY];
         unset($params[self::PRESENTER_KEY]);
     }
     $appRequest->setPresenterName($presenter);
     $appRequest->setParameters($params);
     return $appRequest;
 }
开发者ID:jedenweb,项目名称:framework,代码行数:25,代码来源:FilterRoute.php

示例6: modifyConstructRequest

 /**
  * Modify request by page
  *
  * @param \Nette\Application\Request $request
  * @param RouteEntity $route
  * @param $parameters
  * @param string $domain
  * @return \Nette\Application\Request
  */
 protected function modifyConstructRequest(Request $request, RouteEntity $route, $parameters, $domain)
 {
     $request->setPresenterName(self::DEFAULT_MODULE . ':' . self::DEFAULT_PRESENTER);
     $request->setParameters(array('module' => self::DEFAULT_MODULE, 'presenter' => self::DEFAULT_PRESENTER, 'action' => self::DEFAULT_ACTION, 'lang' => count($this->languages) > 1 ? isset($parameters['lang']) ? $parameters['lang'] : ($route->page->language ? $route->page->language->alias : $this->defaultLanguage) : NULL, 'slug' => $route->getUrl(), 'domain' => $route->domain ? $route->domain->domain : '') + $parameters);
     return $request;
 }
开发者ID:venne,项目名称:cms-module,代码行数:15,代码来源:PageRoute.php


注:本文中的Nette\Application\Request::setPresenterName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。