private function initPages($languages)
 {
     $pages = $this->pageRepository->activePages();
     // Cycles all the website's languages
     foreach ($languages as $language) {
         // Cycles all the website's pages
         foreach ($pages as $page) {
             $this->pages['page'][] = $this->initPageTree($language, $page);
         }
     }
 }
Esempio n. 2
0
 public static function getPages(PageRepositoryInterface $pageRepository, $withNoneOption = true)
 {
     $result = array();
     if ($withNoneOption) {
         $result["none"] = " ";
     }
     $pages = $pageRepository->activePages();
     foreach ($pages as $page) {
         $result[$page->getId()] = $page->getPageName();
     }
     return $result;
 }
Esempio n. 3
0
 /**
  * Saves the current theme structure into a file
  *
  * @param  ThemeInterface $theme
  * @param  string           $themeStructureFile
  * @throws \Exception
  */
 protected function saveThemeStructure(ThemeInterface $theme, $themeStructureFile)
 {
     $templates = array();
     foreach ($this->languagesRepository->activeLanguages() as $language) {
         foreach ($this->pagesRepository->activePages() as $page) {
             $key = $language->getId() . '-' . $page->getId();
             $templates[$key] = $page->getTemplateName();
         }
     }
     $themeName = $theme->getThemeName();
     $currentTheme = array("Theme" => $themeName, "Templates" => $templates);
     file_put_contents($themeStructureFile, json_encode($currentTheme));
 }
Esempio n. 4
0
 /**
  * Removes the active pages
  *
  * @param  \RedKiteLabs\RedKiteCms\RedKiteCmsBundle\Core\Repository\Repository\PageRepositoryInterface $pageRepository
  * @return boolean
  */
 protected function removeActivePages(PageRepositoryInterface $pageRepository)
 {
     try {
         $pages = $pageRepository->activePages();
         foreach ($pages as $page) {
             $page->delete();
         }
         return true;
     } catch (\Exception $ex) {
         $this->errorMessage = "An error occoured during the removing of existing pages. The reported error is: " . $ex->getMessage();
         return false;
     }
 }