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 abstract class Mage_Adminhtml_Block_Extensions_Custom_Edit_Tab_Abstract extends Mage_Adminhtml_Block_Widget_Form
00035 {
00036
00037 protected $_addRowButtonHtml;
00038 protected $_removeRowButtonHtml;
00039
00040 public function __construct()
00041 {
00042 parent::__construct();
00043 $this->setData(Mage::getSingleton('adminhtml/session')->getCustomExtensionPackageFormData());
00044 }
00045
00046 public function initForm()
00047 {
00048 return $this;
00049 }
00050
00051 public function getValue($key, $default='')
00052 {
00053 $value = $this->getData($key);
00054 return htmlspecialchars($value ? $value : $default);
00055 }
00056
00057 public function getSelected($key, $value)
00058 {
00059 return $this->getData($key)==$value ? 'selected="selected"' : '';
00060 }
00061
00062 public function getChecked($key)
00063 {
00064 return $this->getData($key) ? 'checked="checked"' : '';
00065 }
00066
00067 public function getAddRowButtonHtml($container, $template, $title='Add')
00068 {
00069 if (!isset($this->_addRowButtonHtml[$container])) {
00070 $this->_addRowButtonHtml[$container] = $this->getLayout()
00071 ->createBlock('adminhtml/widget_button')
00072 ->setType('button')
00073 ->setClass('add')
00074 ->setLabel($this->__($title))
00075 ->setOnClick("addRow('".$container."', '".$template."')")
00076 ->toHtml();
00077 }
00078 return $this->_addRowButtonHtml[$container];
00079 }
00080
00081 public function getRemoveRowButtonHtml($selector='span')
00082 {
00083 if (!$this->_removeRowButtonHtml) {
00084 $this->_removeRowButtonHtml = $this->getLayout()
00085 ->createBlock('adminhtml/widget_button')
00086 ->setType('button')
00087 ->setClass('delete')
00088 ->setLabel($this->__('Remove'))
00089 ->setOnClick("removeRow(this, '".$selector."')")
00090 ->toHtml();
00091 }
00092 return $this->_removeRowButtonHtml;
00093 }
00094
00095 }
00096