示例#1
0
 public function showAction(Request $request)
 {
     $this->kernel = $this->container->get('kernel');
     $pageTree = $this->container->get('red_kite_cms.page_tree');
     $isSecure = null !== $this->get('security.context')->getToken() ? true : false;
     $this->factoryRepository = $this->container->get('red_kite_cms.factory_repository');
     $this->languageRepository = $this->factoryRepository->createRepository('Language');
     $this->pageRepository = $this->factoryRepository->createRepository('Page');
     $this->seoRepository = $this->factoryRepository->createRepository('Seo');
     $bootstrapVersion = $this->container->get('red_kite_cms.active_theme')->getThemeBootstrapVersion();
     $params = array('template' => 'RedKiteCmsBundle:Cms:Welcome/welcome.html.twig', 'templateStylesheets' => null, 'templateJavascripts' => null, 'available_blocks' => null, 'internal_stylesheets' => null, 'internal_javascripts' => null, 'skin_path' => $this->getSkin(), 'is_secure' => $isSecure, 'page' => 0, 'language' => 0, 'available_languages' => $this->container->getParameter('red_kite_cms.available_languages'), 'frontController' => $this->getFrontcontroller($request));
     if (null !== $pageTree) {
         $pageId = 0;
         $languageId = 0;
         $pageName = '';
         $languageName = '';
         $page = $pageTree->getPage();
         $language = $pageTree->getLanguage();
         if (null !== $page) {
             $pageId = $page->getId();
             $pageName = $page->getPageName();
         }
         if (null !== $language) {
             $languageId = $language->getId();
             $languageName = $language->getLanguageName();
         }
         $blocksAddedMenu = $this->container->get('red_kite_cms.blocks_adder_menu');
         $template = $this->findTemplate($pageTree);
         $params = array_merge($params, array('metatitle' => $pageTree->getMetaTitle(), 'metadescription' => $pageTree->getMetaDescription(), 'metakeywords' => $pageTree->getMetaKeywords(), 'internal_stylesheets' => $pageTree->getInternalStylesheets(), 'internal_javascripts' => $pageTree->getInternalJavascripts(), 'template' => $template, 'pages' => ChoiceValues::getPages($this->pageRepository), 'languages' => ChoiceValues::getLanguages($this->languageRepository), 'permalinks' => ChoiceValues::getPermalinks($this->seoRepository, $languageId), 'page' => $pageId, 'language' => $languageId, 'page_name' => $pageName, 'language_name' => $languageName, 'base_template' => $this->container->getParameter('red_kite_labs_theme_engine.base_template'), 'templateStylesheets' => $pageTree->getExternalStylesheets(), 'templateJavascripts' => $this->fixAssets($pageTree->getExternalJavascripts()), 'available_blocks' => $blocksAddedMenu->build($this->container->get('red_kite_cms.block_manager_factory')->getBlocks())));
     } else {
         $configuration = $this->container->get('red_kite_cms.configuration');
         $cmsLanguage = $configuration->read('language');
         $message = $this->container->get('translator')->trans('cms_controller_page_not_exists_for_given_language', array('%page%' => $request->get('page'), '%language%' => $request->get('_locale')), 'RedKiteCmsBundle', $cmsLanguage);
         $this->container->get('session')->getFlashBag()->add('notice', $message);
     }
     $response = $this->render(sprintf('RedKiteCmsBundle:Bootstrap:%s/Template/Cms/template.html.twig', $bootstrapVersion), $params);
     return $this->dispatchEvents($request, $response);
 }
示例#2
0
 protected function getPages()
 {
     return ChoiceValues::getPages($this->createRepository('Page'), false);
 }