theme_config.php

Go to the documentation of this file.
00001 <?php
00002 
00009 class Theme_Config extends Shop_Config
00010 {
00011     protected $_sTheme = null;
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                 oxRegistry::get("oxUtilsView")->addErrorToDisplay( $oEx );
00043                 $oEx->debugOut();
00044             }
00045         } else {
00046             oxRegistry::get("oxUtilsView")->addErrorToDisplay( oxNew( "oxException", 'EXCEPTION_THEME_NOT_LOADED') );
00047         }
00048         return 'theme_config.tpl';
00049     }
00050 
00056     protected function _getModuleForConfigVars()
00057     {
00058         if ($this->_sTheme === null) {
00059             $this->_sTheme = $this->getEditObjectId();
00060         }
00061 
00062         return oxConfig::OXMODULE_THEME_PREFIX.$this->_sTheme;
00063     }
00064 
00070     public function saveConfVars()
00071     {
00072         $myConfig = $this->getConfig();
00073 
00074         oxAdminDetails::save();
00075 
00076         $sShopId = $myConfig->getShopId();
00077 
00078         $sModule = $this->_getModuleForConfigVars();
00079 
00080         foreach ($this->_aConfParams as $sType => $sParam) {
00081             $aConfVars = $myConfig->getRequestParameter($sParam);
00082             if (is_array($aConfVars)) {
00083                 foreach ( $aConfVars as $sName => $sValue ) {
00084                     $myConfig->saveShopConfVar(
00085                             $sType,
00086                             $sName,
00087                             $this->_serializeConfVar($sType, $sName, $sValue),
00088                             $sShopId,
00089                             $sModule
00090                     );
00091                 }
00092             }
00093         }
00094     }
00095 }