/** * Returns an instance of class (singleton pattern implementation). * * @return BOL_ThemeControlValueDao */ public static function getInstance() { if (self::$classInstance === null) { self::$classInstance = new self(); } return self::$classInstance; }
/** * Removes image control value. * * @param integer $themeId * @param string $controlName */ public function resetImageControl($themeId, $controlName) { $controlValue = $this->themeControlValueDao->findByTcNameAndThemeId($controlName, $themeId); if ($controlValue !== null) { $this->unlinkControlValueImage($controlValue->getValue()); $this->themeControlValueDao->delete($controlValue); } $curentValue = json_decode(OW::getConfig()->getValue('base', 'master_page_theme_info'), true); unset($curentValue[$themeId][$controlName]); OW::getConfig()->saveConfig('base', 'master_page_theme_info', json_encode($curentValue)); $this->updateCustomCssFile($themeId); }
private function exportThemes(ZipArchive $za, $archiveDir) { $currentTheme = OW::getThemeManager()->getSelectedTheme()->getDto(); $currentThemeDir = OW::getThemeManager()->getSelectedTheme()->getRootDir(); $currentThemeUserfilesDir = OW_DIR_THEME_USERFILES; $this->configs['currentTheme'] = array('name' => $currentTheme->name, 'customCss' => $currentTheme->customCss, 'customCssFileName' => $currentTheme->customCssFileName, 'description' => $currentTheme->description, 'isActive' => $currentTheme->isActive, 'sidebarPosition' => $currentTheme->sidebarPosition, 'title' => $currentTheme->title); $controlValueList = OW::getDbo()->queryForList(" SELECT * FROM " . BOL_ThemeControlValueDao::getInstance()->getTableName() . " WHERE themeId = :themeId ", array('themeId' => $currentTheme->id)); foreach ($controlValueList as $controlValue) { $this->configs['controlValue'][$controlValue['themeControlKey']] = $controlValue['value']; } $za->addEmptyDir($archiveDir . '/' . $currentTheme->getName()); $this->zipFolder($za, $currentThemeDir, $archiveDir . '/' . $currentTheme->getName() . '/'); $themesDir = Ow::getPluginManager()->getPlugin('dataexporter')->getPluginFilesDir() . 'themes' . DS; UTIL_File::copyDir(OW_DIR_THEME_USERFILES, $themesDir); $fileList = Ow::getStorage()->getFileNameList(OW_DIR_THEME_USERFILES); mkdir($themesDir, 0777); foreach ($fileList as $file) { if (Ow::getStorage()->isFile($file)) { Ow::getStorage()->copyFileToLocalFS($file, $themesDir . mb_substr($file, mb_strlen(OW_DIR_THEME_USERFILES))); } } $za->addEmptyDir($archiveDir . '/themes'); $this->zipFolder($za, $themesDir, $archiveDir . '/themes/'); }
/** * @param string $key * @param int $themeId * @return string */ public function findThemeControlValue($key, $themeId) { $dto = $this->themeControlValueDao->findByTcNameAndThemeId($key, $themeId); return $dto == null ? null : $dto->getValue(); }
public function findThemeControls($themeId) { $query = "SELECT `c`.`id` AS `cid`, `c`.*, `cv`.* FROM `" . $this->getTableName() . "` AS `c`\n LEFT JOIN ( SELECT * FROM `" . BOL_ThemeControlValueDao::getInstance()->getTableName() . "` WHERE `themeId` = :themeId2 )\n AS `cv` ON (`c`.`key` = `cv`.`themeControlKey`)\n WHERE `c`.`themeId` = :themeId ORDER BY `" . self::LABEL . "`"; return $this->dbo->queryForList($query, array('themeId' => $themeId, 'themeId2' => $themeId)); }