本文整理汇总了PHP中common\models\Category::getDropdownList方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::getDropdownList方法的具体用法?PHP Category::getDropdownList怎么用?PHP Category::getDropdownList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common\models\Category
的用法示例。
在下文中一共展示了Category::getDropdownList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
echo $form->field($model, 'content')->textarea(['name' => $directPopulating ? 'content' : null, 'rows' => 25]);
?>
</div>
<div class="col-sm-3">
<?php
echo $form->field($model, 'city_id')->dropDownList(City::getList(), ['name' => $directPopulating ? 'city_id' : null, 'class' => 'form-control input-sm']);
?>
<?php
echo $form->field($model, 'type')->dropDownList(Advert::getTypesDropDownList(), ['name' => $directPopulating ? 'type' : null, 'class' => 'form-control input-sm']);
?>
<?php
echo $form->field($model, 'category')->dropDownList(Category::getDropdownList(), ['name' => $directPopulating ? 'category' : null, 'class' => 'form-control input-sm']);
?>
<?php
/*echo $form->field($model, 'term')->datepicker([
'name' => ($directPopulating) ? 'term' : null,
'datepicker' => [
'language' => 'ru',
'dateFormat' => 'dd.MM.yyyy'
]
])*/
?>
<!--<div class="row">
<div class="col-sm-offset-3 col-sm-6">
<?php
示例2:
<!-- Advert form -->
<?php
$form = ActiveForm::begin(['id' => 'advert-form', 'enableClientValidation' => true, 'enableAjaxValidation' => true, 'validateOnBlur' => true, 'validationUrl' => Url::to(['validate', 'id' => $model->id]), 'fieldConfig' => ['template' => "{label}{input}"], 'clientEvents' => ['ajaxSubmitSuccess' => "function(data) {\n \$('a[data-update], a[data-view]').magnificPopup('close');\n return false;\n}"]]);
?>
<div class="left">
<?php
echo $form->field($model, 'city_id')->dropDownList(City::getList(), ['name' => $directPopulating ? 'city_id' : null, 'label' => 'City', 'emptyItem' => Yii::t('app', 'Empty city option')]);
?>
<?php
echo $form->field($model, 'type', [])->dropDownList(Advert::getTypesDropDownList(), ['name' => $directPopulating ? 'type' : null, 'emptyItem' => Yii::t('app', 'Empty type option')]);
?>
<?php
echo $form->field($model, 'category')->dropDownList(Category::getDropdownList(), ['name' => $directPopulating ? 'category' : null, 'emptyItem' => Yii::t('app', 'Empty category option')]);
?>
<?php
echo $form->field($model, 'term', ['template' => '{label}{input}'])->datepicker(['name' => $directPopulating ? 'term' : null, 'datepicker' => ['dateFormat' => Yii::$app->formatter->dateFormat, 'clientOptions' => ['maxDate' => "+1m", 'minDate' => "+1d", 'monthNamesShort' => DatepickerHelper::monthNamesShort()]]]);
?>
<div class="range">
<label class="control-label" for="min_price"><?php
echo Yii::t('app', 'Price');
?>
</label>
<br>
<?php
Spaceless::begin();
?>
示例3: function
</div>
<div class="col-sm-4 text-right">
' . WidgetPageSize::widget(['pjaxId' => 'advert-grid-pjax']) . '
</div>
</div>
{items}
<div class="row">
<div class="col-sm-8">
{pager}
</div>
<div class="col-sm-4 text-right" style="padding-top: 20px">
' . GridBulkActions::widget(['gridId' => 'user-grid']) . '
</div>
</div>', 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'options' => ['style' => 'width:10px']], ['class' => 'yii\\grid\\SerialColumn', 'options' => ['style' => 'width:10px']], ['attribute' => 'id', 'header' => '№', 'filterInputOptions' => ['class' => 'form-control input-sm']], ['attribute' => 'content', 'format' => 'raw', 'contentOptions' => ['style' => 'text-align: left'], 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'roman444uk\\yii\\grid\\AjaxUpdateColumn', 'attribute' => 'status', 'fieldType' => AjaxUpdateColumn::FIELD_TYPE_DROPDOWN, 'fieldOptions' => ['class' => 'form-control input-sm', 'items' => Advert::getTranslatedStatusList()], 'filter' => Advert::getTranslatedStatusList(), 'filterInputOptions' => ['class' => 'form-control input-sm'], 'updateUrl' => function ($model, $key, $index) {
return Yii::$app->urlManager->createUrl(['advert/update', 'id' => $key]);
}, 'errorUpdate' => new JsExpression("function() {\n alert('error updating');\n }")], ['class' => 'roman444uk\\yii\\grid\\AjaxUpdateColumn', 'attribute' => 'category', 'fieldType' => AjaxUpdateColumn::FIELD_TYPE_DROPDOWN, 'fieldOptions' => ['class' => 'form-control input-sm', 'items' => Category::getDropdownList()], 'filter' => Category::getDropdownList(), 'filterInputOptions' => ['class' => 'form-control input-sm'], 'updateUrl' => function ($model, $key, $index) {
return Yii::$app->urlManager->createUrl(['advert/update', 'id' => $key]);
}, 'errorUpdate' => new JsExpression("function() {\n alert('error updating');\n }")], ['attribute' => 'city_id', 'header' => 'Город', 'value' => function ($model, $key, $index) {
return $model->cityName;
}, 'filter' => City::getList(), 'filterInputOptions' => ['class' => 'form-control input-sm'], 'format' => 'raw'], ['class' => 'yii\\grid\\DataColumn', 'attribute' => 'created_at', 'header' => 'Добавлено', 'format' => 'datetime', 'filter' => City::getList(), 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'yii\\grid\\DataColumn', 'attribute' => 'updated_at', 'header' => 'Обновлено', 'format' => 'datetime', 'filter' => City::getList(), 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'roman444uk\\yii\\grid\\StatusColumn', 'attribute' => 'published', 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'roman444uk\\yii\\grid\\StatusColumn', 'attribute' => 'is_foreign', 'header' => 'Из сервиса', 'filter' => ['Да', 'Нет'], 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'roman444uk\\yii\\grid\\ViewColumn', 'view' => '@backend/views/advert/_advert_grid_column', 'options' => ['style' => 'width:70px']], ['class' => 'yii\\grid\\ActionColumn', 'contentOptions' => ['style' => 'width:30px; text-align:center;'], 'buttons' => ['view' => function ($url, $model, $key) {
return Html::a('<span class="glyphicon glyphicon-eye-open"></span><br>', $url, ['title' => Yii::t('yii', 'View'), 'data-pjax' => 0, 'data-view' => $key]);
}, 'update' => function ($url, $model, $key) {
return Html::a('<span class="glyphicon glyphicon-pencil"></span><br>', $url, ['title' => Yii::t('yii', 'Update'), 'data-pjax' => 0, 'data-update' => $key]);
}]]]]);
?>
<?php
Pjax::end();
?>
<?php