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 class Mage_Adminhtml_Block_System_Config_Form_Fieldset_Modules_DisableOutput
00029 extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
00030 {
00031 protected $_dummyElement;
00032 protected $_fieldRenderer;
00033 protected $_values;
00034
00035 public function render(Varien_Data_Form_Element_Abstract $element)
00036 {
00037 $html = $this->_getHeaderHtml($element);
00038
00039 $modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
00040
00041 sort($modules);
00042
00043 foreach ($modules as $moduleName) {
00044 if ($moduleName==='Mage_Adminhtml') {
00045 continue;
00046 }
00047 $html.= $this->_getFieldHtml($element, $moduleName);
00048 }
00049 $html .= $this->_getFooterHtml($element);
00050
00051 return $html;
00052 }
00053
00054 protected function _getDummyElement()
00055 {
00056 if (empty($this->_dummyElement)) {
00057 $this->_dummyElement = new Varien_Object(array('show_in_default'=>1, 'show_in_website'=>1));
00058 }
00059 return $this->_dummyElement;
00060 }
00061
00062 protected function _getFieldRenderer()
00063 {
00064 if (empty($this->_fieldRenderer)) {
00065 $this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
00066 }
00067 return $this->_fieldRenderer;
00068 }
00069
00070 protected function _getValues()
00071 {
00072 if (empty($this->_values)) {
00073 $this->_values = array(
00074 array('label'=>Mage::helper('adminhtml')->__('Enable'), 'value'=>0),
00075 array('label'=>Mage::helper('adminhtml')->__('Disable'), 'value'=>1),
00076 );
00077 }
00078 return $this->_values;
00079 }
00080
00081 protected function _getFieldHtml($fieldset, $moduleName)
00082 {
00083 $configData = $this->getConfigData();
00084 $path = 'advanced/modules_disable_output/'.$moduleName;
00085 $data = isset($configData[$path]) ? $configData[$path] : array();
00086
00087 $e = $this->_getDummyElement();
00088
00089 $field = $fieldset->addField($moduleName, 'select',
00090 array(
00091 'name' => 'groups[modules_disable_output][fields]['.$moduleName.'][value]',
00092 'label' => $moduleName,
00093 'value' => $data,
00094 'values' => $this->_getValues(),
00095 'inherit' => isset($configData[$path]) ? false : true,
00096 'can_use_default_value' => $this->getForm()->canUseDefaultValue($e),
00097 'can_use_website_value' => $this->getForm()->canUseWebsiteValue($e),
00098 ))->setRenderer($this->_getFieldRenderer());
00099
00100 return $field->toHtml();
00101 }
00102 }