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