Go to the documentation of this file.00001 <?php
00002
00009 class Module_Config extends Shop_Config
00010 {
00011 protected $_sModule = 'shop_config.tpl';
00012
00019 public function render()
00020 {
00021 $myConfig = $this->getConfig();
00022
00023 $sModuleId = $this->_sModuleId = $this->getEditObjectId();
00024 $sShopId = $myConfig->getShopId();
00025
00026 $oModule = oxNew( 'oxModule' );
00027
00028 if ( $sModuleId && $oModule->load( $sModuleId ) ) {
00029
00030 try {
00031 $aDbVariables = $this->_loadConfVars($sShopId, $this->_getModuleForConfigVars());
00032 $this->_aViewData["var_constraints"] = $aDbVariables['constraints'];
00033 $this->_aViewData["var_grouping"] = $aDbVariables['grouping'];
00034 $iCount = 0;
00035 foreach ($this->_aConfParams as $sType => $sParam) {
00036 $this->_aViewData[$sParam] = $aDbVariables['vars'][$sType];
00037 $iCount += count($aDbVariables['vars'][$sType]);
00038 }
00039 } catch (oxException $oEx) {
00040 oxUtilsView::getInstance()->addErrorToDisplay( $oEx );
00041 $oEx->debugOut();
00042 }
00043 } else {
00044 oxUtilsView::getInstance()->addErrorToDisplay( new oxException('EXCEPTION_MODULE_NOT_LOADED') );
00045 }
00046
00047 $this->_aViewData["oModule"] = $oModule;
00048
00049 return 'module_config.tpl';
00050 }
00051
00057 protected function _getModuleForConfigVars()
00058 {
00059 return oxConfig::OXMODULE_MODULE_PREFIX . $this->_sModuleId;
00060 }
00061
00062
00068 public function saveConfVars()
00069 {
00070 $myConfig = $this->getConfig();
00071
00072
00073 $sModuleId = $this->_sModuleId = $this->getEditObjectId();
00074 $sShopId = $myConfig->getShopId();
00075
00076 $sModuleId = $this->_getModuleForConfigVars();
00077
00078 foreach ($this->_aConfParams as $sType => $sParam) {
00079 $aConfVars = oxConfig::getParameter($sParam);
00080 if (is_array($aConfVars)) {
00081 foreach ( $aConfVars as $sName => $sValue ) {
00082 $myConfig->saveShopConfVar(
00083 $sType,
00084 $sName,
00085 $this->_serializeConfVar($sType, $sName, $sValue),
00086 $sShopId,
00087 $sModuleId
00088 );
00089 }
00090 }
00091 }
00092 }
00093 }