コード例 #1
0
 /**
  * @param array $module
  * @return void
  * @FLOW3\SkipCsrfProtection
  */
 public function indexAction(array $module)
 {
     $moduleRequest = new ActionRequest($this->request);
     $moduleRequest->setArgumentNamespace('moduleArguments');
     $moduleRequest->setControllerObjectName($module['controller']);
     $moduleRequest->setControllerActionName($module['action']);
     if ($this->request->hasArgument($moduleRequest->getArgumentNamespace()) === TRUE && is_array($this->request->getArgument($moduleRequest->getArgumentNamespace()))) {
         $moduleRequest->setArguments($this->request->getArgument($moduleRequest->getArgumentNamespace()));
     }
     foreach ($this->request->getPluginArguments() as $argumentNamespace => $argument) {
         $moduleRequest->setArgument('--' . $argumentNamespace, $argument);
     }
     $modules = explode('/', $module['module']);
     $moduleConfiguration = \TYPO3\FLOW3\Utility\Arrays::getValueByPath($this->settings['modules'], implode('.submodules.', $modules));
     $moduleConfiguration['path'] = $module['module'];
     $moduleBreadcrumb = array();
     $path = array();
     foreach ($modules as $moduleIdentifier) {
         array_push($path, $moduleIdentifier);
         $config = \TYPO3\FLOW3\Utility\Arrays::getValueByPath($this->settings['modules'], implode('.submodules.', $path));
         $moduleBreadcrumb[implode('/', $path)] = $config['label'];
     }
     $moduleRequest->setArgument('__moduleConfiguration', $moduleConfiguration);
     $moduleRequest->setArgument('__moduleBreadcrumb', $moduleBreadcrumb);
     $moduleResponse = new Response($this->response);
     $this->dispatcher->dispatch($moduleRequest, $moduleResponse);
     $this->view->assignMultiple(array('moduleClass' => implode('-', $modules), 'moduleContents' => $moduleResponse->getContent(), 'title' => $moduleRequest->hasArgument('title') ? $moduleRequest->getArgument('title') : $moduleConfiguration['label'], 'rootModule' => array_shift($modules), 'submodule' => array_shift($modules), 'moduleConfiguration' => $moduleConfiguration));
 }
コード例 #2
0
ファイル: Router.php プロジェクト: nxpthx/FLOW3
 /**
  * Routes the specified web request by setting the controller name, action and possible
  * parameters. If the request could not be routed, it will be left untouched.
  *
  * @param \TYPO3\FLOW3\Http\Request $httpRequest The web request to be analyzed. Will be modified by the router.
  * @return \TYPO3\FLOW3\Mvc\ActionRequest
  */
 public function route(\TYPO3\FLOW3\Http\Request $httpRequest)
 {
     $this->actionRequest = $httpRequest->createActionRequest();
     $routePath = substr($httpRequest->getUri()->getPath(), strlen($httpRequest->getBaseUri()->getPath()));
     $matchResults = $this->findMatchResults($routePath);
     if ($matchResults !== NULL) {
         $requestArguments = $this->actionRequest->getArguments();
         $mergedArguments = Arrays::arrayMergeRecursiveOverrule($requestArguments, $matchResults);
         $this->actionRequest->setArguments($mergedArguments);
     }
     $this->setDefaultControllerAndActionNameIfNoneSpecified();
     return $this->actionRequest;
 }
コード例 #3
0
ファイル: ActionRequestTest.php プロジェクト: nxpthx/FLOW3
 /**
  * @test
  */
 public function allArgumentsCanBeSetOrRetrievedAtOnce()
 {
     $httpRequest = HttpRequest::create(new Uri('http://robertlemke.com/blog'));
     $arguments = array('foo' => 'fooValue', 'bar' => 'barValue');
     $actionRequest = new ActionRequest($httpRequest);
     $actionRequest->setArguments($arguments);
     $this->assertEquals($arguments, $actionRequest->getArguments());
 }
コード例 #4
0
ファイル: Request.php プロジェクト: nxpthx/FLOW3
 /**
  * Creates a new Action Request request as a sub request to this HTTP request.
  * Maps the arguments of this request to the new Action Request.
  *
  * @return \TYPO3\FLOW3\Mvc\ActionRequest
  */
 public function createActionRequest()
 {
     $actionRequest = new ActionRequest($this);
     $actionRequest->setArguments($this->arguments);
     return $actionRequest;
 }