@@ 94-108 (lines=15) @@ | ||
91 | return $this; |
|
92 | } |
|
93 | ||
94 | public static function radios($name,$items=array(),$label=NULL,$value=null,$type=NULL){ |
|
95 | $fields=array(); |
|
96 | $i=0; |
|
97 | foreach ($items as $val=>$caption){ |
|
98 | $itemO=new HtmlFormRadio($name."-".$i++,$name,$caption,$val,$type); |
|
99 | if($val===$value){ |
|
100 | $itemO->getInput()->getField()->setProperty("checked", ""); |
|
101 | } |
|
102 | $fields[]=$itemO; |
|
103 | } |
|
104 | $radios=new HtmlFormFields("fields-".$name,$fields); |
|
105 | if(isset($label)) |
|
106 | $radios->setLabel($label)->setProperty("for", $name); |
|
107 | return $radios; |
|
108 | } |
|
109 | ||
110 | public static function checkeds($name,$items=array(),$label=NULL,$values=array(),$type=NULL){ |
|
111 | $fields=array(); |
|
@@ 110-124 (lines=15) @@ | ||
107 | return $radios; |
|
108 | } |
|
109 | ||
110 | public static function checkeds($name,$items=array(),$label=NULL,$values=array(),$type=NULL){ |
|
111 | $fields=array(); |
|
112 | $i=0; |
|
113 | foreach ($items as $val=>$caption){ |
|
114 | $itemO=new HtmlFormCheckbox($name."-".$i++,$name,$caption,$val,$type); |
|
115 | if(\array_search($val, $values)!==false){ |
|
116 | $itemO->getInput()->getField()->setProperty("checked", ""); |
|
117 | } |
|
118 | $fields[]=$itemO; |
|
119 | } |
|
120 | $radios=new HtmlFormFields("fields-".$name,$fields); |
|
121 | if(isset($label)) |
|
122 | $radios->setLabel($label)->setProperty("for", $name); |
|
123 | return $radios; |
|
124 | } |
|
125 | ||
126 | public function setEqualWidth($_equalWidth) { |
|
127 | $this->_equalWidth=$_equalWidth; |