当前位置: 首页>>代码示例>>PHP>>正文


PHP DateControl::widget方法代码示例

本文整理汇总了PHP中kartik\datecontrol\DateControl::widget方法的典型用法代码示例。如果您正苦于以下问题:PHP DateControl::widget方法的具体用法?PHP DateControl::widget怎么用?PHP DateControl::widget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kartik\datecontrol\DateControl的用法示例。


在下文中一共展示了DateControl::widget方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getInputByType

 /**
  * Ham get html cho input theo type
  * @param string $type input co the la text, textarea, editor, date, datetime, daterange, dropdown, checkbox, radio
  * @param string $templateSetting giao dien input theo type
  * @param string $keySetting ten cua key setting
  * @param string $value gia tri cua key setting
  * @param array $items Mang cac gia tri cua setting neu setting co type la dropdown, checkbox, radio
  * @return string
  */
 private static function getInputByType($type = 'text', $templateSetting = null, $keySetting = null, $value = null, $items = [])
 {
     switch ($type) {
         case 'textarea':
             $templateSetting = Html::textarea($keySetting, $value, ['class' => 'form-control', 'title' => $keySetting]);
             break;
         case 'date':
             $templateSetting = DateControl::widget(['name' => $keySetting, 'value' => $value, 'type' => DateControl::FORMAT_DATE, 'ajaxConversion' => false, 'options' => ['pluginOptions' => ['autoclose' => true], 'options' => ['title' => $keySetting]], 'displayFormat' => 'dd-MM-yyyy', 'saveFormat' => 'yyyy-MM-dd']);
             break;
         case 'datetime':
             $templateSetting = DateControl::widget(['name' => $keySetting, 'value' => $value, 'type' => DateControl::FORMAT_DATETIME, 'ajaxConversion' => false, 'options' => ['pluginOptions' => ['autoclose' => true], 'options' => ['title' => $keySetting]], 'saveFormat' => 'yyyy-MM-dd']);
             break;
         case 'daterange':
             $templateSetting = DateRangePicker::widget(['name' => $keySetting, 'value' => $value, 'presetDropdown' => true, 'hideInput' => true, 'options' => ['title' => $keySetting]]);
             break;
         case 'dropdown':
             $templateSetting = Html::dropDownList($keySetting, $value, $items, ['class' => 'form-control', 'title' => $keySetting]);
             break;
         case 'checkbox':
             $templateSetting = Html::checkboxList($keySetting, $value, $items, ['class' => 'form-control', 'title' => $keySetting]);
             break;
         case 'radio':
             $templateSetting = Html::radioList($keySetting, $value, $items, ['class' => 'form-control', 'title' => $keySetting]);
             break;
         default:
             $templateSetting = Html::textInput($keySetting, $value, ['class' => 'form-control', 'title' => $keySetting]);
             break;
     }
     return $templateSetting;
 }
开发者ID:letyii,项目名称:yii2-diy,代码行数:39,代码来源:DiyWidget.php

示例2: function

echo Html::a('Create Posts', ['create'], ['class' => 'btn btn-success']);
?>
            </p>
            <?php 
$userModel = new $searchModel->module->userModel();
$user_items = \yii\helpers\ArrayHelper::map($userModel::find()->where('status = 10')->all(), 'id', 'username');
?>

            <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'id', 'contentOptions' => ['style' => 'width: 7%;']], ['attribute' => 'description', 'contentOptions' => ['style' => 'width: 15%;']], ['attribute' => 'category', 'value' => function ($model) {
    if ($model->category) {
        $category = Category::findOne(['id' => $model->category]);
        if ($category) {
            return $category->name;
        }
    }
}, 'contentOptions' => ['style' => 'width: 15%;'], 'filter' => TreeViewInput::widget(['model' => $searchModel, 'attribute' => 'category', 'showInactive' => true, 'query' => Category::find()->addOrderBy('root, lft'), 'headingOptions' => ['label' => 'Categories'], 'asDropdown' => true, 'multiple' => true, 'fontAwesome' => true, 'dropdownConfig' => ['dropdown' => ['style' => 'width:250px']], 'rootOptions' => ['label' => '<i class="fa fa-tree"></i>', 'class' => 'text-success']])], ['attribute' => 'user_created', 'value' => function ($model, $key, $index, $widget) {
    $userModel = new $model->module->userModel();
    return $userModel::findOne(['id' => $model->user_created])->{$model->module->userNameField};
}, 'format' => 'html', 'contentOptions' => ['style' => 'width: 10%;'], 'filter' => \yii\bootstrap\Html::activeDropDownList($searchModel, 'user_created', $user_items, ['class' => 'form-control', 'prompt' => 'Select...'])], ['attribute' => 'created_at', 'format' => ['date', 'php:d-m-Y'], 'filter' => DateControl::widget(['model' => $searchModel, 'attribute' => 'created_at', 'name' => 'kartik-date-1', 'value' => 'created_at', 'type' => DateControl::FORMAT_DATE, 'options' => ['layout' => '{picker}{input}']]), 'contentOptions' => ['style' => 'width: 12%;']], ['attribute' => 'user_last_change', 'value' => function ($model, $key, $index, $widget) {
    $userModel = new $model->module->userModel();
    return $userModel::findOne(['id' => $model->user_last_change])->{$model->module->userNameField};
}, 'format' => 'html', 'filter' => \yii\bootstrap\Html::activeDropDownList($searchModel, 'user_last_change', $user_items, ['class' => 'form-control', 'prompt' => 'Select...']), 'contentOptions' => ['style' => 'width: 10%;']], ['attribute' => 'updated_at', 'format' => ['date', 'php:d-m-Y'], 'filter' => DateControl::widget(['model' => $searchModel, 'attribute' => 'updated_at', 'name' => 'kartik-date-2', 'value' => 'updated_at', 'type' => DateControl::FORMAT_DATE, 'options' => ['layout' => '{picker}{input}']]), 'contentOptions' => ['style' => 'width: 10%;']], ['attribute' => 'publish', 'value' => function ($model, $key, $index, $widget) {
    return $model->publish == true ? '<span class="label label-success">Published</span>' : '<span class="label label-danger">Unpublished</span>';
}, 'format' => 'html', 'filter' => \yii\bootstrap\Html::activeDropDownList($searchModel, 'publish', ['0' => 'Unpublished', '1' => 'Published'], ['class' => 'form-control', 'prompt' => 'Select...']), 'contentOptions' => ['style' => 'width: 10%;']], ['class' => 'yii\\grid\\ActionColumn', 'contentOptions' => ['style' => 'min-width: 70px;']]]]);
?>

        </div>
    </div>
</div>
开发者ID:plathir,项目名称:yii2-smart-blog,代码行数:30,代码来源:index.php

示例3: function

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a(Yii::t('app', 'Create Comite'), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'nombre', ['attribute' => 'fecha_inicio', 'filter' => DateControl::widget(['name' => 'fecha_inicio', 'attribute' => 'fecha_inicio', 'model' => $searchModel, 'type' => DateControl::FORMAT_DATE])], ['attribute' => 'tipo', 'value' => function ($model) {
    return Categoria::findOne(['id' => $model->tipo])->nombre;
}, 'filter' => Select2::widget(['name' => 'tipo', 'attribute' => 'tipo', 'model' => $searchModel, 'data' => ArrayHelper::map(Categoria::find()->all(), 'id', 'nombre'), 'options' => ['placeholder' => 'Categoría'], 'pluginOptions' => ['allowClear' => true]])], ['attribute' => 'subtipo', 'value' => function ($model) {
    return Subcategoria::findOne(['id' => $model->subtipo])->nombre;
}, 'filter' => Select2::widget(['name' => 'subtipo', 'attribute' => 'subtipo', 'model' => $searchModel, 'data' => ArrayHelper::map(Subcategoria::find()->all(), 'id', 'nombre'), 'options' => ['placeholder' => 'Subcategoría'], 'pluginOptions' => ['allowClear' => true]])], ['attribute' => 'convocatoria', 'value' => function ($model) {
    if (!empty(Convocatoria::findOne(['id' => $model->convocatoria]))) {
        return Convocatoria::findOne(['id' => $model->convocatoria])->descripcion;
    } else {
        return "N/A";
    }
}, 'filter' => Select2::widget(['name' => 'convocatoria', 'attribute' => 'convocatoria', 'model' => $searchModel, 'data' => ArrayHelper::map(Convocatoria::find()->all(), 'id', 'nombre'), 'options' => ['placeholder' => 'Convocatoria'], 'pluginOptions' => ['allowClear' => true]])], 'observaciones:ntext', ['attribute' => '', 'format' => 'raw', 'value' => function ($model) {
    return Html::a('Proyectos', ['/faer/index2', 'id' => $model->id], ['class' => 'btn btn-success btn-xs', 'style' => 'border-radius:4px;']);
}], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
开发者ID:jcesarrc,项目名称:cobertura,代码行数:31,代码来源:index.php

示例4: function

<?php

use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use kartik\datecontrol\DateControl;
?>

<div class="vtoseguro-form">


	<?php 
//Yii::trace($vehiculos);
//echo Html::input('input','fecseguro',$fec,['id'=>'fecseguro']);
//Yii::trace($fec);
echo DateControl::widget(['name' => 'fecseguro', 'value' => $fec, 'type' => DateControl::FORMAT_DATE, 'options' => ['options' => ['id' => 'fecseguro']]]);
$Url = Yii::$app->urlManager->createUrl(['accesos/update-vto-seguro', 'idPersona' => $idPersona, 'fecseguro' => '']);
echo '<br/>';
echo '<div class="form-group">';
echo Html::a('<span class="btn btn-primary">Aceptar</span>', $Url, ['title' => Yii::t('app', 'Aceptar'), 'id' => 'btnUpdSeguro', 'onclick' => '
												var fecs=$("#fecseguro").val();
												//console.log(fecs);
												if (fecs === null) {
													return false;
												} else {										 
													$.ajax({
														type     :"POST",
														cache    : false,
														url      : $(this).attr("href")+fecs,
														success  : function(r) {
																	$("#divlistapersonas").html(r["ingpersonas"]);
																	$("#modalupdseguro").modal("hide");
开发者ID:ibergonzi,项目名称:country,代码行数:31,代码来源:_vtoseguro.php

示例5: date

		]
		],
		'displayFormat' => 'dd/MM/yyyy',
		'language'=>'pt',

])?>
</div>
      <div class="form-group datafimavaliacao">
          <?= Html::label("Até") ?>
    <?= DateControl::widget([
        'name'=>'datafimavaliacao',
       'value'=>(isset($datafim)) ? $datafim : date('Y-m-d'),
        'type'=>DateControl::FORMAT_DATE,
    'ajaxConversion'=>false,
		'options' => [

		'pluginOptions' => [
		'autoclose' => true
		]
		],
		'displayFormat' => 'dd/MM/yyyy',
		'language'=>'pt',
    ])
      ?>
          </div>
      <?= $form->field($modelProduto, 'groupbyavaliacao')->dropDownList(['DAY'=>'Dia','MONTH'=>'Mês','YEAR'=>'Ano']); ?>
      <div class="form-group">
        <?= Html::submitButton('Gerar gráfico <i class="fa fa-line-chart"></i>', ['class' =>  'btn btn-primary btn-block',
            'title' => 'Clique para gerar gráfico da avaliação do Prouto Venda']) ?>
      </div>
      <?php ActiveForm::end(); ?>
开发者ID:aryangomes,项目名称:applanchonete,代码行数:31,代码来源:avaliacaoproduto.php


注:本文中的kartik\datecontrol\DateControl::widget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。