|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
*## TbInputHorizontal class file. |
|
4
|
|
|
* |
|
5
|
|
|
* @author Christoffer Niska <[email protected]> |
|
6
|
|
|
* @copyright Copyright © Christoffer Niska 2011- |
|
7
|
|
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
Yii::import('booster.widgets.input.TbInput'); |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
*## TbInputHorizontal class |
|
14
|
|
|
* |
|
15
|
|
|
* Bootstrap horizontal form input widget. |
|
16
|
|
|
* |
|
17
|
|
|
* @since 0.9.8 |
|
18
|
|
|
* @package booster.widgets.forms.inputs |
|
19
|
|
|
*/ |
|
20
|
|
|
class TbInputHorizontal extends TbInput |
|
21
|
|
|
{ |
|
22
|
|
|
/** |
|
23
|
|
|
* Runs the widget. |
|
24
|
|
|
*/ |
|
25
|
|
|
public function run() |
|
26
|
|
|
{ |
|
27
|
|
|
echo CHtml::openTag('div', array('class' => 'control-group ' . $this->getContainerCssClass())); |
|
28
|
|
|
parent::run(); |
|
29
|
|
|
echo CHtml::closeTag('div'); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Returns the label for this block. |
|
34
|
|
|
* @return string the label |
|
35
|
|
|
*/ |
|
36
|
|
|
protected function getLabel() |
|
37
|
|
|
{ |
|
38
|
|
|
if (isset($this->labelOptions['class'])) { |
|
39
|
|
|
$this->labelOptions['class'] .= ' control-label'; |
|
40
|
|
|
} else { |
|
41
|
|
|
$this->labelOptions['class'] = 'control-label'; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
if (isset($this->htmlOptions['id'])) { |
|
45
|
|
|
$this->labelOptions['for'] = $this->htmlOptions['id']; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
return parent::getLabel(); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Renders a checkbox. |
|
53
|
|
|
* @return string the rendered content |
|
54
|
|
|
*/ |
|
55
|
|
|
protected function checkBox() |
|
56
|
|
|
{ |
|
57
|
|
|
$attribute = $this->attribute; |
|
58
|
|
|
list($hidden, $checkbox) = $this->getSeparatedSelectableInput(); |
|
59
|
|
|
|
|
60
|
|
|
echo '<div class="controls">'; |
|
61
|
|
|
echo ($hidden) ? $hidden . PHP_EOL : ''; |
|
62
|
|
|
echo '<label class="checkbox" for="' . $this->getAttributeId($attribute) . '">'; |
|
63
|
|
|
echo $checkbox . PHP_EOL; |
|
64
|
|
|
echo $this->model->getAttributeLabel($attribute); |
|
65
|
|
|
echo $this->getError() . $this->getHint(); |
|
66
|
|
|
echo '</label></div>'; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Renders a toogle button |
|
71
|
|
|
* @return string the rendered content |
|
72
|
|
|
*/ |
|
73
|
|
|
protected function toggleButton() |
|
74
|
|
|
{ |
|
75
|
|
|
// widget configuration is set on htmlOptions['options'] |
|
76
|
|
|
$options = array( |
|
77
|
|
|
'model' => $this->model, |
|
78
|
|
|
'attribute' => $this->attribute |
|
79
|
|
|
); |
|
80
|
|
|
if (isset($this->htmlOptions['options'])) { |
|
81
|
|
|
$options = CMap::mergeArray($options, $this->htmlOptions['options']); |
|
82
|
|
|
unset($this->htmlOptions['options']); |
|
83
|
|
|
} |
|
84
|
|
|
$options['htmlOptions'] = $this->htmlOptions; |
|
85
|
|
|
|
|
86
|
|
|
echo $this->getLabel(); |
|
87
|
|
|
echo '<div class="controls">'; |
|
88
|
|
|
$this->widget('booster.widgets.TbToggleButton', $options); |
|
89
|
|
|
echo $this->getError() . $this->getHint(); |
|
90
|
|
|
echo '</div>'; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* Renders a list of checkboxes. |
|
95
|
|
|
* @return string the rendered content |
|
96
|
|
|
*/ |
|
97
|
|
|
protected function checkBoxList() |
|
98
|
|
|
{ |
|
99
|
|
|
echo $this->getLabel(); |
|
100
|
|
|
echo '<div class="controls">'; |
|
101
|
|
|
echo $this->form->checkBoxList($this->model, $this->attribute, $this->data, $this->htmlOptions); |
|
102
|
|
|
echo $this->getError() . $this->getHint(); |
|
103
|
|
|
echo '</div>'; |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* Renders a list of inline checkboxes. |
|
108
|
|
|
* @return string the rendered content |
|
109
|
|
|
*/ |
|
110
|
|
|
protected function checkBoxListInline() |
|
111
|
|
|
{ |
|
112
|
|
|
$this->htmlOptions['inline'] = true; |
|
113
|
|
|
$this->checkBoxList(); |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* Renders a list of checkboxes using Button Groups. |
|
118
|
|
|
* @return string the rendered content |
|
119
|
|
|
*/ |
|
120
|
|
|
protected function checkBoxGroupsList() |
|
121
|
|
|
{ |
|
122
|
|
|
if (isset($this->htmlOptions['for']) && !empty($this->htmlOptions['for'])) { |
|
123
|
|
|
$label_for = $this->htmlOptions['for']; |
|
124
|
|
|
unset($this->htmlOptions['for']); |
|
125
|
|
|
} else if (isset($this->data) && !empty($this->data)) { |
|
126
|
|
|
$label_for = CHtml::getIdByName( |
|
127
|
|
|
get_class($this->model) . '[' . $this->attribute . '][' . key($this->data) . ']' |
|
128
|
|
|
); |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
if (isset($label_for)) { |
|
132
|
|
|
$this->labelOptions = array('for' => $label_for); |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
$this->htmlOptions['class'] = 'pull-left'; |
|
136
|
|
|
|
|
137
|
|
|
echo $this->getLabel(); |
|
138
|
|
|
echo '<div class="controls">'; |
|
139
|
|
|
echo $this->form->checkBoxGroupsList($this->model, $this->attribute, $this->data, $this->htmlOptions); |
|
140
|
|
|
echo $this->getError() . $this->getHint(); |
|
141
|
|
|
echo '</div>'; |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
/** |
|
145
|
|
|
* Renders a drop down list (select). |
|
146
|
|
|
* @return string the rendered content |
|
147
|
|
|
*/ |
|
148
|
|
|
protected function dropDownList() |
|
149
|
|
|
{ |
|
150
|
|
|
echo $this->getLabel(); |
|
151
|
|
|
echo '<div class="controls">'; |
|
152
|
|
|
echo $this->form->dropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions); |
|
153
|
|
|
echo $this->getError() . $this->getHint(); |
|
154
|
|
|
echo '</div>'; |
|
155
|
|
|
} |
|
156
|
|
|
|
|
157
|
|
|
/** |
|
158
|
|
|
* Renders a file field. |
|
159
|
|
|
* @return string the rendered content |
|
160
|
|
|
*/ |
|
161
|
|
|
protected function fileField() |
|
162
|
|
|
{ |
|
163
|
|
|
echo $this->getLabel(); |
|
164
|
|
|
echo '<div class="controls">'; |
|
165
|
|
|
echo $this->form->fileField($this->model, $this->attribute, $this->htmlOptions); |
|
166
|
|
|
echo $this->getError() . $this->getHint(); |
|
167
|
|
|
echo '</div>'; |
|
168
|
|
|
} |
|
169
|
|
|
|
|
170
|
|
|
/** |
|
171
|
|
|
* Renders a password field. |
|
172
|
|
|
* @return string the rendered content |
|
173
|
|
|
*/ |
|
174
|
|
|
protected function passwordField() |
|
175
|
|
|
{ |
|
176
|
|
|
echo $this->getLabel(); |
|
177
|
|
|
echo '<div class="controls">'; |
|
178
|
|
|
echo $this->getPrepend(); |
|
179
|
|
|
echo $this->form->passwordField($this->model, $this->attribute, $this->htmlOptions); |
|
180
|
|
|
echo $this->getAppend(); |
|
181
|
|
|
echo $this->getError() . $this->getHint(); |
|
182
|
|
|
echo '</div>'; |
|
183
|
|
|
} |
|
184
|
|
|
|
|
185
|
|
|
/** |
|
186
|
|
|
* Renders a Pass*Field field. |
|
187
|
|
|
* @return string the rendered content |
|
188
|
|
|
* @author Hrumpa |
|
189
|
|
|
*/ |
|
190
|
|
|
protected function passfieldField() |
|
191
|
|
|
{ |
|
192
|
|
|
if (isset($this->htmlOptions['options'])) { |
|
193
|
|
|
$options = $this->htmlOptions['options']; |
|
194
|
|
|
unset($this->htmlOptions['options']); |
|
195
|
|
|
} |
|
196
|
|
|
|
|
197
|
|
|
if (isset($this->htmlOptions['events'])) { |
|
198
|
|
|
$events = $this->htmlOptions['events']; |
|
199
|
|
|
unset($this->htmlOptions['events']); |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
echo $this->getLabel(); |
|
203
|
|
|
echo '<div class="controls">'; |
|
204
|
|
|
echo $this->getPrepend(); |
|
205
|
|
|
$this->widget( |
|
206
|
|
|
'booster.widgets.TbPassfield', |
|
207
|
|
|
array( |
|
208
|
|
|
'model' => $this->model, |
|
209
|
|
|
'attribute' => $this->attribute, |
|
210
|
|
|
'options' => isset($options) ? $options : array(), |
|
211
|
|
|
'events' => isset($events) ? $events : array(), |
|
212
|
|
|
'htmlOptions' => $this->htmlOptions, |
|
213
|
|
|
) |
|
214
|
|
|
); |
|
215
|
|
|
echo $this->getAppend(); |
|
216
|
|
|
echo $this->getError() . $this->getHint(); |
|
217
|
|
|
echo '</div>'; |
|
218
|
|
|
} |
|
219
|
|
|
|
|
220
|
|
|
/** |
|
221
|
|
|
* Renders a radio button. |
|
222
|
|
|
* @return string the rendered content |
|
223
|
|
|
*/ |
|
224
|
|
|
protected function radioButton() |
|
225
|
|
|
{ |
|
226
|
|
|
$attribute = $this->attribute; |
|
227
|
|
|
list($hidden, $radioButton) = $this->getSeparatedSelectableInput(); |
|
228
|
|
|
|
|
229
|
|
|
echo '<div class="controls">'; |
|
230
|
|
|
echo ($hidden) ? $hidden . PHP_EOL : ''; |
|
231
|
|
|
echo '<label class="radio" for="' . $this->getAttributeId($attribute) . '">'; |
|
232
|
|
|
echo $radioButton . PHP_EOL; |
|
233
|
|
|
echo $this->model->getAttributeLabel($attribute); |
|
234
|
|
|
echo $this->getError() . $this->getHint(); |
|
235
|
|
|
echo '</label></div>'; |
|
236
|
|
|
} |
|
237
|
|
|
|
|
238
|
|
|
/** |
|
239
|
|
|
* Renders a list of radio buttons. |
|
240
|
|
|
* @return string the rendered content |
|
241
|
|
|
*/ |
|
242
|
|
|
protected function radioButtonList() |
|
243
|
|
|
{ |
|
244
|
|
|
echo $this->getLabel(); |
|
245
|
|
|
echo '<div class="controls"><span id="' . $this->getAttributeId($this->attribute) . '">'; |
|
246
|
|
|
echo $this->form->radioButtonList($this->model, $this->attribute, $this->data, $this->htmlOptions); |
|
247
|
|
|
echo $this->getError() . $this->getHint(); |
|
248
|
|
|
echo '</span></div>'; |
|
249
|
|
|
} |
|
250
|
|
|
|
|
251
|
|
|
/** |
|
252
|
|
|
* Renders a list of inline radio buttons. |
|
253
|
|
|
* @return string the rendered content |
|
254
|
|
|
*/ |
|
255
|
|
|
protected function radioButtonListInline() |
|
256
|
|
|
{ |
|
257
|
|
|
$this->htmlOptions['inline'] = true; |
|
258
|
|
|
$this->radioButtonList(); |
|
259
|
|
|
} |
|
260
|
|
|
|
|
261
|
|
|
/** |
|
262
|
|
|
* Renders a list of radio buttons using Button Groups. |
|
263
|
|
|
* @return string the rendered content |
|
264
|
|
|
*/ |
|
265
|
|
|
protected function radioButtonGroupsList() |
|
266
|
|
|
{ |
|
267
|
|
|
if (isset($this->htmlOptions['for']) && !empty($this->htmlOptions['for'])) { |
|
268
|
|
|
$label_for = $this->htmlOptions['for']; |
|
269
|
|
|
unset($this->htmlOptions['for']); |
|
270
|
|
|
} else if (isset($this->data) && !empty($this->data)) { |
|
271
|
|
|
$label_for = CHtml::getIdByName( |
|
272
|
|
|
get_class($this->model) . '[' . $this->attribute . '][' . key($this->data) . ']' |
|
273
|
|
|
); |
|
274
|
|
|
} |
|
275
|
|
|
|
|
276
|
|
|
if (isset($label_for)) { |
|
277
|
|
|
$this->labelOptions = array('for' => $label_for); |
|
278
|
|
|
} |
|
279
|
|
|
|
|
280
|
|
|
$this->htmlOptions['class'] = 'pull-left'; |
|
281
|
|
|
|
|
282
|
|
|
echo $this->getLabel(); |
|
283
|
|
|
echo '<div class="controls">'; |
|
284
|
|
|
echo $this->form->radioButtonGroupsList($this->model, $this->attribute, $this->data, $this->htmlOptions); |
|
285
|
|
|
echo $this->getError() . $this->getHint(); |
|
286
|
|
|
echo '</div>'; |
|
287
|
|
|
} |
|
288
|
|
|
|
|
289
|
|
|
/** |
|
290
|
|
|
* Renders a textarea. |
|
291
|
|
|
* @return string the rendered content |
|
292
|
|
|
*/ |
|
293
|
|
|
protected function textArea() |
|
294
|
|
|
{ |
|
295
|
|
|
echo $this->getLabel(); |
|
296
|
|
|
echo '<div class="controls">'; |
|
297
|
|
|
echo $this->form->textArea($this->model, $this->attribute, $this->htmlOptions); |
|
298
|
|
|
echo $this->getError() . $this->getHint(); |
|
299
|
|
|
echo '</div>'; |
|
300
|
|
|
} |
|
301
|
|
|
|
|
302
|
|
|
/** |
|
303
|
|
|
* Renders a text field. |
|
304
|
|
|
* @return string the rendered content |
|
305
|
|
|
*/ |
|
306
|
|
|
protected function textField() |
|
307
|
|
|
{ |
|
308
|
|
|
echo $this->getLabel(); |
|
309
|
|
|
echo '<div class="controls">'; |
|
310
|
|
|
echo $this->getPrepend(); |
|
311
|
|
|
echo $this->form->textField($this->model, $this->attribute, $this->htmlOptions); |
|
312
|
|
|
echo $this->getAppend(); |
|
313
|
|
|
echo $this->getError() . $this->getHint(); |
|
314
|
|
|
echo '</div>'; |
|
315
|
|
|
} |
|
316
|
|
|
|
|
317
|
|
|
/** |
|
318
|
|
|
* Renders a masked text field. |
|
319
|
|
|
* @return string the rendered content |
|
320
|
|
|
*/ |
|
321
|
|
|
protected function maskedTextField() |
|
322
|
|
|
{ |
|
323
|
|
|
echo $this->getLabel(); |
|
324
|
|
|
echo '<div class="controls">'; |
|
325
|
|
|
echo $this->getPrepend(); |
|
326
|
|
|
echo $this->form->maskedTextField($this->model, $this->attribute, $this->data, $this->htmlOptions); |
|
327
|
|
|
echo $this->getAppend(); |
|
328
|
|
|
echo $this->getError() . $this->getHint(); |
|
329
|
|
|
echo '</div>'; |
|
330
|
|
|
} |
|
331
|
|
|
|
|
332
|
|
|
/** |
|
333
|
|
|
* Renders a CAPTCHA. |
|
334
|
|
|
* @return string the rendered content |
|
335
|
|
|
*/ |
|
336
|
|
|
protected function captcha() |
|
337
|
|
|
{ |
|
338
|
|
|
echo $this->getLabel(); |
|
339
|
|
|
echo '<div class="controls"><div class="captcha">'; |
|
340
|
|
|
echo '<div class="widget">' . $this->widget('CCaptcha', $this->captchaOptions, true) . '</div>'; |
|
341
|
|
|
echo $this->form->textField($this->model, $this->attribute, $this->htmlOptions); |
|
342
|
|
|
echo $this->getError() . $this->getHint(); |
|
343
|
|
|
echo '</div></div>'; |
|
344
|
|
|
} |
|
345
|
|
|
|
|
346
|
|
|
/** |
|
347
|
|
|
* Renders an uneditable field. |
|
348
|
|
|
* @return string the rendered content |
|
349
|
|
|
*/ |
|
350
|
|
|
protected function uneditableField() |
|
351
|
|
|
{ |
|
352
|
|
|
echo $this->getLabel(); |
|
353
|
|
|
echo '<div class="controls">'; |
|
354
|
|
|
echo CHtml::tag('span', $this->htmlOptions, $this->model->{$this->attribute}); |
|
355
|
|
|
echo $this->getError() . $this->getHint(); |
|
356
|
|
|
echo '</div>'; |
|
357
|
|
|
} |
|
358
|
|
|
|
|
359
|
|
|
/** |
|
360
|
|
|
* Renders a datepicker field. |
|
361
|
|
|
* @return string the rendered content |
|
362
|
|
|
* @author antonio ramirez <[email protected]> |
|
363
|
|
|
*/ |
|
364
|
|
|
protected function datepickerField() |
|
365
|
|
|
{ |
|
366
|
|
|
if (isset($this->htmlOptions['options'])) { |
|
367
|
|
|
$options = $this->htmlOptions['options']; |
|
368
|
|
|
unset($this->htmlOptions['options']); |
|
369
|
|
|
} |
|
370
|
|
|
|
|
371
|
|
|
if (isset($this->htmlOptions['events'])) { |
|
372
|
|
|
$events = $this->htmlOptions['events']; |
|
373
|
|
|
unset($this->htmlOptions['events']); |
|
374
|
|
|
} |
|
375
|
|
|
|
|
376
|
|
|
echo $this->getLabel(); |
|
377
|
|
|
echo '<div class="controls">'; |
|
378
|
|
|
echo $this->getPrepend(); |
|
379
|
|
|
$this->widget( |
|
380
|
|
|
'booster.widgets.TbDatePicker', |
|
381
|
|
|
array( |
|
382
|
|
|
'model' => $this->model, |
|
383
|
|
|
'attribute' => $this->attribute, |
|
384
|
|
|
'options' => isset($options) ? $options : array(), |
|
385
|
|
|
'events' => isset($events) ? $events : array(), |
|
386
|
|
|
'htmlOptions' => $this->htmlOptions, |
|
387
|
|
|
) |
|
388
|
|
|
); |
|
389
|
|
|
echo $this->getAppend(); |
|
390
|
|
|
echo $this->getError() . $this->getHint(); |
|
391
|
|
|
echo '</div>'; |
|
392
|
|
|
} |
|
393
|
|
|
|
|
394
|
|
|
/** |
|
395
|
|
|
* Renders a datetimepicker field. |
|
396
|
|
|
* @return string the rendered content |
|
397
|
|
|
* @author Hrumpa |
|
398
|
|
|
*/ |
|
399
|
|
|
protected function datetimepickerField() |
|
400
|
|
|
{ |
|
401
|
|
|
if (isset($this->htmlOptions['options'])) { |
|
402
|
|
|
$options = $this->htmlOptions['options']; |
|
403
|
|
|
unset($this->htmlOptions['options']); |
|
404
|
|
|
} |
|
405
|
|
|
|
|
406
|
|
|
if (isset($this->htmlOptions['events'])) { |
|
407
|
|
|
$events = $this->htmlOptions['events']; |
|
408
|
|
|
unset($this->htmlOptions['events']); |
|
409
|
|
|
} |
|
410
|
|
|
|
|
411
|
|
|
echo $this->getLabel(); |
|
412
|
|
|
echo '<div class="controls">'; |
|
413
|
|
|
echo $this->getPrepend(); |
|
414
|
|
|
$this->widget( |
|
415
|
|
|
'booster.widgets.TbDateTimePicker', |
|
416
|
|
|
array( |
|
417
|
|
|
'model' => $this->model, |
|
418
|
|
|
'attribute' => $this->attribute, |
|
419
|
|
|
'options' => isset($options) ? $options : array(), |
|
420
|
|
|
'events' => isset($events) ? $events : array(), |
|
421
|
|
|
'htmlOptions' => $this->htmlOptions, |
|
422
|
|
|
) |
|
423
|
|
|
); |
|
424
|
|
|
echo $this->getAppend(); |
|
425
|
|
|
echo $this->getError() . $this->getHint(); |
|
426
|
|
|
echo '</div>'; |
|
427
|
|
|
} |
|
428
|
|
|
|
|
429
|
|
|
/** |
|
430
|
|
|
* Renders a colorpicker field. |
|
431
|
|
|
* @return string the rendered content |
|
432
|
|
|
* @author antonio ramirez <[email protected]> |
|
433
|
|
|
*/ |
|
434
|
|
|
protected function colorpickerField() |
|
435
|
|
|
{ |
|
436
|
|
|
$format = 'hex'; |
|
437
|
|
|
if (isset($this->htmlOptions['format'])) { |
|
438
|
|
|
$format = $this->htmlOptions['format']; |
|
439
|
|
|
unset($this->htmlOptions['format']); |
|
440
|
|
|
} |
|
441
|
|
|
|
|
442
|
|
|
if (isset($this->htmlOptions['events'])) { |
|
443
|
|
|
$events = $this->htmlOptions['events']; |
|
444
|
|
|
unset($this->htmlOptions['events']); |
|
445
|
|
|
} |
|
446
|
|
|
|
|
447
|
|
|
echo $this->getLabel(); |
|
448
|
|
|
echo '<div class="controls">'; |
|
449
|
|
|
echo $this->getPrepend(); |
|
450
|
|
|
$this->widget( |
|
451
|
|
|
'booster.widgets.TbColorPicker', |
|
452
|
|
|
array( |
|
453
|
|
|
'model' => $this->model, |
|
454
|
|
|
'attribute' => $this->attribute, |
|
455
|
|
|
'format' => $format, |
|
456
|
|
|
'events' => isset($events) ? $events : array(), |
|
457
|
|
|
'htmlOptions' => $this->htmlOptions, |
|
458
|
|
|
) |
|
459
|
|
|
); |
|
460
|
|
|
echo $this->getAppend(); |
|
461
|
|
|
echo $this->getError() . $this->getHint(); |
|
462
|
|
|
echo '</div>'; |
|
463
|
|
|
} |
|
464
|
|
|
|
|
465
|
|
|
/** |
|
466
|
|
|
* Renders a redactor. |
|
467
|
|
|
* @return string the rendered content |
|
468
|
|
|
*/ |
|
469
|
|
|
protected function redactorJs() |
|
470
|
|
|
{ |
|
471
|
|
|
if (isset($this->htmlOptions['options'])) { |
|
472
|
|
|
$options = $this->htmlOptions['options']; |
|
473
|
|
|
unset($this->htmlOptions['options']); |
|
474
|
|
|
} |
|
475
|
|
|
if (isset($this->htmlOptions['width'])) { |
|
476
|
|
|
$width = $this->htmlOptions['width']; |
|
477
|
|
|
unset($this->htmlOptions['width']); |
|
478
|
|
|
} |
|
479
|
|
|
if (isset($this->htmlOptions['height'])) { |
|
480
|
|
|
$height = $this->htmlOptions['height']; |
|
481
|
|
|
unset($this->htmlOptions['height']); |
|
482
|
|
|
} |
|
483
|
|
|
echo $this->getLabel(); |
|
484
|
|
|
echo '<div class="controls">'; |
|
485
|
|
|
$this->widget( |
|
486
|
|
|
'booster.widgets.TbRedactorJs', |
|
487
|
|
|
array( |
|
488
|
|
|
'model' => $this->model, |
|
489
|
|
|
'attribute' => $this->attribute, |
|
490
|
|
|
'editorOptions' => isset($options) ? $options : array(), |
|
491
|
|
|
'width' => isset($width) ? $width : '100%', |
|
492
|
|
|
'height' => isset($height) ? $height : '400px', |
|
493
|
|
|
'htmlOptions' => $this->htmlOptions |
|
494
|
|
|
) |
|
495
|
|
|
); |
|
496
|
|
|
echo $this->getError() . $this->getHint(); |
|
497
|
|
|
echo '</div>'; |
|
498
|
|
|
} |
|
499
|
|
|
|
|
500
|
|
|
/** |
|
501
|
|
|
* Renders a Markdown Editor. |
|
502
|
|
|
* @return string the rendered content |
|
503
|
|
|
*/ |
|
504
|
|
|
protected function markdownEditorJs() |
|
505
|
|
|
{ |
|
506
|
|
|
|
|
507
|
|
|
if (isset($this->htmlOptions['width'])) { |
|
508
|
|
|
$width = $this->htmlOptions['width']; |
|
509
|
|
|
unset($this->htmlOptions['width']); |
|
510
|
|
|
} |
|
511
|
|
|
if (isset($this->htmlOptions['height'])) { |
|
512
|
|
|
$height = $this->htmlOptions['height']; |
|
513
|
|
|
unset($this->htmlOptions['height']); |
|
514
|
|
|
} |
|
515
|
|
|
echo $this->getLabel(); |
|
516
|
|
|
echo '<div class="controls">'; |
|
517
|
|
|
echo '<div class="wmd-panel">'; |
|
518
|
|
|
echo '<div id="wmd-button-bar" class="btn-toolbar"></div>'; |
|
519
|
|
|
$this->widget( |
|
520
|
|
|
'booster.widgets.TbMarkdownEditorJs', |
|
521
|
|
|
array( |
|
522
|
|
|
'model' => $this->model, |
|
523
|
|
|
'attribute' => $this->attribute, |
|
524
|
|
|
'width' => isset($width) ? $width : '100%', |
|
525
|
|
|
'height' => isset($height) ? $height : '400px', |
|
526
|
|
|
'htmlOptions' => $this->htmlOptions |
|
527
|
|
|
) |
|
528
|
|
|
); |
|
529
|
|
|
echo $this->getError() . $this->getHint(); |
|
530
|
|
|
echo '<div id="wmd-preview" class="wmd-panel wmd-preview" style="width:' . (isset($width) ? $width |
|
531
|
|
|
: '100%') . '"></div>'; |
|
532
|
|
|
echo '</div>'; // wmd-panel |
|
533
|
|
|
echo '</div>'; // controls |
|
534
|
|
|
} |
|
535
|
|
|
|
|
536
|
|
|
/** |
|
537
|
|
|
* Renders Bootstrap wysihtml5 editor. |
|
538
|
|
|
* @return mixed|void |
|
539
|
|
|
*/ |
|
540
|
|
|
protected function html5Editor() |
|
541
|
|
|
{ |
|
542
|
|
|
if (isset($this->htmlOptions['options'])) { |
|
543
|
|
|
$options = $this->htmlOptions['options']; |
|
544
|
|
|
unset($this->htmlOptions['options']); |
|
545
|
|
|
} |
|
546
|
|
|
if (isset($this->htmlOptions['width'])) { |
|
547
|
|
|
$width = $this->htmlOptions['width']; |
|
548
|
|
|
unset($this->htmlOptions['width']); |
|
549
|
|
|
} |
|
550
|
|
|
if (isset($this->htmlOptions['height'])) { |
|
551
|
|
|
$height = $this->htmlOptions['height']; |
|
552
|
|
|
unset($this->htmlOptions['height']); |
|
553
|
|
|
} |
|
554
|
|
|
echo $this->getLabel(); |
|
555
|
|
|
echo '<div class="controls">'; |
|
556
|
|
|
$this->widget( |
|
557
|
|
|
'booster.widgets.TbHtml5Editor', |
|
558
|
|
|
array( |
|
559
|
|
|
'model' => $this->model, |
|
560
|
|
|
'attribute' => $this->attribute, |
|
561
|
|
|
'editorOptions' => isset($options) ? $options : array(), |
|
562
|
|
|
'width' => isset($width) ? $width : '100%', |
|
563
|
|
|
'height' => isset($height) ? $height : '400px', |
|
564
|
|
|
'htmlOptions' => $this->htmlOptions |
|
565
|
|
|
) |
|
566
|
|
|
); |
|
567
|
|
|
echo $this->getError() . $this->getHint(); |
|
568
|
|
|
echo '</div>'; |
|
569
|
|
|
} |
|
570
|
|
|
|
|
571
|
|
|
/** |
|
572
|
|
|
* Renders a ckEditor. |
|
573
|
|
|
* @return string the rendered content |
|
574
|
|
|
* @author antonio ramirez <[email protected]> |
|
575
|
|
|
*/ |
|
576
|
|
|
protected function ckEditor() |
|
577
|
|
|
{ |
|
578
|
|
|
if (isset($this->htmlOptions['options'])) { |
|
579
|
|
|
$options = $this->htmlOptions['options']; |
|
580
|
|
|
unset($this->htmlOptions['options']); |
|
581
|
|
|
} |
|
582
|
|
|
|
|
583
|
|
|
echo $this->getLabel(); |
|
584
|
|
|
echo '<div class="controls">'; |
|
585
|
|
|
$this->widget( |
|
586
|
|
|
'booster.widgets.TbCKEditor', |
|
587
|
|
|
array( |
|
588
|
|
|
'model' => $this->model, |
|
589
|
|
|
'attribute' => $this->attribute, |
|
590
|
|
|
'editorOptions' => isset($options) ? $options : array(), |
|
591
|
|
|
'htmlOptions' => $this->htmlOptions |
|
592
|
|
|
) |
|
593
|
|
|
); |
|
594
|
|
|
echo $this->getError() . $this->getHint(); |
|
595
|
|
|
echo '</div>'; |
|
596
|
|
|
} |
|
597
|
|
|
|
|
598
|
|
|
/** |
|
599
|
|
|
* Renders a daterange field. |
|
600
|
|
|
* @return string the rendered content |
|
601
|
|
|
* @author antonio ramirez <[email protected]> |
|
602
|
|
|
*/ |
|
603
|
|
|
protected function dateRangeField() |
|
604
|
|
|
{ |
|
605
|
|
|
if (isset($this->htmlOptions['options'])) { |
|
606
|
|
|
$options = $this->htmlOptions['options']; |
|
607
|
|
|
unset($this->htmlOptions['options']); |
|
608
|
|
|
} |
|
609
|
|
|
|
|
610
|
|
|
if (isset($options['callback'])) { |
|
611
|
|
|
$callback = $options['callback']; |
|
612
|
|
|
unset($options['callback']); |
|
613
|
|
|
} |
|
614
|
|
|
|
|
615
|
|
|
echo $this->getLabel(); |
|
616
|
|
|
echo '<div class="controls">'; |
|
617
|
|
|
echo $this->getPrepend(); |
|
618
|
|
|
$this->widget( |
|
619
|
|
|
'booster.widgets.TbDateRangePicker', |
|
620
|
|
|
array( |
|
621
|
|
|
'model' => $this->model, |
|
622
|
|
|
'attribute' => $this->attribute, |
|
623
|
|
|
'options' => isset($options) ? $options : array(), |
|
624
|
|
|
'callback' => isset($callback) ? $callback : '', |
|
625
|
|
|
'htmlOptions' => $this->htmlOptions, |
|
626
|
|
|
) |
|
627
|
|
|
); |
|
628
|
|
|
echo $this->getAppend(); |
|
629
|
|
|
echo $this->getError() . $this->getHint(); |
|
630
|
|
|
echo '</div>'; |
|
631
|
|
|
} |
|
632
|
|
|
|
|
633
|
|
|
/** |
|
634
|
|
|
* Renders a timepicker field. |
|
635
|
|
|
* @return string the rendered content |
|
636
|
|
|
* @author Sergii Gamaiunov <[email protected]> |
|
637
|
|
|
*/ |
|
638
|
|
|
protected function timepickerField() |
|
639
|
|
|
{ |
|
640
|
|
|
if (isset($this->htmlOptions['options'])) { |
|
641
|
|
|
$options = $this->htmlOptions['options']; |
|
642
|
|
|
unset($this->htmlOptions['options']); |
|
643
|
|
|
} |
|
644
|
|
|
|
|
645
|
|
|
if (isset($this->htmlOptions['events'])) { |
|
646
|
|
|
$events = $this->htmlOptions['events']; |
|
647
|
|
|
unset($this->htmlOptions['events']); |
|
648
|
|
|
} |
|
649
|
|
|
|
|
650
|
|
|
echo $this->getLabel(); |
|
651
|
|
|
echo '<div class="controls">'; |
|
652
|
|
|
echo $this->getPrepend(); |
|
653
|
|
|
$this->widget( |
|
654
|
|
|
'booster.widgets.TbTimePicker', |
|
655
|
|
|
array( |
|
656
|
|
|
'model' => $this->model, |
|
657
|
|
|
'attribute' => $this->attribute, |
|
658
|
|
|
'options' => isset($options) ? $options : array(), |
|
659
|
|
|
'events' => isset($events) ? $events : array(), |
|
660
|
|
|
'htmlOptions' => $this->htmlOptions, |
|
661
|
|
|
'form' => $this->form |
|
662
|
|
|
) |
|
663
|
|
|
); |
|
664
|
|
|
echo $this->getAppend(); |
|
665
|
|
|
echo $this->getError() . $this->getHint(); |
|
666
|
|
|
echo '</div>'; |
|
667
|
|
|
} |
|
668
|
|
|
|
|
669
|
|
|
/** |
|
670
|
|
|
* Renders a select2Field |
|
671
|
|
|
* @return mixed|void |
|
672
|
|
|
*/ |
|
673
|
|
|
protected function select2Field() |
|
674
|
|
|
{ |
|
675
|
|
|
if (isset($this->htmlOptions['options'])) { |
|
676
|
|
|
$options = $this->htmlOptions['options']; |
|
677
|
|
|
unset($this->htmlOptions['options']); |
|
678
|
|
|
} |
|
679
|
|
|
|
|
680
|
|
|
if (isset($this->htmlOptions['events'])) { |
|
681
|
|
|
$events = $this->htmlOptions['events']; |
|
682
|
|
|
unset($this->htmlOptions['events']); |
|
683
|
|
|
} |
|
684
|
|
|
|
|
685
|
|
|
if (isset($this->htmlOptions['data'])) { |
|
686
|
|
|
$data = $this->htmlOptions['data']; |
|
687
|
|
|
unset($this->htmlOptions['data']); |
|
688
|
|
|
} |
|
689
|
|
|
|
|
690
|
|
|
if (isset($this->htmlOptions['asDropDownList'])) { |
|
691
|
|
|
$asDropDownList = $this->htmlOptions['asDropDownList']; |
|
692
|
|
|
unset($this->htmlOptions['asDropDownList']); |
|
693
|
|
|
} |
|
694
|
|
|
|
|
695
|
|
|
echo $this->getLabel(); |
|
696
|
|
|
echo '<div class="controls">'; |
|
697
|
|
|
echo $this->getPrepend(); |
|
698
|
|
|
$this->widget( |
|
699
|
|
|
'booster.widgets.TbSelect2', |
|
700
|
|
|
array( |
|
701
|
|
|
'model' => $this->model, |
|
702
|
|
|
'attribute' => $this->attribute, |
|
703
|
|
|
'options' => isset($options) ? $options : array(), |
|
704
|
|
|
'events' => isset($events) ? $events : array(), |
|
705
|
|
|
'data' => isset($data) ? $data : array(), |
|
706
|
|
|
'asDropDownList' => isset($asDropDownList) ? $asDropDownList : true, |
|
707
|
|
|
'htmlOptions' => $this->htmlOptions, |
|
708
|
|
|
'form' => $this->form |
|
709
|
|
|
) |
|
710
|
|
|
); |
|
711
|
|
|
echo $this->getAppend(); |
|
712
|
|
|
echo $this->getError() . $this->getHint(); |
|
713
|
|
|
echo '</div>'; |
|
714
|
|
|
} |
|
715
|
|
|
|
|
716
|
|
|
/** |
|
717
|
|
|
* Renders a typeAhead field. |
|
718
|
|
|
* @return string the rendered content |
|
719
|
|
|
*/ |
|
720
|
|
|
protected function typeAheadField() |
|
721
|
|
|
{ |
|
722
|
|
|
echo $this->getLabel(); |
|
723
|
|
|
echo '<div class="controls">'; |
|
724
|
|
|
echo $this->getPrepend(); |
|
725
|
|
|
echo $this->form->typeAheadField($this->model, $this->attribute, $this->data, $this->htmlOptions); |
|
726
|
|
|
echo $this->getAppend(); |
|
727
|
|
|
echo $this->getError() . $this->getHint(); |
|
728
|
|
|
echo '</div>'; |
|
729
|
|
|
} |
|
730
|
|
|
|
|
731
|
|
|
/** |
|
732
|
|
|
* Renders a number field. |
|
733
|
|
|
* @return string the rendered content |
|
734
|
|
|
*/ |
|
735
|
|
|
protected function numberField() |
|
736
|
|
|
{ |
|
737
|
|
|
echo $this->getLabel(); |
|
738
|
|
|
echo '<div class="controls">'; |
|
739
|
|
|
echo $this->getPrepend(); |
|
740
|
|
|
echo $this->form->numberField($this->model, $this->attribute, $this->htmlOptions); |
|
741
|
|
|
echo $this->getAppend(); |
|
742
|
|
|
echo $this->getError() . $this->getHint(); |
|
743
|
|
|
echo '</div>'; |
|
744
|
|
|
} |
|
745
|
|
|
|
|
746
|
|
|
/** |
|
747
|
|
|
* Renders a pre-rendered custom field. |
|
748
|
|
|
* @return string the rendered content |
|
749
|
|
|
*/ |
|
750
|
|
|
protected function customField() |
|
751
|
|
|
{ |
|
752
|
|
|
echo $this->getLabel(); |
|
753
|
|
|
echo '<div class="controls">'; |
|
754
|
|
|
echo $this->getPrepend(); |
|
755
|
|
|
echo $this->htmlOptions['input']; |
|
756
|
|
|
echo $this->getAppend(); |
|
757
|
|
|
echo $this->getError() . $this->getHint(); |
|
758
|
|
|
echo '</div>'; |
|
759
|
|
|
} |
|
760
|
|
|
|
|
761
|
|
|
} |
|
762
|
|
|
|