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 Varien_Data_Form_Element_Fieldset extends Varien_Data_Form_Element_Abstract
00036 {
00037
00038
00039
00040
00041
00042
00043 public function __construct($attributes=array())
00044 {
00045 parent::__construct($attributes);
00046 $this->_renderer = Varien_Data_Form::getFieldsetRenderer();
00047 $this->setType('fieldset');
00048 }
00049
00050
00051
00052
00053
00054
00055 public function getElementHtml()
00056 {
00057 $html = '<fieldset id="'.$this->getHtmlId().'"'.$this->serialize(array('class')).'>'."\n";
00058 if ($this->getLegend()) {
00059 $html.= '<legend>'.$this->getLegend().'</legend>'."\n";
00060 }
00061 $html.= $this->getChildrenHtml();
00062 $html.= '</fieldset></div>'."\n";
00063 $html.= $this->getAfterElementHtml();
00064 return $html;
00065 }
00066
00067
00068
00069
00070
00071
00072 public function getChildrenHtml()
00073 {
00074 $html = '';
00075 foreach ($this->getElements() as $element) {
00076 if ($element->getType() != 'fieldset') {
00077 $html.= $element->toHtml();
00078 }
00079 }
00080 return $html;
00081 }
00082
00083
00084
00085
00086
00087
00088 public function getSubFieldsetHtml()
00089 {
00090 $html = '';
00091 foreach ($this->getElements() as $element) {
00092 if ($element->getType() == 'fieldset') {
00093 $html.= $element->toHtml();
00094 }
00095 }
00096 return $html;
00097 }
00098
00099
00100
00101
00102
00103
00104 public function getDefaultHtml()
00105 {
00106 $html = '<div><h4 class="icon-head head-edit-form fieldset-legend">'.$this->getLegend().'</h4>'."\n";
00107 $html.= $this->getElementHtml();
00108 return $html;
00109 }
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120 public function addField($elementId, $type, $config, $after=false)
00121 {
00122 $element = parent::addField($elementId, $type, $config, $after);
00123 if ($renderer = Varien_Data_Form::getFieldsetElementRenderer()) {
00124 $element->setRenderer($renderer);
00125 }
00126 return $element;
00127 }
00128
00129 }