/**
  * Returns the output of the client and adds the header.
  *
  * @param Client_Html_Interface $client Html client object
  * @return string HTML code for inserting into the HTML body
  */
 protected function getOutput($clientName)
 {
     $tmplPaths = $this->aimeos->get()->getCustomPaths('client/html');
     $context = $this->context->get($this->request);
     $langid = $context->getLocale()->getLanguageId();
     $view = $this->viewContainer->create($context->getConfig(), $this->uriBuilder, $tmplPaths, $this->request, $langid);
     $client = \Client_Html_Factory::createClient($context, $tmplPaths, $clientName);
     $client->setView($view);
     $client->process();
     // $this->response->addAdditionalHeaderData( (string) $client->getHeader() );
     return $client->getBody();
 }
Exemple #2
0
 /**
  * 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->context->get();
     $langid = $context->getLocale()->getLanguageId();
     $tmplPaths = $this->aimeos->get()->getCustomPaths('client/html');
     $view = $this->view->create($context->getConfig(), $tmplPaths, $langid);
     $pagesConfig = $this->config->get('shop.page', array());
     $result = array('aibody' => array(), 'aiheader' => array());
     if (isset($pagesConfig[$pageName])) {
         foreach ((array) $pagesConfig[$pageName] as $clientName) {
             $client = \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;
 }
Exemple #3
0
 /**
  * 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');
     $pagesConfig = $this->settings['page'];
     $result = array('aibody' => array(), 'aiheader' => array());
     $context = $this->context->get($request);
     $langid = $context->getLocale()->getLanguageId();
     $view = $this->view->create($context->getConfig(), $this->uriBuilder, $tmplPaths, $request, $langid);
     $context->setView($view);
     if (isset($pagesConfig[$pageName])) {
         foreach ((array) $pagesConfig[$pageName] as $clientName) {
             $client = \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('Client_Html_Exception');
     Client_Html_Factory::createClient($this->_context, $this->_templatePaths, '%account/favorite');
 }