Go to the documentation of this file.00001 <?php
00002
00009 class Module_Main extends oxAdminDetails
00010 {
00011
00018 public function render()
00019 {
00020 if (oxRegistry::getConfig()->getRequestParameter("moduleId")) {
00021 $sModuleId = oxRegistry::getConfig()->getRequestParameter("moduleId");
00022 } else {
00023 $sModuleId = $this->getEditObjectId();
00024 }
00025
00026 $oModule = oxNew('oxModule');
00027
00028 if ($sModuleId) {
00029 if ($oModule->load($sModuleId)) {
00030 $iLang = oxRegistry::getLang()->getTplLanguage();
00031
00032 $this->_aViewData["oModule"] = $oModule;
00033 $this->_aViewData["sModuleName"] = basename($oModule->getInfo("title", $iLang));
00034 $this->_aViewData["sModuleId"] = str_replace("/", "_", $oModule->getModulePath());
00035 } else {
00036 oxRegistry::get("oxUtilsView")->addErrorToDisplay(new oxException('EXCEPTION_MODULE_NOT_LOADED'));
00037 }
00038 }
00039
00040 parent::render();
00041
00042 return 'module_main.tpl';
00043 }
00044
00050 public function activateModule()
00051 {
00052 $sModule = $this->getEditObjectId();
00054 $oModule = oxNew('oxModule');
00055 if (!$oModule->load($sModule)) {
00056 oxRegistry::get("oxUtilsView")->addErrorToDisplay(new oxException('EXCEPTION_MODULE_NOT_LOADED'));
00057
00058 return;
00059 }
00060 try {
00062 $oModuleCache = oxNew('oxModuleCache', $oModule);
00064 $oModuleInstaller = oxNew('oxModuleInstaller', $oModuleCache);
00065
00066 if ($oModuleInstaller->activate($oModule)) {
00067 $this->_aViewData["updatenav"] = "1";
00068 }
00069 } catch (oxException $oEx) {
00070 oxRegistry::get("oxUtilsView")->addErrorToDisplay($oEx);
00071 $oEx->debugOut();
00072 }
00073 }
00074
00080 public function deactivateModule()
00081 {
00082 $sModule = $this->getEditObjectId();
00084 $oModule = oxNew('oxModule');
00085 if (!$oModule->load($sModule)) {
00086 oxRegistry::get("oxUtilsView")->addErrorToDisplay(new oxException('EXCEPTION_MODULE_NOT_LOADED'));
00087
00088 return;
00089 }
00090 try {
00092 $oModuleCache = oxNew('oxModuleCache', $oModule);
00094 $oModuleInstaller = oxNew('oxModuleInstaller', $oModuleCache);
00095
00096 if ($oModuleInstaller->deactivate($oModule)) {
00097 $this->_aViewData["updatenav"] = "1";
00098 }
00099 } catch (oxException $oEx) {
00100 oxRegistry::get("oxUtilsView")->addErrorToDisplay($oEx);
00101 $oEx->debugOut();
00102 }
00103 }
00104 }