Total Complexity | 8 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
3 | class Nip_Form_Element_Checkbox extends Nip_Form_Element_Input_Abstract |
||
4 | { |
||
5 | protected $_type = 'checkbox'; |
||
6 | |||
7 | public function init() |
||
8 | { |
||
9 | parent::init(); |
||
10 | $this->setAttrib('type', 'checkbox'); |
||
11 | } |
||
12 | |||
13 | /** |
||
14 | * @param $request |
||
15 | * @return $this |
||
16 | */ |
||
17 | public function getDataFromRequest($request) |
||
18 | { |
||
19 | $this->setChecked($request != null); |
||
20 | return parent::getDataFromRequest($request); |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * @param boolean $checked |
||
25 | * @return $this |
||
26 | */ |
||
27 | public function setChecked($checked) |
||
28 | { |
||
29 | if ($checked === true) { |
||
30 | $this->setAttrib('checked', 'checked'); |
||
31 | } else { |
||
32 | $this->delAttrib('checked'); |
||
33 | } |
||
34 | return $this; |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * @param $data |
||
39 | * @return $this |
||
40 | */ |
||
41 | public function getDataFromModel($value) |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @return bool |
||
52 | */ |
||
53 | public function isChecked() |
||
56 | } |
||
57 | } |
||
58 |