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


PHP Html::activeDropDownList方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:p0vidl0,项目名称:yii2-select2,代码行数:10,代码来源:Select2.php

示例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);
 }
开发者ID:quynhvv,项目名称:stepup,代码行数:12,代码来源:FieldDropdown.php

示例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);
 }
开发者ID:quynhvv,项目名称:stepup,代码行数:12,代码来源:FieldTarget.php

示例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');
 }
开发者ID:luobenyu,项目名称:yii2-metronic,代码行数:13,代码来源:MultiSelect.php

示例5: 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);
 }
开发者ID:asdf-studio,项目名称:yii2-admin-module,代码行数:13,代码来源:Select.php

示例6: 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);
     }
 }
开发者ID:AsiaWebSolution,项目名称:yii2GeneralVendor,代码行数:11,代码来源:YearSelectbox.php

示例7: 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);
     }
 }
开发者ID:yii2mod,项目名称:yii2-selectize,代码行数:11,代码来源:Selectize.php

示例8: 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>';
 }
开发者ID:Penton,项目名称:MoBlog,代码行数:8,代码来源:UserGroupDropDownList.php

示例9: 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}];
     }];
 }
开发者ID:aekkapun,项目名称:bus-tickets,代码行数:8,代码来源:RelationalTrait.php

示例10: 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);
     }
 }
开发者ID:rychkov-evgeniy,项目名称:yii2-base,代码行数:12,代码来源:Widget.php

示例11: 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);
 }
开发者ID:chenkby,项目名称:yii2-region,代码行数:9,代码来源:Region.php

示例12: 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);
     }
 }
开发者ID:tuyakhov,项目名称:yii2-materialize,代码行数:9,代码来源:Select.php

示例13: 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();
 }
开发者ID:SoftCommerce,项目名称:yii2-chosen-select,代码行数:13,代码来源:ChosenSelect.php

示例14: 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'] . '&nbsp;' . 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'] . '&nbsp;' . 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 .= '&nbsp;' . FontIcon::i('fa-long-arrow-right');
                 $item .= '&nbsp;' . 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;
     }]];
 }
开发者ID:hiqdev,项目名称:hipanel-module-hosting,代码行数:56,代码来源:IpGridView.php

示例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);
     }
 }
开发者ID:vetoni,项目名称:toko,代码行数:13,代码来源:EntityDropDown.php


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