本文整理汇总了PHP中yii\bootstrap\Html::dropDownList方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::dropDownList方法的具体用法?PHP Html::dropDownList怎么用?PHP Html::dropDownList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\bootstrap\Html
的用法示例。
在下文中一共展示了Html::dropDownList方法的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: 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;
}
示例3:
echo Html::dropDownList('oldWorkName', null, $oldList, ['class' => 'form-control']);
?>
</div>
</div>
<div class="form-group">
<?php
echo Html::label('Выбрать из списка преподавателя');
?>
<div class="input-group ">
<span class="input-group-addon">
<?php
echo Html::radio('source', false, ['value' => 'list']);
?>
</span>
<?php
echo Html::dropDownList('listWorkName', null, $workList, ['class' => 'form-control']);
?>
</div>
</div>
<div class="form-group">
<div class="col-lg-12">
<?php
echo Html::submitButton('Сохранить', ['class' => 'btn btn-primary']);
?>
</div>
</div>
<?php
ActiveForm::end();
Pjax::end();
?>
</div>
示例4:
echo Html::submitButton(Yii::t('backend', 'Flush'), ['class' => 'btn btn-danger']);
?>
<?php
ActiveForm::end();
?>
</div>
<div class="col-xs-6">
<h4><?php
echo Yii::t('backend', 'Invalidate tag');
?>
</h4>
<?php
ActiveForm::begin(['action' => Url::to('flush-cache-tag'), 'method' => 'get', 'layout' => 'inline']);
?>
<?php
echo Html::dropDownList('id', null, ArrayHelper::map($dataProvider->allModels, 'name', 'name'), ['class' => 'form-control', 'prompt' => Yii::t('backend', 'Select cache')]);
?>
<?php
echo Html::input('string', 'tag', null, ['class' => 'form-control', 'placeholder' => Yii::t('backend', 'Tag')]);
?>
<?php
echo Html::submitButton(Yii::t('backend', 'Flush'), ['class' => 'btn btn-danger']);
?>
<?php
ActiveForm::end();
?>
</div>
</div>
</div>
示例5: renderField
public static function renderField($group, $fieldName, $fieldParams)
{
$id = $fieldParams['id'];
$type = $fieldParams['type'];
$value = $fieldParams['value'];
$description = $fieldParams['description'];
$options = $fieldParams['options'];
$fld = $group . '[' . $fieldName . ']';
$html = '';
switch ($type) {
case 'text':
$html .= self::labelInput($fieldName, $fld, Html::textInput($fld, $value, ['class' => 'form-control']));
$html .= self::hint($description);
break;
case 'textarea':
$html .= self::labelInput($fieldName, $fld, Html::textarea($fld, $value, ['rows' => 5, 'class' => 'form-control', 'hint' => $description]));
$html .= ConfigurationUtils::hint($description);
break;
case 'checkbox':
$html .= self::labelInput($fieldName, $fld, Html::checkbox($fld, $value, ['value' => $value == '1' ? '1' : '0', 'class' => 'form-control autoval']));
break;
case 'dropdown':
$data = explode(",", $options);
$data = array_reverse($data);
$data[''] = Yii::t('app', 'Select an option...');
$data = array_reverse($data);
$data = array_combine($data, $data);
$html .= self::labelInput($fieldName, $fld, Html::dropDownList($fld, $value, $data, ['class' => 'form-control']));
break;
}
return $html;
}
示例6: number_format
"><span class="glyphicon glyphicon-remove"></span> <?php
echo Yii::t('app', 'Remove from cart');
?>
</a>
</div>
</td>
<td style="font-size: 12pt;text-align: right;vertical-align: middle;padding-right: 30px;color:#AA0000">$<?php
echo number_format($it->price, 2, '.', '');
?>
</td>
<td style="vertical-align: middle">
<?php
ActiveForm::begin(['action' => \yii\helpers\Url::to(['shopcart/update-item', 'index' => $index])]);
?>
<?php
echo \yii\bootstrap\Html::dropDownList('quantity', $it->quantity, [1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9], ['class' => 'form-control update-cart-item']);
?>
<?php
ActiveForm::end();
?>
</td>
<td style="font-size: 12pt;text-align: right;vertical-align: middle;color:#AA0000">$<?php
echo number_format($it->getSubtotal(), 2, '.', '');
?>
</td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
示例7:
<?php
use yii\widgets\LinkPager;
$this->title = 'Каталог товаров на сайте';
$form = \yii\widgets\ActiveForm::begin(['method' => 'get', 'action' => ['goods/index'], 'options' => ['id' => 'filter-form-goods']]);
?>
<div class="well well-lg">
<div class="col-lg-3 filter">
<?php
echo \yii\bootstrap\Html::dropDownList('category', $active_category, $categories, ['class' => 'form-control drop-filter filter-submit', 'prompt' => 'Выберите категорию...', 'id' => 'cat-id']);
?>
</div>
<div class="col-lg-3 filter">
<?php
echo \yii\bootstrap\Html::dropDownList('rubric', $active_rubric, $rubrics, ['class' => 'form-control drop-filter filter-submit', 'prompt' => 'Выберите рубрику...', 'id' => 'rubric-id']);
?>
</div>
<div class="col-lg-6 filter">
<div class="col-lg-5">
<div class="input-group">
<span class="input-group-addon">От</span>
<input type="text" class="form-control input-blur" onkeyup='this.value=parseInt(this.value) | 0'
name="price_before" value="<?php
echo $price_before;
?>
">
</div>
</div>
<div class="col-lg-5">
<div class="input-group">
示例8: isset
"
<?php
}
?>
>
</div>
</td>
<td class="selectize">
<?php
echo \yii\bootstrap\Html::dropDownList("Product[{$number}][category]", isset($receiptProduct) ? $receiptProduct->product->category_id : '', \common\models\Category::getReceiptCategories(), ['class' => 'selectize']);
?>
</td>
<td class="selectize">
<div class="input-group" style="width: 100%">
<?php
echo \yii\bootstrap\Html::dropDownList("Product[{$number}][unit]", isset($receiptProduct) ? $receiptProduct->product->product_unit_id : '', \common\models\ProductUnit::getAll(), ['prompt' => \Yii::t('wallet', 'Select unit'), 'class' => 'selectize']);
?>
</div>
</td>
<td>
<div class="spinner">
<div class="input-group">
<input
type="text"
id="product-count-<?php
echo $number;
?>
"
name="Product[<?php
echo $number;
?>
示例9: array_reduce
<?php
/**
* @var \yii\web\View $this
* @var \yii\bootstrap\ActiveForm $form
* @var \app\modules\shop\models\PaymentType[] $paymentTypes
* @var integer $totalPayment
*/
$currency = \app\modules\shop\models\Currency::getMainCurrency();
?>
<div class="col-md-6 col-md-offset-3">
<div class="row">
<div>К оплате: <?php
echo $currency->format($totalPayment);
?>
</div>
<?php
echo \yii\bootstrap\Html::dropDownList('PaymentType', null, array_reduce($paymentTypes, function ($result, $item) {
/** @var \app\modules\shop\models\PaymentType $item */
$result[$item->id] = $item->name;
return $result;
}, []), ['class' => 'form-control']);
?>
</div>
</div>
示例10:
<option>Buy</option>
<option>Rent</option>
<option>Sale</option>
</select>
</div>
<div class="col-lg-7">
<?php
echo Html::dropDownList('price', '', ['150000-200000' => '$150,000 - $200,000', '200000-250000' => '$200,000 - $250,000', '250000-300000' => '$250,000 - $300,000', '300000' => '$300,000 - above'], ['class' => 'form-control', 'prompt' => 'Price']);
?>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<?php
echo Html::dropDownList('apartment', '', ['Apartment' => 'Apartment', 'Building' => 'Building', 'Office Space' => 'Office Space'], ['class' => 'form-control', 'prompt' => 'Property']);
?>
</div>
</div>
<?php
echo Html::submitButton('Find Now', ['class' => 'btn btn-primary']);
?>
<?php
echo Html::endForm();
?>
</div>
<?php
echo HotWidget::widget();
示例11:
</div>
</div>
<div class="form-group">
<?php
echo Html::label('Выбрать из списка преподавателя');
?>
<div class="input-group ">
<span class="input-group-addon">
<?php
echo Html::radio('source', false, ['value' => 'list']);
?>
</span>
<?php
echo Html::dropDownList('workList', null, $workListArr, ['class' => 'form-control', 'options' => $disabledWorks]);
?>
</div>
</div>
<div class="form-group">
<div class="col-lg-12">
<?php
echo Html::submitButton('Сохранить', ['class' => 'btn btn-primary']);
?>
</div>
</div>
<?php
ActiveForm::end();
Pjax::end();
?>
示例12:
<div class="">
<div class="input-group drp-container">
<?php
echo DateRangePicker::widget(['name' => 'date_range', 'value' => Yii::$app->request->post('date_range') ? Yii::$app->request->post('date_range') : Yii::$app->formatter->asDate('now', 'php:d-M-y') . ' to ' . Yii::$app->formatter->asDate('now', 'php:d-M-y'), 'convertFormat' => true, 'pluginOptions' => ['format' => 'd-M-y', 'separator' => ' to ']]);
?>
</div>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label for="inputEmail3" class="control-label">Select User</label>
<div class="">
<?php
echo Html::dropDownList('player_select', null, [0 => 'All'] + ArrayHelper::map(UserAccounts::find()->all(), 'id', 'name'), ['class' => 'form-control']);
?>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="col-sm-12">
<?php
echo Html::submitButton('Generate Reports', ['class' => 'btn btn-success ']);
?>
</div>
<div class="clearfix"></div>
</div>
</div>
示例13: generateColumnByType
/**
* Ham tao giao dien cho column
* @param string $keyColumn ten truong cua column
* @param array $column mang setting cua column
* @param array $gallery mang gia tri cua image
* @param string $id id cua 1 anh
* @param string $tdOptions Html Attribute of td column
* @return string
*/
private function generateColumnByType($keyColumn, $column, $gallery, $id, $tdOptions = [], $module, $attribute)
{
$typeImage = ArrayHelper::getValue($column, 'displayType', 'text');
$items = ArrayHelper::getValue($column, 'items', []);
$options = ArrayHelper::getValue($column, 'options', ['class' => 'form-control']);
$column_name = $module . '[' . $attribute . '][' . $id . '][' . $keyColumn . ']';
switch ($typeImage) {
case self::SYA_TYPE_COLUMN_DROPDOWN:
$template = Html::dropDownList($column_name, ArrayHelper::getValue($gallery, $keyColumn), $items, $options);
break;
case self::SYA_TYPE_COLUMN_TEXTAREA:
$template = Html::textarea($column_name, ArrayHelper::getValue($gallery, $keyColumn), $options);
break;
case self::SYA_TYPE_COLUMN_RADIO:
$template = Html::radio($column_name, ArrayHelper::getValue($gallery, $keyColumn), $options);
break;
case self::SYA_TYPE_COLUMN_RADIOLIST:
$template = Html::radioList($column_name, ArrayHelper::getValue($gallery, $keyColumn), $items, $options);
break;
case self::SYA_TYPE_COLUMN_CHECKBOX:
$template = Html::checkbox($column_name, ArrayHelper::getValue($gallery, $keyColumn), $options);
break;
case self::SYA_TYPE_COLUMN_CHECKBOXLIST:
$template = Html::checkboxList($column_name, ArrayHelper::getValue($gallery, $keyColumn), $items, $options);
break;
case self::SYA_TYPE_COLUMN_HIDDEN:
$tdOptions = ArrayHelper::merge($tdOptions, ['style' => 'display: none;']);
$template = Html::hiddenInput($column_name, ArrayHelper::getValue($gallery, $keyColumn), $options);
break;
default:
$template = Html::textInput($column_name, ArrayHelper::getValue($gallery, $keyColumn), $options);
break;
}
$templateGallery = Html::beginTag('td', $tdOptions);
$templateGallery .= $template;
$templateGallery .= Html::endTag('td');
return $templateGallery;
}
示例14: number_format
?>
"><?php
echo $model->getName(Yii::$app->language);
?>
</a>
</div>
<div class="product-price">
$<?php
echo number_format($model->price_custom, 2, '.', '');
?>
</div>
<div class="product-buttons">
<?php
$form = ActiveForm::begin(['action' => \yii\helpers\Url::to(['shopcart/add-product', 'id' => $model->id]), 'options' => ['class' => 'add-to-cart']]);
?>
<div class="input-group">
<?php
echo \yii\bootstrap\Html::dropDownList('quantity', 1, [1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9], ['class' => 'form-control']);
?>
<span class="input-group-btn">
<button class="add-to-cart btn btn-default" type="button"><span class=" glyphicon glyphicon-shopping-cart"></span> <?php
echo Yii::t('app', 'Buy');
?>
</button>
</span>
</div>
<?php
ActiveForm::end();
?>
</div>
</div>
示例15: generateHtml
/**
* @param $xmlRow
* @param $settings
* @param bool $place
* @return string
*/
private function generateHtml($xmlRow, $settings, $place = false)
{
$html = "";
$button_option = $xmlRow['field'];
//Проверка "отображать" или нет элемент
if (isset($button_option[6]['@attributes']['value']) && $button_option[6]['@attributes']['value'] == "0") {
return $html;
}
$html .= \yii\bootstrap\Html::beginTag("div", ['class' => 'row form-group']);
$html .= \yii\bootstrap\Html::beginTag("div", ['class' => 'col-xs-6']);
$html .= isset($place[1]) ? str_replace("#place#", $place[1], $button_option[4]['@attributes']['value']) : $button_option[4]['@attributes']['value'];
$html .= \yii\bootstrap\Html::endTag("div");
$html .= \yii\bootstrap\Html::beginTag("div", ['class' => 'col-xs-6']);
$fieldName = isset($place[0]) ? $place[0] . $button_option[0]['@attributes']['value'] : $button_option[0]['@attributes']['value'];
$elProperty = array();
//Проверка "разрешить" редактирование или нет
if ($button_option[5]['@attributes']['value'] == "0") {
$elProperty["disabled"] = "disabled";
}
//Проверка "отображать" или нет элемент
if (isset($button_option[6]['@attributes']['value']) && $button_option[6]['@attributes']['value'] == "0") {
$elProperty["style"] = "display:none";
}
//Дополнительные атрибуты
if ($button_option[1]['@attributes']['value'] == "text") {
$elProperty["size"] = 50;
}
switch ($button_option[1]['@attributes']['value']) {
case 'text':
$match = array();
preg_match("/#(.*)#/i", $button_option[2]['@attributes']['value'], $match);
$value = isset($match[1]) && !empty($match[1]) ? eval($match[1]) : $button_option[2]['@attributes']['value'];
$html .= \yii\bootstrap\Html::textInput($fieldName, isset($settings[$fieldName]) ? $settings[$fieldName] : $value, $elProperty);
break;
case 'select':
$select = json_decode($button_option[3]['@attributes']['value'], true);
$html .= \yii\bootstrap\Html::dropDownList($fieldName, isset($settings[$fieldName]) ? $settings[$fieldName] : $button_option[2]['@attributes']['value'], $select, $elProperty);
break;
}
$html .= \yii\bootstrap\Html::endTag("div");
$html .= \yii\bootstrap\Html::endTag("div");
return $html;
}