本文整理汇总了PHP中yii\helpers\Html::activeDropDownList方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::activeDropDownList方法的具体用法?PHP Html::activeDropDownList怎么用?PHP Html::activeDropDownList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\helpers\Html
的用法示例。
在下文中一共展示了Html::activeDropDownList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$this->registerPlugin('select2');
Html::addCssClass($this->options, 'form-control');
if ($this->hasModel()) {
return Html::activeDropDownList($this->model, $this->attribute, $this->items, $this->options);
} else {
return Html::dropDownList($this->name, $this->selection, $this->items, $this->options);
}
}
示例2: run
/**
* Renders the widget.
*/
public function run()
{
if (!isset($this->options['class']) or empty($this->options['class'])) {
$this->options['class'] = 'form-control';
}
$list[''] = '';
$list += $this->list;
echo Html::activeDropDownList($this->model, $this->attribute, $list, $this->options);
}
示例3: run
/**
* Renders the widget.
*/
public function run()
{
if (!isset($this->options['class']) or empty($this->options['class'])) {
$this->options['class'] = 'form-control';
}
$ages[''] = 'Chọn Mục tiêu';
$ages += ArrayHelper::getValue(Classified::$options, 'target', []);
echo Html::activeDropDownList($this->model, $this->attribute, $ages, $this->options);
}
示例4: run
/**
* Executes the widget.
*/
public function run()
{
if ($this->hasModel()) {
echo Html::activeDropDownList($this->model, $this->attribute, $this->data, $this->options);
} else {
echo Html::dropDownList($this->name, $this->value, $this->data, $this->options);
}
MultiSelectAsset::register($this->view);
$this->registerPlugin('multiSelect');
}
示例5: run
/**
* Renders the widget.
*/
public function run()
{
if ($this->hasModel()) {
return Html::activeDropDownList($this->model, $this->attribute, $this->_getItems(), $this->options);
} else {
return Html::dropDownList($this->name, $this->value, $this->_getItems(), $this->options);
}
}
示例6: renderDropDown
/**
* Render dropdown list
*/
public function renderDropDown()
{
if ($this->hasModel()) {
echo Html::activeDropDownList($this->model, $this->attribute, $this->items, $this->options);
} else {
echo Html::dropDownList($this->name, $this->value, $this->items, $this->options);
}
}
示例7: init
public function init()
{
parent::init();
$this->_inputStr = '<div class="form-group">';
$this->_inputStr .= Html::activeLabel($this->model, $this->attribute);
$this->_inputStr .= Html::activeDropDownList($this->model, $this->attribute, \common\models\User::getUserGroup(), $this->options);
$this->_inputStr .= '</div>';
}
示例8: gridRelationalColumn
public function gridRelationalColumn($attr, $arr, $key, $value)
{
$this->relDataArr += ArrayHelper::map($arr, $key, $value);
return ['attribute' => $attr, 'filter' => Html::activeDropDownList($this, $attr, $this->relDataArr, ['class' => 'form-control']), 'value' => function ($model, $key, $index, $column) {
$attr = $column->attribute;
return $this->relDataArr[$model->{$attr}];
}];
}
示例9: run
/**
* @inheritdoc
*/
public function run()
{
$this->registerClientScript();
if ($this->hasModel()) {
return Html::activeDropDownList($this->model, $this->attribute, $this->items, $this->options);
} else {
return Html::dropDownList($this->name, $this->value, $this->items, $this->options);
}
}
示例10: run
public function run()
{
$output[] = Html::activeDropDownList($this->model, $this->province['attribute'], $this->province['items'], $this->province['options']);
$output[] = Html::activeDropDownList($this->model, $this->city['attribute'], $this->city['items'], $this->city['options']);
if (!empty($this->district)) {
$output[] = Html::activeDropDownList($this->model, $this->district['attribute'], $this->district['items'], $this->district['options']);
}
return @implode("\n", $output);
}
示例11: run
public function run()
{
$this->registerJqueryPlugin('material_select');
if ($this->hasModel()) {
return Html::activeDropDownList($this->model, $this->attribute, $this->items, $this->options);
} else {
return Html::dropDownList($this->name, $this->value, $this->items, $this->options);
}
}
示例12: run
/**
* Render chosen select
* @return string|void
*/
public function run()
{
if ($this->hasModel()) {
echo Html::activeDropDownList($this->model, $this->attribute, $this->items, $this->options);
} else {
echo Html::dropDownList($this->name, $this->value, $this->items, $this->options);
}
$this->registerAssets();
}
示例13: defaultColumns
public static function defaultColumns()
{
return ['ip' => ['class' => MainColumn::class, 'filterAttribute' => 'ip_like'], 'tags' => ['format' => 'raw', 'attribute' => 'tag', 'header' => Yii::t('hipanel:hosting', 'Tags'), 'visible' => Yii::$app->user->can('admin'), 'filter' => function ($column, $model) {
return Html::activeDropDownList($model, 'tag_in', array_merge(['' => Yii::t('hipanel', '---')], static::$ipTags), ['class' => 'form-control']);
}, 'value' => function ($model) {
$labels = [];
foreach ($model->tags as $tag) {
$labels[] = IpTag::widget(['tag' => $tag]);
}
return implode(' ', $labels);
}], 'counters' => ['format' => 'html', 'header' => Yii::t('hipanel:hosting', 'Counters'), 'value' => function ($model) {
$html = '';
foreach ($model->objects_count as $count) {
if ($count['type'] === 'hdomain') {
$url['ok'] = ['@hdomain', (new HdomainSearch())->formName() => ['ip_like' => $model->ip]];
$url['deleted'] = ['@hdomain', (new HdomainSearch())->formName() => ['ip_like' => $model->ip, 'state' => 'deleted']];
$type = function ($count) {
return Yii::t('hipanel:hosting', '{0, plural, one{domain} other{domains}}', (int) $count);
};
} else {
throw new InvalidParamException('The object type is not supported', $model);
}
if ($count['ok']) {
$html .= Html::a((int) $count['ok'] . ' ' . FontIcon::i('fa-check') . ' ' . $type($count['ok']), $url['ok'], ['class' => 'btn btn-success btn-xs']);
}
$html .= ' ';
if ($count['deleted'] > 0) {
$html .= Html::a((int) $count['deleted'] . ' ' . FontIcon::i('fa-trash') . ' ' . $type($count['deleted']), $url['deleted'], ['class' => 'btn btn-xs btn-warning']);
}
}
return $html;
}], 'links' => ['format' => 'html', 'value' => function ($model) {
$items = [];
foreach ($model->links as $link) {
$item = Html::a($link->device, ['@server/view', 'id' => $link->device_id]);
if ($link->service_id) {
$item .= ' ' . FontIcon::i('fa-long-arrow-right');
$item .= ' ' . Html::a($link->service ?: $link->soft, ['@service/view', 'id' => $link->service_id]);
}
$items[] = $item;
}
return ArraySpoiler::widget(['data' => $items, 'visibleCount' => 3]);
}], 'services' => ['attribute' => 'links', 'format' => 'html', 'label' => Yii::t('hipanel:server', 'Services'), 'value' => function ($model) {
return ArraySpoiler::widget(['data' => $model->links, 'formatter' => function ($link) {
if (Yii::$app->user->can('support') && Yii::getAlias('@service', false)) {
return Html::a($link->service, ['@service/view', 'id' => $link->service_id]);
}
return $link->service;
}]);
}], 'actions' => ['class' => MenuColumn::class, 'menuClass' => IpActionsMenu::class], 'ptr' => ['options' => ['style' => 'width: 40%'], 'format' => 'raw', 'value' => function ($model) {
if ($model->canSetPtr()) {
return XEditable::widget(['model' => $model, 'attribute' => 'ptr', 'pluginOptions' => ['url' => Url::to('@ip/set-ptr')]]);
}
return null;
}]];
}
示例14: renderInput
/**
* @inheritdoc
*/
public function renderInput($value, $attribute = null)
{
$select_id = Html::getInputId($this->model, $attribute ? $attribute : $this->attribute);
$this->view->registerJs("\$('#{$select_id}').selectpicker();");
Html::addCssClass($this->options, 'form-control');
if (!isset($this->options['multiple'])) {
$this->options['multiple'] = $this->multiple;
}
return Html::activeDropDownList($this->model, $attribute ? $attribute : $this->attribute, $this->items, $this->options);
}
示例15: run
/**
* @inheritdoc
*/
public function run()
{
$this->items = ArrayHelper::merge(['' => ''], $this->items);
$this->htmlOptions = ArrayHelper::merge($this->htmlOptions, ['class' => 'form-control']);
if (!is_null($this->model)) {
echo Html::activeDropDownList($this->model, $this->attribute, $this->items, $this->htmlOptions);
} else {
echo Html::dropDownList($this->attribute, $this->value, $this->items, $this->htmlOptions);
}
}