本文整理汇总了PHP中yii\jui\DatePicker::widget方法的典型用法代码示例。如果您正苦于以下问题:PHP DatePicker::widget方法的具体用法?PHP DatePicker::widget怎么用?PHP DatePicker::widget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\jui\DatePicker
的用法示例。
在下文中一共展示了DatePicker::widget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: datepicker
/**
* Renders a datepicker text input.
* @see \yii\widgets\ActiveField::textInput()
* @return static the field object itself
*/
public function datepicker($options = [])
{
$datepickerOptions = isset($options['datepicker']) ? $options['datepicker'] : [];
unset($options['datepicker']);
$datepickerOptions['model'] = $this->model;
$datepickerOptions['attribute'] = $this->attribute;
$datepickerOptions['options'] = array_merge($this->inputOptions, $options);
$this->adjustLabelFor($datepickerOptions['options']);
$this->parts['{input}'] = DatePicker::widget($datepickerOptions);
return $this;
}
示例2: run
public function run()
{
if (!empty($this->between)) {
\yii\jui\DatePicker::widget(['model' => $this->model, 'attribute' => $this->between[0]]);
echo $this->form->field($this->model, $this->between[0], ['addon' => ['prepend' => ['content' => '<i class="glyphicon glyphicon-calendar"></i>'], 'groupOptions' => ['class' => 'col-sm-4']]])->textInput(['readonly' => 'readonly', 'placeholder' => "คลิกเลือก {$this->label[0]}"]);
\yii\jui\DatePicker::widget(['model' => $this->model, 'attribute' => $this->between[1]]);
echo $this->form->field($this->model, $this->between[1], ['addon' => ['prepend' => ['content' => '<i class="glyphicon glyphicon-calendar"></i>'], 'groupOptions' => ['class' => 'col-sm-4']]])->textInput(['readonly' => 'readonly', 'placeholder' => "คลิกเลือก {$this->label[1]}"]);
} else {
\yii\jui\DatePicker::widget(['model' => $this->model, 'attribute' => $this->attr]);
echo $this->form->field($this->model, $this->attr, ['addon' => ['prepend' => ['content' => '<i class="glyphicon glyphicon-calendar"></i>'], 'groupOptions' => ['class' => 'col-sm-4']]])->textInput(['readonly' => 'readonly', 'placeholder' => "คลิกเลือก {$this->label[0]}"]);
}
$this->js();
}
示例3: renderFilterCellContent
/**
* Renders the filter cell content.
* The default implementation simply renders a space.
* This method may be overridden to customize the rendering of the filter cell (if any).
* @return string the rendering result
*/
protected function renderFilterCellContent()
{
if (is_string($this->filter)) {
return $this->filter;
}
$model = $this->grid->filterModel;
if ($this->filter !== false && $this->attribute !== null && $model->isAttributeActive($this->attribute)) {
if ($model->hasErrors($this->attribute)) {
Html::addCssClass($this->filterOptions, 'has-error');
$error = ' ' . Html::error($model, $this->attribute, $this->grid->filterErrorOptions);
} else {
$error = '';
}
$filterOptions = ['=' => '=', '>' => '>', '<' => '<'];
Html::addCssClass($this->filterInputOptions, 'date-filter-input');
$dropDown = Html::activeDropDownList($model, $this->attribute . '_operand', $filterOptions, ['class' => 'form-control pull-left', 'style' => 'width: 32px; appearance: none; -moz-appearance: none; -webkit-appearance: none;']);
$field = DatePicker::widget(['model' => $model, 'attribute' => $this->attribute, 'options' => $this->filterInputOptions, 'dateFormat' => 'yyyy-MM-dd']);
return $dropDown . $field . $error;
} else {
return parent::renderFilterCellContent();
}
}
示例4: function
<div class="post-index">
<p>
<?php
echo Html::a('Создать запись', ['create'], ['class' => 'btn btn-success']);
?>
</p>
<?php
Pjax::begin();
?>
<?php
echo himiklab\sortablegrid\SortableGridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'id' => 'post_tbl', 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['class' => CheckboxColumn::classname()], ['attribute' => 'title', 'format' => 'html', 'value' => function ($model) {
return Html::a($model['title'], ['update', 'id' => $model['id']]);
}], ['attribute' => 'cat_id', 'content' => function ($data) {
return $data->getCategoryName();
}, 'filter' => \yii\helpers\Arrayhelper::map(\app\modules\category\models\Category::find()->all(), 'id', 'title')], ['attribute' => 'created_at', 'format' => ['date', 'dd.MM.yyyy'], 'options' => array('width' => '225px'), 'filter' => \yii\jui\DatePicker::widget(['dateFormat' => 'dd.MM.yyyy', 'model' => $searchModel, 'attribute' => 'created_at', 'options' => ['class' => 'form-control'], 'clientOptions' => ['dateFormat' => 'dd.mm.yy']])], ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) {
$class = $model->status === 1 ? '<i class="icon-ok"></i>' : '<i class="icon-lock">';
return $class;
}, 'options' => array('width' => '100px'), 'filter' => Html::activeDropDownList($searchModel, 'status', array(1 => 'On', 0 => 'Off'), ['class' => 'form-control', 'prompt' => 'Все'])], ['attribute' => 'main', 'format' => 'html', 'value' => function ($model) {
$res = $model->main === 1 ? '<i class="icon-ok"></i>' : '<i class="icon-minus">';
return $res;
}, 'options' => array('width' => '100px'), 'filter' => Html::activeDropDownList($searchModel, 'main', array(1 => 'Да', 0 => 'Нет'), ['class' => 'form-control', 'prompt' => 'Все'])], 'username', ['class' => 'yii\\grid\\ActionColumn', 'header' => 'Действия', 'headerOptions' => ['width' => '100']]]]);
?>
<p>
<?php
echo Html::a('Удалить выбранные', ['massdelete'], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Вы уверены?', 'data-method' => 'post']]);
?>
</p>
示例5: function
?>
<?php
echo $this->render('_menu');
?>
<?php
Pjax::begin();
?>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'layout' => "{items}\n{pager}", 'columns' => ['username', 'email:email', ['attribute' => 'registration_ip', 'value' => function ($model) {
return $model->registration_ip == null ? '<span class="not-set">' . Yii::t('user', '(not set)') . '</span>' : $model->registration_ip;
}, 'format' => 'html'], ['attribute' => 'created_at', 'value' => function ($model) {
return Yii::t('user', '{0, date, MMMM dd, YYYY HH:mm}', [$model->created_at]);
}, 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'created_at', 'dateFormat' => 'php:Y-m-d', 'options' => ['class' => 'form-control']])], ['header' => Yii::t('user', 'Confirmation'), 'value' => function ($model) {
if ($model->isConfirmed) {
return '<div class="text-center"><span class="text-success">' . Yii::t('user', 'Confirmed') . '</span></div>';
} else {
return Html::a(Yii::t('user', 'Confirm'), ['confirm', 'id' => $model->id], ['class' => 'btn btn-xs btn-success btn-block', 'data-method' => 'post', 'data-confirm' => Yii::t('user', 'Are you sure you want to confirm this user?')]);
}
}, 'format' => 'raw', 'visible' => Yii::$app->getModule('user')->enableConfirmation], ['header' => Yii::t('user', 'Block status'), 'value' => function ($model) {
if ($model->isBlocked) {
return Html::a(Yii::t('user', 'Unblock'), ['block', 'id' => $model->id], ['class' => 'btn btn-xs btn-success btn-block', 'data-method' => 'post', 'data-confirm' => Yii::t('user', 'Are you sure you want to unblock this user?')]);
} else {
return Html::a(Yii::t('user', 'Block'), ['block', 'id' => $model->id], ['class' => 'btn btn-xs btn-danger btn-block', 'data-method' => 'post', 'data-confirm' => Yii::t('user', 'Are you sure you want to block this user?')]);
}
}, 'format' => 'raw'], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}']]]);
?>
<?php
示例6:
<div class="subscriber-form">
<?php
$form = ActiveForm::begin(['id' => 'dynamic-form']);
?>
<?php
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'birth_date')->textInput();
?>
<!-- <?php
echo DatePicker::widget(['model' => $model, 'attribute' => 'birth_date', 'dateFormat' => 'yyyy-MM-dd']);
?>
-->
<?php
echo $form->field($model, 'notes')->textarea(['rows' => 6]);
?>
<div class="row">
<div class="panel panel-default">
<div class="panel-heading"><h4><i class="glyphicon glyphicon-envelope"></i> Phones</h4></div>
<div class="panel-body">
<?php
DynamicFormWidget::begin(['widgetContainer' => 'dynamicform_wrapper', 'widgetBody' => '.container-items', 'widgetItem' => '.item', 'limit' => 5, 'min' => 1, 'insertButton' => '.add-item', 'deleteButton' => '.remove-item', 'model' => $modelsPhone[0], 'formId' => 'dynamic-form', 'formFields' => ['number']]);
?>
示例7: empty
<?php
use yii\helpers\Url;
$id = \Yii::$app->controller->action->id;
$search_date = Yii::$app->request->get("search_date");
if (empty($url)) {
$url = '/visit/api.html?fc=totalvisit';
}
?>
<div class="panel-heading">
<div class="btn-toolbar" role="toolbar" aria-label="Toolbar with button groups">
<div class="btn-group pull-left">
<?php
echo \yii\jui\DatePicker::widget(['options' => ['class' => 'form-control datepicker', 'readonly' => true], 'attribute' => 'start_date', 'language' => 'zh-CN', 'dateFormat' => 'yyyy-MM-dd', 'value' => empty($search_date) ? date('Y-m-d') : $search_date, 'clientOptions' => ['minDate' => '2015-01-01', 'maxDate' => date("Y-m-d"), 'onSelect' => new \yii\web\JsExpression("function (dateText, inst) {\n var url = '" . $url . "&search_date='+ dateText;\n location.href = url;\n }")]]);
?>
</div>
</div>
</div>
示例8: function
?>
</h1>
<p>
<?php
echo Html::a('Создать Проект', ['create'], ['class' => 'btn btn-success']);
?>
</p>
<div class="row">
<div class="col-xs-3">
<div class="alert alert-warning" role="alert">В обработке</div>
</div>
<div class="col-xs-3">
<div class="alert alert-success">Одобрена/завершена</div>
</div>
</div>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'summary' => '', 'rowOptions' => function ($model, $index, $widget, $grid) {
return ['style' => 'background-color:' . $model->getColor() . ';'];
}, 'columns' => [['attribute' => 'id', 'value' => 'id', 'contentOptions' => ['style' => 'width: 50px;']], 'name', ['attribute' => 'status', 'format' => 'raw', 'value' => function ($data) {
return $data->getStatus();
}, 'filter' => R::PROJECT_STATUSES()], ['attribute' => 'deadline', 'value' => 'deadline', 'filter' => \yii\jui\DatePicker::widget(['model' => $searchModel, 'attribute' => 'deadline', 'language' => 'ru', 'dateFormat' => 'yyyy-MM-dd', 'options' => ['class' => 'form-control']]), 'format' => 'html'], ['attribute' => 'stages', 'format' => 'raw', 'value' => function ($data) {
return $data->getStagesName();
}], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view} {update} {done}', 'buttons' => ['done' => function ($url, $model, $key) {
$options = ['data-confirm' => Yii::t('yii', 'Вы действительно желаете завершить проект?'), 'data-method' => 'post', 'data-pjax' => '0'];
return Html::a('<span class="glyphicon glyphicon-ok"></span>', $url, $options);
}]]]]);
?>
</div>
示例9:
use yii\helpers\Html;
use yii\grid\GridView;
use yii\jui;
/* @var $this yii\web\View */
/* @var $searchModel app\models\search\UserSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('app', 'Users');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-index">
<h1><?php
echo Html::encode($this->title);
?>
</h1>
<?php
// echo $this->render('_search', ['model' => $searchModel]);
?>
<p>
<?php
echo Html::a(Yii::t('app', 'Create User'), ['create'], ['class' => 'btn btn-success']);
?>
</p>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'username', 'name', 'surname', ['attribute' => 'create_date', 'value' => 'create_date', 'filter' => \yii\jui\DatePicker::widget(['language' => 'ru', 'dateFormat' => 'dd-MM-yyyy']), 'format' => 'html'], ['class' => 'yii\\grid\\ActionColumn']]]);
?>
</div>
示例10: function
<div class="panel panel-default">
<?php
echo $this->render('common_top.php');
?>
<div class="panel-body">
<?php
Pjax::begin(['id' => 'countries']);
?>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn', 'headerOptions' => ['style' => 'width:80px;']], ['attribute' => 'ApplicationName', 'label' => '类型', 'value' => function ($model) {
return Html::encode($model->ApplicationId);
}], ['label' => '函数', 'filter' => Html::activeTextInput($searchModel, 'Method', ['class' => 'form-control']), 'format' => 'raw', 'value' => function ($model) {
return Html::encode($model->Method);
}], ['label' => '参数', 'filter' => Html::activeTextInput($searchModel, 'Parameter', ['class' => 'form-control']), 'format' => 'raw', 'value' => function ($model) {
return Html::encode($model->Parameter);
}], ['attribute' => 'start_date', 'label' => '开始时间', 'value' => 'AddDate', 'filter' => \yii\jui\DatePicker::widget(['model' => $searchModel, 'options' => ['style' => 'width:80px;'], 'attribute' => 'start_date', 'language' => 'zh-CN', 'dateFormat' => 'yyyy-MM-dd']), 'format' => 'html'], ['attribute' => 'end_date', 'label' => '结束时间', 'value' => 'AddDate', 'filter' => \yii\jui\DatePicker::widget(['model' => $searchModel, 'options' => ['style' => 'width:80px;'], 'attribute' => 'end_date', 'language' => 'zh-CN', 'dateFormat' => 'yyyy-MM-dd', 'value' => date('Y-m-d')]), 'format' => 'html'], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view}', 'buttons' => ['view' => function ($url, $model, $key) {
$options = ['title' => Yii::t('yii', 'View'), 'aria-label' => Yii::t('yii', 'View'), 'class' => 'show_model'];
$url = 'javascript:showDetaildiv("text' . $model->Id . '");';
return Html::textarea('text' . $model->Id, Html::encode($model->Content), ['style' => 'display:none;', 'id' => 'text' . $model->Id]) . Html::a('<button type="button" class="btn btn-sm btn-info">查看详情</button>', $url, $options);
}]]]]);
Pjax::end();
?>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
<?php
if (isset($params['TraceLogSearch']['Parameter']) && !empty($params['TraceLogSearch']['Parameter'])) {
示例11: function
?>
<div class="col-md-11">
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title"><?php
echo 'Pending Verification of Registered User';
?>
</h3>
</div>
<div class="box-body">
<?php
Pjax::begin();
?>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'username', 'auth_key', 'email:email', ['attribute' => 'created_at', 'value' => function ($data) {
return $data->created_at;
}, 'filter' => \yii\jui\DatePicker::widget(['dateFormat' => 'dd-MM-yyyy']), 'format' => ['date', 'php:d-m-Y H:i:s']], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view} {accept} {block}', 'buttons' => ['accept' => function ($url, $model) {
return Html::a('<span class="fa fa-check"></span>', $url, ['title' => Yii::t('app', 'Accept'), 'data-confirm' => Yii::t('app', "Apakah Anda yakin akan memberikan akses API kepada user " . $model->username . "?")]);
}, 'block' => function ($url, $model) {
return Html::a("<span class='fa fa-ban'></span>", $url, ['title' => Yii::t('app', 'Block'), 'data-confirm' => Yii::t('app', "Apakah Anda yakin akan menolak pendaftaran akses dengan username " . $model->username . "?")]);
}]]]]);
?>
<?php
Pjax::end();
?>
</div><!--box footer-->
</div><!--box-->
</div>
</div>
示例12: function
/* @var $searchModel \app\models\CardSearch */
use yii\grid\GridView;
use yii\helpers\Html;
use yii\jui\DatePicker;
use app\models\Card;
use app\models\Serial;
$this->title = 'Карты';
$this->params['breadcrumbs'][] = '';
$js = <<<JS
\$('.card-delete').on('click', function(event){
event.preventDefault();
var self = \$(this);
\$.post('/card/delete', {id:self.data('id')})
.done(function(data){
if (data.result==true) {
self.parents('tr').remove();
}
});
});
JS;
$this->registerJs($js);
?>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'layout' => '{items}{pager}', 'columns' => ['id', ['attribute' => 'serialSerial', 'value' => 'serial.serial'], 'number', ['attribute' => 'serialReleaseDate', 'value' => 'serial.release_date', 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'serialReleaseDate', 'options' => ['class' => 'form-control'], 'dateFormat' => 'yyyy-MM-dd'])], ['attribute' => 'end_date', 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'end_date', 'options' => ['class' => 'form-control'], 'dateFormat' => 'yyyy-MM-dd'])], ['attribute' => 'status', 'format' => 'raw', 'value' => function ($data) {
return Html::a($data->statusText, ['/card/update', 'id' => $data->id], ['class' => 'book-view']);
}, 'filter' => Html::activeDropDownList($searchModel, 'status', Card::getStatuses(), ['class' => 'form-control', 'prompt' => ''])], ['class' => \yii\grid\ActionColumn::class, 'header' => 'Действия', 'headerOptions' => ['width' => '150'], 'template' => '{view} {delete}', 'buttons' => ['delete' => function ($url, $model) {
return Html::a('Удалить', null, ['class' => 'card-delete', 'data-id' => $model->id]);
}, 'view' => function ($url, $model) {
return Html::a('Просмотр', $url, ['class' => 'book-view']);
}]]]]);
示例13: get_class
echo Html::a('PDF', ['export-data/export-to-pdf', 'model' => get_class($searchModel)], ['class' => 'btn btn-block btn-warning', 'target' => '_blank']);
?>
</div>
<div class="col-xs-4 left-padding">
<?php
echo Html::a('EXCEL', ['export-data/export-excel', 'model' => get_class($searchModel)], ['class' => 'btn btn-block btn-primary', 'target' => '_blank']);
?>
</div>
</div>
</div>
<div class="col-xs-12" style="padding-top: 10px;">
<div class="box">
<div class="box-header">
</div><!-- /.box-header -->
<div class="box-body table-responsive">
<div class="national-holidays-index">
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'summary' => '', 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'national_holiday_name', ['attribute' => 'national_holiday_date', 'value' => function ($data) {
return Yii::$app->formatter->asDate($data->national_holiday_date);
}, 'filter' => \yii\jui\DatePicker::widget(['model' => $searchModel, 'attribute' => 'national_holiday_date', 'clientOptions' => ['dateFormat' => 'dd-mm-yyyy', 'changeMonth' => true, 'changeYear' => true, 'defaultValue' => null, 'yearRange' => '1900:' . (date('Y') + 1), 'defaultDate' => null], 'options' => ['id' => 'national_holiday_date', 'value' => NULL, 'class' => 'form-control']]), 'format' => 'html'], 'national_holiday_remarks', ['class' => 'app\\components\\CustomActionColumn']]]);
?>
</div>
</div>
</div>
</div>
示例14:
<?php
$form = \yii\bootstrap\ActiveForm::begin(['layout' => 'horizontal']);
echo $form->field($book, 'title');
echo $form->field($book, 'author_id')->dropDownList(\yii\helpers\ArrayHelper::map($authors, 'id', 'fullName'));
?>
<div class="form-group field-book-date_created">
<label class="control-label col-sm-3" for="book-date_created">Дата выхода книги </label>
<div class="col-sm-6">
<?php
echo \yii\jui\DatePicker::widget(['model' => $book, 'attribute' => 'date_created', 'language' => 'ru', 'dateFormat' => 'yyyy-MM-dd']);
?>
</div>
</div>
<?php
echo $form->field($book, 'preview');
echo \yii\bootstrap\Button::widget(['label' => 'Создать', 'options' => ['class' => 'col-md-offset-3']]);
示例15:
?>
<br><br>
<h4> SHOPS REPORT ORDER IN TIME</h4><br>
<form action="" method="GET">
<table>
<tr>
<td>
<?php
echo yii\jui\DatePicker::widget(['name' => 'startDate', 'language' => 'es-UY', 'dateFormat' => 'dd-MM-yyyy', 'options' => ['placeholder' => 'Start Date ...']]);
?>
</td>
<td> </td>
<td>
<?php
echo yii\jui\DatePicker::widget(['name' => 'endDate', 'language' => 'es-UY', 'dateFormat' => 'dd-MM-yyyy', 'options' => ['placeholder' => 'End Date ...']]);
?>
</td>
<td> </td>
<td>
<select id="store-picker" name="storePicker" class="btn btn-sm dropdown-toggle">
<option value="0" selected>Choose Store...</option>
<?php
echo $stores;
?>
</select>
</td>
<td> </td>
<td>
<input class="btn btn-default btn-primary btn-sm" type='submit' value='Generate'/>