00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 class Mage_Adminhtml_Extensions_ConfigController extends Mage_Adminhtml_Controller_Action
00036 {
00037 public function indexAction()
00038 {
00039 $this->loadLayout();
00040
00041 $this->_setActiveMenu('system/extensions');
00042
00043 $this->_addContent($this->getLayout()->createBlock('adminhtml/extensions_config_edit')->initForm());
00044
00045 $this->renderLayout();
00046 }
00047
00048 public function saveAction()
00049 {
00050 $pear = Varien_Pear::getInstance();
00051 $error = Mage::helper('adminhtml')->__("Unknown error");
00052 $state = $this->getRequest()->getPost('preferred_state');
00053 if (!empty($state)) {
00054 $session = Mage::getSingleton('adminhtml/session');
00055 $result = $pear->run('config-set', array(), array('preferred_state', $state));
00056 if ($result instanceof PEAR_Error) {
00057 $error = $result->getMessage();
00058 } else {
00059 $error = false;
00060 }
00061 }
00062 if ($error) {
00063 $session->addError($result->getMessage());
00064 } else {
00065 $session->addSuccess(Mage::helper('adminhtml')->__("PEAR Configuration was successfully saved"));
00066 }
00067 $this->_redirect('*/*');
00068 }
00069
00070 protected function _isAllowed()
00071 {
00072 return Mage::getSingleton('admin/session')->isAllowed('system/extensions/config');
00073 }
00074 }