1 | <?php |
||
23 | class InlineEdit extends Nette\Object |
||
24 | { |
||
25 | |||
26 | use Traits\ButtonIconTrait; |
||
27 | |||
28 | /** |
||
29 | * @var callable[] |
||
30 | */ |
||
31 | public $onSubmit; |
||
32 | |||
33 | /** |
||
34 | * @var callable[] |
||
35 | */ |
||
36 | public $onControlAdd; |
||
37 | |||
38 | /** |
||
39 | * @var callable[] |
||
40 | */ |
||
41 | public $onSetDefaults; |
||
42 | |||
43 | /** |
||
44 | * @var mixed |
||
45 | */ |
||
46 | protected $item_id; |
||
47 | |||
48 | /** |
||
49 | * @var string |
||
50 | */ |
||
51 | protected $title = 'edit'; |
||
52 | |||
53 | /** |
||
54 | * @var string |
||
55 | */ |
||
56 | protected $class = 'btn btn-xs btn-default ajax'; |
||
57 | |||
58 | /** |
||
59 | * @var string |
||
60 | */ |
||
61 | protected $icon = 'pencil'; |
||
62 | |||
63 | /** |
||
64 | * @var string |
||
65 | */ |
||
66 | protected $text = ''; |
||
67 | |||
68 | /** |
||
69 | * @var DataGrid |
||
70 | */ |
||
71 | protected $grid; |
||
72 | |||
73 | /** |
||
74 | * @var string|NULL |
||
75 | */ |
||
76 | protected $primary_where_column; |
||
77 | |||
78 | |||
79 | /** |
||
80 | * @param DataGrid $grid |
||
81 | * @param string|NULL $primary_where_column |
||
82 | */ |
||
83 | public function __construct(DataGrid $grid, $primary_where_column = NULL) |
||
88 | |||
89 | |||
90 | /** |
||
91 | * @param mixed $id |
||
92 | */ |
||
93 | public function setItemId($id) |
||
97 | |||
98 | |||
99 | /** |
||
100 | * @return mixed |
||
101 | */ |
||
102 | public function getItemId() |
||
106 | |||
107 | |||
108 | /** |
||
109 | * @return string |
||
110 | */ |
||
111 | public function getPrimaryWhereColumn() |
||
115 | |||
116 | |||
117 | /** |
||
118 | * Render row item detail button |
||
119 | * @param Row $row |
||
120 | * @return Html |
||
121 | */ |
||
122 | public function renderButton($row) |
||
136 | |||
137 | |||
138 | /** |
||
139 | * Render row item detail button |
||
140 | * @return Html |
||
141 | */ |
||
142 | public function renderButtonAdd() |
||
155 | |||
156 | |||
157 | /** |
||
158 | * Set attribute title |
||
159 | * @param string $title |
||
160 | */ |
||
161 | public function setTitle($title) |
||
167 | |||
168 | |||
169 | /** |
||
170 | * Get attribute title |
||
171 | * @return string |
||
172 | */ |
||
173 | public function getTitle() |
||
177 | |||
178 | |||
179 | /** |
||
180 | * Set attribute class |
||
181 | * @param string $class |
||
182 | */ |
||
183 | public function setClass($class) |
||
189 | |||
190 | |||
191 | /** |
||
192 | * Get attribute class |
||
193 | * @return string |
||
194 | */ |
||
195 | public function getClass() |
||
199 | |||
200 | |||
201 | /** |
||
202 | * Set icon |
||
203 | * @param string $icon |
||
204 | */ |
||
205 | public function setIcon($icon) |
||
211 | |||
212 | |||
213 | /** |
||
214 | * Get icon |
||
215 | * @return string |
||
216 | */ |
||
217 | public function getIcon() |
||
221 | |||
222 | |||
223 | /** |
||
224 | * Set text |
||
225 | * @param string $text |
||
226 | */ |
||
227 | public function setText($text) |
||
233 | |||
234 | |||
235 | /** |
||
236 | * Get text |
||
237 | * @return string |
||
238 | */ |
||
239 | public function getText() |
||
243 | |||
244 | } |
||
245 |