10 Yii::import(
'booster.widgets.input.TbInput');
29 echo CHtml::closeTag(
'div');
38 if (isset($this->labelOptions[
'class'])) {
39 $this->labelOptions[
'class'] .=
' control-label';
41 $this->labelOptions[
'class'] =
'control-label';
44 if (isset($this->htmlOptions[
'id'])) {
45 $this->labelOptions[
'for'] = $this->htmlOptions[
'id'];
57 $attribute = $this->attribute;
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);
66 echo
'</label></div>';
77 'model' => $this->model,
78 'attribute' => $this->attribute
80 if (isset($this->htmlOptions[
'options'])) {
81 $options = CMap::mergeArray($options, $this->htmlOptions[
'options']);
82 unset($this->htmlOptions[
'options']);
84 $options[
'htmlOptions'] = $this->htmlOptions;
87 echo
'<div class="controls">';
88 $this->widget(
'booster.widgets.TbToggleButton', $options);
100 echo
'<div class="controls">';
101 echo $this->form->checkBoxList($this->model, $this->attribute, $this->data, $this->htmlOptions);
112 $this->htmlOptions[
'inline'] =
true;
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) .
']'
131 if (isset($label_for)) {
132 $this->labelOptions = array(
'for' => $label_for);
135 $this->htmlOptions[
'class'] =
'pull-left';
138 echo
'<div class="controls">';
139 echo $this->form->checkBoxGroupsList($this->model, $this->attribute, $this->data, $this->htmlOptions);
151 echo
'<div class="controls">';
152 echo $this->form->dropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions);
164 echo
'<div class="controls">';
165 echo $this->form->fileField($this->model, $this->attribute, $this->htmlOptions);
177 echo
'<div class="controls">';
179 echo $this->form->passwordField($this->model, $this->attribute, $this->htmlOptions);
192 if (isset($this->htmlOptions[
'options'])) {
193 $options = $this->htmlOptions[
'options'];
194 unset($this->htmlOptions[
'options']);
197 if (isset($this->htmlOptions[
'events'])) {
198 $events = $this->htmlOptions[
'events'];
199 unset($this->htmlOptions[
'events']);
203 echo
'<div class="controls">';
206 'booster.widgets.TbPassfield',
208 'model' => $this->model,
209 'attribute' => $this->attribute,
210 'options' => isset($options) ? $options : array(),
211 'events' => isset($events) ? $events : array(),
212 'htmlOptions' => $this->htmlOptions,
226 $attribute = $this->attribute;
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;
234 echo $this->model->getAttributeLabel($attribute);
236 echo
'</label></div>';
246 echo
'<div class="controls"><span id="' . $this->
getAttributeId($this->attribute) .
'">';
247 echo $this->form->radioButtonList($this->model, $this->attribute, $this->data, $this->htmlOptions);
249 echo
'</span></div>';
258 $this->htmlOptions[
'inline'] =
true;
268 if (isset($this->htmlOptions[
'for']) && !empty($this->htmlOptions[
'for'])) {
269 $label_for = $this->htmlOptions[
'for'];
270 unset($this->htmlOptions[
'for']);
271 }
else if (isset($this->data) && !empty($this->data)) {
272 $label_for = CHtml::getIdByName(
273 get_class($this->model) .
'[' . $this->attribute .
'][' . key($this->data) .
']'
277 if (isset($label_for)) {
278 $this->labelOptions = array(
'for' => $label_for);
281 $this->htmlOptions[
'class'] =
'pull-left';
284 echo
'<div class="controls">';
285 echo $this->form->radioButtonGroupsList($this->model, $this->attribute, $this->data, $this->htmlOptions);
297 echo
'<div class="controls">';
298 echo $this->form->textArea($this->model, $this->attribute, $this->htmlOptions);
310 echo
'<div class="controls">';
312 echo $this->form->textField($this->model, $this->attribute, $this->htmlOptions);
325 echo
'<div class="controls">';
327 echo $this->form->maskedTextField($this->model, $this->attribute, $this->data, $this->htmlOptions);
340 echo
'<div class="controls"><div class="captcha">';
341 echo
'<div class="widget">' . $this->widget(
'CCaptcha', $this->captchaOptions,
true) .
'</div>';
342 echo $this->form->textField($this->model, $this->attribute, $this->htmlOptions);
354 echo
'<div class="controls">';
355 echo CHtml::tag(
'span', $this->htmlOptions, $this->model->{$this->attribute});
365 protected function datepickerField()
367 if (isset($this->htmlOptions[
'options'])) {
368 $options = $this->htmlOptions[
'options'];
369 unset($this->htmlOptions[
'options']);
372 if (isset($this->htmlOptions[
'events'])) {
373 $events = $this->htmlOptions[
'events'];
374 unset($this->htmlOptions[
'events']);
377 echo $this->getLabel();
378 echo
'<div class="controls">';
379 echo $this->getPrepend();
381 'booster.widgets.TbDatePicker',
383 'model' => $this->model,
384 'attribute' => $this->attribute,
385 'options' => isset($options) ? $options : array(),
386 'events' => isset($events) ? $events : array(),
387 'htmlOptions' => $this->htmlOptions,
390 echo $this->getAppend();
391 echo $this->getError() . $this->getHint();
400 protected function datetimepickerField()
402 if (isset($this->htmlOptions[
'options'])) {
403 $options = $this->htmlOptions[
'options'];
404 unset($this->htmlOptions[
'options']);
407 if (isset($this->htmlOptions[
'events'])) {
408 $events = $this->htmlOptions[
'events'];
409 unset($this->htmlOptions[
'events']);
412 echo $this->getLabel();
413 echo
'<div class="controls">';
414 echo $this->getPrepend();
416 'booster.widgets.TbDateTimePicker',
418 'model' => $this->model,
419 'attribute' => $this->attribute,
420 'options' => isset($options) ? $options : array(),
421 'events' => isset($events) ? $events : array(),
422 'htmlOptions' => $this->htmlOptions,
425 echo $this->getAppend();
426 echo $this->getError() . $this->getHint();
435 protected function colorpickerField()
438 if (isset($this->htmlOptions[
'format'])) {
439 $format = $this->htmlOptions[
'format'];
440 unset($this->htmlOptions[
'format']);
443 if (isset($this->htmlOptions[
'events'])) {
444 $events = $this->htmlOptions[
'events'];
445 unset($this->htmlOptions[
'events']);
448 echo $this->getLabel();
449 echo
'<div class="controls">';
450 echo $this->getPrepend();
452 'booster.widgets.TbColorPicker',
454 'model' => $this->model,
455 'attribute' => $this->attribute,
457 'events' => isset($events) ? $events : array(),
458 'htmlOptions' => $this->htmlOptions,
461 echo $this->getAppend();
462 echo $this->getError() . $this->getHint();
470 protected function redactorJs()
472 if (isset($this->htmlOptions[
'options'])) {
473 $options = $this->htmlOptions[
'options'];
474 unset($this->htmlOptions[
'options']);
476 if (isset($this->htmlOptions[
'width'])) {
477 $width = $this->htmlOptions[
'width'];
478 unset($this->htmlOptions[
'width']);
480 if (isset($this->htmlOptions[
'height'])) {
481 $height = $this->htmlOptions[
'height'];
482 unset($this->htmlOptions[
'height']);
484 echo $this->getLabel();
485 echo
'<div class="controls">';
487 'booster.widgets.TbRedactorJs',
489 'model' => $this->model,
490 'attribute' => $this->attribute,
491 'editorOptions' => isset($options) ? $options : array(),
492 'width' => isset($width) ? $width :
'100%',
493 'height' => isset($height) ? $height :
'400px',
494 'htmlOptions' => $this->htmlOptions
497 echo $this->getError() . $this->getHint();
505 protected function markdownEditorJs()
508 if (isset($this->htmlOptions[
'width'])) {
509 $width = $this->htmlOptions[
'width'];
510 unset($this->htmlOptions[
'width']);
512 if (isset($this->htmlOptions[
'height'])) {
513 $height = $this->htmlOptions[
'height'];
514 unset($this->htmlOptions[
'height']);
516 echo $this->getLabel();
517 echo
'<div class="controls">';
518 echo
'<div class="wmd-panel">';
519 echo
'<div id="wmd-button-bar" class="btn-toolbar"></div>';
521 'booster.widgets.TbMarkdownEditorJs',
523 'model' => $this->model,
524 'attribute' => $this->attribute,
525 'width' => isset($width) ? $width :
'100%',
526 'height' => isset($height) ? $height :
'400px',
527 'htmlOptions' => $this->htmlOptions
530 echo $this->getError() . $this->getHint();
531 echo
'<div id="wmd-preview" class="wmd-panel wmd-preview" style="width:' . (isset($width) ? $width
532 :
'100%') .
'"></div>';
541 protected function html5Editor()
543 if (isset($this->htmlOptions[
'options'])) {
544 $options = $this->htmlOptions[
'options'];
545 unset($this->htmlOptions[
'options']);
547 if (isset($this->htmlOptions[
'width'])) {
548 $width = $this->htmlOptions[
'width'];
549 unset($this->htmlOptions[
'width']);
551 if (isset($this->htmlOptions[
'height'])) {
552 $height = $this->htmlOptions[
'height'];
553 unset($this->htmlOptions[
'height']);
555 echo $this->getLabel();
556 echo
'<div class="controls">';
558 'booster.widgets.TbHtml5Editor',
560 'model' => $this->model,
561 'attribute' => $this->attribute,
562 'editorOptions' => isset($options) ? $options : array(),
563 'width' => isset($width) ? $width :
'100%',
564 'height' => isset($height) ? $height :
'400px',
565 'htmlOptions' => $this->htmlOptions
568 echo $this->getError() . $this->getHint();
577 protected function ckEditor()
579 if (isset($this->htmlOptions[
'options'])) {
580 $options = $this->htmlOptions[
'options'];
581 unset($this->htmlOptions[
'options']);
584 echo $this->getLabel();
585 echo
'<div class="controls">';
587 'booster.widgets.TbCKEditor',
589 'model' => $this->model,
590 'attribute' => $this->attribute,
591 'editorOptions' => isset($options) ? $options : array(),
592 'htmlOptions' => $this->htmlOptions
595 echo $this->getError() . $this->getHint();
604 protected function dateRangeField()
606 if (isset($this->htmlOptions[
'options'])) {
607 $options = $this->htmlOptions[
'options'];
608 unset($this->htmlOptions[
'options']);
611 if (isset($options[
'callback'])) {
612 $callback = $options[
'callback'];
613 unset($options[
'callback']);
616 echo $this->getLabel();
617 echo
'<div class="controls">';
618 echo $this->getPrepend();
620 'booster.widgets.TbDateRangePicker',
622 'model' => $this->model,
623 'attribute' => $this->attribute,
624 'options' => isset($options) ? $options : array(),
625 'callback' => isset($callback) ? $callback :
'',
626 'htmlOptions' => $this->htmlOptions,
629 echo $this->getAppend();
630 echo $this->getError() . $this->getHint();
639 protected function timepickerField()
641 if (isset($this->htmlOptions[
'options'])) {
642 $options = $this->htmlOptions[
'options'];
643 unset($this->htmlOptions[
'options']);
646 if (isset($this->htmlOptions[
'events'])) {
647 $events = $this->htmlOptions[
'events'];
648 unset($this->htmlOptions[
'events']);
651 echo $this->getLabel();
652 echo
'<div class="controls">';
653 echo $this->getPrepend();
655 'booster.widgets.TbTimePicker',
657 'model' => $this->model,
658 'attribute' => $this->attribute,
659 'options' => isset($options) ? $options : array(),
660 'events' => isset($events) ? $events : array(),
661 'htmlOptions' => $this->htmlOptions,
662 'form' => $this->form
665 echo $this->getAppend();
666 echo $this->getError() . $this->getHint();
674 protected function select2Field()
676 if (isset($this->htmlOptions[
'options'])) {
677 $options = $this->htmlOptions[
'options'];
678 unset($this->htmlOptions[
'options']);
681 if (isset($this->htmlOptions[
'events'])) {
682 $events = $this->htmlOptions[
'events'];
683 unset($this->htmlOptions[
'events']);
686 if (isset($this->htmlOptions[
'data'])) {
687 $data = $this->htmlOptions[
'data'];
688 unset($this->htmlOptions[
'data']);
691 if (isset($this->htmlOptions[
'asDropDownList'])) {
692 $asDropDownList = $this->htmlOptions[
'asDropDownList'];
693 unset($this->htmlOptions[
'asDropDownList']);
696 echo $this->getLabel();
697 echo
'<div class="controls">';
698 echo $this->getPrepend();
700 'booster.widgets.TbSelect2',
702 'model' => $this->model,
703 'attribute' => $this->attribute,
704 'options' => isset($options) ? $options : array(),
705 'events' => isset($events) ? $events : array(),
707 'asDropDownList' => isset($asDropDownList) ? $asDropDownList :
true,
708 'htmlOptions' => $this->htmlOptions,
709 'form' => $this->form
712 echo $this->getAppend();
713 echo $this->getError() . $this->getHint();
721 protected function typeAheadField()
723 echo $this->getLabel();
724 echo
'<div class="controls">';
725 echo $this->getPrepend();
726 echo $this->form->typeAheadField($this->model, $this->attribute, $this->data, $this->htmlOptions);
727 echo $this->getAppend();
728 echo $this->getError() . $this->getHint();
736 protected function numberField()
738 echo $this->getLabel();
739 echo
'<div class="controls">';
740 echo $this->getPrepend();
741 echo $this->form->numberField($this->model, $this->attribute, $this->htmlOptions);
742 echo $this->getAppend();
743 echo $this->getError() . $this->getHint();
751 protected function customField()
753 echo $this->getLabel();
754 echo
'<div class="controls">';
755 echo $this->getPrepend();
756 echo $this->htmlOptions[
'input'];
757 echo $this->getAppend();
758 echo $this->getError() . $this->getHint();