当前位置: 首页>>代码示例>>PHP>>正文


PHP Html::activeCheckboxList方法代码示例

本文整理汇总了PHP中yii\helpers\Html::activeCheckboxList方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::activeCheckboxList方法的具体用法?PHP Html::activeCheckboxList怎么用?PHP Html::activeCheckboxList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\helpers\Html的用法示例。


在下文中一共展示了Html::activeCheckboxList方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  *
  */
 public function run()
 {
     $view = $this->getView();
     $this->registerScript($view);
     if ($this->hasModel()) {
         $list = Html::activeCheckboxList($this->model, $this->attribute, $this->items, $this->options);
     } else {
         $list = Html::checkboxList($this->name, $this->value, $this->items, $this->options);
     }
     $input = Html::tag('div', $list, $this->containerOptions);
     echo strtr($this->template, ['{input}' => $input]);
 }
开发者ID:pavlinter,项目名称:yii2-adm-app,代码行数:15,代码来源:CheckboxList.php

示例2: renderInput

 /**
  * render the html input for the widget
  */
 protected function renderInput()
 {
     if ($this->hasModel()) {
         $content = Html::activeCheckboxList($this->model, $this->attribute, $this->items, $this->options);
     } else {
         $content = Html::checkboxList($this->name, $this->value, $this->items, $this->options);
     }
     return Html::tag('div', $content, ['id' => $this->widgetId . '-checkbox', 'class' => 'checkbox_button_group' . '_checkbox']);
 }
开发者ID:webtoolsnz,项目名称:yii2-widgets,代码行数:12,代码来源:CheckboxButtonGroup.php

示例3: function

?>

<div class="user-search">

    <?php 
$form = ActiveForm::begin(['action' => ['index'], 'method' => 'get']);
?>

    <?php 
echo $form->field($model, 'username');
?>

    <?php 
echo Html::activeCheckboxList($model, 'cities', $cities, ['item' => function ($index, $label, $name, $checked, $value) use($model) {
    $selected_ids = Yii::$app->session['UserSearch']['cities'];
    $checked = $selected_ids ? in_array($value, $selected_ids) : false;
    return Html::checkbox($name, $checked, ['value' => $value, 'label' => Html::encode($label)]);
}]);
?>

    <?php 
echo $form->field($model, 'education_id')->dropDownList($educations, ['prompt' => 'Select education']);
?>



    <div class="form-group">
        <?php 
echo Html::submitButton('Search', ['class' => 'btn btn-primary']);
?>
        <?php 
开发者ID:kocapb,项目名称:library,代码行数:31,代码来源:_search.php

示例4: checkboxList

 /**
  * Renders a list of checkboxes.
  * A checkbox list allows multiple selection, like [[listBox()]].
  * As a result, the corresponding submitted value is an array.
  * The selection of the checkbox list is taken from the value of the model attribute.
  * @param array $items the data item used to generate the checkboxes.
  * The array values are the labels, while the array keys are the corresponding checkbox values.
  * Note that the labels will NOT be HTML-encoded, while the values will.
  * @param array $options options (name => config) for the checkbox list. The following options are specially handled:
  *
  * - unselect: string, the value that should be submitted when none of the checkboxes 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 checkbox in the whole list; $label
  * is the label for the checkbox; and $name, $value and $checked represent the name,
  * value and the checked status of the checkbox input.
  * @return static the field object itself
  */
 public function checkboxList($items, $options = [])
 {
     $this->adjustLabelFor($options);
     $this->parts['{input}'] = Html::activeCheckboxList($this->model, $this->attribute, $items, $options);
     return $this;
 }
开发者ID:bmsrox,项目名称:yiicomm,代码行数:31,代码来源:ActiveField.php

示例5: function

    <?php 
$form = ActiveForm::begin(['method' => 'get', 'enableClientScript' => false, 'action' => Url::current()]);
?>

    <div class="filter-box">
<!--        <div class="filter-check">-->
<!--            <label class="checkbox-style"><input type="checkbox"><i></i> Free delivery</label>-->
<!--        </div>-->
        <div class="box-toggle">
            <div class="toggle-header">Brands</div>
            <div class="toggle-in">
                <div class="scroll-pane">
                    <ul class="filter-checkbox">
                        <?php 
echo Html::activeCheckboxList($searchModel, 'brand_id', $brands, ['item' => function ($index, $label, $name, $checked, $value) use($brandsProductCount) {
    return '<li><label class="checkbox-style">' . Html::checkbox($name, $checked, ['value' => $value]) . '<i></i> ' . $label . ' <span>(' . $brandsProductCount[$value] . ')</span></label></li>';
}]);
?>
                    </ul>
                </div>
            </div>
        </div>

        <?php 
echo Filter::widget(['propertiesProvider' => $this->params['propertiesProvider']]);
?>

        <?php 
echo \yii\helpers\Html::submitButton('Apply filter', ['class' => 'filter-btn']);
?>
    </div>
开发者ID:ninetor,项目名称:yii-classifield,代码行数:31,代码来源:_filter.php

示例6: foreach

});
$values = $searchModel->{$element->name};
if (is_array($values) && count($values)) {
    foreach ($values as $value) {
        if ($value !== null && !empty($value)) {
            $variants[$value] = $value;
        }
    }
}
if (count($variants)) {
    ?>

<label class="f-label"><?php 
    echo $element->title;
    ?>
</label>

<?php 
    echo Html::activeCheckboxList($searchModel, $element->name, $variants, ['class' => $element->name . '-filter checkbox-filter']);
    ?>

<?php 
    if (count($variants) > 5) {
        ?>
	<?php 
        echo Html::a('Показать все', '#', ['class' => 'dfn', 'data-uk-toggle' => "{cls: 'active', target:'#" . Html::getInputId($searchModel, $element->name) . "'}"]);
    }
    ?>

<?php 
}
开发者ID:worstinme,项目名称:yii2-zoo,代码行数:31,代码来源:_filter.php

示例7: function

<?php

echo \yii\helpers\Html::activeCheckboxList($model, $attribute, $items, ['class' => 'btn-group', 'data-toggle' => 'buttons', 'item' => function ($index, $label, $name, $checked, $value) {
    return \yii\helpers\Html::checkbox($name, $checked, ['value' => $value, 'label' => $label, 'container' => false, 'labelOptions' => ['class' => "btn btn-{$this->context->type} btn-{$this->context->size}" . ($checked ? ' active' : '')]]);
}]);
开发者ID:kolyunya,项目名称:yii2-bootstrap-checkbox-list,代码行数:5,代码来源:CheckboxList.php

示例8: run

 /**
  * Renders the widget.
  */
 public function run()
 {
     $categories = LetCategory::getCategory($this->model->moduleName(), '-- ');
     echo Html::activeCheckboxList($this->model, $this->attribute, $categories, $this->options);
 }
开发者ID:letyii,项目名称:cms,代码行数:8,代码来源:FieldCategory.php

示例9:

<?php

echo \yii\helpers\Html::activeCheckboxList($role, 'users', $users, ['onchange' => '$.get("/rbac/auth-assignment/change", {
        "id" : "' . $role->name . '",
        "user_id" : event.target.value,
        "add" : $(event.target).is(":checked") ? 1 : 0
    }).error(function(data){alert(data.responseText);});']);
开发者ID:burnb,项目名称:yii2-rbac-cms-module,代码行数:7,代码来源:role-users.php

示例10: renderInput

 /**
  * @return string
  */
 public function renderInput()
 {
     return $this->hasModel() ? Html::activeCheckboxList($this->model, $this->attribute, $this->items, $this->options) : Html::checkboxList($this->name, $this->selection, $this->items, $this->options);
 }
开发者ID:Vincent-X,项目名称:yii2-semantic-ui,代码行数:7,代码来源:CheckboxList.php

示例11: renderHtml

 /**
  * @inheritdoc
  */
 public function renderHtml()
 {
     if ($this->form !== null && $this->model !== null) {
         return $this->form->field($this->model, $this->attribute)->hint($this->hint)->checkboxList($this->items, $this->options);
     }
     if ($this->model !== null) {
         return Html::activeCheckboxList($this->model, $this->attribute, $this->items, $this->options);
     }
     return Html::checkboxList($this->name, $this->value, $this->items, $this->options);
 }
开发者ID:phpdn,项目名称:qc-base,代码行数:13,代码来源:CheckBoxControl.php


注:本文中的yii\helpers\Html::activeCheckboxList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。