OXID eShop CE  4.10.1
 All Classes Namespaces 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 
12  protected $_sTheme = null;
13 
20  public function render()
21  {
22  $myConfig = $this->getConfig();
23 
24  $sTheme = $this->_sTheme = $this->getEditObjectId();
25  $sShopId = $myConfig->getShopId();
26 
27  if (!isset($sTheme)) {
28  $sTheme = $this->_sTheme = $this->getConfig()->getConfigParam('sTheme');
29  }
30 
31  $oTheme = oxNew('oxTheme');
32  if ($oTheme->load($sTheme)) {
33  $this->_aViewData["oTheme"] = $oTheme;
34 
35  try {
36  $aDbVariables = $this->loadConfVars($sShopId, $this->_getModuleForConfigVars());
37  $this->_aViewData["var_constraints"] = $aDbVariables['constraints'];
38  $this->_aViewData["var_grouping"] = $aDbVariables['grouping'];
39  foreach ($this->_aConfParams as $sType => $sParam) {
40  $this->_aViewData[$sParam] = $aDbVariables['vars'][$sType];
41  }
42  } catch (oxException $oEx) {
43  oxRegistry::get("oxUtilsView")->addErrorToDisplay($oEx);
44  $oEx->debugOut();
45  }
46  } else {
47  oxRegistry::get("oxUtilsView")->addErrorToDisplay(oxNew("oxException", 'EXCEPTION_THEME_NOT_LOADED'));
48  }
49 
50  return 'theme_config.tpl';
51  }
52 
58  protected function _getModuleForConfigVars()
59  {
60  if ($this->_sTheme === null) {
61  $this->_sTheme = $this->getEditObjectId();
62  }
63 
65  }
66 
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 }