/** * Renders a text input. * This method will generate the "name" and "value" tag attributes automatically for the model attribute * unless they are explicitly specified in `$options`. * @param array $options the tag options in terms of name-value pairs. These will be rendered as * the attributes of the resulting tag. The values will be HTML-encoded using [[Html::encode()]]. * @return static the field object itself */ public function spinnerInput($options = [], $clientOptions = ['step' => 1, 'min' => 0]) { $options = array_merge($this->inputOptions, $options); $this->adjustLabelFor($options); $this->parts['{input}'] = \yii\jui\Spinner::widget(['model' => $this->model, 'attribute' => $this->attribute, 'options' => $options, 'clientOptions' => $clientOptions]); return $this; }
?> <?php echo $form->field($model, 'date_to')->widget(DateControl::className(), ['type' => DateControl::FORMAT_DATE, 'language' => Yii::$app->language]); ?> <?php echo $form->field($model, 'time_from')->widget(TimePicker::className(), ['pluginOptions' => ['defaultTime' => false, 'showSeconds' => false, 'showMeridian' => false], 'options' => ['class' => 'form-control']]); ?> <?php echo $form->field($model, 'time_to')->widget(TimePicker::className(), ['pluginOptions' => ['defaultTime' => false, 'showSeconds' => false, 'showMeridian' => false], 'options' => ['class' => 'form-control']]); ?> <?php echo $form->field($model, 'hour_length')->widget(Spinner::className()); ?> <div class="form-group"> <?php echo Html::submitButton($actionId != 'update' ? Module::t('res', 'Create') : Module::t('res', 'Update'), ['class' => $actionId == 'create' ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div> </div>
?> <?php echo Html::tag('span', null, ['id' => 'sem_count_label']); ?> <?php echo Spinner::widget(['name' => 'sem_count', 'id' => 'sem_count', 'value' => 8, 'clientOptions' => ['step' => 1]]); ?> </div> <div class="form-group"> <?php echo Html::label('Год начала обучения'); ?> <?php echo Spinner::widget(['name' => 'begin_year', 'id' => 'begin_year', 'value' => date("Y"), 'clientOptions' => ['step' => 1]]); ?> </div> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?>
use yii\jui\Spinner; use yii\jui\DatePicker as JuiDatePicker; use sjaakp\fuzzydate\DatePicker; /** * @var $this View * @var $widget DatePicker */ $model = $widget->model; $attribute = $widget->attribute; setlocale(LC_ALL, Yii::$app->language); // need this for strftime() $months = []; for ($m = 1; $m <= 12; $m++) { $months[$m] = strftime($widget->monthFormat, mktime(0, 0, 0, $m, 1)); } ?> <div class="form-group"> <div class="form-inline"> <?php echo Spinner::widget(['model' => $model, 'attribute' => "{$attribute}[y]", 'options' => ['class' => 'fuzzy-year ' . $widget->controlClass, 'size' => 4], 'clientOptions' => ['min' => $widget->minYear, 'max' => $widget->maxYear]]); ?> <?php echo Html::activeDropDownList($model, "{$attribute}[m]", $months, ['prompt' => '', 'class' => 'fuzzy-month ' . $widget->controlClass]); ?> <?php echo JuiDatePicker::widget(['model' => $model, 'attribute' => "{$attribute}[d]", 'dateFormat' => 'd', 'options' => ['class' => 'fuzzy-day ' . $widget->controlClass, 'size' => 2], 'clientOptions' => ['hideIfNoPrevNext' => true]]); ?> </div> </div>