예제 #1
0
 /**
  * Sets current theme.
  *
  * @param OW_Theme $theme
  */
 public function setCurrentTheme(OW_Theme $theme)
 {
     if ($theme === null) {
         return;
     }
     $this->themeObjects[self::CURRENT_THEME] = $theme;
     $this->themeObjects[$theme->getDto()->getName()] = $theme;
 }
예제 #2
0
 /**
  * Generates theme object for theme manager (OW_Theme).
  *
  * @param BOL_Theme $theme
  * @return OW_Theme
  */
 private function getThemeObject(BOL_Theme $theme, $mobile = false)
 {
     $themeContentArray = $this->themeContentDao->findByThemeId($theme->getId());
     $documentMasterPagesArray = $this->themeMasterPageDao->findByThemeId($theme->getId());
     $decorators = array();
     $masterPages = array();
     $cssFiles = array();
     $documentMasterPages = array();
     /* @var $value BOL_ThemeContent */
     foreach ($themeContentArray as $value) {
         if ($value->getType() === BOL_ThemeContentDao::VALUE_TYPE_ENUM_DECORATOR) {
             $decorators[$value->getValue()] = $this->getDecoratorsDir($theme->getName()) . $value->getValue() . '.html';
         } else {
             if ($value->getType() === BOL_ThemeContentDao::VALUE_TYPE_ENUM_MASTER_PAGE) {
                 if (!$mobile) {
                     $masterPages[$value->getValue()] = $this->getMasterPagesDir($theme->getName()) . $value->getValue() . '.html';
                 }
             } else {
                 if ($value->getType() === BOL_ThemeContentDao::VALUE_TYPE_ENUM_MOBILE_MASTER_PAGE) {
                     if ($mobile) {
                         $masterPages[$value->getValue()] = $this->getMasterPagesDir($theme->getName(), true) . $value->getValue() . '.html';
                     }
                 } else {
                     throw new LogicException("Invalid theme content type `" . $value->getType() . "`");
                 }
             }
         }
     }
     /* @var $value BOL_ThemeMasterPage */
     foreach ($documentMasterPagesArray as $value) {
         $documentMasterPages[$value->getDocumentKey()] = $value->getMasterPage();
     }
     $themeObj = new OW_Theme($theme);
     $themeObj->setDecorators($decorators);
     $themeObj->setDocumentMasterPages($documentMasterPages);
     $themeObj->setMasterPages($masterPages);
     return $themeObj;
 }
예제 #3
0
 /**
  * Returns theme css file url.
  *
  * @param string $cssFileName
  * @return string
  */
 public function getCssFileUrl($mobile = false)
 {
     return $this->currentTheme->getStaticUrl() . ($mobile ? 'mobile/' : '') . BOL_ThemeService::CSS_FILE_NAME;
 }