コード例 #1
0
ファイル: Version201511240844.php プロジェクト: ollietb/sulu
 /**
  * Iterates over all nodes of the given type, and upgrades them.
  *
  * @param StructureMetadata $structureMetadata The structure metadata, whose pages have to be upgraded
  * @param array $properties The properties which are or contain URL fields
  * @param bool $addScheme Adds the scheme to URLs if true, removes the scheme otherwise
  */
 private function iterateStructureNodes(StructureMetadata $structureMetadata, array $properties, $addScheme)
 {
     foreach ($this->localizationManager->getLocalizations() as $localization) {
         $rows = $this->session->getWorkspace()->getQueryManager()->createQuery(sprintf('SELECT * FROM [nt:unstructured] WHERE [%s] = "%s" OR [%s] = "%s"', $this->propertyEncoder->localizedSystemName('template', $localization->getLocalization()), $structureMetadata->getName(), 'template', $structureMetadata->getName()), 'JCR-SQL2')->execute();
         foreach ($rows->getNodes() as $node) {
             $this->upgradeNode($node, $localization->getLocalization(), $properties, $addScheme);
         }
     }
 }
コード例 #2
0
ファイル: AdminController.php プロジェクト: Silwereth/sulu
 /**
  * Renders admin ui.
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function indexAction()
 {
     if (!$this->authorizationChecker->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
         return new RedirectResponse($this->urlGenerator->generate('sulu_admin.login', []));
     }
     $user = $this->tokenStorage->getToken()->getUser();
     // get js config from bundles
     $jsConfig = $this->jsConfigPool->getConfigParams();
     // render template
     if ($this->environment === 'dev') {
         $template = 'SuluAdminBundle:Admin:index.html.twig';
     } else {
         $template = 'SuluAdminBundle:Admin:index.html.dist.twig';
     }
     return $this->engine->renderResponse($template, ['name' => $this->adminName, 'locales' => array_keys($this->localizationManager->getLocalizations()), 'translated_locales' => $this->translatedLocales, 'translations' => $this->translations, 'fallback_locale' => $this->fallbackLocale, 'suluVersion' => $this->suluVersion, 'user' => $this->serializer->serialize($user, 'array', SerializationContext::create()->setGroups(['frontend'])), 'config' => $jsConfig]);
 }
コード例 #3
0
 private function addLocalizationProvider($localizations)
 {
     $localizationProvider1 = $this->prophesize('Sulu\\Component\\Localization\\Provider\\LocalizationProviderInterface');
     $localizationProvider1->getAllLocalizations()->willReturn($localizations);
     $this->localizationManager->addLocalizationProvider($localizationProvider1->reveal());
 }