00001 <?php 00007 class CheckboxListField extends AbstractListField 00008 { 00012 public function drawInput() 00013 { 00014 foreach($this->options as $value => $title) 00015 { 00016 $id = uniqid($this->name); 00017 echo "<input type=\"checkbox\" name=\"{$this->name}[]\" value=\"$value\" id=\"$id\"", 00018 array_search($value, $this->value) !== false ? 'checked="checked"/>' : '/>', 00019 "<label for=\"$id\">$title</label>"; 00020 } 00021 } 00022 00023 00028 public function setData($data) 00029 { 00030 if(!is_array($data)) 00031 $data = explode(',', $data); 00032 00033 $this->value = $data; 00034 } 00035 00040 public function getSqlImpl() 00041 { 00042 return $this->name . '=\'' . implode(',', $this->value) . '\''; 00043 } 00044 } 00045 00046 ?>