本文整理汇总了PHP中yii\bootstrap\Html::activeDropDownList方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::activeDropDownList方法的具体用法?PHP Html::activeDropDownList怎么用?PHP Html::activeDropDownList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\bootstrap\Html
的用法示例。
在下文中一共展示了Html::activeDropDownList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderDropdown
private function renderDropdown()
{
if ($this->hasModel()) {
echo Html::activeDropDownList($this->model, $this->attribute, $this->getItems(), $this->options);
} else {
echo Html::dropDownList($this->name, $this->value, $this->getItems(), $this->options);
}
}
示例2: defaultColumns
public static function defaultColumns()
{
return ['zone' => ['class' => MainColumn::className(), 'label' => Yii::t('hipanel:dns', 'Zone'), 'attribute' => 'name'], 'domain' => ['class' => MainColumn::className(), 'filterAttribute' => 'domain_like'], 'idn' => ['class' => MainColumn::className(), 'filterAttribute' => 'idn_like'], 'actions' => ['class' => MenuColumn::class, 'menuClass' => DnsActionsMenu::class], 'nss' => ['format' => 'raw', 'attribute' => 'nss_like', 'label' => Yii::t('hipanel:dns', 'NS servers'), 'value' => function ($model) {
return ArraySpoiler::widget(['data' => $model->nss]);
}], 'dns_on' => ['format' => 'raw', 'filter' => function ($column, $model, $attribute) {
return Html::activeDropDownList($model, $attribute, ['' => Yii::t('hipanel:dns', '---'), '1' => Yii::t('hipanel:dns', 'Enabled'), '0' => Yii::t('hipanel:dns', 'Disabled')], ['class' => 'form-control']);
}, 'value' => function ($model) {
return Label::widget(['color' => $model->dns_on ? 'success' : '', 'label' => $model->dns_on ? Yii::t('hipanel:dns', 'Enabled') : Yii::t('hipanel:dns', 'Disabled'), 'labelOptions' => ['title' => Yii::t('hipanel:dns', 'Means that the panel will publish DNS records on the NS servers')]]);
}], 'bound_to' => ['format' => 'raw', 'label' => Yii::t('hipanel:dns', 'Bound to'), 'value' => function ($model) {
if (Yii::getAlias('@domain') !== null && $model->is_reg_domain) {
return Html::a(Yii::t('hipanel:dns', 'Registered domain'), ['@domain/view', 'id' => $model->id]);
} elseif ($model->server_id) {
return Html::a($model->account . '@' . $model->server, ['@hdomain/view', 'id' => $model->id]);
} else {
return Yii::$app->formatter->nullDisplay;
}
}]];
}
示例3: renderInput
/**
* @return string render input
*/
protected function renderInput()
{
$input = Html::dropDownList($this->name, $this->selected, $this->items, $this->options);
// If use form model then $input use active input
if ($this->hasModel()) {
$input = Html::activeDropDownList($this->model, $this->attribute . '[status]', $this->items, $this->options);
}
$input .= Html::beginTag('div', ['id' => 'status_payment', 'style' => 'margin-top: 20px;']);
foreach ($this->columns as $status => $item) {
$input .= Html::beginTag('div', ['class' => 'status_payment', 'id' => 'status_payment_' . $status, 'style' => 'display: none']);
foreach ($item as $name => $info) {
$placeholder = isset($info['placeholder']) ? $info['placeholder'] : null;
$value = isset($info['value']) ? $info['value'] : null;
$input .= Html::activeInput('text', $this->model, $this->attribute . '[infomation][' . $name . ']', ['placeholder' => $placeholder, 'class' => $this->options['columnClass'], 'readonly' => '', 'value' => $value, 'style' => 'margin-top: 20px;']);
}
$input .= Html::endTag('div');
}
$input .= Html::endTag('div');
return $input;
}
示例4: 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>
示例5: array
use yii\widgets\Pjax;
use meican\base\grid\Grid;
use meican\base\grid\IcheckboxColumn;
use meican\base\grid\GridButtons;
\meican\topology\assets\network\Index::register($this);
$this->params['header'] = [Yii::t('topology', 'Networks'), [Yii::t('home', 'Home'), Yii::t('topology', 'Topology'), 'Networks']];
?>
<div class="box box-default">
<div class="box-header with-border">
<?php
echo GridButtons::widget();
?>
</div>
<div class="box-body">
<?php
$form = ActiveForm::begin(['method' => 'post', 'action' => ['delete'], 'id' => 'network-form', 'enableClientScript' => false, 'enableClientValidation' => false]);
Pjax::begin();
echo Grid::widget(['dataProvider' => $networks, 'filterModel' => $searchModel, 'id' => 'gridNetowrks', 'columns' => array(['class' => IcheckboxColumn::className(), 'name' => 'delete', 'multiple' => false, 'headerOptions' => ['style' => 'width: 2%;']], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update}', 'buttons' => ['update' => function ($url, $model) {
return Html::a('<span class="fa fa-pencil"></span>', $url);
}], 'headerOptions' => ['style' => 'width: 2%;']], ['label' => Yii::t("topology", 'Name'), 'value' => 'name', 'headerOptions' => ['style' => 'width: 25%;']], ['label' => Yii::t("topology", 'Urn'), 'value' => 'urn', 'headerOptions' => ['style' => 'width: 30%;']], ['label' => Yii::t("topology", 'Latitude'), 'value' => 'latitude', 'headerOptions' => ['style' => 'width: 8%;']], ['label' => Yii::t("topology", 'Longitude'), 'value' => 'longitude', 'headerOptions' => ['style' => 'width: 8%;']], ['label' => Yii::t("topology", 'Domain'), 'value' => function ($net) {
return $net->getDomain()->one()->name;
}, 'filter' => Html::activeDropDownList($searchModel, 'domain_name', ArrayHelper::map($allowedDomains, 'name', 'name'), ['class' => 'form-control', 'prompt' => Yii::t("topology", 'any')]), 'headerOptions' => ['style' => 'width: 25%;']])]);
Pjax::end();
ActiveForm::end();
?>
</div>
</div>
示例6: function
</div>
<div class="panel-body">
<div class="user-account-index">
<p>
<?php
echo Html::a(Yii::t('app', 'Create User'), ['create'], ['class' => 'btn btn-success']);
?>
<?php
echo Html::a(Yii::t('app', 'Settings'), ['/user/settings'], ['class' => 'btn btn-success']);
?>
</p>
<?php
?>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['header' => 'Image', 'format' => 'raw', 'value' => function ($model, $key, $index, $grid) {
return Html::img(UserHelper::getProfileImage($model->id, $this), ['alt' => '...', 'class' => 'img-circle', 'width' => '30', 'align' => 'center']);
}], 'id', 'username', ['format' => 'raw', 'value' => function ($model, $key, $index, $grid) {
return Html::decode(UserHelper::getProfileFullName($model->id));
}], 'email', ['attribute' => 'status', 'value' => function ($model, $key, $index, $widget) {
return $model->status == true ? '<span class="label label-success">Active</span>' : '<span class="label label-danger">Inactive</span>';
}, 'format' => 'html', 'filter' => \yii\bootstrap\Html::activeDropDownList($searchModel, 'status', ['0' => 'Inactive', '10' => 'Active'], ['class' => 'form-control', 'prompt' => 'Select...']), 'contentOptions' => ['style' => 'width: 10%;']], 'created_at:datetime', 'updated_at:datetime', ['class' => 'yii\\grid\\ActionColumn', 'contentOptions' => ['style' => 'min-width: 70px;']]]]);
?>
</div>
</div>
</div>
示例7: function
use yii\grid\GridView;
use yii\grid\SerialColumn;
use yii\web\View;
/* @var $this View */
/* @var $model UserSearch */
/* @var $dataProvider ActiveDataProvider */
?>
<h1>
<?php
echo Yii::t('user', 'Users list');
?>
<?php
if (Yii::$app->user->can('createUser')) {
?>
<?php
echo Html::a(Yii::t('user', 'Create'), ['create'], ['class' => 'btn btn-primary']);
?>
<?php
}
?>
</h1>
<?php
print GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $model, 'columns' => ['id', 'name', ['attribute' => 'email', 'value' => function ($data) {
/* @var $data User */
return Yii::$app->user->can('updateUser') || Yii::$app->user->can('deleteUser') ? Html::a(Html::encode($data->email), ['update', 'id' => $data->id]) : $data->email;
}, 'format' => 'html'], ['attribute' => 'status', 'value' => function ($data) {
/* @var $data User */
return $data->getStatusName();
}, 'filter' => Html::activeDropDownList($model, 'status', $model->getStatuses(), ['class' => 'form-control'])], ['class' => ActionColumn::className(), 'template' => Yii::$app->user->can('updateUser') || Yii::$app->user->can('deleteUser') ? '{update}' : '']]]);
示例8: function
<div class="posts-index">
<?php
echo Tabs::widget(['items' => [['label' => 'Category Tree Admin', 'content' => '<br>' . TreeView::widget(['query' => \plathir\smartblog\backend\models\Categorytree::find()->addOrderBy('root, lft'), 'headingOptions' => ['label' => 'Categories'], 'isAdmin' => true, 'displayValue' => 1, 'softDelete' => true, 'showInactive' => true, 'cacheSettings' => ['enableCache' => false]])], ['label' => 'Extra fields', 'content' => '<br>' . GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['header' => 'Name', 'format' => 'html', 'value' => function ($model, $key, $index, $grid) {
$lvlVal = '';
for ($x = 0; $x < $model->lvl; $x++) {
if ($x == 0) {
$lvlVal .= str_repeat(' ', 5);
}
$lvlVal .= '<span class="glyphicon glyphicon-minus" aria-hidden="true"></span>';
}
if ($lvlVal == '') {
$lvlVal .= '<span class="glyphicon glyphicon-tree-conifer" aria-hidden="true"></span>';
$lvlVal .= $model->name;
} else {
$lvlVal .= '<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>' . $model->name;
}
return $lvlVal;
}], 'id', ['attribute' => 'active', 'value' => function ($model, $key, $index, $widget) {
return $model->active == true ? '<span class="label label-success">Active</span>' : '<span class="label label-danger">Inactive</span>';
}, 'format' => 'html', 'filter' => \yii\bootstrap\Html::activeDropDownList($searchModel, 'active', ['0' => 'Inactive', '1' => 'Active'], ['class' => 'form-control', 'prompt' => 'Select...']), 'contentOptions' => ['style' => 'width: 10%;']], 'description', ['header' => 'Image', 'format' => 'raw', 'value' => function ($model, $key, $index, $grid) {
if ($model->image) {
// return $model->module->CategoryImagePathPreview . '/' . $model->id . '/' . $model->image;
return Html::img($model->module->CategoryImagePathPreview . '/' . $model->id . '/' . $model->image, ['alt' => '...', 'width' => '50', 'align' => 'center']);
} else {
return '';
}
}], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update}']]])]]]);
?>
</div>
</div>
</div>
示例9:
return '<label class="btn btn-default">' . Html::radio($name, $checked, ['value' => $value]) . $label . '</label>';
}]);
?>
</div>
<div class="col-lg-12">
<hr>
</div>
<div class="col-lg-4">
<?php
echo \Yii::t('app', 'OBSERVED PROPERTY');
?>
</div>
<div class="col-lg-8">
<?php
echo Html::activeDropDownList($model, 'property', ['Observation 1' => 'Observation 1', 'Observation 2' => 'Observation 2', 'Observation 3' => 'Observation 3', 'Observation 4' => 'Observation 4']);
?>
</div>
<div class="col-lg-12">
<hr>
</div>
<div class="col-lg-4">
<?php
echo \Yii::t('app', 'SENSOR ADMIN MAIL');
?>
<br /><?php
echo \Yii::t('app', 'Who will be uploading data?');
?>
</div>
示例10: run
public function run()
{
$items = $this->getItems();
$options = array_merge(['class' => 'form-control', 'encodeSpaces' => true, 'prompt' => '---Не выбрана---', 'options' => $this->disabledItems], $this->options);
return Html::activeDropDownList($this->model, $this->attribute, $items, $options);
}
示例11: array
<h3 class="box-title"><?php
echo Yii::t("topology", "Discovered changes");
?>
</h3>
<div class="box-tools">
<button class="btn btn-sm btn-default" id="apply-all">Apply all changes</button>
</div>
</div>
<div class="box-body">
<?php
Pjax::begin(['id' => 'change-pjax']);
echo Grid::widget(['id' => 'change-grid', 'filterModel' => $searchChange, 'dataProvider' => $changeProvider, 'columns' => array(['class' => 'yii\\grid\\ActionColumn', 'template' => '{apply}', 'buttons' => ['apply' => function ($url, $model) {
return $model->status == Change::STATUS_APPLIED ? "" : Html::a('<span class="fa fa-check apply-btn"></span>', '#');
}], 'headerOptions' => ['style' => 'width: 2%;']], ['attribute' => 'domain', 'filter' => Html::activeDropDownList($searchChange, 'domain', ArrayHelper::map(Change::find()->where(['status' => Change::STATUS_PENDING])->asArray()->select("domain")->distinct(true)->orderBy("domain ASC")->all(), 'domain', 'domain'), ['class' => 'form-control', 'prompt' => 'any']), 'headerOptions' => ['style' => 'width: 16%;']], ['header' => Yii::t('topology', 'Type'), 'value' => function ($model) {
return $model->getType();
}, 'filter' => Html::activeDropDownList($searchChange, 'type', ArrayHelper::map(Change::getTypes(), 'id', 'name'), ['class' => 'form-control', 'prompt' => 'any']), 'headerOptions' => ['style' => 'width: 7%;']], ['attribute' => 'item_type', 'filter' => Html::activeDropDownList($searchChange, 'item_type', ArrayHelper::map(Change::getItemTypes(), 'id', 'name'), ['class' => 'form-control', 'prompt' => 'any']), 'value' => function ($model) {
return $model->getItemType();
}, 'headerOptions' => ['style' => 'width: 12%;']], ['attribute' => 'data', 'filter' => false, 'format' => 'raw', 'value' => function ($model) {
return $model->getDetails();
}, 'headerOptions' => ['style' => 'width: 30%;']], ['header' => 'Status', 'filter' => false, 'format' => 'raw', 'value' => function ($model) {
switch ($model->status) {
case Change::STATUS_FAILED:
return '<a href="#" title="' . $model->error . '"><span class="label label-danger">Failed</span></a>';
case Change::STATUS_APPLIED:
return '<span class="label label-success">Applied</span>';
case Change::STATUS_PENDING:
return '<span class="label label-primary">Pending</span>';
default:
return "";
}
}, 'headerOptions' => ['style' => 'width: 5%;']])]);
示例12:
<?php
echo Html::activeDropDownList($model, 'catchmentid', ArrayHelper::map(Catchment::find()->all(), 'id', 'name'));
?>
</div>
<div class="col-sm-12">
<hr>
</div>
<div class="col-sm-4">
<?php
echo \Yii::t('app', 'SENSORS');
?>
</div>
<div class="col-sm-4">
<?php
echo Html::activeDropDownList($model, 'sensorid', ArrayHelper::map(Sensor::find()->all(), 'id', 'name'));
?>
</div>
<div class="col-sm-4">
<button type="button" class="btn"><?php
echo \Yii::t('app', 'Choose on map');
?>
</button>
</div>
<div class="col-sm-12">
<hr>
</div>
<div class="col-sm-4">
<?php
示例13: function
}], ['label' => 'Поставщик', 'value' => 'provider.name'], ['label' => 'ID заказа поставщика', 'class' => 'kartik\\grid\\EditableColumn', 'format' => 'raw', 'editableOptions' => function ($model) {
return ['header' => 'ID поставщика', 'name' => 'OrdersSearch[order_provider_id]', 'value' => $model['order_provider_id'], 'contentOptions' => ['class' => 'editable-inline-in-table'], 'type' => \kartik\popover\PopoverX::TYPE_SUCCESS, 'inputType' => \kartik\editable\Editable::INPUT_TEXT, 'size' => 'md', 'containerOptions' => ['id' => 'text-danger'], 'options' => ['class' => 'form-control', 'placeholder' => 'Введите ID заказа у поставщика...'], 'asPopover' => false, 'ajaxSettings' => ['url' => '/autoparts/orders/order-provider-status'], 'submitButton' => ['icon' => '<i class="glyphicon glyphicon-ok"></i>'], 'pluginEvents' => ['editableSuccess' => 'function(event, val, form, data){
var status_td = $(event.target).parents("tr").find("td.provider_status_text > select");
if(data.status !== undefined){
if(!status_td.find("option[value="+data.status+"]").length)
status_td.append("<option value=\\""+data.status+"\\">"+data.status_text+"</option>");
status_td.val(data.status).change();
}
}']];
}], ['label' => 'Статус поставщика', 'attribute' => 'providerOrderStatusName.status_name', 'contentOptions' => ['class' => 'provider_status_text'], 'format' => 'raw', 'value' => function ($model, $key) {
$states = \yii\helpers\ArrayHelper::map($model['allProviderOrderStatusName'], 'status_code', 'status_name');
$params = ['class' => 'form-control', 'onChange' => 'setOrderProviderState(' . $key . ', this)', 'style' => 'font-size:12px', 'prompt' => 'Выбрать статус'];
return \yii\helpers\Html::dropDownList('provider_status', $model['order_provider_status'], $states, $params);
}], ['label' => 'Срок', 'value' => 'delivery_days'], ['label' => 'Статус', 'attribute' => 'state', 'contentOptions' => ['class' => 'detailStatus'], 'format' => 'raw', 'value' => function ($model, $key) {
return !isset($model['related_detail']) ? $model['state']['status_name'] : \yii\bootstrap\Html::activeDropDownList($model, 'status', $model['stateAll'], ['class' => 'form-control', 'style' => 'min-width:125px; font-size:12px', 'onChange' => 'updateStatus(this)', 'id' => 'order-status-' . $key . '-field']);
}, 'vAlign' => 'middle'], ['label' => 'Поставщик', 'format' => 'raw', 'value' => function ($model) {
$href = '';
switch ((int) $model['provider_id']) {
case 1:
$href = 'http://ixora-auto.ru/Shop/Search.html?DetailNumber=';
break;
case 2:
$href = 'http://www.part-kom.ru/new/#/search/0/0/0/';
break;
case 4:
$href = 'https://www.emex.ru/f?detailNum=';
break;
case 8:
$href = 'http://moskvorechie.ru/search.php?artikul=';
break;
示例14: render
/**
* Renders the filter content
* @return string
*/
public function render()
{
return Html::activeDropDownList($this->getModel(), $this->getAttribute(), ['' => 'Все', '0' => 'Нет', '1' => 'Да'], ['class' => 'form-control', 'style' => 'min-width: 90px']);
}
示例15:
?>
</div>
<?php
echo Html::activeTextInput($model, 'credit_card', ['class' => 'form-control']);
?>
</div>
<div class="col-sm-4">
<div style="margin-bottom: 4px;"><?php
echo Yii::t('app', 'Expiration Date');
?>
</div>
<?php
echo Html::activeDropDownList($model, 'expiration_month', $months, ['class' => 'form-control', 'style' => 'width:60%;display:inline-block;padding-left:6px;']);
?>
<?php
echo Html::activeDropDownList($model, 'expiration_year', $years, ['class' => 'form-control', 'style' => 'width:38%;display:inline-block;padding-left:6px;']);
?>
</div>
<div class="col-sm-3">
<div style="margin-bottom: 4px;"><?php
echo Yii::t('app', 'Security Code');
?>
</div>
<?php
echo Html::activeTextInput($model, 'security_code', ['class' => 'form-control']);
?>
</div>
</div>
<div class="row" style="margin-top: 10px;">