Example #1
0
 /**
  * Returns an array of all basic templates for the active theme
  * @return  array           The array of template strings
  * @access  public
  */
 function getTemplates($page)
 {
     global $objDatabase;
     if (isset($_GET['custom_content']) && preg_match('/^[a-zA-Z0-9_]+$/', $_GET['custom_content'])) {
         $this->customContentTemplate = $_GET['custom_content'];
     }
     if (isset($_GET['preview']) && intval($_GET['preview'])) {
         $id = intval($_GET['preview']);
         $theme = $this->themeRepository->findById($id);
         if ($theme) {
             $this->currentThemesId = $id;
         }
     }
     // get theme object so we get the configured libraries
     $theme = $this->getFrontendTemplate();
     $themesPath = $theme->getFoldername();
     if ($theme && $theme->isComponent()) {
         $libraries = JS::getConfigurableLibraries();
         foreach ($theme->getDependencies() as $libraryName => $libraryVersions) {
             if (!isset($libraries[$libraryName])) {
                 continue;
             }
             $version = $libraryVersions[0];
             $libraryData = isset($libraries[$libraryName]['versions'][$version]) ? $libraries[$libraryName]['versions'][$version] : array();
             if (isset($libraryData['jsfiles'])) {
                 foreach ($libraryData['jsfiles'] as $file) {
                     \JS::registerJS($file, true);
                 }
             }
             if (isset($libraryData['cssfiles'])) {
                 foreach ($libraryData['cssfiles'] as $file) {
                     \JS::registerCSS($file);
                 }
             }
         }
     }
     $this->themesPath = $themesPath;
     $this->templates['index'] = $this->getThemeFileContent($themesPath, 'index.html');
     $this->templates['home'] = $this->getThemeFileContent($themesPath, 'home.html');
     $this->templates['navbar'] = $this->getThemeFileContent($themesPath, 'navbar.html');
     $this->templates['navbar2'] = $this->getThemeFileContent($themesPath, 'navbar2.html');
     $this->templates['navbar3'] = $this->getThemeFileContent($themesPath, 'navbar3.html');
     $this->templates['subnavbar'] = $this->getThemeFileContent($themesPath, 'subnavbar.html');
     $this->templates['subnavbar2'] = $this->getThemeFileContent($themesPath, 'subnavbar2.html');
     $this->templates['subnavbar3'] = $this->getThemeFileContent($themesPath, 'subnavbar3.html');
     $this->templates['sidebar'] = $this->getThemeFileContent($themesPath, 'sidebar.html');
     $this->templates['top_news'] = $this->getThemeFileContent($themesPath, 'top_news.html');
     $this->templates['shopnavbar'] = $this->getThemeFileContent($themesPath, 'shopnavbar.html');
     $this->templates['shopnavbar2'] = $this->getThemeFileContent($themesPath, 'shopnavbar2.html');
     $this->templates['shopnavbar3'] = $this->getThemeFileContent($themesPath, 'shopnavbar3.html');
     $this->templates['headlines'] = $this->getThemeFileContent($themesPath, 'headlines.html');
     $this->templates['headlines2'] = $this->getThemeFileContent($themesPath, 'headlines2.html');
     $this->templates['headlines3'] = $this->getThemeFileContent($themesPath, 'headlines3.html');
     $this->templates['headlines4'] = $this->getThemeFileContent($themesPath, 'headlines4.html');
     $this->templates['news_recent_comments'] = $this->getThemeFileContent($themesPath, 'news_recent_comments.html');
     $this->templates['javascript'] = $this->getThemeFileContent($themesPath, 'javascript.js');
     //$this->templates['style']                 = $this->getThemeFileContent($themesPath, 'style.css');
     $this->templates['buildin_style'] = $this->getThemeFileContent($themesPath, 'buildin_style.css');
     $this->templates['calendar_headlines'] = $this->getThemeFileContent($themesPath, 'events.html');
     $this->templates['directory_content'] = $this->getThemeFileContent($themesPath, 'directory.html');
     $this->templates['forum_content'] = $this->getThemeFileContent($themesPath, 'forum.html');
     $this->templates['podcast_content'] = $this->getThemeFileContent($themesPath, 'podcast.html');
     $this->templates['blog_content'] = $this->getThemeFileContent($themesPath, 'blog.html');
     $this->templates['immo'] = $this->getThemeFileContent($themesPath, 'immo.html');
     if (!$this->hasCustomContent() || !$this->loadCustomContent($page)) {
         // load default content layout if page doesn't have a custom content
         // layout or if it failed to be loaded
         $this->templates['content'] = $this->getThemeFileContent($themesPath, 'content.html');
     }
     return $this->templates;
 }
Example #2
0
 public function setDependencies($dependencies = array())
 {
     $this->configurableLibraries = \JS::getConfigurableLibraries();
     usort($dependencies, array($this, 'sortDependencies'));
     $this->componentData['dependencies'] = $dependencies;
 }
Example #3
0
 /**
  * Get the library settings column on overview page
  * @param \Cx\Core\View\Model\Entity\Theme $theme the template object
  */
 protected function getLibrarySettings($theme)
 {
     global $_ARRAYLANG, $objTemplate;
     $libraries = \JS::getConfigurableLibraries();
     $objTemplate->setVariable(array('TXT_TEMPLATE_USED_LIBRARIES' => $_ARRAYLANG['TXT_TEMPLATE_USED_LIBRARIES'], 'TXT_SAVE' => $_ARRAYLANG['TXT_SAVE'], 'THEMES_SELECTED_THEME' => $theme->getFoldername()));
     $objTemplate->setGlobalVariable('TXT_THEME_LIBRARY_NOT_USED', $_ARRAYLANG['TXT_THEME_LIBRARY_NOT_USED']);
     $usedLibraries = $theme->getDependencies();
     // parse available libraries as setting tab
     $objTemplate->setCurrentBlock('theme_library');
     foreach ($libraries as $libraryName => $libraryInfo) {
         foreach ($libraryInfo['versions'] as $version => $files) {
             $objTemplate->setVariable(array('THEME_LIBRARY_NAME' => $libraryName, 'THEME_LIBRARY_VERSION' => $version, 'THEME_LIBRARY_VERSION_SELECTED' => isset($usedLibraries[$libraryName]) && $version == $usedLibraries[$libraryName][0] ? 'selected="selected"' : ''));
             $objTemplate->parse('theme_library_version');
         }
         if (array_key_exists($libraryName, $usedLibraries)) {
             $objTemplate->setVariable('THEME_LIBRARY_ACTIVE_CHECKED', 'checked="checked"');
         } else {
             $objTemplate->setVariable('THEME_LIBRARY_VERSION_DROPDOWN_HIDDEN', 'style="display: none;"');
         }
         $objTemplate->setVariable('THEME_LIBRARY_NAME', $libraryName);
         $objTemplate->parseCurrentBlock();
     }
 }