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 class Mage_Adminhtml_Block_System_Config_Edit extends Mage_Adminhtml_Block_Widget
00035 {
00036 const DEFAULT_SECTION_BLOCK = 'adminhtml/system_config_form';
00037
00038 protected $_section;
00039
00040 public function __construct()
00041 {
00042 parent::__construct();
00043 $this->setTemplate('system/config/edit.phtml');
00044
00045 $sectionCode = $this->getRequest()->getParam('section');
00046 $sections = Mage::getSingleton('adminhtml/config')->getSections();
00047
00048 $this->_section = $sections->$sectionCode;
00049
00050 $this->setTitle((string)$this->_section->label);
00051 }
00052
00053 protected function _prepareLayout()
00054 {
00055 $this->setChild('save_button',
00056 $this->getLayout()->createBlock('adminhtml/widget_button')
00057 ->setData(array(
00058 'label' => Mage::helper('adminhtml')->__('Save Config'),
00059 'onclick' => 'configForm.submit()',
00060 'class' => 'save',
00061 ))
00062 );
00063 return parent::_prepareLayout();
00064 }
00065
00066 public function getSaveButtonHtml()
00067 {
00068 return $this->getChildHtml('save_button');
00069 }
00070
00071 public function getSaveUrl()
00072 {
00073 return $this->getUrl('*/*/save', array('_current'=>true));
00074 }
00075
00076 public function initForm()
00077 {
00078
00079
00080
00081
00082
00083
00084
00085 $blockName = (string)$this->_section->frontend_model;
00086 if (empty($blockName)) {
00087 $blockName = self::DEFAULT_SECTION_BLOCK;
00088 }
00089 $this->setChild('form',
00090 $this->getLayout()->createBlock($blockName)
00091 ->initForm()
00092 );
00093 return $this;
00094 }
00095
00096
00097 }