本文整理汇总了PHP中yii\helpers\Html::radioList方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::radioList方法的具体用法?PHP Html::radioList怎么用?PHP Html::radioList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\helpers\Html
的用法示例。
在下文中一共展示了Html::radioList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* @inheritdoc
*/
public function run()
{
if ($this->hasModel()) {
echo Html::activeRadioList($this->model, $this->attribute, $this->enum, $this->options);
} else {
echo Html::radioList($this->name, $this->value, $this->enum, $this->options);
}
}
示例2: renderHtml
/**
* @inheritdoc
*/
public function renderHtml()
{
if ($this->form !== null && $this->model !== null) {
return $this->form->field($this->model, $this->attribute)->hint($this->hint)->radioList($this->items, $this->options);
}
if ($this->model !== null) {
return Html::activeRadioList($this->model, $this->attribute, $this->items, $this->options);
}
return Html::radioList($this->name, $this->value, $this->items, $this->options);
}
示例3: run
public function run()
{
$variantsList = $this->field->variants;
$variantsList = ArrayHelper::map($variantsList, 'id', 'value');
ksort($variantsList);
$checked = $this->model->getFieldVariantId($this->field->slug);
$radio = Html::radioList('choice-field-value', $checked, $variantsList);
$variants = Html::tag('div', $radio, $this->options);
return $variants;
}
示例4: run
/**
*
*/
public function run()
{
$view = $this->getView();
$this->registerScript($view);
if ($this->hasModel()) {
$list = Html::activeRadioList($this->model, $this->attribute, $this->items, $this->options);
} else {
$list = Html::radioList($this->name, $this->value, $this->items, $this->options);
}
$input = Html::tag('div', $list, $this->containerOptions);
echo strtr($this->template, ['{input}' => $input]);
}
示例5: run
public function run()
{
if ($this->model instanceof \pistol88\cart\interfaces\CartElement) {
$optionsList = $this->model->getCartOptions();
$changerCssClass = 'pistol88-option-values-before';
$id = $this->model->getCartId();
} else {
$optionsList = $this->model->getModel()->getCartOptions();
$this->defaultValues = $this->model->getOptions();
$id = $this->model->getId();
$changerCssClass = 'pistol88-option-values';
}
if (!empty($optionsList)) {
$i = 1;
foreach ($optionsList as $optionId => $optionData) {
if (!is_array($optionData)) {
$optionData = [];
}
$cssClass = "{$changerCssClass} pistol88-cart-option{$id} ";
$optionsArray = ['' => $optionData['name']];
foreach ($optionData['variants'] as $variantId => $value) {
$optionsArray[$variantId] = $value;
}
if ($this->type == 'select') {
$list = Html::dropDownList('cart_options' . $id . '-' . $i, $this->_defaultValue($optionId), $optionsArray, ['data-href' => Url::toRoute(["/cart/element/update"]), 'data-filter-id' => $optionId, 'data-name' => Html::encode($optionData['name']), 'data-id' => $id, 'class' => "form-control {$cssClass}"]);
} else {
$list = Html::tag('div', Html::tag('strong', $optionData['name']), ['class' => 'pistol88-option-heading']);
$list .= Html::radioList('cart_options' . $id . '-' . $i, $this->_defaultValue($optionId), $optionsArray, ['itemOptions' => ['data-href' => Url::toRoute(["/cart/element/update"]), 'data-filter-id' => $optionId, 'data-name' => Html::encode($optionData['name']), 'data-id' => $id, 'class' => $cssClass]]);
}
$options[] = Html::tag('div', $list, ['class' => "pistol88-option"]);
$i++;
}
} else {
return null;
}
return Html::tag('div', implode('', $options), ['class' => 'pistol88-change-options ' . $this->cssClass]);
}
示例6: genField
private function genField($name, $setting, $options)
{
if (preg_match("/number|string/i", $setting->type)) {
return Html::textInput($name, $setting->value, $options);
} elseif (preg_match("/text/i", $setting->type)) {
return Html::textArea($name, $setting->value, $options);
} elseif (preg_match("/bool/i", $setting->type)) {
return Html::checkBox($name, $setting->value, array_merge($options, $this->checkboxOptions, ['template' => '']));
} elseif (preg_match("/dropdown/i", $setting->type)) {
$data = @unserialize($setting->options);
$data = is_array($data) ? $data : [];
return Html::dropDownList($name, $setting->value, $data, $options);
} elseif (preg_match("/radiolist/i", $setting->type)) {
$data = @unserialize($setting->options);
$data = is_array($data) ? $data : [];
$template = $this->radioTemplate;
$this->radioOptions['item'] = !$this->radioCallback ? function ($index, $label, $name, $checked, $value) use($template) {
return strtr($template, ['{input}' => Html::radio($name, $checked, ['value' => $value]), '{labelText}' => $label]);
} : $this->radioCallback;
return Html::radioList($name, $setting->value, $data, array_merge($options, $this->radioOptions));
} elseif (preg_match("/{dateradiolist}/i", $setting->type)) {
$data = @unserialize($setting->options);
$data = is_array($data) ? $data : [];
$template = $this->radioTemplate;
$this->radioOptions['item'] = function ($index, $label, $name, $checked, $value) use($template) {
return strtr($template, ['{input}' => Html::radio($name, $checked, ['value' => $value]), '{labelText}' => date($value, time())]);
};
return Html::radioList($name, $setting->value, array_combine($data, $data), array_merge($options, $this->radioOptions));
} elseif (preg_match("/timezone/i", $setting->type)) {
return Html::dropDownList($name, $setting->value, $this->getTimezones(), $options);
} elseif (preg_match("/date/i", $setting->type)) {
return DatePicker::widget(['name' => $name, 'type' => DatePicker::TYPE_INPUT, 'value' => date('d-m-Y', strtotime($setting->value)), 'pluginOptions' => ['autoclose' => true, 'format' => 'dd-M-yyyy']]);
} else {
return Html::textArea($name, $setting->value, $options);
}
}
示例7:
)')->all(), 'nombre', 'nombre'), ['prompt' => 'Seleccione un usuario']);
} else {
echo $form->field($model, 'nombre_usuario')->dropDownList(ArrayHelper::map(Usuario::find()->all(), 'nombre', 'nombre'), ['prompt' => 'Seleccione un usuario']);
}
?>
<?php
echo $form->field($model, 'carnet_minoridad')->textInput(['maxlength' => true]);
?>
<?php
echo '<div class="cflex">';
echo '<span style="order: 1; flex-grow: 1; margin-right:10px;">';
if ($model->isNewRecord) {
echo Html::label('Es Informante', 'esinfor');
echo Html::radioList('informante', 'No', ['Si' => 'Si', 'No' => 'No'], ['id' => 'esinfor']);
echo Html::label('Firma', 'firin');
echo Html::fileInput('firma', null, ['id' => 'firin', 'enable' => false, 'class' => 'form-control']);
} else {
$objInformante = Informante::find()->select('codigo')->where('cod_persona = :valor', [':valor' => $model->codigo])->one();
if (isset($objInformante)) {
echo Html::a('Ver informante', '/sgm/web/informante/update/' . $objInformante->codigo, ['target' => '_blank', 'class' => 'form-control']);
}
}
echo '</span>';
echo '</div>';
?>
<div class="form-group">
<?php
echo Html::button($model->isNewRecord ? 'Crear' : 'Actualizar', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary', 'id' => 'procesar']);
示例8: run
/** Render widget */
public function run()
{
$model = $this->behavior->owner;
$model_name = MyHelper::modelFromNamespace($this->behavior->model_name);
$parent_model_name = MyHelper::modelFromNamespace($this->behavior->parent_model_name);
$parent_relation = $this->behavior->parent_relation;
if ($model->{$parent_relation}) {
$cat_id = $model->{$parent_relation}->id;
/**
* Формируем поля для параметров
*
* @var $optionList \porcelanosa\yii2options\models\OptionsList
*/
if ($this->behavior->getChildOptionsList($cat_id) and is_array($this->behavior->getChildOptionsList($cat_id))) {
foreach ($this->behavior->getChildOptionsList($cat_id) as $optionList) {
$option = ChildOptions::findOne(['model' => $parent_model_name . '-' . $model_name, 'model_id' => $model->id, 'option_id' => $optionList->id]);
$option_name = trim(str_replace(' ', '_', $optionList->alias));
$value = $this->behavior->getChildOptionValueById($optionList->id);
$option_type_alias = $optionList->type->alias;
if ($option_type_alias == 'boolean') {
$this->options_string .= $this->render('@vendor/porcelanosa/yii2-options/views/_partials/_boolean', ['option_name' => $option_name, 'optionList' => $optionList, 'value' => $value]);
}
if ($option_type_alias == 'textinput') {
$this->options_string .= $this->render('@vendor/porcelanosa/yii2-options/views/_partials/_textinput', ['option_name' => $option_name, 'optionList' => $optionList, 'value' => $value]);
}
if ($option_type_alias == 'textarea') {
$textarea = $option ? ChildRichTexts::find()->where(['option_id' => $option->id])->one() : null;
$this->options_string .= $this->render('@vendor/porcelanosa/yii2-options/views/_partials/_textarea', ['option_name' => $option_name, 'optionList' => $optionList, 'richTextValue' => $textarea != null ? $textarea->text : '']);
}
if ($option_type_alias == 'richtext') {
$richText = $option ? ChildRichTexts::find()->where(['option_id' => $option->id])->one() : null;
$this->options_string .= $this->render('@vendor/porcelanosa/yii2-options/views/_partials/_rich_text', ['option_name' => $option_name, 'optionList' => $optionList, 'richTextValue' => $richText != null ? $richText->text : '']);
}
if ($option_type_alias == 'dropdown') {
// получаем фабрики
$status_preset_values = OptionPresetValues::find()->where(['preset_id' => $optionList->preset->id])->orderBy('sort')->all();
// формируем массив, с ключем равным полю 'id' и значением равным полю 'name'
$status_preset_items = ArrayHelper::map($status_preset_values, 'id', 'value');
$status_preset_items = ArrayHelper::merge(['null' => 'Выберите ' . mb_strtolower($optionList->name)], $status_preset_items);
$this->options_string .= $this->render('@vendor/porcelanosa/yii2-options/views/_partials/_dropdown', ['option_name' => $option_name, 'optionList' => $optionList, 'value' => $value, 'status_preset_items' => $status_preset_items]);
}
if ($option_type_alias == 'radiobuton_list') {
// получаем фабрики
$status_preset_values = OptionPresetValues::find()->where(['preset_id' => $optionList->preset->id])->orderBy('sort')->all();
// формируем массив, с ключем равным полю 'id' и значением равным полю 'name'
$status_preset_items = ArrayHelper::map($status_preset_values, 'id', 'value');
$this->options_string .= '<label> ' . $optionList->name . '</label>' . Html::radioList($option_name, $value ? $value : null, $status_preset_items, ['id' => $option_name, 'class' => 'form-control']);
}
if ($option_type_alias == 'dropdown-multiple') {
// получаем список значений для мульти селектед
$multipleValuesArray = $this->behavior->getChildOptionMultipleValueByOptionId($option->id);
// получаем фабрики
$status_preset_values = OptionPresetValues::find()->where(['preset_id' => $optionList->preset->id])->orderBy('sort')->all();
// формируем массив, с ключем равным полю 'id' и значением равным полю 'name'
$status_preset_items = ArrayHelper::map($status_preset_values, 'id', 'value');
$this->options_string .= $this->render('@vendor/porcelanosa/yii2-options/views/_partials/_dropdown_multiple', ['option_name' => $option_name, 'optionList' => $optionList, 'multipleValuesArray' => $multipleValuesArray, 'status_preset_items' => $status_preset_items]);
}
/* Список checkboxes */
if ($option_type_alias == 'checkboxlist-multiple') {
// получаем список значений для мульти селектед
$multipleValuesArray = $option ? $this->behavior->getChildOptionMultipleValueByOptionId($option->id) : [];
// получаем фабрики
$status_preset_values = OptionPresetValues::find()->where(['preset_id' => $optionList->preset->id])->orderBy('sort')->all();
// формируем массив, с ключем равным полю 'id' и значением равным полю 'name'
$status_preset_items = ArrayHelper::map($status_preset_values, 'id', 'value');
$this->options_string .= $this->render('@vendor/porcelanosa/yii2-options/views/_partials/_checkboxlist_multiple', ['option_name' => $option_name, 'optionList' => $optionList, 'multipleValuesArray' => $multipleValuesArray, 'status_preset_items' => $status_preset_items]);
}
/* IMAGE Изображение */
if ($option_type_alias == 'image') {
$this->options_string .= $this->render('@vendor/porcelanosa/yii2-options/views/_partials/_image', ['option_name' => $option_name, 'optionList' => $optionList, 'value' => $value, 'this_widget' => $this, 'behavior' => $this->behavior]);
}
}
}
$view = $this->getView();
OptionsAsset::register($view);
$this->options['id'] = 'child-opt-widget-' . $this->model->id;
$this->options['class'] = 'child-options';
}
return $this->render('optionsWidget', ['options_string' => $this->options_string]);
}
示例9: renderRadioList
/**
* @param $name
* @param $value
* @param $options
* @return string
*/
protected function renderRadioList($name, $value, $options)
{
if (!array_key_exists('unselect', $options)) {
$options['unselect'] = '';
}
$options['item'] = function ($index, $label, $name, $checked, $value) {
return '<div class="radio">' . Html::radio($name, $checked, ['label' => $label, 'value' => $value]) . '</div>';
};
$input = Html::radioList($name, $value, $this->prepareItems($this->items), $options);
return Html::tag('div', $input, ['class' => 'radio-list']);
}
示例10:
</div>
</div>
</div>
</div>
<h3><?php
echo Yii::t('analytics', 'Grouping');
?>
</h3>
<div class="analytycs-grouping">
<?php
echo Html::dropDownList('group[by]', '', Group::getGroupByList(), ['class' => 'form-control input-small']);
?>
<br/>
<?php
echo Html::radioList('group[position]', Group::GROUP_VERTICAL, Group::getPositions());
?>
</div>
<h3><?php
echo Yii::t('analytics', 'Aggregations');
?>
</h3>
<div class="panel panel-default analytycs-aggregation">
<div class="panel-body">
<div class="row">
<div class="col-md-4">
<?php
$allAggregationParametrs = Aggregation::getParameters();
?>
示例11:
<div class="col-sm-7">
<?php
echo Html::input('number', 'Option[posts_per_rss][value]', $model->posts_per_rss->value, ['id' => 'option-post_per_rss', 'min' => 1, 'step' => 1]);
?>
</div>
</div>
<div class="form-group">
<?php
echo Html::label(Yii::t('writesdown', 'For each article in a feed, show'), null, ['class' => 'col-sm-2 control-label']);
?>
<div class="col-sm-7">
<div class="radio">
<?php
echo Html::radioList('Option[rss_use_excerpt][value]', $model->rss_use_excerpt->value, [0 => 'Full text', 1 => 'Summary'], ['separator' => '<br />']);
?>
</div>
</div>
</div>
<div class="form-group">
<?php
echo Html::label(Yii::t('writesdown', 'Search Engine Visibility'), 'option-site_indexing', ['class' => 'col-sm-2 control-label']);
?>
<div class="col-sm-7">
<div class="checkbox">
<?php
echo Html::label(Html::checkbox('Option[disable_site_indexing][value]', $model->disable_site_indexing->value, ['id' => 'option-site_indexing', 'uncheck' => 0]) . Yii::t('writesdown', 'Do not allow search engines to index the site'));
?>
示例12:
}']])->label('Fecha de Matrimonio');
?>
</span>
<span style="order: 3; flex-grow: 1; margin-right:10px;">
<?php
echo $form->field($partida, 'hora_suceso')->widget(TimePicker::className(), ['language' => 'es', 'pluginOptions' => ['showMeridian' => true, 'autoclose' => true], 'options' => ['readonly' => true]])->label('Hora de Matrimonio');
?>
</span>
</div>
<div class="cflex">
<span style="order: 1; flex-grow: 1; margin-right:10px;">
<?php
echo Html::label('Adopta Apellido', 'matrimonio-ape');
?>
<?php
echo Html::radioList('adop_casada', 'No', ['Si' => 'Si', 'No' => 'No'], ['id' => 'matrimonio-ape']);
?>
</span>
<span style="order: 2; flex-grow: 1; margin-right:10px;">
<?php
echo $form->field($model, 'apellido_casada')->textInput(['readOnly' => true, 'placeholder' => 'Especifique el apellido de casada']);
?>
</span>
</div>
<div class="form-group">
<?php
echo Html::button('Guardar', ['class' => 'btn btn-primary', 'id' => 'guardar']);
?>
<?php
echo Html::button('Vista Previa', ['class' => 'btn btn-primary', 'id' => 'generar']);
?>
示例13: if
$options = $widget->clientOptions;
$clientOptions = \yii\helpers\Json::encode($options);
?>
<div id="<?php
echo $widget->id;
?>
">
<div class="sx-select-controll">
<? if ($widget->modelAttributeSaveType) : ?>
<?php
echo \yii\helpers\Html::activeRadioList($widget->model, $widget->modelAttributeSaveType, \skeeks\cms\widgets\formInputs\comboText\ComboTextInputWidget::editors());
?>
<? else : ?>
<?php
echo \yii\helpers\Html::radioList($widget->id . '-radio', $widget->defaultEditor, \skeeks\cms\widgets\formInputs\comboText\ComboTextInputWidget::editors());
?>
<? endif; ?>
</div>
<div class="sx-controll">
<?php
echo $textarea;
?>
</div>
</div>
<?
//TODO: убрать в файл
$this->registerCss(<<<CSS
示例14: array
<!-- Main Heading Ends -->
<form>
<div class="breadcrumb address-panel">
<div class="box-title container_24"><span
style="float:right"><?php
echo Html::a('管理收货地址', array('/customer/delivery-address'), array('target' => '_blank'));
?>
</span>收货地址
</div>
<div class="box-content">
<?php
list($addressList, $defaultAddress) = Kiwi::getCustomerAddress()->getAddressList();
?>
<?php
echo Html::radioList('address', $defaultAddress, $addressList, ['separator' => '<br />']);
?>
</div>
</div>
<div class="breadcrumb">
<div class="box-title container_24">支付方式</div>
<div class="box-content" style="vertical-align:middle;">
<!-- --><?php
// $cri = new CDbCriteria(array(
// 'condition' => 'enabled = 1'
// ));
// $paymentMethod = PaymentMethod::model()->findAll($cri);
// $list = CHtml::listData($paymentMethod, 'payment_method_id', 'name');
// echo CHtml::radioButtonList('payment_method_id', '0', $list);
//
?>
示例15: array
<div class="row">
<?php
echo Html::encode($personalData->delivery_address);
?>
</div>
<div class="row">
<?php
echo Html::encode($personalData->delivery_contact);
?>
</div>
<div class="row radio">
<?php
echo Html::radioList('IsDifferentAddress', '0', array(0 => 'Delivery to this address', 1 => 'Delivery to different address'));
?>
</div>
<div style="height: 50px">
</div>
<div class="form-group">
<div><?php
echo Html::a('< Go Back', ['cart/cart']);
?>
</div>
</div>
<div class="form-group">
<div><?php