OXID eShop CE  4.8.12
 All Classes Files Functions Variables Pages
theme_config.php
Go to the documentation of this file.
1 <?php
2 
9 class Theme_Config extends Shop_Config
10 {
11  protected $_sTheme = null;
12 
19  public function render()
20  {
21  $myConfig = $this->getConfig();
22 
23  $sTheme = $this->_sTheme = $this->getEditObjectId();
24  $sShopId = $myConfig->getShopId();
25 
26  if (!isset( $sTheme ) ) {
27  $sTheme = $this->_sTheme = $this->getConfig()->getConfigParam('sTheme');
28  }
29 
30  $oTheme = oxNew('oxTheme');
31  if ($oTheme->load($sTheme)) {
32  $this->_aViewData["oTheme"] = $oTheme;
33 
34  try {
35  $aDbVariables = $this->loadConfVars($sShopId, $this->_getModuleForConfigVars());
36  $this->_aViewData["var_constraints"] = $aDbVariables['constraints'];
37  $this->_aViewData["var_grouping"] = $aDbVariables['grouping'];
38  foreach ($this->_aConfParams as $sType => $sParam) {
39  $this->_aViewData[$sParam] = $aDbVariables['vars'][$sType];
40  }
41  } catch (oxException $oEx) {
42  oxRegistry::get("oxUtilsView")->addErrorToDisplay( $oEx );
43  $oEx->debugOut();
44  }
45  } else {
46  oxRegistry::get("oxUtilsView")->addErrorToDisplay( oxNew( "oxException", 'EXCEPTION_THEME_NOT_LOADED') );
47  }
48  return 'theme_config.tpl';
49  }
50 
56  protected function _getModuleForConfigVars()
57  {
58  if ($this->_sTheme === null) {
59  $this->_sTheme = $this->getEditObjectId();
60  }
61 
62  return oxConfig::OXMODULE_THEME_PREFIX.$this->_sTheme;
63  }
64 
70  public function saveConfVars()
71  {
72  $myConfig = $this->getConfig();
73 
75 
76  $sShopId = $myConfig->getShopId();
77 
78  $sModule = $this->_getModuleForConfigVars();
79 
80  foreach ($this->_aConfParams as $sType => $sParam) {
81  $aConfVars = $myConfig->getRequestParameter($sParam);
82  if (is_array($aConfVars)) {
83  foreach ( $aConfVars as $sName => $sValue ) {
84  $myConfig->saveShopConfVar(
85  $sType,
86  $sName,
87  $this->_serializeConfVar($sType, $sName, $sValue),
88  $sShopId,
89  $sModule
90  );
91  }
92  }
93  }
94  }
95 }