1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use Arcanesoft\Core\Helpers\UI\Button; |
4
|
|
|
use Arcanesoft\Core\Helpers\UI\Label; |
5
|
|
|
use Arcanesoft\Core\Helpers\UI\Link; |
6
|
|
|
|
7
|
|
|
/* ----------------------------------------------------------------- |
8
|
|
|
| Buttons |
9
|
|
|
| ----------------------------------------------------------------- |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
if ( ! function_exists('ui_button')) { |
13
|
|
|
/** |
14
|
|
|
* Generate a link. |
15
|
|
|
* |
16
|
|
|
* @param string $action |
17
|
|
|
* @param string $type |
18
|
|
|
* @param array $attributes |
19
|
|
|
* @param bool $disabled |
20
|
|
|
* |
21
|
|
|
* @return \Arcanesoft\Core\Helpers\UI\Button |
22
|
|
|
*/ |
23
|
|
|
function ui_button($action, $type = 'button', array $attributes = [], $disabled = false) { |
24
|
|
|
return Button::make($action, $type, $attributes, $disabled) |
25
|
|
|
->size('sm'); |
26
|
|
|
} |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
if ( ! function_exists('ui_button_icon')) { |
30
|
|
|
/** |
31
|
|
|
* Generate a small icon link. |
32
|
|
|
* |
33
|
|
|
* @param string $action |
34
|
|
|
* @param string $type |
35
|
|
|
* @param array $attributes |
36
|
|
|
* @param bool $disabled |
37
|
|
|
* |
38
|
|
|
* @return \Arcanesoft\Core\Helpers\UI\Button |
39
|
|
|
*/ |
40
|
|
|
function ui_button_icon($action, $type = 'button', array $attributes = [], $disabled = false) { |
41
|
|
|
return Button::make($action, $type, $attributes, $disabled) |
42
|
|
|
->withTooltip(true) |
43
|
|
|
->size('xs'); |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/* ----------------------------------------------------------------- |
48
|
|
|
| Labels |
49
|
|
|
| ----------------------------------------------------------------- |
50
|
|
|
*/ |
51
|
|
|
|
52
|
|
|
if ( ! function_exists('label_active_icon')) { |
53
|
|
|
/** |
54
|
|
|
* Generate active icon label. |
55
|
|
|
* |
56
|
|
|
* @param bool $active |
57
|
|
|
* @param array $options |
58
|
|
|
* @param bool $withTooltip |
59
|
|
|
* |
60
|
|
|
* @return \Illuminate\Support\HtmlString |
61
|
|
|
*/ |
62
|
|
|
function label_active_icon($active, array $options = [], $withTooltip = true) { |
63
|
|
|
return Label::activeIcon($active, $options, $withTooltip); |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
if ( ! function_exists('label_active_status')) { |
68
|
|
|
/** |
69
|
|
|
* Generate active status label. |
70
|
|
|
* |
71
|
|
|
* @param bool $active |
72
|
|
|
* @param array $options |
73
|
|
|
* @param bool $withIcon |
74
|
|
|
* |
75
|
|
|
* @return \Illuminate\Support\HtmlString |
76
|
|
|
*/ |
77
|
|
|
function label_active_status($active, array $options = [], $withIcon = true) { |
78
|
|
|
return Label::activeStatus($active, $options, $withIcon); |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
if ( ! function_exists('label_check_icon')) { |
83
|
|
|
/** |
84
|
|
|
* Generate check icon label. |
85
|
|
|
* |
86
|
|
|
* @param bool $checked |
87
|
|
|
* @param array $options |
88
|
|
|
* @param bool $withTooltip |
89
|
|
|
* |
90
|
|
|
* @return \Illuminate\Support\HtmlString |
91
|
|
|
*/ |
92
|
|
|
function label_check_icon($checked, array $options = [], $withTooltip = true) { |
93
|
|
|
return Label::checkIcon($checked, $options, $withTooltip); |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
if ( ! function_exists('label_check_status')) { |
98
|
|
|
/** |
99
|
|
|
* Generate check status label. |
100
|
|
|
* |
101
|
|
|
* @param bool $checked |
102
|
|
|
* @param array $options |
103
|
|
|
* @param bool $withIcon |
104
|
|
|
* |
105
|
|
|
* @return \Illuminate\Support\HtmlString |
106
|
|
|
*/ |
107
|
|
|
function label_check_status($checked, array $options = [], $withIcon = true) { |
108
|
|
|
return Label::checkStatus($checked, $options, $withIcon); |
109
|
|
|
} |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
if ( ! function_exists('label_count')) { |
113
|
|
|
/** |
114
|
|
|
* Generate count label. |
115
|
|
|
* |
116
|
|
|
* @param int|float $count |
117
|
|
|
* @param array $options |
118
|
|
|
* |
119
|
|
|
* @return Illuminate\Support\HtmlString |
120
|
|
|
*/ |
121
|
|
|
function label_count($count, array $options = []) { |
122
|
|
|
return Label::count($count, $options); |
123
|
|
|
} |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
if ( ! function_exists('label_locked_icon')) { |
127
|
|
|
/** |
128
|
|
|
* Generate locked icon label. |
129
|
|
|
* |
130
|
|
|
* @param bool $locked |
131
|
|
|
* @param array $options |
132
|
|
|
* @param bool $withTooltip |
133
|
|
|
* |
134
|
|
|
* @return \Illuminate\Support\HtmlString |
135
|
|
|
*/ |
136
|
|
|
function label_locked_icon($locked, array $options = [], $withTooltip = true) { |
137
|
|
|
return Label::lockedIcon($locked, $options, $withTooltip); |
138
|
|
|
} |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
if ( ! function_exists('label_locked_status')) { |
142
|
|
|
/** |
143
|
|
|
* Generate locked status label. |
144
|
|
|
* |
145
|
|
|
* @param bool $locked |
146
|
|
|
* @param array $options |
147
|
|
|
* @param bool $withIcon |
148
|
|
|
* |
149
|
|
|
* @return \Illuminate\Support\HtmlString |
150
|
|
|
*/ |
151
|
|
|
function label_locked_status($locked, array $options = [], $withIcon = true) { |
152
|
|
|
return Label::lockedStatus($locked, $options, $withIcon); |
153
|
|
|
} |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
if ( ! function_exists('label_trashed_status')) { |
157
|
|
|
/** |
158
|
|
|
* Generate trashed status label. |
159
|
|
|
* |
160
|
|
|
* @param array $options |
161
|
|
|
* @param bool $withIcon |
162
|
|
|
* |
163
|
|
|
* @return \Illuminate\Support\HtmlString |
164
|
|
|
*/ |
165
|
|
|
function label_trashed_status(array $options = [], $withIcon = true) { |
166
|
|
|
return Label::trashedStatus($options, $withIcon); |
167
|
|
|
} |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/* ----------------------------------------------------------------- |
171
|
|
|
| Links |
172
|
|
|
| ----------------------------------------------------------------- |
173
|
|
|
*/ |
174
|
|
|
|
175
|
|
|
if ( ! function_exists('ui_link')) { |
176
|
|
|
/** |
177
|
|
|
* Generate a link. |
178
|
|
|
* |
179
|
|
|
* @param string $action |
180
|
|
|
* @param string $url |
181
|
|
|
* @param array $attributes |
182
|
|
|
* @param bool $disabled |
183
|
|
|
* |
184
|
|
|
* @return \Arcanesoft\Core\Helpers\UI\Link |
185
|
|
|
*/ |
186
|
|
|
function ui_link($action, $url, array $attributes = [], $disabled = false) { |
187
|
|
|
return Link::make($action, $url, $attributes, $disabled)->size('sm'); |
188
|
|
|
} |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
if ( ! function_exists('ui_link_icon')) { |
192
|
|
|
/** |
193
|
|
|
* Generate a small icon link. |
194
|
|
|
* |
195
|
|
|
* @param string $action |
196
|
|
|
* @param string $url |
197
|
|
|
* @param array $attributes |
198
|
|
|
* @param bool $disabled |
199
|
|
|
* |
200
|
|
|
* @return \Arcanesoft\Core\Helpers\UI\Link |
201
|
|
|
*/ |
202
|
|
|
function ui_link_icon($action, $url, array $attributes = [], $disabled = false) { |
203
|
|
|
return Link::make($action, $url, $attributes, $disabled) |
204
|
|
|
->withTooltip(true) |
205
|
|
|
->size('xs'); |
206
|
|
|
} |
207
|
|
|
} |
208
|
|
|
|