1 | <?php |
||
16 | class ColumnStatus extends Column |
||
17 | { |
||
18 | |||
19 | /** |
||
20 | * @var callable[] |
||
21 | */ |
||
22 | public $onChange = []; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $key; |
||
28 | |||
29 | /** |
||
30 | * @var array |
||
31 | */ |
||
32 | protected $options = []; |
||
33 | |||
34 | /** |
||
35 | * @var boolean |
||
36 | */ |
||
37 | protected $caret = TRUE; |
||
38 | |||
39 | |||
40 | /** |
||
41 | * @param DataGrid $grid |
||
42 | * @param string $key |
||
43 | * @param string $column |
||
44 | * @param string $name |
||
45 | */ |
||
46 | public function __construct(DataGrid $grid, $key, $column, $name) |
||
54 | |||
55 | |||
56 | /** |
||
57 | * @return string |
||
58 | */ |
||
59 | public function getKey() |
||
63 | |||
64 | |||
65 | /** |
||
66 | * @return array |
||
67 | */ |
||
68 | public function getOptions() |
||
72 | |||
73 | |||
74 | /** |
||
75 | * Get particular option |
||
76 | * @param mixed $value |
||
77 | * @return Option |
||
78 | * @throws DataGridColumnStatusException |
||
79 | */ |
||
80 | public function getOption($value) |
||
90 | |||
91 | |||
92 | /** |
||
93 | * @return string |
||
94 | */ |
||
95 | public function getColumn() |
||
99 | |||
100 | |||
101 | /** |
||
102 | * Find selected option for current item/row |
||
103 | * @param Row $row |
||
104 | * @return Option|NULL |
||
105 | */ |
||
106 | public function getCurrentOption(Row $row) |
||
116 | |||
117 | |||
118 | /** |
||
119 | * Add option to status select |
||
120 | * @param mixed $value |
||
121 | * @param string $text |
||
122 | * @return Option |
||
123 | * @throws DataGridColumnStatusException |
||
124 | */ |
||
125 | public function addOption($value, $text) |
||
137 | |||
138 | |||
139 | /** |
||
140 | * Set all options at once |
||
141 | * @param array $options |
||
142 | * @return static |
||
143 | */ |
||
144 | public function setOptions(array $options) |
||
152 | |||
153 | |||
154 | /** |
||
155 | * @param mixed $value |
||
156 | * @return void |
||
157 | */ |
||
158 | public function removeOption($value) |
||
166 | |||
167 | |||
168 | /** |
||
169 | * Column can have variables that will be passed to custom template scope |
||
170 | * @return array |
||
171 | */ |
||
172 | public function getTemplateVariables() |
||
181 | |||
182 | |||
183 | /** |
||
184 | * Should be a "caret" present in status dropdown? |
||
185 | * @param bool $use_caret |
||
186 | * @return static |
||
187 | */ |
||
188 | public function setCaret($use_caret) |
||
194 | |||
195 | |||
196 | /** |
||
197 | * @return boolean |
||
198 | */ |
||
199 | public function hasCaret() |
||
203 | |||
204 | } |
||
205 |