1 | <?php |
||
16 | class ItemDetail extends Ublaboo\DataGrid\Object |
||
17 | { |
||
18 | |||
19 | use Traits\ButtonIconTrait; |
||
20 | |||
21 | /** |
||
22 | * (renderer | template | block) |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $type; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $template; |
||
31 | |||
32 | /** |
||
33 | * @var callable |
||
34 | */ |
||
35 | protected $renderer; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $title; |
||
41 | |||
42 | /** |
||
43 | * @var string |
||
44 | */ |
||
45 | protected $class = 'btn btn-xs btn-default ajax'; |
||
46 | |||
47 | /** |
||
48 | * @var string |
||
49 | */ |
||
50 | protected $icon = 'eye'; |
||
51 | |||
52 | /** |
||
53 | * @var string |
||
54 | */ |
||
55 | protected $text = ''; |
||
56 | |||
57 | /** |
||
58 | * @var DataGrid |
||
59 | */ |
||
60 | protected $grid; |
||
61 | |||
62 | /** |
||
63 | * @var string |
||
64 | */ |
||
65 | protected $primary_where_column; |
||
66 | |||
67 | |||
68 | /** |
||
69 | * @param DataGrid $grid |
||
70 | * @param string $primary_where_column |
||
71 | */ |
||
72 | public function __construct(DataGrid $grid, $primary_where_column) |
||
77 | |||
78 | |||
79 | /** |
||
80 | * Render row item detail button |
||
81 | * @param Row $row |
||
82 | * @return Html |
||
83 | */ |
||
84 | public function renderButton($row) |
||
100 | |||
101 | |||
102 | /** |
||
103 | * Render item detail |
||
104 | * @param mixed $item |
||
105 | * @return mixed |
||
106 | */ |
||
107 | public function render($item) |
||
111 | |||
112 | |||
113 | /** |
||
114 | * Get primary column for where clause |
||
115 | * @return string |
||
116 | */ |
||
117 | public function getPrimaryWhereColumn() |
||
121 | |||
122 | |||
123 | /** |
||
124 | * Set attribute title |
||
125 | * @param string $title |
||
126 | */ |
||
127 | public function setTitle($title) |
||
133 | |||
134 | |||
135 | /** |
||
136 | * Get attribute title |
||
137 | * @return string |
||
138 | */ |
||
139 | public function getTitle() |
||
143 | |||
144 | |||
145 | /** |
||
146 | * Set attribute class |
||
147 | * @param string $class |
||
148 | */ |
||
149 | public function setClass($class) |
||
155 | |||
156 | |||
157 | /** |
||
158 | * Get attribute class |
||
159 | * @return string |
||
160 | */ |
||
161 | public function getClass() |
||
165 | |||
166 | |||
167 | /** |
||
168 | * Set icon |
||
169 | * @param string $icon |
||
170 | */ |
||
171 | public function setIcon($icon) |
||
177 | |||
178 | |||
179 | /** |
||
180 | * Get icon |
||
181 | * @return string |
||
182 | */ |
||
183 | public function getIcon() |
||
187 | |||
188 | |||
189 | /** |
||
190 | * Set text |
||
191 | * @param string $text |
||
192 | */ |
||
193 | public function setText($text) |
||
199 | |||
200 | |||
201 | /** |
||
202 | * Get text |
||
203 | * @return string |
||
204 | */ |
||
205 | public function getText() |
||
209 | |||
210 | |||
211 | /** |
||
212 | * Set item detail type |
||
213 | * @param string $type |
||
214 | */ |
||
215 | public function setType($type) |
||
221 | |||
222 | |||
223 | /** |
||
224 | * Get item detail type |
||
225 | * @return string |
||
226 | */ |
||
227 | public function getType() |
||
231 | |||
232 | |||
233 | /** |
||
234 | * Set item detail template |
||
235 | * @param string $template |
||
236 | */ |
||
237 | public function setTemplate($template) |
||
243 | |||
244 | |||
245 | /** |
||
246 | * Get item detail template |
||
247 | * @return string |
||
248 | */ |
||
249 | public function getTemplate() |
||
253 | |||
254 | |||
255 | /** |
||
256 | * Set item detail renderer |
||
257 | * @param callable $renderer |
||
258 | */ |
||
259 | public function setRenderer($renderer) |
||
265 | |||
266 | |||
267 | /** |
||
268 | * Get item detail renderer |
||
269 | * @return callable |
||
270 | */ |
||
271 | public function getRenderer() |
||
275 | |||
276 | } |
||
277 |