Example #1
0
 /**
  * Returns the view for the ExtJS admin interface
  *
  * @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 indexAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args)
 {
     $site = isset($args['site']) ? $args['site'] : 'default';
     $lang = isset($args['lang']) ? $args['lang'] : 'en';
     $tab = isset($args['tab']) ? $args['tab'] : 0;
     $aimeos = $container->get('aimeos');
     $cntlPaths = $aimeos->getCustomPaths('controller/extjs');
     $context = $container->get('aimeos_context')->get(false, $args, 'backend');
     $context = self::setLocale($context, $site, $lang);
     $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths);
     $cssFiles = array();
     foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) {
         foreach ($paths as $path) {
             $jsbAbsPath = $base . '/' . $path;
             if (!is_file($jsbAbsPath)) {
                 throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath));
             }
             $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path));
             $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css'));
         }
     }
     $csrfname = $request->getAttribute('csrf_name');
     $csrfvalue = $request->getAttribute('csrf_value');
     $router = $container->get('router');
     $jqadmUrl = $router->pathFor('aimeos_shop_jqadm_search', array('site' => $site, 'resource' => 'product'));
     $jsonUrl = $router->pathFor('aimeos_shop_extadm_json', array('site' => $site, $csrfname => $csrfvalue));
     $adminUrl = $router->pathFor('aimeos_shop_extadm', array('site' => '<site>', 'lang' => '<lang>', 'tab' => '<tab>'));
     $vars = array('lang' => $lang, 'cssFiles' => $cssFiles, 'languages' => self::getJsonLanguages($aimeos), 'config' => self::getJsonClientConfig($context), 'site' => self::getJsonSiteItem($context, $site), 'i18nContent' => self::getJsonClientI18n($aimeos->getI18nPaths(), $lang), 'uploaddir' => $context->getConfig()->get('uploaddir', '/.'), 'searchSchemas' => $controller->getJsonSearchSchemas(), 'itemSchemas' => $controller->getJsonItemSchemas(), 'smd' => $controller->getJsonSmd($jsonUrl), 'urlTemplate' => $adminUrl, 'jqadmurl' => $jqadmUrl, 'activeTab' => $tab, 'version' => \Aimeos\Slim\Bootstrap::getVersion());
     return $container->get('view')->render($response, 'Extadm/index.html.twig', $vars);
 }
Example #2
0
 /**
  * Returns the generated HTML code
  *
  * @param ContainerInterface $container Dependency injection container
  * @param ResponseInterface $response Response object
  * @param string $content Content from admin client
  * @return \Illuminate\Contracts\View\View View for rendering the output
  */
 protected static function getHtml(ContainerInterface $container, ResponseInterface $response, $content)
 {
     $version = \Aimeos\Slim\Bootstrap::getVersion();
     $content = str_replace(array('{type}', '{version}'), array('Slim', $version), $content);
     return $container->get('view')->render($response, 'Jqadm/index.html.twig', array('content' => $content));
 }
Example #3
0
 public function testGetVersion()
 {
     $result = \Aimeos\Slim\Bootstrap::getVersion();
     $this->assertInternalType('string', $result);
 }