/** * 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; }