本文整理汇总了PHP中yii\helpers\Html::activeRadioList方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::activeRadioList方法的具体用法?PHP Html::activeRadioList怎么用?PHP Html::activeRadioList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\helpers\Html
的用法示例。
在下文中一共展示了Html::activeRadioList方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: if
* @date 06.06.2015
*/
/* @var $this yii\web\View */
/* @var $widget \skeeks\cms\widgets\formInputs\comboText\ComboTextInputWidget */
$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>
<?
示例3: 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);
}
示例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:
$cfg = $uploader->illustration;
$aspect = $cfg->aspectRatio;
if (!is_numeric($aspect)) {
$model->setAttribute($aspect, 1000 * $model->getAttribute($aspect));
}
?>
<div id="<?php
echo $uploader->id;
?>
" class="uploader">
<div class="cropper"></div>
<div class="uploader-aspect">
<?php
if (!is_numeric($aspect) && $uploader->aspectOptions) {
echo $uploader->radio ? Html::activeRadioList($model, $aspect, $uploader->aspectOptions, ['class' => 'uploader-select', 'separator' => '<br />', 'itemOptions' => ['disabled' => 'disabled']]) : Html::activeDropDownList($model, $aspect, $uploader->aspectOptions, ['class' => 'form-control uploader-select', 'disabled' => 'disabled']);
}
?>
<?php
echo $uploader->deleteOptions ? Html::activeCheckbox($model, "__{$attr}_delete__", array_merge($uploader->deleteOptions, ['disabled' => !$uploader->current, 'class' => 'del-switch'])) : '';
?>
</div>
<div class="uploader-control">
<?php
echo Html::activeFileInput($model, "__{$attr}_file__");
?>
<?php
echo Html::activeHiddenInput($model, "__{$attr}_crop__");
?>
</div>
</div>
示例6: radioList
/**
* Renders a list of radio buttons.
* A radio button list is like a checkbox list, except that it only allows single selection.
* The selection of the radio buttons is taken from the value of the model attribute.
* @param array $items the data item used to generate the radio buttons.
* The array values are the labels, while the array keys are the corresponding radio values.
* Note that the labels will NOT be HTML-encoded, while the values will.
* @param array $options options (name => config) for the radio button list. The following options are specially handled:
*
* - unselect: string, the value that should be submitted when none of the radio buttons is selected.
* By setting this option, a hidden input will be generated.
* - separator: string, the HTML code that separates items.
* - item: callable, a callback that can be used to customize the generation of the HTML code
* corresponding to a single item in $items. The signature of this callback must be:
*
* ~~~
* function ($index, $label, $name, $checked, $value)
* ~~~
*
* where $index is the zero-based index of the radio button in the whole list; $label
* is the label for the radio button; and $name, $value and $checked represent the name,
* value and the checked status of the radio button input.
* @return static the field object itself
*/
public function radioList($items, $options = [])
{
$this->adjustLabelFor($options);
$this->parts['{input}'] = Html::activeRadioList($this->model, $this->attribute, $items, $options);
return $this;
}
示例7: function
<h3 >添加子节点</h3>
<?php
$form = \yii\bootstrap\ActiveForm::begin([]);
?>
<?php
echo $form->field($model, 'parent')->textInput(['value' => $name, 'readonly' => 'readonly']);
?>
<?php
echo $form->field($model, 'child')->textInput(['placeholder' => '请输入子节点name']);
?>
<?php
echo Html::activeRadioList($model, 'childType', [1 => '角色', 2 => '许可'], ['item' => function ($index, $label, $name, $checked, $value) {
if ($value == 1) {
$checked = true;
}
return '<label class="radio-inline">' . Html::radio($name, $checked, ['value' => $value]) . $label . '</label>';
}]);
?>
<?php
echo Html::submitButton(t('app', 'create'), ['class' => 'btn btn-primary']);
?>
<?php
$form->end();
?>
</div>
示例8:
?>
<?php
echo Html::button(\Yii::t($module->messageCategory, 'choose'), ['class' => 'btn btn-default', 'data-form-selection' => $module->url('article/get')]);
?>
<?php
echo Html::tag('span', $item['article'] ? $item['article']['title'] : null);
?>
</div>
</div>
<div class="form-group status">
<?php
echo Html::activeLabel($item, 'status', ['class' => 'control-label col-sm-2']);
?>
<div class="col-sm-4">
<?php
echo Html::activeRadioList($item, 'status', $item->getAttributeItems('status'), ['itemOptions' => ['labelOptions' => ['class' => 'radio-inline']]]);
?>
</div>
</div>
<div class="form-group">
<div class="col-sm-4 col-sm-push-2">
<?php
echo Html::submitButton(\Yii::t($module->messageCategory, 'submit'), ['class' => 'btn btn-primary']);
?>
</div>
</div>
</div>
<?php
echo Html::endForm();
?>
<!-- end admin-form -->
示例9: renderFilterCellContent
/**
* Renders filter inputs based on the `filterType`
*
* @return string
*/
protected function renderFilterCellContent()
{
$content = parent::renderFilterCellContent();
$chkType = !empty($this->filterType) && $this->filterType !== GridView::FILTER_CHECKBOX && $this->filterType !== GridView::FILTER_RADIO && !class_exists($this->filterType);
if ($this->filter === false || empty($this->filterType) || $content === $this->grid->emptyCell || $chkType) {
return $content;
}
$widgetClass = $this->filterType;
$options = ['model' => $this->grid->filterModel, 'attribute' => $this->attribute, 'options' => $this->filterInputOptions];
if (is_array($this->filter)) {
if ($this->filterType === GridView::FILTER_SELECT2 || $this->filterType === GridView::FILTER_TYPEAHEAD) {
$options['data'] = $this->filter;
}
if ($this->filterType === GridView::FILTER_RADIO) {
return Html::activeRadioList($this->grid->filterModel, $this->attribute, $this->filter, $this->filterInputOptions);
}
}
if ($this->filterType === GridView::FILTER_CHECKBOX) {
return Html::activeCheckbox($this->grid->filterModel, $this->attribute, $this->filterInputOptions);
}
$options = ArrayHelper::merge($this->filterWidgetOptions, $options);
/** @var \kartik\base\Widget $widgetClass */
return $widgetClass::widget($options);
}
示例10:
}
?>
<!-- --><?php
//$isVote = true; $_POST['pollStatus']='shows'
?>
<?php
if ($isVote == false && Yii::$app->user->getId() != null && $_POST['pollStatus'] != 'show' || $pullName == $pollData['poll_name'] && $_POST['pollStatus'] == 'vote' && $_POST['pollStatus'] != 'show' && Yii::$app->user->getId() != null) {
?>
<?php
echo Html::beginForm('#', 'post', ['class' => 'uk-width-medium-1-1 uk-form uk-form-horizontal']);
?>
<?php
echo Html::activeRadioList($model, 'voice', $answers);
?>
<input type="hidden" name="poll_name" value="<?php
echo $pollData['poll_name'];
?>
"/>
<?php
AjaxSubmitButton::begin(['label' => 'Vote', 'ajaxOptions' => ['type' => 'POST', 'url' => '#', 'success' => new \yii\web\JsExpression('function(data){
$("body").html(data);
}')], 'options' => ['class' => 'customclass', 'type' => 'submit']]);
AjaxSubmitButton::end();
?>
<?php
echo Html::endForm();
示例11: function
<?php
echo \yii\helpers\Html::activeRadioList($this->context->model, $this->context->attribute, $this->context->items, ['class' => 'btn-group', 'data-toggle' => 'buttons', 'item' => function ($index, $label, $name, $checked, $value) {
$type = 'btn-' . $this->context->type;
$size = 'btn-' . $this->context->size;
$checked = $checked ? 'active' : '';
$class = "btn {$type} {$size} {$checked}";
return \yii\helpers\Html::radio($name, $checked, ['value' => $value, 'label' => $label, 'container' => false, 'labelOptions' => ['class' => $class]]);
}]);
示例12:
<?php
echo $form->field($model, 'product_category_icon')->fileInput();
?>
<?php
echo $form->field($model, 'product_category_icon_mobile')->fileInput();
?>
<div class="row">
<div class="control-label col-sm-3">
<label>Parent category</label>
</div>
<div class="col-sm-3">
<?php
echo Html::activeRadioList($model, 'product_category_parent_id', ArrayHelper::map($parentCategories, 'product_category_id', 'product_category_name'), ['class' => 'categoryOptionList']);
?>
</div>
</div>
<div class="form-group">
<?php
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>
<?php
ActiveForm::end();
?>
</div>
示例13: renderInput
public function renderInput()
{
return $this->hasModel() ? Html::activeRadioList($this->model, $this->attribute, $this->items, $this->options) : Html::radioList($this->name, $this->selection, $this->items, $this->options);
}
示例14:
use yii\helpers\Url;
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use common\models\Address;
use common\models\Building;
use common\models\School;
$this->title = $model->isNewRecord ? '添加收货地址' : '更新收货地址';
$this->params['breadcrumbs'][] = ['label' => '个人中心', 'url' => ['/i']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="edit-form">
<?php
$form = ActiveForm::begin(['enableAjaxValidation' => true, 'validateOnChange' => false, 'validateOnBlur' => false, 'layout' => 'horizontal', 'fieldConfig' => ['horizontalCssClasses' => ['label' => 'col-md-2', 'wrapper' => 'col-md-8']]]);
?>
<?php
echo $form->field($model, 'consignee', ['template' => "{label}\n{beginWrapper}\n{beginRow}\n{beginCol}\n{input}\n{hint}\n{error}\n{endCol}\n{beginCol}\n{gender}\n{endCol}\n{endRow}\n{endWrapper}", 'parts' => ['{gender}' => Html::activeRadioList($model, 'gender', Address::getGenderList()), '{beginRow}' => '<div class="row">', '{endRow}' => '</div>', '{beginCol}' => '<div class="col-xs-6">', '{endCol}' => '</div>']]);
?>
<?php
echo $form->field($model, 'cellphone');
?>
<?php
echo $form->field($model, 'school_id')->dropDownList(School::getKeyValuePairs());
?>
<div class="form-group">
<label class="col-md-2 control-label">收货地址</label>
<div class="col-md-8">
<div class="row">
<div class="col-xs-6">
<div class="col-md-12"><?php
echo $form->field($model, 'building_id', ['template' => "{input}\n{hint}\n{error}"])->dropDownList(Building::getKeyValuePairs($model->school_id));
?>