本文整理汇总了PHP中yii\helpers\Html::dropdownList方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::dropdownList方法的具体用法?PHP Html::dropdownList怎么用?PHP Html::dropdownList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\helpers\Html
的用法示例。
在下文中一共展示了Html::dropdownList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
// echo $this->render('_search', ['model' => $searchModel]);
?>
<p>
<?php
echo Html::a('Добавить препарат', ['create'], ['class' => 'btn btn-success']);
?>
</p>
<br>
<?php
$reg = Geo::find()->select(['name', 'id'])->indexBy('id')->orderBy('name')->column();
echo Html::dropdownList('region', $region, $reg, ['class' => 'form-control', 'id' => 'change_reg']);
?>
<script>
$(document).ready(function () {
$('#change_reg').change(function () {
window.location.href='?region='+this.value;
});
});
</script>
<br>
<table>
<?php
foreach ($model as $preparat) {
print "<tr>";
示例2:
<?php
use app\models\Geo;
use yii\helpers\Html;
use app\models\Users;
$this->title = 'Реестр';
$this->params['breadcrumbs'][] = $this->title;
$reg = Geo::find()->select(['name', 'id'])->indexBy('id')->orderBy('name')->column();
echo HTML::beginForm();
echo Html::dropdownList('where[region]', null, $reg, ['class' => 'form-control', 'id' => 'change_reg', 'prompt' => 'Все регионы']);
print "<br>";
$regional = Users::find()->select(['username', 'id'])->indexBy('id')->where(['status' => '2'])->orderBy('username')->column();
echo Html::dropdownList('where[regional]', null, $regional, ['class' => 'form-control', 'id' => 'change_regional', 'prompt' => 'Все региональные представители']);
echo "<br>";
echo Html::Checkbox('groupby[ur_l.id]', null, ['label' => 'Группировать по юр.лицам', 'value' => '1']);
echo "<br>";
echo " <div class=\"row\">\n <div class=\"col-md-4\">";
echo "<br>";
echo Html::Checkbox('select[region.name]', true, ['label' => 'Регион', 'value' => 'Регион']);
echo "<br>";
echo Html::Checkbox('select[ur_l.name]', true, ['label' => 'Юридическое лицо', 'value' => 'Юридическое лицо']);
echo "<br>";
echo Html::Checkbox('select[ur_l.inn]', true, ['label' => 'ИНН', 'value' => 'ИНН']);
echo "<br>";
echo Html::Checkbox('select[ur_l.address]', false, ['label' => 'Юр.адрес', 'value' => 'Юр.адрес']);
echo "<br>";
echo Html::Checkbox('select[ur_l.wabc]', false, ['label' => 'WABC', 'value' => 'WABC']);
echo "<br>";
echo Html::Checkbox('select[ur_l.contact_face]', false, ['label' => 'Руководитель', 'value' => 'Руководитель']);
echo "<br>";
echo Html::Checkbox('select[ur_l.contact_phone]', false, ['label' => 'Телефон руководителя', 'value' => 'Телефон руководителя']);