33 public function load($sOXID)
35 $sFilePath = $this->
getConfig()->getViewsDir() . $sOXID .
"/theme.php";
36 if (file_exists($sFilePath) && is_readable($sFilePath)) {
39 $this->_aTheme = $aTheme;
40 $this->_aTheme[
'id'] = $sOXID;
52 public function activate()
57 $oException =
oxNew(
"oxException", $sError);
60 $sParent = $this->
getInfo(
'parentTheme');
62 $this->
getConfig()->saveShopConfVar(
"str",
'sTheme', $sParent);
63 $this->
getConfig()->saveShopConfVar(
"str",
'sCustomTheme', $this->
getId());
65 $this->
getConfig()->saveShopConfVar(
"str",
'sTheme', $this->
getId());
66 $this->
getConfig()->saveShopConfVar(
"str",
'sCustomTheme',
'');
77 $this->_aThemeList = array();
78 $sOutDir = $this->
getConfig()->getViewsDir();
79 foreach (glob($sOutDir .
"*", GLOB_ONLYDIR) as $sDir) {
80 $oTheme =
oxNew(
'oxTheme');
81 if ($oTheme->load(basename($sDir))) {
82 $this->_aThemeList[$sDir] = $oTheme;
98 if (!isset($this->_aTheme[$sName])) {
102 return $this->_aTheme[$sName];
112 $sCustTheme = $this->
getConfig()->getConfigParam(
'sCustomTheme');
117 return $this->
getConfig()->getConfigParam(
'sTheme');
127 $sParent = $this->
getInfo(
'parentTheme');
131 $oTheme =
oxNew(
'oxTheme');
132 if ($oTheme->load($sParent)) {
147 if (!$this->
getId()) {
148 return 'EXCEPTION_THEME_NOT_LOADED';
152 $sParentVersion = $oParent->getInfo(
'version');
153 if (!$sParentVersion) {
154 return 'EXCEPTION_PARENT_VERSION_UNSPECIFIED';
156 $aMyParentVersions = $this->
getInfo(
'parentVersions');
157 if (!$aMyParentVersions || !is_array($aMyParentVersions)) {
158 return 'EXCEPTION_UNSPECIFIED_PARENT_VERSIONS';
160 if (!in_array($sParentVersion, $aMyParentVersions)) {
161 return 'EXCEPTION_PARENT_VERSION_MISMATCH';
163 } elseif ($this->
getInfo(
'parentTheme')) {
164 return 'EXCEPTION_PARENT_THEME_NOT_FOUND';