Example #1
0
 public function init()
 {
     $value = $this->model->{$this->attribute};
     if (is_int($value) || is_float($value) || is_string($value) && strlen($value)) {
         $this->inputOptions['value'] = Text::date($this->dateFormat . $this->separator . $this->timeFormat, $value);
         $this->hiddenInputOptions['value'] = Text::date($this->altDateFormat . $this->altSeparator . $this->altTimeFormat, $value);
     }
     if (!$this->readOnly) {
         $pluginOptions = array_merge(['numberOfMonths' => 3, 'showButtonPanel' => true, 'altFieldTimeOnly' => false], $this->pluginOptions, ['dateFormat' => Text::juiDateFormat($this->dateFormat), 'altFormat' => Text::juiDateFormat($this->altDateFormat), 'separator' => $this->separator, 'altSeparator' => $this->altSeparator, 'timeFormat' => Text::juiTimeFormat($this->timeFormat), 'altTimeFormat' => Text::juiTimeFormat($this->altTimeFormat)]);
         $inputId = Html::getInputId($this->model, $this->attribute);
         $pluginOptions['altField'] = '#' . $inputId . '-alt';
         $js = 'jQuery(\'#' . $inputId . '\').datetimepicker(' . Json::encode($pluginOptions) . ');';
         $this->inputOptions['name'] = false;
         $this->hiddenInputOptions['id'] = $inputId . '-alt';
         $this->template .= "\n{hiddenInput}";
         $this->parts['{hiddenInput}'] = Html::activeHiddenInput($this->model, $this->attribute, $this->hiddenInputOptions);
         if (Yii::$app->getRequest()->getIsAjax()) {
             $this->template .= "\n{script}";
             $this->parts['{script}'] = Html::script($js);
         } else {
             $view = $this->form->getView();
             TimePickerAsset::register($view);
             $view->registerJs($js);
         }
     }
     parent::init();
 }
 public function init()
 {
     parent::init();
     $this->widget(JuiTimePicker::className(), ['options' => $this->inputOptions, 'timeFormat' => $this->timeFormat, 'altTimeFormat' => $this->altTimeFormat, 'showButtonPanel' => $this->showButtonPanel, 'clientOptions' => $this->pluginOptions]);
 }
 public function init()
 {
     parent::init();
     $this->textarea();
 }
 public function init()
 {
     parent::init();
     $this->widget(Tinymce::className(), ['options' => $this->inputOptions, 'clientOptions' => $this->pluginOptions]);
 }
Example #5
0
 public function init()
 {
     parent::init();
     $this->dropDownList([1 => Yii::t('mozayka', 'yes'), 0 => Yii::t('mozayka', 'no')], ['prompt' => '']);
 }
 public function init()
 {
     parent::init();
     $this->widget(JuiDatePicker::className(), ['options' => $this->inputOptions, 'dateFormat' => $this->dateFormat, 'altDateFormat' => $this->altDateFormat, 'numberOfMonths' => $this->numberOfMonths, 'showButtonPanel' => $this->showButtonPanel, 'clientOptions' => $this->pluginOptions]);
 }
 public function init()
 {
     $this->inputOptions['maxlength'] = $this->getMaxLength();
     parent::init();
 }
 public function init()
 {
     parent::init();
     $this->dropDownList(Yii::$app->getFormatter()->booleanFormat, ['prompt' => $this->prompt]);
 }
 public function init()
 {
     parent::init();
     $this->checkbox();
 }