theme_main.php

Go to the documentation of this file.
00001 <?php
00002 
00009 class Theme_Main extends oxAdminDetails
00010 {
00011 
00018     public function render()
00019     {
00020         $soxId = $this->getEditObjectId();
00021 
00022         $oTheme = oxNew('oxTheme');
00023 
00024         if (!$soxId) {
00025             $soxId = $oTheme->getActiveThemeId();
00026         }
00027 
00028         if ($oTheme->load($soxId)) {
00029             $this->_aViewData["oTheme"] =  $oTheme;
00030         } else {
00031             oxUtilsView::getInstance()->addErrorToDisplay( new oxException('EXCEPTION_THEME_NOT_LOADED') );
00032         }
00033 
00034         parent::render();
00035 
00036         return 'theme_main.tpl';
00037     }
00038 
00039 
00045     public function setTheme()
00046     {
00047         $sTheme = $this->getEditObjectId();
00048         $oTheme = oxNew('oxtheme');
00049         if (!$oTheme->load($sTheme)) {
00050             oxUtilsView::getInstance()->addErrorToDisplay( new oxException('EXCEPTION_THEME_NOT_LOADED') );
00051             return;
00052         }
00053         try {
00054             $oTheme->activate();
00055             $this->resetContentCache();
00056         } catch (oxException $oEx) {
00057             oxUtilsView::getInstance()->addErrorToDisplay( $oEx );
00058             $oEx->debugOut();
00059         }
00060     }
00061 }