/** * Returns the html for the "My account" download page. * * @param ContainerInterface $container Dependency injection container * @param ServerRequestInterface $request Request object * @param ResponseInterface $response Response object * @param array $args Associative list of route parameters * @return ResponseInterface $response Modified response object with generated output */ public static function downloadAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) { $context = $container->get('aimeos_context')->get(true, $args); $langid = $context->getLocale()->getLanguageId(); $view = $container->get('aimeos_view')->create($context->getConfig(), $request, $response, $args, array(), $langid); $context->setView($view); $client = \Aimeos\Client\Html\Factory::createClient($context, array(), 'account/download'); $client->setView($view); $client->process(); return $view->response(); }
/** * Returns the html for the "My account" download page. * * @return Response Response object containing the generated output */ public function downloadAction() { $context = $this->container->get('aimeos_context')->get(); $langid = $context->getLocale()->getLanguageId(); $view = $this->container->get('aimeos_view')->create($context, array(), $langid); $context->setView($view); $client = \Aimeos\Client\Html\Factory::createClient($context, array(), 'account/download'); $client->setView($view); $client->process(); $response = $view->response(); return new Response((string) $response->getBody(), $response->getStatusCode(), $response->getHeaders()); }
/** * Returns the output of the client and adds the header. * * @param string $clientName Html client name * @return string HTML code for inserting into the HTML body */ protected function getOutput($clientName) { $tmplPaths = $this->aimeos->get()->getCustomPaths('client/html/templates'); $context = $this->context->get($this->request); $langid = $context->getLocale()->getLanguageId(); $view = $this->viewContainer->create($context, $this->uriBuilder, $tmplPaths, $this->request, $langid); $client = \Aimeos\Client\Html\Factory::createClient($context, $tmplPaths, $clientName); $client->setView($view); $client->process(); $this->view->assign('aimeos_component_header', (string) $client->getHeader()); return $client->getBody(); }
/** * Returns the html for the "My account" download page. * * @return \Illuminate\Contracts\View\View View for rendering the output */ public function downloadAction() { $context = app('\\Aimeos\\Shop\\Base\\Context')->get(); $langid = $context->getLocale()->getLanguageId(); $view = app('\\Aimeos\\Shop\\Base\\View')->create($context->getConfig(), array(), $langid); $context->setView($view); $client = \Aimeos\Client\Html\Factory::createClient($context, array(), 'account/download'); $client->setView($view); $client->process(); $response = $view->response(); return Response::make((string) $response->getBody(), $response->getStatusCode(), $response->getHeaders()); }
/** * Content for MyAccount download page * * @Flow\Session(autoStart = TRUE) */ public function downloadAction() { $context = $this->context->get($this->request); $langid = $context->getLocale()->getLanguageId(); $view = $this->viewContainer->create($context, $this->uriBuilder, array(), $this->request, $langid); $context->setView($view); $client = \Aimeos\Client\Html\Factory::createClient($context, array(), 'account/download'); $client->setView($view); $client->process(); $response = $view->response(); $this->response->setStatus($response->getStatusCode()); foreach ($response->getHeaders() as $key => $value) { $this->response->setHeader($key, $value); } return $this->response; }
/** * Returns the output of the client and adds the header. * * @param string $clientName Html client name * @return Response Response object containing the generated output */ protected function getOutput($clientName) { $tmplPaths = $this->container->get('aimeos')->get()->getCustomPaths('client/html/templates'); $context = $this->container->get('aimeos_context')->get(); $langid = $context->getLocale()->getLanguageId(); $view = $this->container->get('aimeos_view')->create($context, $tmplPaths, $langid); $context->setView($view); $client = \Aimeos\Client\Html\Factory::createClient($context, $tmplPaths, $clientName); $client->setView($view); $client->process(); $twig = $this->container->get('twig'); $vars = $twig->getGlobals(); if (!isset($vars['aiheader'])) { $vars['aiheader'] = array(); } $vars['aiheader'][$clientName] = (string) $client->getHeader(); $twig->addGlobal('aiheader', $vars['aiheader']); return new Response((string) $client->getBody()); }
/** * Returns the body and header sections created by the clients configured for the given page name. * * @param string $pageName Name of the configured page * @return array Associative list with body and header output separated by client name */ public function getSections($pageName) { $context = $this->container->get('aimeos_context')->get(); $pagesConfig = $this->container->getParameter('aimeos_shop.page'); $result = array('aibody' => array(), 'aiheader' => array()); $langid = $context->getLocale()->getLanguageId(); $tmplPaths = $this->container->get('aimeos')->get()->getCustomPaths('client/html/templates'); $view = $this->container->get('aimeos_view')->create($context, $tmplPaths, $langid); $context->setView($view); if (isset($pagesConfig[$pageName])) { foreach ((array) $pagesConfig[$pageName] as $clientName) { $client = \Aimeos\Client\Html\Factory::createClient($context, $tmplPaths, $clientName); $client->setView(clone $view); $client->process(); $result['aibody'][$clientName] = $client->getBody(); $result['aiheader'][$clientName] = $client->getHeader(); } } return $result; }
/** * Returns the body and header sections created by the clients configured for the given page name. * * @param \TYPO3\Flow\Mvc\RequestInterface $request Request object * @param string $pageName Name of the configured page * @return array Associative list with body and header output separated by client name */ public function getSections(\TYPO3\Flow\Mvc\RequestInterface $request, $pageName) { $this->uriBuilder->setRequest($request); $tmplPaths = $this->aimeos->get()->getCustomPaths('client/html/templates'); $pagesConfig = $this->settings['page']; $result = array('aibody' => array(), 'aiheader' => array()); $context = $this->context->get($request); $langid = $context->getLocale()->getLanguageId(); $view = $this->view->create($context, $this->uriBuilder, $tmplPaths, $request, $langid); $context->setView($view); if (isset($pagesConfig[$pageName])) { foreach ((array) $pagesConfig[$pageName] as $clientName) { $client = \Aimeos\Client\Html\Factory::createClient($context, $tmplPaths, $clientName); $client->setView(clone $view); $client->process(); $varName = str_replace('/', '_', $clientName); $result['aibody'][$varName] = $client->getBody(); $result['aiheader'][$varName] = $client->getHeader(); } } return $result; }
public function testCreateClientNameInvalid() { $this->setExpectedException('\\Aimeos\\Client\\Html\\Exception'); \Aimeos\Client\Html\Factory::createClient($this->context, $this->templatePaths, '%account/favorite'); }