Go to the documentation of this file.00001 <?php
00002
00009 class Theme_Main extends oxAdminDetails
00010 {
00011
00018 public function render()
00019 {
00020 $soxId = $this->getEditObjectId();
00021
00022 $oTheme = oxNew('oxTheme');
00023
00024 if (!$soxId) {
00025 $soxId = $oTheme->getActiveThemeId();
00026 }
00027
00028 if ($oTheme->load($soxId)) {
00029 $this->_aViewData["oTheme"] = $oTheme;
00030 } else {
00031 oxRegistry::get("oxUtilsView")->addErrorToDisplay(oxNew("oxException", 'EXCEPTION_THEME_NOT_LOADED'));
00032 }
00033
00034 parent::render();
00035
00036 if ($this->themeInConfigFile()) {
00037 oxRegistry::get("oxUtilsView")->addErrorToDisplay('EXCEPTION_THEME_SHOULD_BE_ONLY_IN_DATABASE');
00038 }
00039
00040 return 'theme_main.tpl';
00041 }
00042
00048 public function themeInConfigFile()
00049 {
00050 $blThemeSet = isset($this->getConfig()->sTheme);
00051 $blCustomThemeSet = isset($this->getConfig()->sCustomTheme);
00052
00053 if ($blThemeSet || $blCustomThemeSet) {
00054 return true;
00055 }
00056
00057 return false;
00058 }
00059
00060
00066 public function setTheme()
00067 {
00068 $sTheme = $this->getEditObjectId();
00070 $oTheme = oxNew('oxtheme');
00071 if (!$oTheme->load($sTheme)) {
00072 oxRegistry::get("oxUtilsView")->addErrorToDisplay(oxNew("oxException", 'EXCEPTION_THEME_NOT_LOADED'));
00073
00074 return;
00075 }
00076 try {
00077 $oTheme->activate();
00078 $this->resetContentCache();
00079 } catch (oxException $oEx) {
00080 oxRegistry::get("oxUtilsView")->addErrorToDisplay($oEx);
00081 $oEx->debugOut();
00082 }
00083 }
00084 }