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


PHP Html::checkboxList方法代码示例

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


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

示例1:

    <?php 
$form = ActiveForm::begin();
?>

    <div class="tbox">
    	<div class="hd">继承角色:</div>
    	<?php 
$existItems = array_keys($existItems);
echo Html::checkboxList('selectedRoles', $existItems, ArrayHelper::map($allRoles, 'name', 'name'));
?>
    
    </div>
    <div class="tbox">
    	<div class="hd">设置权限:</div>
    	<?php 
echo Html::checkboxList('selectedPermissions', $existItems, ArrayHelper::map($allPermissions, 'name', 'name'));
?>
    </div>
    
  

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary', 'name' => 'submit']);
?>
    </div>

    <?php 
ActiveForm::end();
?>
开发者ID:liasica,项目名称:yiiforum,代码行数:30,代码来源:permission.php

示例2: getApixCheckboxGroupHtml

 protected function getApixCheckboxGroupHtml($form, $config, $field)
 {
     $model = $config['model'];
     $fieldHtml = null;
     $fieldOptions = $field->options;
     if (isset($fieldOptions['items'])) {
         $items = $fieldOptions['items'];
         unset($fieldOptions['items']);
         $fieldHtml = Html::checkboxList($model . "[{$field->name}]", null, $items, $field->options);
     } else {
         $fieldHtml = Html::checkboxList($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;
 }
开发者ID:cmsgears,项目名称:module-core,代码行数:19,代码来源:FormDesigner.php

示例3: 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

示例4: testCheckboxList

    public function testCheckboxList()
    {
        $this->assertEquals('<div></div>', Html::checkboxList('test'));
        $expected = <<<EOD
<div><div class="checkbox"><label><input type="checkbox" name="test[]" value="value1"> text1</label></div>
<div class="checkbox"><label><input type="checkbox" name="test[]" value="value2" checked> text2</label></div></div>
EOD;
        $this->assertEqualsWithoutLE($expected, Html::checkboxList('test', ['value2'], $this->getDataItems()));
        $expected = <<<EOD
<div><div class="checkbox"><label><input type="checkbox" name="test[]" value="value1&lt;&gt;"> text1&lt;&gt;</label></div>
<div class="checkbox"><label><input type="checkbox" name="test[]" value="value  2"> text  2</label></div></div>
EOD;
        $this->assertEqualsWithoutLE($expected, Html::checkboxList('test', ['value2'], $this->getDataItems2()));
        $expected = <<<EOD
<input type="hidden" name="test" value="0"><div><div class="checkbox"><label><input type="checkbox" name="test[]" value="value1"> text1</label></div><br>
<div class="checkbox"><label><input type="checkbox" name="test[]" value="value2" checked> text2</label></div></div>
EOD;
        $this->assertEqualsWithoutLE($expected, Html::checkboxList('test', ['value2'], $this->getDataItems(), ['separator' => "<br>\n", 'unselect' => '0']));
        $expected = <<<EOD
<div>0<label>text1 <input type="checkbox" name="test[]" value="value1"></label>
1<label>text2 <input type="checkbox" name="test[]" value="value2" checked></label></div>
EOD;
        $this->assertEqualsWithoutLE($expected, Html::checkboxList('test', ['value2'], $this->getDataItems(), ['item' => function ($index, $label, $name, $checked, $value) {
            return $index . Html::label($label . ' ' . Html::checkbox($name, $checked, ['value' => $value]));
        }]));
    }
开发者ID:rajanishtimes,项目名称:basicyii,代码行数:26,代码来源:HtmlTest.php

示例5: 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

示例6: actionForm

 public function actionForm()
 {
     echo Html::beginForm();
     echo Html::checkboxList('test', ['value 1' => 'item 1', 'value 2' => 'item 2', 'value 3' => 'item 3'], isset($_POST['test']) ? $_POST['test'] : null, function ($index, $label, $name, $value, $checked) {
         return Html::label($label . ' ' . Html::checkbox($name, $value, $checked), null, ['class' => 'inline checkbox']);
     });
     echo Html::submitButton();
     echo Html::endForm();
     print_r($_POST);
 }
开发者ID:glcode,项目名称:yii2-2.0.3-annotated,代码行数:10,代码来源:SiteController.php

示例7:

" data-parent="#create-menu-items" data-toggle="collapse"
               class="collapsed" aria-expanded="false">
                <?php 
    echo $postType->post_type_pn;
    ?>

            </a>
        </h4>
    </div>
    <div class="panel-collapse collapse post-type-menu" id="post-type-<?php 
    echo $postType->id;
    ?>
">
        <div class="box-body">
            <?php 
    echo Html::checkboxList('postIds', null, ArrayHelper::map($postType->posts, 'id', 'post_title'), ['class' => 'checkbox post-type-menu-item ', 'separator' => '<br />']);
    ?>

        </div>
        <div class="box-footer">
            <?php 
    echo Html::hiddenInput('type', 'post');
    ?>

            <?php 
    echo Html::submitButton(Yii::t('writesdown', 'Add Menu'), ['class' => 'btn btn-flat btn-primary btn-create-menu-item']);
    ?>

        </div>
    </div>
    <?php 
开发者ID:tampaphp,项目名称:app-cms,代码行数:31,代码来源:_post-types.php

示例8: rgba

<?php

use yii\helpers\Html;
use porcelanosa\yii2options\models\OptionsList;
/**
 * @var $optionList          OptionsList
 * @var $option_name         string
 * @var $multipleValuesArray array
 * @var $status_preset_items array
 *
 */
?>

<div style="margin-bottom: 20px; padding: 5px; border: 1px solid rgba(166, 166, 166, 0.71)">
	<label>&nbsp;<?php 
echo $optionList->name;
?>
</label><br>
	<?php 
echo Html::checkboxList($option_name, $multipleValuesArray, $status_preset_items, ['id' => $option_name, 'class' => 'form-control', 'multiple' => 'true', 'itemOptions' => ['class' => 'i-check', 'style' => 'display:inline-block']]);
?>
</div>
开发者ID:porcelanosa,项目名称:yii2-options,代码行数:22,代码来源:_checkboxlist_multiple.php

示例9: renderCheckboxList

 /**
  * @param $name
  * @param $value
  * @param $options
  * @return string
  */
 protected function renderCheckboxList($name, $value, $options)
 {
     if (!array_key_exists('unselect', $options)) {
         $options['unselect'] = '';
     }
     $options['item'] = function ($index, $label, $name, $checked, $value) {
         return '<div class="checkbox">' . Html::checkbox($name, $checked, ['label' => $label, 'value' => $value]) . '</div>';
     };
     $input = Html::checkboxList($name, $value, $this->prepareItems($this->items), $options);
     return Html::tag('div', $input, ['class' => 'checkbox-list']);
 }
开发者ID:wqcsimple,项目名称:wwhis-weixin,代码行数:17,代码来源:BaseColumn.php

示例10: renderCheckboxList

 protected function renderCheckboxList($name, $value, $options)
 {
     $options['item'] = function ($index, $label, $name, $checked, $value) {
         return '<div class="checkbox">' . Html::checkbox($name, $checked, ['label' => $label, 'value' => $value]) . '</div>';
     };
     $input = Html::checkboxList($name, $value, $this->items, $options);
     return Html::tag('div', $input, ['class' => 'checkbox']);
 }
开发者ID:eborned,项目名称:yii2-multiple-input,代码行数:8,代码来源:MultipleInputColumn.php

示例11:

</h1>

    <?php 
$form = ActiveForm::begin();
?>
    <?php 
$existRoles = array_keys($existRoles);
foreach ($allRoles as $group => $roles) {
    ?>
	    <div class="tbox">
	    	<div class="hd"><?php 
    echo $group;
    ?>
</div>
	    	<?php 
    echo Html::checkboxList('selectedRoles', $existRoles, ArrayHelper::map($roles, 'name', 'description'));
    ?>
	    </div>
    <?php 
}
?>
    
 

    <div class="form-group">
        <?php 
echo Html::submitButton('Update', ['class' => 'btn btn-primary', 'name' => 'submit']);
?>
    </div>

    <?php 
开发者ID:liasica,项目名称:yiiforum,代码行数:31,代码来源:role.php

示例12:

<?php

use yii\helpers\Html;
use yii\bootstrap\Collapse;
use themes\admin360\widgets\Panel;
use themes\admin360\widgets\Button;
$this->title = 'اعطای دسترسی به کاربر';
$this->params['breadcrumbs'][] = $this->title;
$accordion = [];
foreach ($modules as $moduleId => $title) {
    $accordion[$moduleId]['label'] = $title;
    $accordion[$moduleId]['content'] = Html::checkboxList("permisions", $userPermissions, $allPermissions[$moduleId], ['itemOptions' => ['labelOptions' => ['class' => 'checkbox-inline']]]);
    $accordion[$moduleId]['contentOptions'] = ['class' => 'in'];
}
?>

<div class="row">
    <div class="col-sm-12">
        <?php 
Box::begin(['title' => 'اعطای دسترسی', 'options' => ['class' => 'box-solid box-primary']]);
?>
            <?php 
echo Html::beginForm();
?>
            <?php 
echo Collapse::widget(['items' => $accordion]);
?>
            <?php 
echo Html::submitButton('<i class="fa fa-save"></i> ذخیره', ['class' => 'btn btn-lg btn-flat margin bg-green']);
?>
            <?php 
开发者ID:ahb360,项目名称:cms,代码行数:31,代码来源:assign.php

示例13:

<?php

/* @var $postmsg string */
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;
?>
<div class="pizzamaster">
<h3>Калькулятор пиццы - Шаг 3</h3>
<div class="body_pizzamaster">
<?php 
$form = ActiveForm::begin(['method' => 'post', 'action' => ['']]);
?>
<p>
<label>Дополнительные опции</label>
<?php 
echo Html::checkboxList('optionsPizza', null, $arrOptions);
?>
 
</p>
<p class="submit_button">
<?php 
echo Html::submitButton('Далее', ['type' => 'submit', 'class' => 'btn btn-default']);
?>
</p>
 </div>
 </div>
<?php 
ActiveForm::end();
$session = \Yii::$app->session;
$session['step'] = '3';
/*записываем в сессию данные предыдущего шага*/
开发者ID:rkashapov2015,项目名称:rinatk-yii,代码行数:31,代码来源:pizza3.php

示例14:

                <div class="panel panel-default">
                    <div class="panel-heading">
                        <strong>Categories</strong>
                        <?php 
echo Html::a('<i class="glyphicon glyphicon-plus-sign"></i> Add', ['#'], ['class' => 'pull-right', 'data-toggle' => 'modal', 'data-target' => '#myModal']);
?>
                    </div>
                    <div class="panel-body">

                        <div class="categories-wrapper">
                            <?php 
$availableCategories = ArrayHelper::map($categories, 'id', 'name');
$preselectedOptions = ArrayHelper::map(ArrayHelper::toArray($model->terms), 'id', 'term_id');
?>
                            <?php 
echo Html::checkboxList('categories', $preselectedOptions, $availableCategories, ['id' => 'categories-con']);
?>

                        </div>
                    </div>
                </div>
            </div>
        </div>

    <?php 
ActiveForm::end();
?>

</div>

开发者ID:linchpinstudios,项目名称:yii2-blog,代码行数:29,代码来源:_form.php

示例15: t_arr

<!--   添加角色  -->
<?php 
$form = \yii\widgets\ActiveForm::begin(['options' => ['class' => 'p20']]);
?>

    <?php 
?>
    <h3><?php 
echo t_arr('app', ['user', 'role', 'edit'], '', ':');
?>
 <?php 
echo $user->username;
?>
</h3>
    <?php 
echo $form->field($model, 'user_id')->textInput(['placeholde' => 'placeholde', 'value' => $user->id]);
?>


    <?php 
echo Html::checkboxList($model->formName() . '[item_name][]', $assignMentSelectArray, $allRolesArray);
?>


    <?php 
echo Html::submitButton(t('app', 'update'), ['class' => 'btn btn-primary']);
?>


<?php 
$form->end();
开发者ID:xiaohongyang,项目名称:yii_shop,代码行数:31,代码来源:assign_ment_edit.php


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