00001 <?php 00002 00009 class Theme_Config extends Shop_Config 00010 { 00011 protected $_sTheme = 'shop_config.tpl'; 00012 00019 public function render() 00020 { 00021 $myConfig = $this->getConfig(); 00022 00023 $sTheme = $this->_sTheme = $this->getEditObjectId(); 00024 $sShopId = $myConfig->getShopId(); 00025 00026 if (!isset( $sTheme ) ) { 00027 $sTheme = $this->_sTheme = $this->getConfig()->getConfigParam('sTheme'); 00028 } 00029 00030 $oTheme = oxNew('oxTheme'); 00031 if ($oTheme->load($sTheme)) { 00032 $this->_aViewData["oTheme"] = $oTheme; 00033 00034 try { 00035 $aDbVariables = $this->_loadConfVars($sShopId, $this->_getModuleForConfigVars()); 00036 $this->_aViewData["var_constraints"] = $aDbVariables['constraints']; 00037 $this->_aViewData["var_grouping"] = $aDbVariables['grouping']; 00038 foreach ($this->_aConfParams as $sType => $sParam) { 00039 $this->_aViewData[$sParam] = $aDbVariables['vars'][$sType]; 00040 } 00041 } catch (oxException $oEx) { 00042 oxUtilsView::getInstance()->addErrorToDisplay( $oEx ); 00043 $oEx->debugOut(); 00044 } 00045 } else { 00046 oxUtilsView::getInstance()->addErrorToDisplay( oxNew( "oxException", 'EXCEPTION_THEME_NOT_LOADED') ); 00047 } 00048 return 'theme_config.tpl'; 00049 } 00050 00051 00057 public function setTheme() 00058 { 00059 $sTheme = $this->getEditObjectId(); 00060 $oTheme = oxNew('oxtheme'); 00061 $oTheme->setTheme($sTheme); 00062 } 00063 00069 protected function _getModuleForConfigVars() 00070 { 00071 return oxConfig::OXMODULE_THEME_PREFIX.$this->_sTheme; 00072 } 00073 00079 public function saveConfVars() 00080 { 00081 $myConfig = $this->getConfig(); 00082 00083 oxAdminDetails::save(); 00084 00085 $sTheme = $this->_sTheme = $this->getEditObjectId(); 00086 $sShopId = $myConfig->getShopId(); 00087 00088 $sModule = $this->_getModuleForConfigVars(); 00089 00090 foreach ($this->_aConfParams as $sType => $sParam) { 00091 $aConfVars = oxConfig::getParameter($sParam); 00092 if (is_array($aConfVars)) { 00093 foreach ( $aConfVars as $sName => $sValue ) { 00094 $myConfig->saveShopConfVar( 00095 $sType, 00096 $sName, 00097 $this->_serializeConfVar($sType, $sName, $sValue), 00098 $sShopId, 00099 $sModule 00100 ); 00101 } 00102 } 00103 } 00104 } 00105 }