theme_config.php

Go to the documentation of this file.
00001 <?php
00002 
00009 class Theme_Config extends Shop_Config
00010 {
00011 
00012     protected $_sTheme = null;
00013 
00020     public function render()
00021     {
00022         $myConfig = $this->getConfig();
00023 
00024         $sTheme = $this->_sTheme = $this->getEditObjectId();
00025         $sShopId = $myConfig->getShopId();
00026 
00027         if (!isset($sTheme)) {
00028             $sTheme = $this->_sTheme = $this->getConfig()->getConfigParam('sTheme');
00029         }
00030 
00031         $oTheme = oxNew('oxTheme');
00032         if ($oTheme->load($sTheme)) {
00033             $this->_aViewData["oTheme"] = $oTheme;
00034 
00035             try {
00036                 $aDbVariables = $this->loadConfVars($sShopId, $this->_getModuleForConfigVars());
00037                 $this->_aViewData["var_constraints"] = $aDbVariables['constraints'];
00038                 $this->_aViewData["var_grouping"] = $aDbVariables['grouping'];
00039                 foreach ($this->_aConfParams as $sType => $sParam) {
00040                     $this->_aViewData[$sParam] = $aDbVariables['vars'][$sType];
00041                 }
00042             } catch (oxException $oEx) {
00043                 oxRegistry::get("oxUtilsView")->addErrorToDisplay($oEx);
00044                 $oEx->debugOut();
00045             }
00046         } else {
00047             oxRegistry::get("oxUtilsView")->addErrorToDisplay(oxNew("oxException", 'EXCEPTION_THEME_NOT_LOADED'));
00048         }
00049 
00050         return 'theme_config.tpl';
00051     }
00052 
00058     protected function _getModuleForConfigVars()
00059     {
00060         if ($this->_sTheme === null) {
00061             $this->_sTheme = $this->getEditObjectId();
00062         }
00063 
00064         return oxConfig::OXMODULE_THEME_PREFIX . $this->_sTheme;
00065     }
00066 
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 }