本文整理汇总了PHP中kartik\datetime\DateTimePicker::widget方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimePicker::widget方法的具体用法?PHP DateTimePicker::widget怎么用?PHP DateTimePicker::widget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kartik\datetime\DateTimePicker
的用法示例。
在下文中一共展示了DateTimePicker::widget方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
echo $form->field($lab_en, 'content')->textarea(['rows' => 6, 'class' => 'ntSaveForms form-control']);
?>
</div>
<div class="col-md-12">
<?php
echo $form->field($lab, 'email')->textInput(['maxlength' => true, 'class' => 'ntSaveForms form-control']);
?>
</div>
<div class="col-md-12">
<?php
echo '<label>Начало</label>';
echo DateTimePicker::widget(['model' => $lab, 'attribute' => 'created_date', 'language' => 'ru', 'name' => 'datetime_1', 'options' => ['placeholder' => 'Select operating time ...'], 'convertFormat' => true, 'pluginOptions' => ['format' => 'yyyy-MM-dd H:mm:ss', 'startDate' => '01-Mar-2015 12:00 AM', 'todayHighlight' => true, 'todayBtn' => true, 'autoclose' => true]]);
?>
</div>
<div class="col-md-12">
<?php
echo $form->field($lab, 'user_id')->dropDownList(ArrayHelper::map(User::find()->all(), 'id', 'username'));
?>
</div>
<div class="col-md-12">
<?php
echo $form->field($lab, 'images[]')->fileInput(['multiple' => false, 'required' => $lab->isNewRecord ? true : false]);
?>
</div>
<div class="col-md-12">
<p><img src="<?php
示例2:
<?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']);
?>
示例3:
<div class="box-header">
<h3 class="box-title"><?php
echo Yii::t('fin.form', 'Monthly');
?>
</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">
<div class="input-group">
<?php
echo DateTimePicker::widget(['model' => $model, 'attribute' => 'fmonth', 'type' => 1, 'readonly' => true, 'pluginOptions' => ['autoclose' => true, 'format' => $fmKeyJui, 'startView' => 3, 'minView' => 3, 'startDate' => $startDateJui], 'options' => ['class' => 'pull-right']]);
?>
<div class="input-group-btn">
<button class='btn btn-default' type='submit' name='<?php
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
示例4:
?>
<input type="hidden" name="empty_date" value="1">
<?php
}
?>
<div class="panel panel-info ">
<div class="panel-heading">Фильтр по датам</div>
<div class="input-group filter-date-list">
<div class="input-group date-group">
<?php
echo DateTimePicker::widget(['name' => 'date_before_filter', 'class' => 'form-control', 'convertFormat' => true, 'value' => $date_before_filter ? $date_before_filter : ($datePayDay ? $datePayDay[2] . "." . $datePayDay[1] . "." . $datePayDay[0] : ""), 'pluginOptions' => ['minView' => 2, 'format' => 'dd.MM.yyyy'], 'pluginEvents' => ['changeDate' => 'function(){$(this).parents("form").submit();}']]);
?>
</div>
<div class="input-group date-group">
<?php
echo DateTimePicker::widget(['name' => 'date_after_filter', 'class' => 'form-control', 'convertFormat' => true, 'value' => $date_after_filter, 'pluginOptions' => ['minView' => 2, 'format' => 'dd.MM.yyyy'], 'pluginEvents' => ['changeDate' => 'function(){$(this).parents("form").submit();}']]);
?>
</div>
</div>
</div>
</form>
<?php
if ($is_filter) {
?>
<a class="btn btn-primary pull-right-custom btn-in-panel"
href="<?php
echo \yii\helpers\Url::toRoute(['expense/list', 'empty_date' => 1]);
?>
">Сброс фильтра</a>
<?php
}
示例5:
<?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>
示例6: 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; });');
?>
示例7: 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"
// });
示例8:
<div class="tblorderassignment-form">
<?php
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'order_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Tblorders::find()->all(), 'order_id', 'title'), 'options' => ['placeholder' => 'Select one'], 'pluginOptions' => ['allowClear' => true]]);
?>
<?php
echo $form->field($model, 'editor_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Tbleditors::find()->all(), 'editor_id', 'editor_name'), 'options' => ['placeholder' => 'Select one'], 'pluginOptions' => ['allowClear' => true]]);
?>
<?php
echo '<label>Deadline</label>';
echo DateTimePicker::widget(['name' => 'dead_line', 'value' => $model->dead_line, 'options' => ['required' => true], 'pluginOptions' => ['format' => 'yyyy-mm-dd hh:ii', 'startDate' => '01-Mar-2014 12:00 AM', 'todayHighlight' => true]]);
echo $form->field($model, 'amount')->textInput();
?>
<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();
?>
</div>
示例9:
<div class="form-group">
<label class="control-label" for="speech-detailed_intro">详情</label>
<?php
echo Ueditor::widget(['id' => 'Speech[detailed_intro]', 'options' => ['toolbars' => [['fullscreen', 'undo', 'redo', 'bold', 'italic', 'underline', 'fontborder', 'backcolor', 'fontsize', 'fontfamily'], ['justifyleft', 'justifyright', 'justifycenter', 'justifyjustify', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc']], 'initialFrameWidth' => '100%', 'initialFrameHeight' => '100%', 'autoHeightEnabled' => true, 'autoFloadEnabled' => true]]);
?>
</div>
<?php
echo $form->field($model, 'author')->textInput(['maxlength' => 50]);
?>
<div class="form-group">
<label for="">演讲时间</label>
<?php
echo DateTimePicker::widget(['type' => 1, 'name' => 'Speech[speech_date]', 'options' => ['placeholder' => '演讲时间', 'style' => 'width:100%'], 'size' => 'md', 'convertFormat' => true, 'pluginOptions' => ['format' => '', 'startDate' => '01-Mar-2014 12:00 AM', 'todayHighlight' => true, 'autoclose' => true]]);
?>
</div>
<?php
echo $form->field($model, 'photo')->input('file', ['name' => 'photo']);
?>
<?php
echo $form->field($model, 'photo_url')->input('file', ['name' => 'photo_url']);
?>
<?php
echo $form->field($model, 'video_url')->textInput();
?>
<?php
echo $form->field($model, 'price')->textInput();
示例10:
echo $form->field($model,'course_id')->dropdownList(
[],
[
'prompt' => 'Select Courses',
]);
}
?>
<label class="control-label" for="blocktime-starttime">Starttime</label>
<?php
echo DateTimePicker::widget(['model' => $model, 'attribute' => 'starttime', 'name' => 'starttime', 'type' => DateTimePicker::TYPE_INPUT, 'value' => '2015-11-01 14:00:00', 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd hh:ii:ss']]);
?>
<label class="control-label" for="blocktime-endtime">Endtime</label>
<?php
echo DateTimePicker::widget(['model' => $model, 'attribute' => 'endtime', 'name' => 'endtime', 'type' => DateTimePicker::TYPE_INPUT, 'value' => '2015-11-01 14:00:00', 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd hh:ii:ss']]);
?>
<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();
?>
</div>
示例11: date
?>
><?php
echo $value;
?>
</option>
<?php
}
?>
</select>
</div>
<div class="form-group">
<label for="">
开始时间:
</label>
<?php
echo DateTimePicker::widget(['name' => 'start_time', 'type' => 1, 'pickerButton' => ['icon' => 'calendar'], 'options' => ['placeholder' => '开始时间', 'style' => 'width:58%', 'class' => 'form-control input-sm'], 'size' => 'md', 'value' => !empty($data['start_time']) ? date("Y-m-d", $data['start_time']) : '', 'convertFormat' => true, 'pluginOptions' => ['format' => 'yyyy-MM-dd', 'todayHighlight' => true, 'autoclose' => true, 'minView' => 2]]);
?>
</div>
<button class="btn btn-default btn-sm" type="submit">
搜 索
</button>
</form>
</div>
<div class="box-body">
<table class="table table-responsive" id="sample-table-2">
<thead>
<!-- <tr>
<td>申请人</td>
<td>产品名称 </td>
<td>申请日期</td>
示例12:
<form action="?r=schedule/create-event" method="post">
<input id="event_color" name="EventCreateForm[color]" style="display: none" value="#00C0EF">
<div class="input-group">
<div class="input-group-btn">
<label style="background-color: #00C0EF; border-color: #00C0EF;" id="add-new-event" class="btn btn-primary btn-flat">Tên:</label>
</div><!-- /btn-group -->
<input name="EventCreateForm[title]" id="new-event" class="form-control" type="text">
</div><!-- /input-group -->
<div class="input-group" style="margin-top: 10px">
<?php
echo DateTimePicker::widget(['name' => 'EventCreateForm[start]', 'type' => DateTimePicker::TYPE_COMPONENT_PREPEND, 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd hh:ii']]);
?>
</div>
<div class="input-group" style="margin-top: 10px">
<?php
echo DateTimePicker::widget(['name' => 'EventCreateForm[end]', 'type' => DateTimePicker::TYPE_COMPONENT_PREPEND, 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd hh:ii']]);
?>
</div>
<div class="input-group" style="margin-top: 10px;">
<?php
echo Select2::widget(['name' => 'EventCreateForm[friend][]', 'data' => $arrUserName, 'options' => ['multiple' => true, 'placeholder' => 'With?'], 'pluginOptions' => ['allowClear' => true]]);
?>
</div>
<div class="input-group">
<button class="schedule_btn btn bg-purple margin" type="submit">Thêm sự kiện</button>
</div>
</form>
</div>
</div>
<div class="schedule_fail alert alert-info alert-dismissable" style="display: none">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
示例13:
?>
<?php
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'price')->input('number', ['step' => '0.01']);
?>
<?php
echo $form->field($model, 'descriptions')->textarea(['rows' => 6]);
?>
<?php
echo DateTimePicker::widget(['name' => 'timer', 'model' => $model, 'options' => ['placeholder' => 'Select operating time ...'], 'convertFormat' => true, 'pluginOptions' => ['format' => 'dd.MM.yyyy H:i', 'todayHighlight' => true]]);
?>
<?php
echo $form->field($model, 'goods')->listBox(\yii\helpers\ArrayHelper::map($goods, 'id', 'name'), ['multiple' => true, 'selected' => $model->getGoodsIds(), 'size' => 10]);
?>
<?php
echo $form->field($model, 'status')->dropDownList(Prints::$statuses);
?>
<?php
if (!$model->isNewRecord) {
echo Html::img($model->getImageUrl(), ['style' => 'max-width:300px;max-height:300px;']);
}
?>
<?php
echo $form->field($model, 'imageFile')->widget(FileInput::classname(), ['options' => ['multiple' => false, 'accept' => 'image/png'], 'pluginOptions' => ['previewFileType' => 'image', 'showUpload' => true]]);
示例14: function
<p>
<?php
echo Html::a('Create Card', ['create'], ['class' => 'btn btn-success']);
?>
<a class="btn btn-primary" href="/card/generate">Generate Card</a>
</p>
<? Pjax::begin(); ?>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'number', 'header' => 'Number', 'content' => function ($model) {
return '<div class="make_mask"><span>' . $model->number . '</span></div>';
}, 'label' => 'Number'], 'serial', ['attribute' => 'issue_date', 'value' => 'issue_date', 'format' => 'raw', 'filter' => DateTimePicker::widget(['options' => ['placeholder' => 'Choose date and time'], 'model' => $searchModel, 'attribute' => 'issue_date', 'convertFormat' => true, 'pluginOptions' => ['format' => 'yyyy-MM-dd HH:i', 'startDate' => date('yyyy-MM-dd HH:i'), 'todayHighlight' => true]])], ['attribute' => 'expiration_date', 'value' => function ($model) {
$days = (int) (new DateTime("now"))->diff(date_create($model->expiration_date))->format('%a');
$result = '';
if ((int) ((int) $days / 30) < 12) {
$result = (int) ((int) $days / 30) == 1 ? '1 month' : (int) ((int) $days / 30) . ' months ';
}
if ((int) ((int) $days / 30 / 12) >= 1) {
$result = (int) ((int) $days / 30 / 12) == 1 ? '1 year' : (int) ((int) $days / 30 / 12) . ' years ';
}
return $result;
}, 'format' => 'raw', 'filter' => DateTimePicker::widget(['options' => ['placeholder' => 'Choose date and time'], 'model' => $searchModel, 'attribute' => 'expiration_date', 'convertFormat' => true, 'pluginOptions' => ['format' => 'yyyy-MM-dd HH:i', 'startDate' => date('yyyy-MM-dd HH:i'), 'todayHighlight' => true]])], ['attribute' => 'status', 'value' => 'status', 'filter' => Html::activeDropDownList($searchModel, 'status', $statusItems, ['class' => 'form-control', 'prompt' => 'Select Category']), 'content' => function ($model) {
return '<span>' . $model->currentStatus->title . '</span>';
}, 'label' => 'Status', 'enableSorting' => true], ['class' => 'yii\\grid\\ActionColumn']]]);
?>
<? Pjax::end(); ?>
</div>