1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @copyright Copyright (c) 2015 ublaboo <[email protected]> |
5
|
|
|
* @author Pavel Janda <[email protected]> |
6
|
|
|
* @package Ublaboo |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace Ublaboo\DataGrid\Status; |
10
|
|
|
|
11
|
|
|
use Nette; |
12
|
|
|
use Ublaboo\DataGrid\Column\ColumnStatus; |
13
|
|
|
|
14
|
|
|
class Option extends Nette\Object |
15
|
1 |
|
{ |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @var ColumnStatus |
19
|
|
|
*/ |
20
|
|
|
protected $columnStatus; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var mixed |
24
|
|
|
*/ |
25
|
|
|
protected $value; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var string |
29
|
|
|
*/ |
30
|
|
|
protected $text; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var string|callable |
34
|
|
|
*/ |
35
|
|
|
protected $title; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var string|callable |
39
|
|
|
*/ |
40
|
|
|
protected $class = 'btn-success'; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var string |
44
|
|
|
*/ |
45
|
|
|
protected $class_secondary = 'btn btn-xs'; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var string |
49
|
|
|
*/ |
50
|
|
|
protected $class_in_dropdown = 'ajax'; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var string |
54
|
|
|
*/ |
55
|
|
|
protected $icon; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var string |
59
|
|
|
*/ |
60
|
|
|
protected $icon_secondary; |
61
|
|
|
|
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* [__construct description] |
65
|
|
|
* @param ColumnStatus $columnStatus |
66
|
|
|
* @param mixed $value |
67
|
|
|
* @param string $text |
68
|
|
|
*/ |
69
|
|
|
public function __construct(ColumnStatus $columnStatus, $value, $text) |
70
|
|
|
{ |
71
|
1 |
|
$this->columnStatus = $columnStatus; |
72
|
1 |
|
$this->value = $value; |
73
|
1 |
|
$this->text = (string) $text; |
74
|
1 |
|
} |
75
|
|
|
|
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @return mixed |
79
|
|
|
*/ |
80
|
|
|
public function getValue() |
81
|
|
|
{ |
82
|
1 |
|
return $this->value; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* End option fluent interface and return parent |
88
|
|
|
* @return ColumnStatus |
89
|
|
|
*/ |
90
|
|
|
public function endOption() |
91
|
|
|
{ |
92
|
1 |
|
return $this->columnStatus; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @param string $title |
98
|
|
|
* @return static |
99
|
|
|
*/ |
100
|
|
|
public function setTitle($title) |
101
|
|
|
{ |
102
|
|
|
$this->title = (string) $title; |
103
|
|
|
|
104
|
|
|
return $this; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @return string |
110
|
|
|
*/ |
111
|
|
|
public function getTitle() |
112
|
|
|
{ |
113
|
|
|
return $this->title; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @param string $class |
119
|
|
|
* @param string $class_secondary |
120
|
|
|
* @return static |
121
|
|
|
*/ |
122
|
|
|
public function setClass($class, $class_secondary = NULL) |
123
|
|
|
{ |
124
|
1 |
|
$this->class = (string) $class; |
125
|
|
|
|
126
|
1 |
|
if ($class_secondary !== NULL) { |
127
|
|
|
$this->class_secondary = (string) $class_secondary; |
128
|
|
|
} |
129
|
|
|
|
130
|
1 |
|
return $this; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @return string |
136
|
|
|
*/ |
137
|
|
|
public function getClass() |
138
|
|
|
{ |
139
|
|
|
return $this->class; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @param string $class_secondary |
145
|
|
|
* @return static |
146
|
|
|
*/ |
147
|
|
|
public function setClassSecondary($class_secondary) |
148
|
|
|
{ |
149
|
|
|
$this->class_secondary = (string) $class_secondary; |
150
|
|
|
|
151
|
|
|
return $this; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @return string |
157
|
|
|
*/ |
158
|
|
|
public function getClassSecondary() |
159
|
|
|
{ |
160
|
|
|
return $this->class_secondary; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* @param string $class_in_dropdown |
166
|
|
|
* @return static |
167
|
|
|
*/ |
168
|
|
|
public function setClassInDropdown($class_in_dropdown) |
169
|
|
|
{ |
170
|
|
|
$this->class_in_dropdown = (string) $class_in_dropdown; |
171
|
|
|
|
172
|
|
|
return $this; |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* @return string |
178
|
|
|
*/ |
179
|
|
|
public function getClassInDropdown() |
180
|
|
|
{ |
181
|
|
|
return $this->class_in_dropdown; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* @param string $icon |
187
|
|
|
* @return static |
188
|
|
|
*/ |
189
|
|
|
public function setIcon($icon) |
190
|
|
|
{ |
191
|
1 |
|
$this->icon = (string) $icon; |
192
|
|
|
|
193
|
1 |
|
return $this; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* @return string|NULL |
199
|
|
|
*/ |
200
|
|
|
public function getIcon() |
201
|
|
|
{ |
202
|
|
|
return $this->icon; |
203
|
|
|
} |
204
|
|
|
|
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* @param string $icon_secondary |
208
|
|
|
*/ |
209
|
|
|
public function setIconSecondary($icon_secondary) |
210
|
|
|
{ |
211
|
|
|
$this->icon_secondary = (string) $icon_secondary; |
212
|
|
|
|
213
|
|
|
return $this; |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
|
217
|
|
|
/** |
218
|
|
|
* @return string|NULL |
219
|
|
|
*/ |
220
|
|
|
public function getIconSecondary() |
221
|
|
|
{ |
222
|
|
|
return $this->icon_secondary; |
223
|
|
|
} |
224
|
|
|
|
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* @return string |
228
|
|
|
*/ |
229
|
|
|
public function getText() |
230
|
|
|
{ |
231
|
|
|
return $this->text; |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
} |
235
|
|
|
|