/** * Returns the initial HTML view for the admin interface. * * @param \Illuminate\Http\Request $request Laravel request object * @return \Illuminate\Contracts\View\View View for rendering the output */ public function indexAction(Request $request) { if (config('shop.authorize', true)) { $this->authorize('admin'); } $site = Route::input('site', 'default'); $lang = Input::get('lang', config('app.locale', 'en')); $aimeos = app('\\Aimeos\\Shop\\Base\\Aimeos')->get(); $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); $context = app('\\Aimeos\\Shop\\Base\\Context')->get(false); $context = $this->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')); } } $jqadmUrl = route('aimeos_shop_jqadm_search', array('site' => $site, 'resource' => 'product')); $jsonUrl = route('aimeos_shop_extadm_json', array('site' => $site, '_token' => csrf_token())); $adminUrl = route('aimeos_shop_extadm', array('site' => '<site>', 'lang' => '<lang>', 'tab' => '<tab>')); $vars = array('lang' => $lang, 'cssFiles' => $cssFiles, 'languages' => $this->getJsonLanguages($context), 'config' => $this->getJsonClientConfig($context), 'site' => $this->getJsonSiteItem($context, $site), 'i18nContent' => $this->getJsonClientI18n($aimeos->getI18nPaths(), $lang), 'searchSchemas' => $controller->getJsonSearchSchemas(), 'itemSchemas' => $controller->getJsonItemSchemas(), 'smd' => $controller->getJsonSmd($jsonUrl), 'urlTemplate' => str_replace(['<', '>'], ['{', '}'], urldecode($adminUrl)), 'uploaddir' => config('shop::uploaddir'), 'activeTab' => Input::get('tab', 0), 'version' => $this->getVersion(), 'jqadmurl' => $jqadmUrl); return View::make('shop::admin.extadm-index', $vars); }
/** * Returns the initial HTML view for the admin interface. * * @return Response Response object containing the generated output */ public function indexAction() { if (config('shop.authorize', true)) { $this->authorize('admin'); } $site = \Input::get('site', 'default'); $lang = \Input::get('lang', 'en'); $aimeos = app('\\Aimeos\\Shop\\Base\\Aimeos')->get(); $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); $context = app('\\Aimeos\\Shop\\Base\\Context')->get(false); $context = $this->setLocale($context, $site, $lang); $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); $cssFiles = array(); foreach ($aimeos->getCustomPaths('client/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')); } } $params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}'); $adminUrl = route('aimeos_shop_admin', $params); $jsonUrl = route('aimeos_shop_admin_json', array('_token' => csrf_token())); $vars = array('lang' => $lang, 'cssFiles' => $cssFiles, 'languages' => $this->getJsonLanguages($context), 'config' => $this->getJsonClientConfig($context), 'site' => $this->getJsonSiteItem($context, \Input::get('site', 'default')), 'i18nContent' => $this->getJsonClientI18n($aimeos->getI18nPaths(), $lang), 'searchSchemas' => $controller->getJsonSearchSchemas(), 'itemSchemas' => $controller->getJsonItemSchemas(), 'smd' => $controller->getJsonSmd($jsonUrl), 'urlTemplate' => urldecode($adminUrl), 'uploaddir' => \Config::get('shop::uploaddir'), 'activeTab' => \Input::get('tab', 0), 'version' => $this->getVersion()); return \View::make('shop::admin.index', $vars); }
/** * 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); }
/** * Returns the initial HTML view for the admin interface. * * @param integer $tab Number of the currently active tab * @return \Symfony\Component\HttpFoundation\Response HTML page for the admin interface */ public function indexAction($site, $lang, $tab) { $context = $this->get('aimeos_context')->get(false); $context = $this->setLocale($context, $site, $lang); $aimeos = $this->get('aimeos')->get(); $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); $cssFiles = array(); foreach ($aimeos->getCustomPaths('client/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')); } } $params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}'); $adminUrl = $this->generateUrl('aimeos_shop_admin', $params); $token = $this->get('security.csrf.token_manager')->getToken('aimeos_admin_token')->getValue(); $jsonUrl = $this->generateUrl('aimeos_shop_admin_json', array('_token' => $token)); $vars = array('lang' => $lang, 'cssFiles' => $cssFiles, 'languages' => $this->getJsonLanguages($context), 'config' => $this->getJsonClientConfig($context), 'site' => $this->getJsonSiteItem($context, $site), 'i18nContent' => $this->getJsonClientI18n($aimeos->getI18nPaths(), $lang), 'searchSchemas' => $controller->getJsonSearchSchemas(), 'itemSchemas' => $controller->getJsonItemSchemas(), 'smd' => $controller->getJsonSmd($jsonUrl), 'urlTemplate' => urldecode($adminUrl), 'uploaddir' => $this->container->getParameter('aimeos_shop.uploaddir'), 'version' => $this->getVersion(), 'activeTab' => $tab); return $this->render('AimeosShopBundle:Admin:index.html.twig', $vars); }
/** * Returns the initial HTML view for the admin interface. * * @param Request $request Symfony request object * @return Response Generated output for the admin interface */ public function indexAction(Request $request) { $site = $request->attributes->get('site', $request->query->get('site', 'default')); $lang = $request->attributes->get('lang', $request->query->get('lang', 'en')); $tab = $request->attributes->get('tab', $request->query->get('tab', 0)); $context = $this->get('aimeos_context')->get(false, 'backend'); $context->setLocale($this->get('aimeos_locale')->getBackend($context, $site)); $aimeos = $this->get('aimeos'); $bootstrap = $aimeos->get(); $cntlPaths = $bootstrap->getCustomPaths('controller/extjs'); $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); $cssFiles = array(); foreach ($bootstrap->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')); } } $params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}'); $adminUrl = $this->generateUrl('aimeos_shop_extadm', $params); $token = $this->get('security.csrf.token_manager')->getToken('aimeos_admin_token')->getValue(); $jsonUrl = $this->generateUrl('aimeos_shop_extadm_json', array('_token' => $token, 'site' => $site)); $jqadmUrl = $this->generateUrl('aimeos_shop_jqadm_search', array('site' => $site, 'resource' => 'product')); $vars = array('lang' => $lang, 'cssFiles' => $cssFiles, 'languages' => $this->getJsonLanguages(), 'config' => $this->getJsonClientConfig($context), 'site' => $this->getJsonSiteItem($context, $site), 'i18nContent' => $this->getJsonClientI18n($bootstrap->getI18nPaths(), $lang), 'searchSchemas' => $controller->getJsonSearchSchemas(), 'itemSchemas' => $controller->getJsonItemSchemas(), 'smd' => $controller->getJsonSmd($jsonUrl), 'urlTemplate' => urldecode($adminUrl), 'uploaddir' => $this->container->getParameter('aimeos_shop.uploaddir'), 'version' => $aimeos->getVersion(), 'jqadmurl' => $jqadmUrl, 'activeTab' => $tab); return $this->render('AimeosShopBundle:Extadm:index.html.twig', $vars); }
/** * Creates the initial HTML view for the admin interface. * * @param string $site Shop site code * @param string $lang ISO language code * @param integer $tab Number of the current active tab */ public function indexAction($site = 'default', $lang = 'en', $tab = 0) { $context = $this->context->get(null, 'backend'); $context->setLocale($this->locale->getBackend($context, $site)); $aimeos = $this->aimeos->get(); $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); $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', '')); } } $params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}'); $adminUrl = $this->uriBuilder->uriFor('index', $params); $jsonUrl = $this->uriBuilder->uriFor('do', array('site' => 'default')); $jqadmUrl = $this->uriBuilder->uriFor('search', array('site' => $site, 'resource' => 'product'), 'Jqadm'); $vars = array('lang' => $lang, 'cssFiles' => $cssFiles, 'languages' => $this->getJsonLanguages(), 'config' => $this->getJsonClientConfig($context), 'site' => $this->getJsonSiteItem($context, $site), 'i18nContent' => $this->getJsonClientI18n($aimeos->getI18nPaths(), $lang), 'searchSchemas' => $controller->getJsonSearchSchemas(), 'itemSchemas' => $controller->getJsonItemSchemas(), 'smd' => $controller->getJsonSmd($jsonUrl), 'uploaddir' => $context->getConfig()->get('flow/uploaddir', '/.'), 'version' => $this->aimeos->getVersion(), 'urlTemplate' => urldecode($adminUrl), 'jqadmurl' => $jqadmUrl, 'activeTab' => $tab); $this->view->assignMultiple($vars); }