11 Yii::import(
'booster.widgets.input.TbInput');
29 $attribute = $this->attribute;
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);
48 'model' => $this->model,
49 'attribute' => $this->attribute
51 if (isset($this->htmlOptions[
'options'])) {
52 $options = CMap::mergeArray($options, $this->htmlOptions[
'options']);
53 unset($this->htmlOptions[
'options']);
55 $options[
'htmlOptions'] = $this->htmlOptions;
58 $this->widget(
'booster.widgets.TbToggleButton', $options);
69 echo $this->form->checkBoxList($this->model, $this->attribute, $this->data, $this->htmlOptions);
79 $this->htmlOptions[
'inline'] =
true;
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) .
']'
98 if (isset($label_for)) {
99 $this->labelOptions = array(
'for' => $label_for);
103 echo $this->form->checkBoxGroupsList($this->model, $this->attribute, $this->data, $this->htmlOptions);
114 echo $this->form->dropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions);
125 echo $this->form->fileField($this->model, $this->attribute, $this->htmlOptions);
137 echo $this->form->passwordField($this->model, $this->attribute, $this->htmlOptions);
149 if (isset($this->htmlOptions[
'options'])) {
150 $options = $this->htmlOptions[
'options'];
151 unset($this->htmlOptions[
'options']);
154 if (isset($this->htmlOptions[
'events'])) {
155 $events = $this->htmlOptions[
'events'];
156 unset($this->htmlOptions[
'events']);
162 'booster.widgets.TbPassfield',
164 'model' => $this->model,
165 'attribute' => $this->attribute,
166 'options' => isset($options) ? $options : array(),
167 'events' => isset($events) ? $events : array(),
168 'htmlOptions' => $this->htmlOptions,
181 $attribute = $this->attribute;
184 echo ($hidden) ? $hidden . PHP_EOL :
'';
185 echo
'<label class="radio" for="' . $this->
getAttributeId($attribute) .
'">';
186 echo $radioButton . PHP_EOL;
188 echo $this->model->getAttributeLabel($attribute);
200 echo
'<span id="' . $this->
getAttributeId($this->attribute) .
'">';
201 echo $this->form->radioButtonList($this->model, $this->attribute, $this->data, $this->htmlOptions);
212 $this->htmlOptions[
'inline'] =
true;
222 if (isset($this->htmlOptions[
'for']) && !empty($this->htmlOptions[
'for'])) {
223 $label_for = $this->htmlOptions[
'for'];
224 unset($this->htmlOptions[
'for']);
225 }
else if (isset($this->data) && !empty($this->data)) {
226 $label_for = CHtml::getIdByName(
227 get_class($this->model) .
'[' . $this->attribute .
'][' . key($this->data) .
']'
231 if (isset($label_for)) {
232 $this->labelOptions = array(
'for' => $label_for);
236 echo $this->form->radioButtonGroupsList($this->model, $this->attribute, $this->data, $this->htmlOptions);
247 echo $this->form->textArea($this->model, $this->attribute, $this->htmlOptions);
259 echo $this->form->textField($this->model, $this->attribute, $this->htmlOptions);
272 echo $this->form->maskedTextField($this->model, $this->attribute, $this->data, $this->htmlOptions);
283 echo $this->
getLabel() .
'<div class="captcha">';
284 echo
'<div class="widget">' . $this->widget(
'CCaptcha', $this->captchaOptions,
true) .
'</div>';
285 echo $this->form->textField($this->model, $this->attribute, $this->htmlOptions);
297 echo CHtml::tag(
'span', $this->htmlOptions, $this->model->{$this->attribute});
306 protected function datepickerField()
308 if (isset($this->htmlOptions[
'options'])) {
309 $options = $this->htmlOptions[
'options'];
310 unset($this->htmlOptions[
'options']);
313 if (isset($this->htmlOptions[
'events'])) {
314 $events = $this->htmlOptions[
'events'];
315 unset($this->htmlOptions[
'events']);
318 echo $this->getLabel();
319 echo $this->getPrepend();
321 'booster.widgets.TbDatePicker',
323 'model' => $this->model,
324 'attribute' => $this->attribute,
325 'options' => isset($options) ? $options : array(),
326 'events' => isset($events) ? $events : array(),
327 'htmlOptions' => $this->htmlOptions,
330 echo $this->getAppend();
331 echo $this->getError() . $this->getHint();
339 protected function datetimepickerField()
341 if (isset($this->htmlOptions[
'options'])) {
342 $options = $this->htmlOptions[
'options'];
343 unset($this->htmlOptions[
'options']);
346 if (isset($this->htmlOptions[
'events'])) {
347 $events = $this->htmlOptions[
'events'];
348 unset($this->htmlOptions[
'events']);
351 echo $this->getLabel();
352 echo $this->getPrepend();
354 'booster.widgets.TbDateTimePicker',
356 'model' => $this->model,
357 'attribute' => $this->attribute,
358 'options' => isset($options) ? $options : array(),
359 'events' => isset($events) ? $events : array(),
360 'htmlOptions' => $this->htmlOptions,
363 echo $this->getAppend();
364 echo $this->getError() . $this->getHint();
372 protected function colorpickerField()
375 if (isset($this->htmlOptions[
'format'])) {
376 $format = $this->htmlOptions[
'format'];
377 unset($this->htmlOptions[
'format']);
380 if (isset($this->htmlOptions[
'events'])) {
381 $events = $this->htmlOptions[
'events'];
382 unset($this->htmlOptions[
'events']);
385 echo $this->getLabel();
386 echo $this->getPrepend();
388 'booster.widgets.TbColorPicker',
390 'model' => $this->model,
391 'attribute' => $this->attribute,
393 'events' => isset($events) ? $events : array(),
394 'htmlOptions' => $this->htmlOptions,
397 echo $this->getAppend();
398 echo $this->getError() . $this->getHint();
405 protected function redactorJs()
407 if (isset($this->htmlOptions[
'options'])) {
408 $options = $this->htmlOptions[
'options'];
409 unset($this->htmlOptions[
'options']);
411 if (isset($this->htmlOptions[
'width'])) {
412 $width = $this->htmlOptions[
'width'];
413 unset($this->htmlOptions[
'width']);
415 if (isset($this->htmlOptions[
'height'])) {
416 $height = $this->htmlOptions[
'height'];
417 unset($this->htmlOptions[
'height']);
419 echo $this->getLabel();
421 'booster.widgets.TbRedactorJs',
423 'model' => $this->model,
424 'attribute' => $this->attribute,
425 'editorOptions' => isset($options) ? $options : array(),
426 'width' => isset($width) ? $width :
'100%',
427 'height' => isset($height) ? $height :
'400px',
428 'htmlOptions' => $this->htmlOptions
431 echo $this->getError() . $this->getHint();
438 protected function markdownEditorJs()
441 if (isset($this->htmlOptions[
'width'])) {
442 $width = $this->htmlOptions[
'width'];
443 unset($this->htmlOptions[
'width']);
445 if (isset($this->htmlOptions[
'height'])) {
446 $height = $this->htmlOptions[
'height'];
447 unset($this->htmlOptions[
'height']);
449 echo $this->getLabel();
450 echo
'<div class="wmd-panel">';
451 echo
'<div id="wmd-button-bar" class="btn-toolbar"></div>';
453 'booster.widgets.TbMarkdownEditorJs',
455 'model' => $this->model,
456 'attribute' => $this->attribute,
457 'width' => isset($width) ? $width :
'100%',
458 'height' => isset($height) ? $height :
'400px',
459 'htmlOptions' => $this->htmlOptions
462 echo $this->getError() . $this->getHint();
463 echo
'<div id="wmd-preview" class="wmd-panel wmd-preview" style="width:' . (isset($width) ? $width
464 :
'100%') .
'"></div>';
472 protected function ckEditor()
474 if (isset($this->htmlOptions[
'options'])) {
475 $options = $this->htmlOptions[
'options'];
476 unset($this->htmlOptions[
'options']);
479 echo $this->getLabel();
481 'booster.widgets.TbCKEditor',
483 'model' => $this->model,
484 'attribute' => $this->attribute,
485 'editorOptions' => isset($options) ? $options : array(),
486 'htmlOptions' => $this->htmlOptions
489 echo $this->getError() . $this->getHint();
496 protected function html5Editor()
498 if (isset($this->htmlOptions[
'options'])) {
499 $options = $this->htmlOptions[
'options'];
500 unset($this->htmlOptions[
'options']);
502 if (isset($this->htmlOptions[
'width'])) {
503 $width = $this->htmlOptions[
'width'];
504 unset($this->htmlOptions[
'width']);
506 if (isset($this->htmlOptions[
'height'])) {
507 $height = $this->htmlOptions[
'height'];
508 unset($this->htmlOptions[
'height']);
510 echo $this->getLabel();
512 'booster.widgets.TbHtml5Editor',
514 'model' => $this->model,
515 'attribute' => $this->attribute,
516 'editorOptions' => isset($options) ? $options : array(),
517 'width' => isset($width) ? $width :
'100%',
518 'height' => isset($height) ? $height :
'400px',
519 'htmlOptions' => $this->htmlOptions
522 echo $this->getError() . $this->getHint();
530 protected function dateRangeField()
532 if (isset($this->htmlOptions[
'options'])) {
533 $options = $this->htmlOptions[
'options'];
534 unset($this->htmlOptions[
'options']);
537 if (isset($options[
'callback'])) {
538 $callback = $options[
'callback'];
539 unset($options[
'callback']);
542 echo $this->getLabel();
543 echo $this->getPrepend();
545 'booster.widgets.TbDateRangePicker',
547 'model' => $this->model,
548 'attribute' => $this->attribute,
549 'options' => isset($options) ? $options : array(),
550 'callback' => isset($callback) ? $callback :
'',
551 'htmlOptions' => $this->htmlOptions,
554 echo $this->getAppend();
555 echo $this->getError() . $this->getHint();
563 protected function timepickerField()
565 if (isset($this->htmlOptions[
'options'])) {
566 $options = $this->htmlOptions[
'options'];
567 unset($this->htmlOptions[
'options']);
570 if (isset($this->htmlOptions[
'events'])) {
571 $events = $this->htmlOptions[
'events'];
572 unset($this->htmlOptions[
'events']);
575 echo $this->getLabel();
576 echo $this->getPrepend();
578 'booster.widgets.TbTimePicker',
580 'model' => $this->model,
581 'attribute' => $this->attribute,
582 'options' => isset($options) ? $options : array(),
583 'events' => isset($events) ? $events : array(),
584 'htmlOptions' => $this->htmlOptions,
585 'form' => $this->form
588 echo $this->getAppend();
589 echo $this->getError() . $this->getHint();
596 protected function select2Field()
598 if (isset($this->htmlOptions[
'options'])) {
599 $options = $this->htmlOptions[
'options'];
600 unset($this->htmlOptions[
'options']);
603 if (isset($this->htmlOptions[
'events'])) {
604 $events = $this->htmlOptions[
'events'];
605 unset($this->htmlOptions[
'events']);
608 if (isset($this->htmlOptions[
'data'])) {
609 $data = $this->htmlOptions[
'data'];
610 unset($this->htmlOptions[
'data']);
613 if (isset($this->htmlOptions[
'asDropDownList'])) {
614 $asDropDownList = $this->htmlOptions[
'asDropDownList'];
615 unset($this->htmlOptions[
'asDropDownList']);
618 if (isset($this->htmlOptions[
'val']))
620 $val = $this->htmlOptions[
'val'];
621 unset($this->htmlOptions[
'val']);
624 echo $this->getLabel();
625 echo $this->getPrepend();
627 'booster.widgets.TbSelect2',
629 'model' => $this->model,
630 'attribute' => $this->attribute,
631 'options' => isset($options) ? $options : array(),
632 'events' => isset($events) ? $events : array(),
634 'asDropDownList' => isset($asDropDownList) ? $asDropDownList :
true,
635 'val' => isset($val) ? $val : null,
636 'htmlOptions' => $this->htmlOptions,
637 'form' => $this->form
640 echo $this->getAppend();
641 echo $this->getError() . $this->getHint();
648 protected function typeAheadField()
650 echo $this->getLabel();
651 echo $this->getPrepend();
652 echo $this->form->typeAheadField($this->model, $this->attribute, $this->data, $this->htmlOptions);
653 echo $this->getAppend();
654 echo $this->getError() . $this->getHint();
661 protected function numberField()
663 echo $this->getLabel();
664 echo $this->getPrepend();
665 echo $this->form->numberField($this->model, $this->attribute, $this->htmlOptions);
666 echo $this->getAppend();
667 echo $this->getError() . $this->getHint();
674 protected function customField()
676 echo $this->getLabel();
677 echo $this->getPrepend();
678 echo $this->htmlOptions[
'input'];
679 echo $this->getAppend();
680 echo $this->getError() . $this->getHint();