/** * @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); } }
/** * */ 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]); }
/** * @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); }
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; }
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]); }
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); } }
)')->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']);
/** 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]); }
/** * @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']); }
</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(); ?>
<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')); ?>
}']])->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']); ?>
$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
<!-- 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); // ?>
<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
</div> <? } ?> <? } ?> <div class="vote-option-total"><?php echo Yii::t('f/vote', 'Total votes:'); ?> <span><?php echo $vote->total_votes; ?> </span></div> <? } else { ?> <? if(!empty($options)) { ?> <div class="vote-error"></div> <? if($vote->type == Vote::TYPE_SINGLE) { ?> <?php echo Html::radioList('vote', '', $options, ['class' => 'vote-input']); ?> <? } elseif($vote->type == Vote::TYPE_MULTI) { ?> <?php echo Html::checkboxList('vote', '', $options, ['class' => 'vote-input']); ?> <? } ?> <div><?php echo Html::button(Yii::t('f/vote', 'Do vote'), ['id' => 'vote-send-btn', 'class' => 'btn']); ?> </div> <div><?php echo Html::a(Yii::t('f/vote', 'Results'), ['/vote/vote/show', 'id' => $vote->id], ['target' => '_blank', 'class' => 'vote-results-lnk']); ?> </div> <?
</thead> <tbody></tbody> </table> </div> <div class="cflex"> <span style="order: 1; flex-grow: 1; margin-right:10px;"> <div class="form-group"> <?php echo Html::textInput('nombre_familiar', null, array('id' => 'nomfamiliar', 'class' => 'form-control', 'placeholder' => 'Nombre del familiar')); ?> </div> </span> <span style="order: 2; flex-grow: 1; margin-right:10px;"> <div class="form-group"> <?php echo Html::radioList('gen_familiar', 'Masculino', array('Masculino' => 'Masculino', 'Femenino' => 'Femenino')); ?> </div> </span> <span style="order: 2; flex-grow: 1; margin-right:10px;"> <div class="form-group"> <?php echo Html::dropDownList('rel_familiar', 'dre', ['dre' => 'Padre-Madre', 'Herman' => 'Herman@', 'Ti' => 'Ti@', 'Espos' => 'Espos@', 'Abuel' => 'Abuel@'], ['class' => 'form-control', 'id' => 'relfamiliar']); ?> </div> </span> <span style="order: 4; flex-grow: 1; margin-right:10px;"> <button id='agfamiliar' type="button" class="btn btn-primary" style="margin-top:5px;"> <i class="glyphicon glyphicon-plus"></i> </button> </span>
$choice = 'none'; if ($item['ch_ff'] == 1) { $choice = 'form_fulltime'; } if ($item['ch_fe'] == 1) { $choice = 'form_extramural'; } $options = []; $options['none'] = 'не выбрана'; if ($item['form_fulltime'] == 1) { $options['form_fulltime'] = 'Очная'; } if ($item['form_extramural'] == 1) { $options['form_extramural'] = 'Заочная'; } echo '<div class="list-group-item"><h4><small>[' . $item['code'] . ']</small> ' . $item['name'] . '</h4>' . Html::radioList('spec[' . $item['id'] . ']', $choice, $options) . '</div>'; } ?> </div> <?php Pjax::end(); ?> </div> </div> <div class="form-group"> <?php
/** * @inheritdoc */ public function radioList($items, $options = []) { $options = $this->mergeInputOptions($options, ['placeholder' => null]); $this->parts['{input}'] = Html::radioList($this->attribute, null, $items, $options); return $this; }
echo Html::radioList('radio-date_format', $model->date_format->option_value, ['F d, Y' => date('F d, Y'), 'M d, Y' => date('M d, Y'), 'Y-m-d' => date('Y-m-d'), 'm/d/Y' => date('m/d/Y'), 'custom' => Yii::t('content', 'Custom: ') . Html::textInput('Option[date_format][option_value]', $model->date_format->option_value, ['class' => 'value-date_format', 'readonly' => 'readonly'])], ['separator' => '<br />', 'encode' => false, 'class' => 'radio', 'itemOptions' => ['class' => 'radio-date_format']]); ?> <p class="description"><?php echo Html::a(Yii::t('content', 'What\'s this?'), 'http://php.net/manual/en/function.date.php', ['rel' => 'external, nofollow', 'target' => '_blank']); ?> </p> </div> </div> <div class="form-group"> <?php echo Html::label(Yii::t('content', 'Time Format'), null, ['class' => 'col-sm-2 control-label']); ?> <div class="col-sm-7"> <?php echo Html::radioList('radio-time_format', $model->time_format->option_value, ['g:i:s a' => date('g:i:s a'), 'g:i:s A' => date('g:i:s A'), 'H:i:s' => date('H:i:s'), 'custom' => Yii::t('content', 'Custom: ') . Html::textInput('Option[time_format][option_value]', $model->time_format->option_value, ['class' => 'value-time_format', 'readonly' => 'readonly'])], ['separator' => '<br />', 'encode' => false, 'class' => 'radio', 'itemOptions' => ['class' => 'radio-time_format']]); ?> <p class="description"><?php echo Html::a(Yii::t('content', 'What\'s this?'), 'http://php.net/manual/en/function.date.php', ['rel' => 'external, nofollow', 'target' => '_blank']); ?> </p> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <?php echo Html::submitButton(Yii::t('content', 'Save'), ['class' => 'btn btn-flat btn-success']); ?> </div> </div>
protected function getApixRadioGroupHtml($form, $config, $field) { $model = $config['model']; $fieldHtml = null; $fieldOptions = $field->options; if (isset($fieldOptions['items'])) { $items = $fieldOptions['items']; unset($fieldOptions['items']); $fieldHtml = Html::radioList($model . "[{$field->name}]", null, $items, $field->options); } else { $fieldHtml = Html::radioList($model . "[{$field->name}]", null, [], $field->options); } if ($config['label']) { $fieldHtml = "<div class='frm-field'><label>{$field->label}</label>{$fieldHtml}<span class='error' cmt-error='{$field->name}'></span></div>"; } else { $fieldHtml = "<div class='frm-field'>{$fieldHtml}<span class='error' cmt-error='{$field->name}'></span></div>"; } return $fieldHtml; }
?> </h1> <?php $variants = [$question->var1 => $question->var1, $question->var2 => $question->var2, $question->var3 => $question->var3, $question->var4 => $question->var4, $question->var5 => $question->var5]; ?> <div class="question-row row"> <div id="question<?php echo $question->id; ?> " class="hard-question"> <?php echo Html::a('<i class="fa fa-fw fa-minus"></i>', '/graduate/hard-question/remove?question_id=' . $question->id, ['onclick' => "\n \$.ajax({\n type :'POST',\n cache : false,\n url : '/graduate/hard-question/remove?question_id=" . $question->id . "',\n success : function(response) {\n \$('#close').html(response);\n }\n });return false;"]); ?> </div> <h3 class="title"><?php echo $question->description; ?> </h3> <?php echo Html::radioList($question->id, null, $variants); ?> </div> </div>
<?php echo Html::a($evidence->attachment_name, ['download', 'evidenceId' => $evidence->id]); ?> <br><br> <?php echo Html::beginForm(['give-feedback', 'id' => $model['id'], 'evidenceId' => $evidence['id']], 'post'); ?> <?php $array = [['value' => 1, 'estado' => 'Aceptado'], ['value' => 2, 'estado' => 'No aceptado']]; ?> <?php echo Html::label('Aceptar avance?'); ?> <?php echo Html::radioList('aceptado', 1, ArrayHelper::map($array, 'value', 'estado'), ['class' => "form-control", 'required' => true]); ?> <br> <?php echo Html::label('Retroalimentación'); ?> <br> <?php echo Html::textarea('feedback', null, ['class' => "form-control", 'required' => true]); ?> <br> <?php echo Html::submitButton('Guardar', ['class' => 'btn btn-success pull-right']); ?>
<div class="box-content"> <?php list($addressList, $defaultAddress) = \star\member\models\DeliveryAddress::getAddressList(); ?> <?php echo Html::dropDownList('address', $defaultAddress, $addressList); ?> </div> </div> <div class="breadcrumb"> <div class="box-title container_24">支付方式</div> <div class="box-content" style="vertical-align:middle;"> <?php $payment = Yii::createObject(\star\payment\models\Payment::className()); echo Html::radioList('payment', [$payment::ALIPAY], $payment->getPayList()); ?> </div> </div> <div class="breadcrumb"> <div class="box-title container_24">商品列表</div> <div class="box-content cart container_24"> <table id="list-div-box" class="table"> <tr style="background:#F3F3F3;"> <th class="col-xs-3">图片</th> <th class="col-xs-3">名称</th> <th class="col-xs-3">属性</th> <th class="col-xs-1">价格</th> <th class="col-xs-1">数量</th>
<?php echo $form->field($model, 'sports_id')->label('运动类型')->dropDownList($sports); ?> <?php echo $form->field($model, 'quantity')->label('场地数量'); ?> <div class="form-group"> <div class="col-md-2"> <label class="control-label">价格表</label> </div> <div class="col-md-7"> <?php echo Html::radioList('priceType', 'general', $priceTableType, ['class' => 'js_pricetype']); ?> </div> </div> <div id="js_ptgeneral" class="form-group"> <ul class="col-md-12 fd-gen-timetable"> <li class="time-item"> <h5 class="title">时间段: </h5> <?php echo Html::dropDownList('AddFieldcategoryForm[0][time-sel]', 'mon', $weekdays, ['class' => 'time-sel']); ?> <span class="clockpicker"> <input type="text" name="AddFieldcategoryForm[0][time][start]" value="09:30"> </span> <strong> 到 </strong> <span class="clockpicker"> <input type="text" name="AddFieldcategoryForm[0][time][end]" value="21:30">
<div class="radio"> <?php echo Html::radioList('Option[avatar_rating][option_value]', $model->avatar_rating->option_value, ['G' => Yii::t('writesdown', 'G — Suitable for all audiences'), 'PG' => Yii::t('writesdown', 'PG — Possibly offensive, usually for audiences 13 and above'), 'R' => Yii::t('writesdown', 'R — Intended for adult audiences above 17'), 'X' => Yii::t('writesdown', 'X — Even more mature than above')], ['separator' => '<br />']); ?> </div> </div> </div> <div class="form-group"> <?php echo Html::label(Yii::t('writesdown', 'Default Avatar'), null, ['class' => 'col-sm-2 control-label']); ?> <div class="col-sm-7"> <div class="radio"> <?php echo Html::radioList('Option[avatar_default][option_value]', $model->avatar_default->option_value, ['mystery' => Html::img('http://0.gravatar.com/avatar/0e42823c22bc734de4c13fd569cf1010?s=32&d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G&forcedefault=1', ['class' => 'avatar avatar-32 photo', 'width' => 32, 'height' => 32, 'alt' => '']) . ' Mystery Man', 'blank' => Html::img('http://0.gravatar.com/avatar/0e42823c22bc734de4c13fd569cf1010?s=32&d=blank&r=G&forcedefault=1', ['class' => 'avatar avatar-32 photo', 'width' => 32, 'height' => 32, 'alt' => '']) . ' Blank', 'gravatar_default' => Html::img('http://0.gravatar.com/avatar/0e42823c22bc734de4c13fd569cf1010?s=32&d=&r=G&forcedefault=1', ['class' => 'avatar avatar-32 photo', 'width' => 32, 'height' => 32, 'alt' => '']) . ' Gravatar Logo', 'identicon' => Html::img('http://0.gravatar.com/avatar/0e42823c22bc734de4c13fd569cf1010?s=32&d=identicon&r=G&forcedefault=1', ['class' => 'avatar avatar-32 photo', 'width' => 32, 'height' => 32, 'alt' => '']) . ' Identicon (Generated)', 'wavatar' => Html::img('http://0.gravatar.com/avatar/0e42823c22bc734de4c13fd569cf1010?s=32&d=wavatar&r=G&forcedefault=1', ['class' => 'avatar avatar-32 photo', 'width' => 32, 'height' => 32, 'alt' => '']) . ' Watavar (Generated)', 'monsterid' => Html::img('http://0.gravatar.com/avatar/0e42823c22bc734de4c13fd569cf1010?s=32&d=monsterid&r=G&forcedefault=1', ['class' => 'avatar avatar-32 photo', 'width' => 32, 'height' => 32, 'alt' => '']) . ' MonsterID (Generated)', 'retro' => Html::img('http://0.gravatar.com/avatar/0e42823c22bc734de4c13fd569cf1010?s=32&d=retro&r=G&forcedefault=1', ['class' => 'avatar avatar-32 photo', 'width' => 32, 'height' => 32, 'alt' => '']) . ' Retro (Generated)'], ['separator' => '<br />', 'encode' => false]); ?> </div> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <?php echo Html::submitButton(Yii::t('writesdown', 'Save'), ['class' => 'btn btn-flat btn-success']); ?> </div> </div> <?php ActiveForm::end();
/** * @inheritdoc */ public static function radioList($name, $selection = null, $items = [], $options = []) { $options['item'] = function ($index, $label, $name, $checked, $value) { return Radio::widget(['label' => $label, 'checked' => $checked, 'name' => $name, 'value' => $value]); }; static::addCssClasses($options, ['grouped', 'fields']); return Html::radioList($name, $selection, $items, $options); }
public function testRadioList() { $this->assertEquals('<div></div>', Html::radioList('test')); $expected = <<<EOD <div><div class="radio"><label><input type="radio" name="test" value="value1"> text1</label></div> <div class="radio"><label><input type="radio" name="test" value="value2" checked> text2</label></div></div> EOD; $this->assertEqualsWithoutLE($expected, Html::radioList('test', ['value2'], $this->getDataItems())); $expected = <<<EOD <div><div class="radio"><label><input type="radio" name="test" value="value1<>"> text1<></label></div> <div class="radio"><label><input type="radio" name="test" value="value 2"> text 2</label></div></div> EOD; $this->assertEqualsWithoutLE($expected, Html::radioList('test', ['value2'], $this->getDataItems2())); $expected = <<<EOD <input type="hidden" name="test" value="0"><div><div class="radio"><label><input type="radio" name="test" value="value1"> text1</label></div><br> <div class="radio"><label><input type="radio" name="test" value="value2" checked> text2</label></div></div> EOD; $this->assertEqualsWithoutLE($expected, Html::radioList('test', ['value2'], $this->getDataItems(), ['separator' => "<br>\n", 'unselect' => '0'])); $expected = <<<EOD <div>0<label>text1 <input type="radio" name="test" value="value1"></label> 1<label>text2 <input type="radio" name="test" value="value2" checked></label></div> EOD; $this->assertEqualsWithoutLE($expected, Html::radioList('test', ['value2'], $this->getDataItems(), ['item' => function ($index, $label, $name, $checked, $value) { return $index . Html::label($label . ' ' . Html::radio($name, $checked, ['value' => $value])); }])); }
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; use yii\helpers\ArrayHelper; $form = ActiveForm::begin(['method' => 'get', 'action' => ['site/index']]); echo Html::radioList('type', 'guest', ['guest' => 'Посетитель', 'auto' => 'Автотранспорт']); echo "<br>"; echo Html::submitButton('Вход', ['class' => 'btn btn-success']); ActiveForm::end();
protected function renderRadioList($name, $value, $options) { $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->items, $options); return Html::tag('div', $input, ['class' => 'radio']); }