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 | * Inline adding - render on the top or in the bottom? |
||
80 | * @var bool |
||
81 | */ |
||
82 | protected $position_top = FALSE; |
||
83 | |||
84 | |||
85 | /** |
||
86 | * @param DataGrid $grid |
||
87 | * @param string|NULL $primary_where_column |
||
88 | */ |
||
89 | public function __construct(DataGrid $grid, $primary_where_column = NULL) |
||
94 | |||
95 | |||
96 | /** |
||
97 | * @param mixed $id |
||
98 | */ |
||
99 | public function setItemId($id) |
||
103 | |||
104 | |||
105 | /** |
||
106 | * @return mixed |
||
107 | */ |
||
108 | public function getItemId() |
||
112 | |||
113 | |||
114 | /** |
||
115 | * @return string |
||
116 | */ |
||
117 | public function getPrimaryWhereColumn() |
||
121 | |||
122 | |||
123 | /** |
||
124 | * Render row item detail button |
||
125 | * @param Row $row |
||
126 | * @return Html |
||
127 | */ |
||
128 | public function renderButton($row) |
||
142 | |||
143 | |||
144 | /** |
||
145 | * Render row item detail button |
||
146 | * @return Html |
||
147 | */ |
||
148 | public function renderButtonAdd() |
||
161 | |||
162 | |||
163 | /** |
||
164 | * Set attribute title |
||
165 | * @param string $title |
||
166 | */ |
||
167 | public function setTitle($title) |
||
173 | |||
174 | |||
175 | /** |
||
176 | * Get attribute title |
||
177 | * @return string |
||
178 | */ |
||
179 | public function getTitle() |
||
183 | |||
184 | |||
185 | /** |
||
186 | * Set attribute class |
||
187 | * @param string $class |
||
188 | */ |
||
189 | public function setClass($class) |
||
195 | |||
196 | |||
197 | /** |
||
198 | * Get attribute class |
||
199 | * @return string |
||
200 | */ |
||
201 | public function getClass() |
||
205 | |||
206 | |||
207 | /** |
||
208 | * Set icon |
||
209 | * @param string $icon |
||
210 | */ |
||
211 | public function setIcon($icon) |
||
217 | |||
218 | |||
219 | /** |
||
220 | * Get icon |
||
221 | * @return string |
||
222 | */ |
||
223 | public function getIcon() |
||
227 | |||
228 | |||
229 | /** |
||
230 | * Set text |
||
231 | * @param string $text |
||
232 | */ |
||
233 | public function setText($text) |
||
239 | |||
240 | |||
241 | /** |
||
242 | * Get text |
||
243 | * @return string |
||
244 | */ |
||
245 | public function getText() |
||
249 | |||
250 | |||
251 | /** |
||
252 | * Setter for inline adding position |
||
253 | * @param bool $position_top |
||
254 | * @return static |
||
255 | */ |
||
256 | public function setPositionTop($position_top = TRUE) |
||
262 | |||
263 | |||
264 | /** |
||
265 | * Getter for inline adding |
||
266 | * @return bool |
||
267 | */ |
||
268 | public function isPositionTop() |
||
272 | |||
273 | |||
274 | /** |
||
275 | * @return bool |
||
276 | */ |
||
277 | public function isPositionBottom() |
||
281 | |||
282 | } |
||
283 |