本文整理汇总了PHP中yii\jui\DatePicker类的典型用法代码示例。如果您正苦于以下问题:PHP DatePicker类的具体用法?PHP DatePicker怎么用?PHP DatePicker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DatePicker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderInput
/**
* Формирование Html кода поля для вывода в форме
* @param ActiveForm $form объект форма
* @param array $options массив html атрибутов поля
* @param bool|int $index инднкс модели при табличном вводе
* @return string
*/
public function renderInput(ActiveForm $form, array $options = [], $index = false)
{
$options = ArrayHelper::merge($this->options, $options);
$widgetOptions = ArrayHelper::merge(["options" => ["class" => "form-control"]], $this->widgetOptions, ["options" => $options]);
$fieldOptions = ["options" => ["class" => "form-group col-xs-6"]];
$html = Html::beginTag('div', ['class' => 'row']);
$html .= $form->field($this->modelField->model, $this->fromAttr, $fieldOptions)->widget(DatePicker::className(), $widgetOptions);
$html .= $form->field($this->modelField->model, $this->toAttr, $fieldOptions)->widget(DatePicker::className(), $widgetOptions);
$html .= Html::endTag('div');
return $html;
}
示例2: renderWidget
/**
* Renders the DatePicker widget.
* @return string the rendering result.
*/
protected function renderWidget()
{
if ($this->hasModel()) {
$this->model->{$this->attribute} = $this->model->{$this->attribute} ? Yii::$app->formatter->asDate($this->model->{$this->attribute}, 'medium') : null;
}
return parent::renderWidget();
}
示例3: 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;
}
示例4: 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();
}
示例5: editAttribute
/**
* @param $model - profile model
* @param $field - profile fields model item
* @param $htmlOptions - htmlOptions
* @return string
*/
public function editAttribute($model, $field, $htmlOptions = [])
{
if (!isset($htmlOptions['size'])) {
$htmlOptions['size'] = 60;
}
if (!isset($htmlOptions['maxlength'])) {
$htmlOptions['maxlength'] = $field->field_size ? $field->field_size : 10;
}
if (!isset($htmlOptions['id'])) {
$htmlOptions['id'] = get_class($model) . '_' . $field->varname;
}
// $this->params['dateFormat'] = 'yy-mm-dd';
$this->params['options']['class'] = 'form-control';
/** @var $afield ActiveForm*/
$field = $htmlOptions['formField'];
unset($htmlOptions['formField']);
return $field->widget(DatePicker::className(), $this->params);
}
示例6: 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();
}
}
示例7: date
<div class="col-xs-12 col-sm-4 col-lg-4">
<?php
echo $form->field($model, 'fees_pay_tran_bank_id')->dropDownList(ArrayHelper::map(app\modules\fees\models\BankMaster::find()->where(['is_status' => 0])->all(), 'bank_master_id', 'bank_master_name'), ['prompt' => 'Select Bank']);
?>
</div>
<div class="col-xs-12 col-sm-4 col-lg-4">
<?php
echo $form->field($model, 'fees_pay_tran_bank_branch')->textInput(['placeholder' => $model->getAttributeLabel('fees_pay_tran_bank_branch')]);
?>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-lg-12 no-padding cheque-data">
<div class="col-xs-12 col-sm-4 col-lg-4">
<?php
echo $form->field($model, 'fees_pay_tran_cheque_date')->widget(yii\jui\DatePicker::className(), ['model' => $model, 'attribute' => 'fees_pay_tran_cheque_date', 'clientOptions' => ['dateFormat' => 'dd-mm-yyyy', 'changeMonth' => true, 'yearRange' => date('Y') - 5 . ':' . (date('Y') + 5), 'changeYear' => true, 'readOnly' => true, 'autoSize' => true, 'buttonImage' => Yii::$app->homeUrl . "images/calendar.png"], 'options' => ['class' => 'form-control', 'placeholder' => $model->getAttributeLabel('fees_pay_tran_cheque_date')]]);
?>
</div>
<div class="col-xs-12 col-sm-4 col-lg-4"></div>
<div class="col-xs-12 col-sm-4 col-lg-4"></div>
</div>
<!--End cheque related field-->
</div><!---End box-body div---->
<div class="box-footer">
<div class="<?php
echo Yii::$app->language == 'ar' ? 'pull-left' : 'pull-right';
?>
" style="padding-bottom:10px">
<?php
if ($collectOn) {
示例8: 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>
示例9:
$form = ActiveForm::begin();
?>
<?php
foreach ($modelGS as $key => $gs) {
?>
<div class="panel panel-primary">
<div class="panel-heading">
<?php
echo 'Семестр : ' . $gs->semester_number;
?>
</div>
<div class="panel-body">
<?php
echo $form->field($gs, "[{$key}]begin_date")->widget(DatePicker::className(), ['options' => ['class' => 'form-control'], 'dateFormat' => 'dd-MM-yyyy', 'language' => 'ru']);
echo $form->field($gs, "[{$key}]end_date")->widget(DatePicker::className(), ['options' => ['class' => 'form-control'], 'dateFormat' => 'dd-MM-yyyy', 'language' => 'ru']);
?>
</div>
</div>
<?php
}
?>
<div class="form-group">
<?php
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>
<?php
示例10:
echo $form->field($model, 'author_id')->dropDownList(ArrayHelper::map(Authors::find()->all(), 'id', 'Name'), ['prompt' => '---']);
?>
</div>
<div class="col-md-4">
<?php
echo $form->field($model, 'name');
?>
</div>
</div>
<div class="row">
<div class="col-md-6">
Дата выхода от: <?php
echo DatePicker::widget(['model' => $model, 'attribute' => 'date_ot', 'language' => 'ru', 'dateFormat' => 'yyyy-MM-dd']);
?>
до <?php
echo DatePicker::widget(['model' => $model, 'attribute' => 'date_do', 'language' => 'ru', 'dateFormat' => 'yyyy-MM-dd']);
?>
</div>
</div>
<div class="row">
<div class="col-md-4">
<?php
echo Html::submitButton('Поиск', ['class' => 'btn btn-primary']);
?>
</div>
</div>
<?php
ActiveForm::end();
?>
示例11: DateTime
?>
<?php
echo $form->field($model, 'chistota')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'masa_1000')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'klass')->textInput();
?>
<?php
echo $form->field($model, 'date_doc')->widget(DatePicker::classname(), ['value' => $model->date_doc ? $model->date_doc : (new DateTime())->format('Y-m-d'), 'dateFormat' => 'php:Y-m-d', 'options' => ['class' => 'form-control']]);
?>
<?php
echo $form->field($model, 'id_type')->dropDownList(ArrayHelper::map(TestType::find()->orderBy(['order' => SORT_ASC])->all(), 'id', 'type'))->label(Yii::t('test-type', 'Type'));
?>
<?php
echo $form->field($model, 'N_prev')->textInput();
?>
<?php
echo $form->field($model, 'v_rahunok')->textInput();
?>
<div class="form-group">
示例12:
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>
示例13: Participant
<!-- Modal -->
<div class="modal fade" id="appointModal" tabindex="-1" role="dialog" aria-labelledby="consentModal">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Change appointment date</h4>
</div>
<div class="modal-body">
<?php
$model = new Participant();
?>
<?php
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'appoint_date')->widget(DatePicker::className(), ['dateFormat' => 'yyyy-MM-dd', 'options' => ['class' => 'form-control'], 'clientOptions' => ['changeMonth' => true, 'changeYear' => true, 'minDate' => 'today']]);
?>
</div>
<div class="modal-footer">
<input type="hidden" value="" id="idparticipant2" />
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" onClick="updateAppoint()">Submit</button>
</div>
</div>
</div>
</div>
示例14:
<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']]);
?>
示例15:
echo $form->field($model, 'ampur')->widget(DepDrop::className(), ['data' => $amp, 'options' => ['placeholder' => '<--คลิกเลือกอำเภอ-->'], 'type' => DepDrop::TYPE_SELECT2, 'select2Options' => ['pluginOptions' => ['allowClear' => true]], 'pluginOptions' => ['depends' => ['employees-chw'], 'url' => yii\helpers\Url::to(['/employees/get-amp']), 'loadingText' => 'กำลังค้นข้อมูล...']]);
?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3">
<?php
echo $form->field($model, 'tumbon')->widget(DepDrop::className(), ['data' => $tum, 'options' => ['placeholder' => '<--คลิกเลือกตำบล-->'], 'type' => DepDrop::TYPE_SELECT2, 'select2Options' => ['pluginOptions' => ['allowClear' => true]], 'pluginOptions' => ['depends' => ['employees-chw', 'employees-ampur'], 'url' => yii\helpers\Url::to(['/employees/get-dist']), 'loadingText' => 'กำลังค้นข้อมูล...']]);
?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3">
<?php
echo $form->field($model, 'tel')->widget(\yii\widgets\MaskedInput::classname(), ['mask' => '999-999-9999']);
?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3">
<?php
echo $form->field($model, 'comein')->widget(DatePicker::className(), ['language' => 'th', 'dateFormat' => 'yyyy-MM-dd', 'clientOptions' => ['changeMonth' => true, 'changeYear' => true], 'options' => ['class' => 'form-control']]);
?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3">
<?php
echo $form->field($model, 'department_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Departments::find()->all(), 'id', 'name'), 'language' => 'th', 'options' => ['placeholder' => 'เลือกแผนก ...'], 'pluginOptions' => ['allowClear' => true]]);
?>
</div>
<div class="col-xs-3 col-sm-3 col-md-3">
<?php
echo $form->field($model, 'education')->dropDownList(['ปริณญาตรี' => 'ปริณญาตรี', 'ปริณญาโท' => 'ปริณญาโท', 'สูงกว่าระดับปริณญาโทขึ้นไป' => 'สูงกว่าระดับปริณญาโทขึ้นไป', 'ปวส/อนุปริณญา' => 'ปวส/อนุปริณญา', 'มัธยมศึกษา6' => 'มัธยมศึกษา6', 'มัธยมศึกษา3' => 'มัธยมศึกษา3', 'ประถมศึกษา' => 'ประถมศึกษา'], ['prompt' => '']);
?>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-6col-md-6">