本文整理汇总了PHP中kartik\datetime\DateTimePicker类的典型用法代码示例。如果您正苦于以下问题:PHP DateTimePicker类的具体用法?PHP DateTimePicker怎么用?PHP DateTimePicker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DateTimePicker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
echo $form->field($model, 'title')->textInput(['maxlength' => true]);
?>
<?php
//echo $form->field($model, 'intro')->textarea(['rows' => 6])
?>
<?php
echo $form->field($model, 'url')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'start_time')->widget(DateTimePicker::classname(), ['options' => ['placeholder' => '开始时间'], 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd hh:ii']]);
?>
<?php
echo $form->field($model, 'end_time')->widget(DateTimePicker::classname(), ['options' => ['placeholder' => '到期时间'], 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd hh:ii']]);
?>
<?php
echo $form->field($model, 'status')->dropDownList(['1' => '启用', '0' => '禁用']);
?>
<div class="form-group">
<?php
echo Html::submitButton($model->isNewRecord ? '添加' : '修改', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>
<?php
ActiveForm::end();
?>
示例2:
<div class="box-header with-border"><h3 class="box-title"><?php
echo Yii::t('fin.form', 'Input Values');
?>
</h3></div>
<div id="oefPurchaseCreateForm" class="box-body"><?php
$form = ActiveForm::begin(['requiredCssClass' => 'form-group-required']);
?>
<div class="row"><div class="col-md-12">
<?php
echo $form->field($model, 'purchase_date')->widget(DateTimePicker::className(), ['type' => 1, 'pluginOptions' => ['autoclose' => true, 'format' => $fmShortDateJui, 'startView' => 2, 'minView' => 2, 'todayHighlight' => true]]);
?>
<?php
echo $form->field($model, 'purchase_type')->dropDownList($arrPurchaseType, ['prompt' => '']);
?>
<?php
echo $form->field($model, 'sip_date')->widget(DateTimePicker::className(), ['type' => 1, 'options' => ['data-backup' => $model->sip_date], 'pluginOptions' => ['autoclose' => true, 'format' => $fmShortDateJui, 'startView' => 2, 'minView' => 2, 'todayHighlight' => true]]);
?>
<?php
echo $form->field($model, 'nav')->textInput(['type' => 'number', 'step' => 'any']);
?>
<?php
echo $form->field($model, 'purchase')->textInput(['type' => 'number']);
?>
<?php
echo $form->field($model, 'transfer_fee')->textInput(['type' => 'number']);
?>
<?php
echo $form->field($model, 'other_fee')->textInput(['type' => 'number']);
?>
<div class="form-group">
<?php
示例3:
?>
<?php
echo $form->field($model, 'destination')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'miles')->textInput();
?>
<?php
echo $form->field($model, 'start_time')->widget(DateTimePicker::classname(), ['options' => ['placeholder' => 'Enter start time ...'], 'pluginOptions' => ['autoclose' => true]]);
?>
<?php
echo $form->field($model, 'end_time')->widget(DateTimePicker::classname(), ['options' => ['placeholder' => 'Enter end time ...'], 'pluginOptions' => ['autoclose' => true]]);
?>
<?php
echo $form->field($model, 'status')->dropDownList($status, ['prompt' => '- Choose Route status -']);
?>
<?php
echo $form->field($model, 'about')->textarea(['rows' => 6]);
?>
<!-- --><?php
//$form->field($model, 'check_list')->textarea(['rows' => 6])
?>
示例4:
<?php
echo $form->field($model, 'type')->radioButtonGroup($model->TypeArray, ['id' => 'type-create', 'itemOptions' => ['labelOptions' => ['class' => 'btn btn-warning btn-sm']]])->label(false);
?>
<?php
echo Html::error($model, 'type', ['data-activity' => 'form-summary', 'class' => 'help-block hidden']);
?>
</div>
<div class="form-group" data-activity="form-group">
<div class="col-sm-4">
<?php
echo \Yii::t('net_frenzel_activity', 'When');
?>
:
<?php
echo DateTimePicker::widget(['model' => $model, 'attribute' => 'next_at', 'type' => DateTimePicker::TYPE_COMPONENT_PREPEND, 'pluginOptions' => ['autoclose' => true]]);
?>
<?php
echo Html::error($model, 'next_at', ['data-activity' => 'form-summary', 'class' => 'help-block hidden']);
?>
</div>
<div class="col-sm-8"><?php
echo \Yii::t('net_frenzel_activity', 'Next');
?>
:
<?php
echo $form->field($model, 'next_type')->radioButtonGroup($model->NextTypeArray, ['id' => 'next_type-create', 'itemOptions' => ['labelOptions' => ['class' => 'btn btn-primary btn-sm']]])->label(false);
?>
<?php
echo Html::error($model, 'next_type', ['data-activity' => 'form-summary', 'class' => 'help-block hidden']);
?>
示例5: ActiveDataProvider
echo Yii::t('oef.nav', 'Transaction');
?>
</h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i></button>
</div>
</div>
<div class="box-body" style="padding-bottom: 0;"><?php
$form = ActiveForm::begin(['requiredCssClass' => 'form-group-required']);
?>
<div class="row"><div class="col-md-12">
<?php
echo $form->field($searchModel, 'trade_date_from')->widget(DateTimePicker::className(), ['type' => 1, 'pluginOptions' => ['autoclose' => true, 'format' => $fmShortDateJui, 'startView' => 2, 'minView' => 2, 'todayHighlight' => true]]);
?>
<?php
echo $form->field($searchModel, 'trade_date_to')->widget(DateTimePicker::className(), ['type' => 1, 'pluginOptions' => ['autoclose' => true, 'format' => $fmShortDateJui, 'startView' => 2, 'minView' => 2, 'todayHighlight' => true]]);
?>
<div class="form-group">
<?php
echo Html::submitButton(Yii::t('button', 'Search'), ['class' => 'btn btn-info btn-lg btn-block', 'name' => MasterValueUtils::SM_MODE_NAME, 'value' => MasterValueUtils::SM_MODE_INPUT]);
?>
</div>
</div></div>
<?php
ActiveForm::end();
?>
</div>
<div class="box-body-notool">
<div class="row"><?php
Pjax::begin();
echo GridView::widget(['layout' => '{summary}<div class="table-responsive">{items}</div>{pager}', 'options' => ['class' => 'grid-view col-xs-12'], 'tableOptions' => ['class' => 'table table-bordered'], 'pager' => ['options' => ['class' => 'pagination pagination-bottom'], 'maxButtonCount' => 6], 'dataProvider' => new ActiveDataProvider(['query' => $dataQuery, 'pagination' => ['pagesize' => 20]]), 'columns' => [['label' => Yii::t('fin.grid', 'Ref'), 'headerOptions' => ['style' => 'text-align: center'], 'contentOptions' => ['style' => 'vertical-align: middle; text-align: center'], 'format' => 'raw', 'value' => function ($model, $key, $index, $column) {
示例6:
?>
<?php
echo $form->field($model, 'budzhet')->dropDownList(['1' => 'Относится', '0' => 'Не относится']);
?>
<?php
echo $form->field($model, 'date_zvit')->widget(DateTimePicker::classname(), ['options' => ['placeholder' => 'Выберите дату и время ...'], 'pluginOptions' => ['autoclose' => true, 'weekStart' => 1]]);
?>
<br>
<?php
echo $form->field($model, 'date_zvit_us')->widget(DateTimePicker::classname(), ['options' => ['placeholder' => 'Выберите дату и время ...'], 'pluginOptions' => ['autoclose' => true, 'weekStart' => 1]]);
?>
<br>
<?php
echo $form->field($model, 'key')->dropDownList(['0' => 'Не нужен', '1' => 'Нужен']);
?>
<?php
echo $form->field($model, 'zhurnal')->dropDownList(['1' => 'Внесено', '0' => 'Не Внесено']);
?>
<?php
echo $form->field($model, 'note')->textInput(['maxlength' => true]);
示例7:
</li>
<li><span>Stap 6</span><?php
echo Html::a(Yii::t('request-project', 'Overview'), ['/request-project/overview']);
?>
</li>
</ul>
<div class="col-sm-6">
<div class="row">
<div class="block">
<?php
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'deadline')->widget(\kartik\datetime\DateTimePicker::classname(), ['pluginOptions' => ['minView' => 'month', 'format' => 'dd-mm-yyyy', 'weekStart' => 1, 'daysOfWeekDisabled' => [0, 6], 'todayHighlight' => true, 'startDate' => '+7d']]);
?>
<?php
echo $form->field($model, 'comment')->textArea();
?>
<?php
echo Html::a(Yii::t('common', 'Last step'), ['step-2'], ['class' => 'btn btn-primary']);
?>
<?php
echo Html::submitButton(Yii::t('common', 'Next step'), ['class' => 'btn btn-primary']);
?>
<?php
ActiveForm::end();
示例8:
<?php
use kartik\form\ActiveForm;
/** @var \backend\modules\ads\models\BannerForm $model */
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'id' => 'edit-ad-form', 'options' => ['data-pjax' => true]]);
echo $form->field($model, 'name'), $form->field($model, 'position')->dropDownList($model->possiblePositions), $form->field($model, 'enableDate')->widget(\kartik\datetime\DateTimePicker::className(), []), $form->field($model, 'disableDate')->widget(\kartik\datetime\DateTimePicker::className(), []), $form->field($model, 'code')->textarea(['style' => 'height: 30vh']), $form->field($model, 'state')->checkbox([], false), \yii\bootstrap\Html::tag('div', \yii\helpers\Html::button('Сохранить', ['class' => 'btn btn-success', 'type' => 'submit']), ['class' => 'text-center']);
$form->end();
示例9: foreach
/* @var $this \yii\web\View */
/* @var $parent yii\db\ActiveRecord */
/* @var $model bariew\scheduleAbstractModule\models\Schedule */
/* @var $form yii\widgets\ActiveForm */
?>
<table class="table table-bordered table-striped">
<tr>
<?php
foreach (['model_class', 'model_method', 'model_value', 'start_at_local', 'interval', 'end_at_local'] as $attribute) {
?>
<?php
if ($this->context->{$attribute} === null) {
?>
<td><?php
echo in_array($attribute, ['start_at_local', 'end_at_local']) ? $form->field($model, "[{$index}]{$attribute}")->label(false)->widget(\kartik\datetime\DateTimePicker::className(), ['options' => ['placeholder' => $model->getAttributeLabel($attribute), 'onmouseenter' => 'if ($(this).parents(".template").length){
$(this).datetimepicker($(this).attr("data-krajee-datetimepicker"));
}']]) : $form->field($model, "[{$index}]{$attribute}")->label(false)->textInput(['placeholder' => $model->getAttributeLabel($attribute)]);
?>
</td>
<?php
} elseif (is_array($this->context->{$attribute})) {
?>
<td><?php
echo $form->field($model, "[{$index}]{$attribute}")->label(false)->dropDownList($this->context->{$attribute});
?>
</td>
<?php
} else {
?>
<td class="hide"><?php
示例10:
echo MasterValueUtils::SM_MODE_NAME;
?>
' value='<?php
echo MasterValueUtils::SM_MODE_INPUT;
?>
'><i class="fa fa-edit"></i></button>
</div>
</div>
<div class="progress progress-xxs" style="margin-top: 8px;">
<div style="width: 100%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="100" role="progressbar" class="progress-bar progress-bar-warning progress-bar-striped"></div>
</div>
<?php
echo $form->field($model, 'fmonth_from')->widget(DateTimePicker::className(), ['type' => 1, 'readonly' => true, 'pluginOptions' => ['autoclose' => true, 'format' => $fmKeyJui, 'startView' => 3, 'minView' => 3]]);
?>
<?php
echo $form->field($model, 'fmonth_to')->widget(DateTimePicker::className(), ['type' => 1, 'readonly' => true, 'pluginOptions' => ['autoclose' => true, 'format' => $fmKeyJui, 'startView' => 3, 'minView' => 3]]);
?>
<div class="form-group">
<?php
echo Html::submitButton(Yii::t('button', 'Search'), ['class' => 'btn btn-info btn-lg btn-block', 'name' => MasterValueUtils::SM_MODE_NAME, 'value' => MasterValueUtils::SM_MODE_LIST]);
?>
</div>
</div></div>
<?php
ActiveForm::end();
?>
</div>
<?php
if (!is_null($gridData)) {
?>
<div class="box-body-notool">
示例11:
<?php
echo $form->field($model, 'title')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'description')->textarea();
?>
<?php
echo $form->field($model, 'start')->widget(\kartik\datetime\DateTimePicker::classname(), ['options' => ['placeholder' => '请设置事件的起始时间...'], 'pluginOptions' => ['autoclose' => true]]);
?>
<?php
echo $form->field($model, 'end')->widget(\kartik\datetime\DateTimePicker::classname(), ['options' => ['placeholder' => '请设置事件的起始时间...'], 'pluginOptions' => ['autoclose' => true]]);
?>
<?php
echo $form->field($model, 'dow')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'url')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'className')->textInput(['maxlength' => true]);
?>
示例12: date
<div class="tab-content">
<div class="tab-pane active fade in " id="edit-tab-state">
<br /><br />
</div>
<div class="tab-pane fade" id="edit-tab-slug">
<br /><br />
</div>
<div class="tab-pane fade" id="edit-tab-user">
<br />
<br />
</div>
<div class="tab-pane fade" id="edit-tab-created">
<br />
<?php
echo DateTimePicker::widget(['name' => 'event_time', 'value' => date("Y-m-d H:i", $model->created_at), 'removeButton' => false, 'pluginOptions' => ['format' => 'yyyy-mm-dd hh:mm', 'autoclose' => true, 'todayHighlight' => true], 'pluginEvents' => ["changeDate" => "function(e,b) { console.log(e.date.getTimezoneOffset()); \$('#created_at').val(Math.round(e.date.valueOf()/1000)+(e.date.getTimezoneOffset()*60)); }"]]);
?>
<br />
</div>
<div class="tab-pane fade" id="edit-tab-meta">
<br /><br />
</div>
</div>
<?php
$this->registerJs('$(".widget-file-remove").click(function(a){ l = $(this); $.get(l.attr("href"),function(d){ if(d == "deleted") l.parent().remove(); }); return false; });');
?>
示例13:
<?php
foreach ($purses as $purse) {
echo '<option value="' . $purse->id . '" ' . ($model->purse_id == $purse->id ? "selected" : "") . '>' . $purse->name . '</option>';
}
?>
</select>
<br>
<label class="whiteColor">Сумма*</label>
<input type="text" name="ExpenseForm[money]" value="<?php
echo $model->money;
?>
" class="form-control money-input" >
<br>
<div class="input-group date-group">
<label class="whiteColor">Дата расхода (необязательно для заполнения)</label>
<?php
echo DateTimePicker::widget(['name' => 'ExpenseForm[datetime]', 'class' => 'form-control', 'convertFormat' => true, 'pluginOptions' => ['minView' => 2, 'format' => 'dd.MM.yyyy']]);
?>
</div><!-- /input-group --><br>
<label class="whiteColor">Описание</label>
<textarea class="form-control" name="ExpenseForm[description]" ><?php
echo $model->description;
?>
</textarea>
<br>
<button class="btn btn-lg btn-primary" type="submit">Добавить</button>
<?php
ActiveForm::end();
?>
<br>
<br>
示例14: function
return Html::a($data->title, Url::toRoute(['/catalog/update-product', 'id' => $data->id]), ['data-pjax' => 0]);
}], ['header' => 'Категории', 'format' => 'raw', 'value' => function ($data) {
$tmp = '';
foreach ($data->categories as $cItem) {
$tmp .= '<div>' . Html::a($cItem->title, Url::toRoute(['/catalog/products', 'Product[parents]' => $cItem->id])) . '</div>';
}
return $tmp;
}, 'filter' => Html::activeDropDownList($filterModel, 'parents', Category::getAllToList(), ['class' => 'form-control input-sm filtered', 'prompt' => '-'])], ['attribute' => 'price', 'format' => 'raw', 'value' => function ($data) {
return Yii::$app->formatter->asCurrency($data->price, 'RUR');
}], ['attribute' => 'quantity', 'headerOptions' => ['class' => 'text-center'], 'contentOptions' => ['class' => 'text-center'], 'format' => 'raw', 'value' => function ($data) {
return Yii::$app->formatter->asInteger($data->quantity);
}], ['attribute' => 'is_active', 'headerOptions' => ['class' => 'text-center'], 'contentOptions' => ['class' => 'text-center'], 'format' => 'html', 'value' => function ($data) {
return $data->is_active ? '<span class="label label-success">Активный</span>' : '<span class="label label-danger">Не активный</span>';
}, 'filter' => Html::activeDropDownList($filterModel, 'is_active', [true => 'Активный', false => 'Не активный'], ['class' => 'form-control input-sm filtered', 'prompt' => '-'])], ['attribute' => 'created_at', 'format' => 'raw', 'options' => ['width' => '200'], 'value' => function ($data) {
return Yii::$app->formatter->asDateTime($data->created_at, Yii::$app->formatter->dateFormat) . ' <small style="color:gray;">' . Yii::$app->formatter->asDateTime($data->created_at, Yii::$app->formatter->timeFormat) . '</small>';
}, 'filter' => DateTimePicker::widget(['name' => 'Product[created_at]', 'value' => $filterModel->created_at != '' ? Yii::$app->formatter->asDateTime($filterModel->created_at, Yii::$app->formatter->dateFormat) : null, 'options' => ['placeholder' => 'Введите дату ...', 'class' => 'form-control input-sm filtered'], 'size' => 'sm', 'pickerButton' => null, 'convertFormat' => true, 'type' => DateTimePicker::TYPE_COMPONENT_APPEND, 'pluginOptions' => ['format' => 'dd.MM.yyyy', 'autoclose' => true, 'todayBtn' => true, 'startView' => 2, 'minView' => 3]])], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update-product} {delete-product}', 'options' => ['width' => '100'], 'buttons' => ['update-product' => function ($url, $model) {
return Html::a('<span class="icon fa fa-edit"></span>', $url, ['class' => 'btn btn-xs btn-primary', 'data-pjax' => 0]);
}, 'delete-product' => function ($url, $model) {
return Html::a('<span class="icon fa fa-trash"></span>', $url, ['class' => 'btn btn-xs btn-danger isDel', 'data-pjax' => 0]);
}]]]]);
?>
</div>
<?php
$js = <<<SCRIPT
jQuery(document).ready(function () {
// jQuery('#w2').yiiGridView("destroy");
// jQuery('#w2').yiiGridView({
// "filterUrl":"\\/admin\\/catalog\\/products?Product%5Btitle%5D=\\u0026Product%5Bparents%5D=\\u0026Product%5Bis_active%5D=\\u0026Product%5Bcreated_at%5D=\\u0026_pjax=%23w0",
// "filterSelector":"#w2-filters .filtered"
// });
示例15:
?>
<?php
$listRoom = ArrayHelper::map(Msroom::find()->all(), 'RoomID', 'RoomName');
$listPatient = ArrayHelper::map(Mspatient::find()->all(), 'PatientID', 'FirstName');
$listDoctor = ArrayHelper::map(Msdoctor::find()->all(), 'DoctorID', 'FirstName');
?>
<div class="trreservation-form">
<?php
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'Date')->widget(DateTimePicker::className());
?>
<?php
echo $form->field($model, 'RoomID')->dropDownList($listRoom);
?>
<?php
echo $form->field($model, 'PatientID')->dropDownList($listPatient);
?>
<?php
echo $form->field($model, 'DoctorID')->dropDownList($listDoctor);
?>
<div class="form-group">