/** * Creates the view object for the HTML client. * * @param \Aimeos\MW\Config\Iface $config Configuration object * @param \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder $uriBuilder URL builder object * @param array $templatePaths List of base path names with relative template paths as key/value pairs * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface|null $request Request object * @param string|null $locale Code of the current language or null for no translation * @return MW_View_Interface View object */ public static function getView(\Aimeos\MW\Config\Iface $config, \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder $uriBuilder, array $templatePaths, \TYPO3\CMS\Extbase\Mvc\RequestInterface $request = null, $locale = null) { $params = $fixed = array(); if ($request !== null && $locale !== null) { $params = $request->getArguments(); $fixed = self::getFixedParams($config, $request); $i18n = Base::getI18n(array($locale), $config->get('i18n', array())); $translation = $i18n[$locale]; } else { $translation = new \Aimeos\MW\Translation\None('en'); } $view = new \Aimeos\MW\View\Standard($templatePaths); // workaround for TYPO3 bug (UriBuilder is incomplete in CLI environment) if ($request !== null) { $helper = new \Aimeos\MW\View\Helper\Url\Typo3($view, $uriBuilder, $fixed); } else { $helper = new \Aimeos\MW\View\Helper\Url\None($view); } $view->addHelper('url', $helper); $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); $view->addHelper('translate', $helper); $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params); $view->addHelper('param', $helper); $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); $view->addHelper('config', $helper); $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.'); $sep1000 = $config->get('client/html/common/format/seperator1000', ' '); $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000); $view->addHelper('number', $helper); $helper = new \Aimeos\MW\View\Helper\Formparam\Standard($view, array($uriBuilder->getArgumentPrefix())); $view->addHelper('formparam', $helper); $ip = $_SERVER['REMOTE_ADDR']; $target = $GLOBALS["TSFE"]->id; $body = @file_get_contents('php://input'); $files = is_array($_FILES) ? $_FILES : array(); $helper = new \Aimeos\MW\View\Helper\Request\Standard($view, $body, $ip, $target, $files); $view->addHelper('request', $helper); return $view; }
/** * Override the action name if found in the uc of the user * * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface $request * @param \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response * @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException */ public function processRequest(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response) { $vars = GeneralUtility::_GET('tx_indexedsearch_web_indexedsearchisearch'); $beUser = $this->getBackendUserAuthentication(); if (is_array($vars) && isset($vars['action']) && method_exists($this, $vars['action'] . 'Action')) { $action = $vars['action']; switch ($action) { case 'saveStopwordsKeywords': $action = 'statisticDetails'; break; case 'deleteIndexedItem': $action = 'statistic'; break; } $beUser->uc['indexed_search']['action'] = $action; $beUser->uc['indexed_search']['arguments'] = $request->getArguments(); $beUser->writeUC(); } elseif (isset($beUser->uc['indexed_search']['action'])) { if ($request instanceof WebRequest) { $request->setControllerActionName($beUser->uc['indexed_search']['action']); } if (isset($beUser->uc['indexed_search']['arguments'])) { $request->setArguments($beUser->uc['indexed_search']['arguments']); } } parent::processRequest($request, $response); }