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


PHP Html::checkbox方法代码示例

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


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

示例1: renderDataCellContent

 protected function renderDataCellContent($model, $key, $index)
 {
     if ($this->checkboxOptions instanceof Closure) {
         $options = call_user_func($this->checkboxOptions, $model, $key, $index, $this);
     } else {
         $options = $this->checkboxOptions;
         if (!isset($options['value'])) {
             $options['value'] = is_array($key) ? json_encode($key, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) : $key;
         }
     }
     if (isset($options['class'])) {
         $options['class'] .= ' icheck';
     } else {
         $options['class'] = 'icheck';
     }
     $options['hidden'] = true;
     return Html::checkbox($this->name, !empty($options['checked']), $options);
 }
开发者ID:ufrgs-hyman,项目名称:meican,代码行数:18,代码来源:IcheckboxColumn.php

示例2: foreach

    foreach ($broadcast_address as $address) {
        if ($address->user_id) {
            $user_exist = true;
            echo Html::tag('li', '<div class="checkbox">' . Html::checkbox('check_user_' . $address->id, true, ['label' => Html::tag('strong', $address->user->email) . ' &mdash; ' . $address->user->username, 'data-checkbox-address-id' => $address->id, 'class' => 'check-user', 'disabled' => Yii::$app->request->get('action') == 'send' ? true : false]) . (Yii::$app->request->get('action') == 'send' ? Html::tag('span', 'Ожидание', ['id' => 'status-' . $address->id, 'class' => 'text-danger', 'style' => 'margin-left: 15px;']) : '') . '</div>');
        }
    }
    if (!$user_exist) {
        echo Html::tag('li', '<em class="text-muted">Не заданы</em>');
    }
}
if (ArrayHelper::getColumn($broadcast_address, 'email')) {
    echo Html::tag('li', '<h3>Незарегистрированные пользователи</h3>');
    $user_exist = false;
    foreach ($broadcast_address as $address) {
        if ($address->email) {
            $user_exist = true;
            echo Html::tag('li', '<div class="checkbox">' . Html::checkbox('check_user_' . $address->id, true, ['label' => Html::tag('strong', $address->email) . ($address->fio ? ' &mdash; ' . $address->fio : ''), 'data-checkbox-address-id' => $address->id, 'class' => 'check-user', 'disabled' => Yii::$app->request->get('action') == 'send' ? true : false]) . (Yii::$app->request->get('action') == 'send' ? Html::tag('span', 'Ожидание', ['id' => 'status-' . $address->id, 'class' => 'text-danger', 'style' => 'margin-left: 15px;']) : '') . '</div>');
        }
    }
    if (!$user_exist) {
        echo Html::tag('li', '<em class="text-muted">Не заданы</em>');
    }
}
?>
        </ul>
    </div>
</div>



开发者ID:mark38,项目名称:yii2-site-mng,代码行数:27,代码来源:send.php

示例3: getItem

 /**
  * @param null $options
  * @param null $pluginOptions
  *
  * @return string
  * @throws \Exception
  */
 public function getItem($options = null, $pluginOptions = null)
 {
     switch ($this->type) {
         case self::TYPE_TEXT:
             return Html::input('text', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
         case self::TYPE_EMAIL:
             return Html::input('email', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
         case self::TYPE_NUMBER:
             return Html::input('number', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
         case self::TYPE_TEXTAREA:
             return Html::textarea('Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
         case self::TYPE_COLOR:
             return ColorInput::widget(['value' => $this->value, 'name' => 'Setting[' . $this->code . ']', 'options' => $options != null ? $options : ['class' => 'form-control']]);
         case self::TYPE_DATE:
             return DatePicker::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['format' => 'yyyy-mm-dd', 'todayHighlight' => true]]);
         case self::TYPE_TIME:
             return TimePicker::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['minuteStep' => 1, 'showSeconds' => true, 'showMeridian' => false]]);
         case self::TYPE_DATETIME:
             return DateTimePicker::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => ['format' => 'yyyy-mm-dd H:i:s', 'todayHighlight' => true]]);
         case self::TYPE_PASSWORD:
             return PasswordInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['showMeter' => true, 'toggleMask' => false]]);
         case self::TYPE_ROXYMCE:
             return RoxyMceWidget::widget(['id' => 'Setting_' . $this->code, 'name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'action' => Url::to(['roxymce/default']), 'options' => $options != null ? $options : ['title' => $this->getName()], 'clientOptions' => $pluginOptions != null ? $pluginOptions : []]);
         case self::TYPE_SELECT:
             return Select2::widget(['value' => $this->value, 'name' => 'Setting[' . $this->code . ']', 'data' => $this->getStoreRange(), 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => ['allowClear' => true]]);
         case self::TYPE_MULTI_SELECT:
             $options['multiple'] = true;
             if (!isset($options['class'])) {
                 $options['class'] = 'form-control';
             }
             return Select2::widget(['name' => 'Setting[' . $this->code . ']', 'value' => explode(",", $this->value), 'data' => $this->getStoreRange(), 'options' => $options, 'pluginOptions' => ['allowClear' => true]]);
         case self::TYPE_FILE_PATH:
             $value = Yii::getAlias($this->store_dir) . DIRECTORY_SEPARATOR . $this->value;
             return FileInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $value, 'options' => $options != null ? $options : ['class' => 'form-control', 'multiple' => false], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['previewFileType' => 'any', 'showRemove' => false, 'showUpload' => false, 'initialPreview' => !$this->isNewRecord ? [$this->value] : []]]);
         case self::TYPE_FILE_URL:
             $value = $this->store_url . '/' . $this->value;
             return FileInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['previewFileType' => 'any', 'showRemove' => false, 'showUpload' => false, 'initialPreviewAsData' => true, 'initialPreviewFileType' => self::fileType(pathinfo($this->value, PATHINFO_EXTENSION)), 'initialPreview' => !$this->isNewRecord ? $value : [], 'initialCaption' => $this->value]]);
         case self::TYPE_PERCENT:
             return RangeInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'html5Options' => ['min' => 0, 'max' => 100, 'step' => 1], 'options' => $options != null ? $options : ['class' => 'form-control'], 'addon' => ['append' => ['content' => '%']]]);
         case self::TYPE_SWITCH:
             $selector = explode(',', $this->store_range);
             if (count($selector) != 2) {
                 throw new ErrorException(Yii::t('setting', 'Switch Field should have store with 2 value, and negative is first. Example: no,yes'), 500);
             }
             return Html::hiddenInput('Setting[' . $this->code . ']', $selector[0]) . SwitchInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $selector[1], 'containerOptions' => ['class' => 'nv-switch-container'], 'options' => $options != null ? $options : [], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['state' => $this->value == $selector[1], 'size' => 'small', 'offText' => ucfirst($selector[0]), 'onText' => ucfirst($selector[1])]]);
         case self::TYPE_CHECKBOX:
             $random = rand(1000, 9999);
             return Html::checkboxList('Setting[' . $this->code . ']', explode(",", $this->value), $this->getStoreRange(), $options != null ? $options : ['class' => 'nv-checkbox-list checkbox', 'item' => function ($index, $label, $name, $checked, $value) use($random) {
                 $html = Html::beginTag('div');
                 $html .= Html::checkbox($name, $checked, ['id' => 'Setting_checkbox_' . $label . '_' . $index . '_' . $random, 'value' => $value]);
                 $html .= Html::label($label, 'Setting_checkbox_' . $label . '_' . $index . '_' . $random);
                 $html .= Html::endTag('div');
                 return $html;
             }]);
         case self::TYPE_RADIO:
             $random = rand(1000, 9999);
             return Html::radioList('Setting[' . $this->code . ']', $this->value, $this->getStoreRange(), $options != null ? $options : ['class' => 'nv-checkbox-list radio', 'item' => function ($index, $label, $name, $checked, $value) use($random) {
                 $html = Html::beginTag('div');
                 $html .= Html::radio($name, $checked, ['id' => 'Setting_radio_' . $label . '_' . $index . '_' . $random, 'value' => $value]);
                 $html .= Html::label($label, 'Setting_radio_' . $label . '_' . $index . '_' . $random);
                 $html .= Html::endTag('div');
                 return $html;
             }]);
         case self::TYPE_SEPARATOR:
             return '<hr>';
         default:
             return Html::input('text', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
     }
 }
开发者ID:navatech,项目名称:yii2-setting,代码行数:76,代码来源:Setting.php

示例4:

<div class="form-group">
    <?php 
echo Html::label('Список тем');
?>
    <?php 
echo Html::listBox('workList', null, $workListArr, ['class' => 'form-control', 'options' => $disabledWorks]);
?>
</div>
<div class="form-group">
    <?php 
echo Html::label('Новая тема');
?>
    <div class="input-group ">    
        <span class="input-group-addon">
            <?php 
echo Html::checkbox('newWorkCheckbox');
?>
        </span>    
        <span class="input-group-addon" id="basic-addon1">
            Название
        </span>
        <?php 
echo Html::textInput('newWorkName', null, ['class' => 'form-control']);
?>
        <span class="input-group-addon" id="basic-addon1">
            Руководитель
        </span>
        <?php 
echo Html::dropDownList('newWorkTeacher', null, $teachersArr, ['class' => 'form-control']);
?>
    </div>    
开发者ID:mrhat24,项目名称:site-for-pm,代码行数:31,代码来源:begin_graduate.php

示例5: array

        <p><?php 
echo Yii::t('InstallerModule.views_config_modules', 'HumHub is very flexible and can be adjusted and/or expanded for various different applications thanks to its’ different modules.  The following modules are just a few examples and the ones we thought are most important for your chosen application.<br><br>You can always install or remove modules later. You can find more available modules after installation in the admin area.');
?>
</p>
        <br>

        <?php 
echo Html::beginForm();
?>

        <?php 
foreach ($modules as $module) {
    ?>
            <label>
                <?php 
    echo Html::checkbox('enableModules[' . $module['id'] . ']', true);
    echo $module['name'];
    ?>
            </label>
            <p class="help-block" style="margin: 0 0 10px 23px;"><?php 
    echo $module['description'];
    ?>
</p>
            <hr>
        <?php 
}
?>

        <?php 
echo Html::submitButton(Yii::t('base', 'Next'), array('class' => 'btn btn-primary', 'data-loader' => "modal", 'data-message' => Yii::t('InstallerModule.base', 'Downloading & Installing Modules...')));
?>
开发者ID:VasileGabriel,项目名称:humhub,代码行数:31,代码来源:modules.php

示例6: generateColumnByType

 /**
  * Ham tao giao dien cho column
  * @param string $keyColumn ten truong cua column
  * @param array $column mang setting cua column
  * @param array $gallery mang gia tri cua image
  * @param string $id id cua 1 anh
  * @param string $tdOptions Html Attribute of td column
  * @return string
  */
 private function generateColumnByType($keyColumn, $column, $gallery, $id, $tdOptions = [], $module, $attribute)
 {
     $typeImage = ArrayHelper::getValue($column, 'displayType', 'text');
     $items = ArrayHelper::getValue($column, 'items', []);
     $options = ArrayHelper::getValue($column, 'options', ['class' => 'form-control']);
     $column_name = $module . '[' . $attribute . '][' . $id . '][' . $keyColumn . ']';
     switch ($typeImage) {
         case self::SYA_TYPE_COLUMN_DROPDOWN:
             $template = Html::dropDownList($column_name, ArrayHelper::getValue($gallery, $keyColumn), $items, $options);
             break;
         case self::SYA_TYPE_COLUMN_TEXTAREA:
             $template = Html::textarea($column_name, ArrayHelper::getValue($gallery, $keyColumn), $options);
             break;
         case self::SYA_TYPE_COLUMN_RADIO:
             $template = Html::radio($column_name, ArrayHelper::getValue($gallery, $keyColumn), $options);
             break;
         case self::SYA_TYPE_COLUMN_RADIOLIST:
             $template = Html::radioList($column_name, ArrayHelper::getValue($gallery, $keyColumn), $items, $options);
             break;
         case self::SYA_TYPE_COLUMN_CHECKBOX:
             $template = Html::checkbox($column_name, ArrayHelper::getValue($gallery, $keyColumn), $options);
             break;
         case self::SYA_TYPE_COLUMN_CHECKBOXLIST:
             $template = Html::checkboxList($column_name, ArrayHelper::getValue($gallery, $keyColumn), $items, $options);
             break;
         case self::SYA_TYPE_COLUMN_HIDDEN:
             $tdOptions = ArrayHelper::merge($tdOptions, ['style' => 'display: none;']);
             $template = Html::hiddenInput($column_name, ArrayHelper::getValue($gallery, $keyColumn), $options);
             break;
         default:
             $template = Html::textInput($column_name, ArrayHelper::getValue($gallery, $keyColumn), $options);
             break;
     }
     $templateGallery = Html::beginTag('td', $tdOptions);
     $templateGallery .= $template;
     $templateGallery .= Html::endTag('td');
     return $templateGallery;
 }
开发者ID:sya0710,项目名称:yii2-gallery,代码行数:47,代码来源:Gallery.php

示例7: renderField

 public static function renderField($group, $fieldName, $fieldParams)
 {
     $id = $fieldParams['id'];
     $type = $fieldParams['type'];
     $value = $fieldParams['value'];
     $description = $fieldParams['description'];
     $options = $fieldParams['options'];
     $fld = $group . '[' . $fieldName . ']';
     $html = '';
     switch ($type) {
         case 'text':
             $html .= self::labelInput($fieldName, $fld, Html::textInput($fld, $value, ['class' => 'form-control']));
             $html .= self::hint($description);
             break;
         case 'textarea':
             $html .= self::labelInput($fieldName, $fld, Html::textarea($fld, $value, ['rows' => 5, 'class' => 'form-control', 'hint' => $description]));
             $html .= ConfigurationUtils::hint($description);
             break;
         case 'checkbox':
             $html .= self::labelInput($fieldName, $fld, Html::checkbox($fld, $value, ['value' => $value == '1' ? '1' : '0', 'class' => 'form-control autoval']));
             break;
         case 'dropdown':
             $data = explode(",", $options);
             $data = array_reverse($data);
             $data[''] = Yii::t('app', 'Select an option...');
             $data = array_reverse($data);
             $data = array_combine($data, $data);
             $html .= self::labelInput($fieldName, $fld, Html::dropDownList($fld, $value, $data, ['class' => 'form-control']));
             break;
     }
     return $html;
 }
开发者ID:d4rkstar,项目名称:yii2-dbconfig,代码行数:32,代码来源:ConfigurationUtils.php

示例8:

    <div class="row">
        <div class="col-md-7">
            <?php 
echo $form->field($model, 'title')->textInput(['maxlength' => true]);
?>
            <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>
        </div>
        <div class="col-md-5">
            <?php 
echo $form->field($model, 'isPublished')->checkbox();
?>
            <?php 
if (YII_DEBUG) {
    echo Html::checkbox('createMigration', false, ['label' => \Yii::t('app', 'Создать миграцию')]);
}
?>
        </div>
    </div>
    <?php 
echo $form->field($model, 'text')->widget(CKEditor::className());
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? \Yii::t('app', 'Добавить') : \Yii::t('app', 'Сохранить'), ['class' => 'btn btn-primary']);
?>
    </div>

<?php 
开发者ID:ExtPoint,项目名称:project-boilerplate,代码行数:31,代码来源:update.php

示例9: function

class="hidden-js" <?php 
}
?>
>
			<?php 
echo $form->field($model, 'material_other');
?>
		</div>
		<?php 
echo $form->field($model, 'entrances')->checkboxList($model->getBoxEntrances(), ['unselect' => null, 'item' => function ($index, $label, $name, $checked, $value) use($form, $model) {
    $extra = '';
    $checked = is_array($model->checked_entrances) && in_array($value, array_keys($model->checked_entrances)) ? true : false;
    if ($value === Boxtypes::BOX_ENTRANCES_OTHER && !empty($model->checked_entrances[$value])) {
        $extra = '<input type="text" name="Boxtypes[entrance_other]" value="' . $model->checked_entrances[$value] . '" class="form-control">';
    }
    return '<div>' . Html::checkbox($name, $checked, ['label' => $label, 'value' => $value]) . ' ' . $extra . '</div>';
}]);
?>
		<?php 
echo $form->field($model, 'dropping_board')->dropDownList(["" => ""] + Boxtypes::getBoxDroppingBoards());
?>
		<div id="dropping_board_other_container" <?php 
if (!$model->dropping_board_other) {
    ?>
class="hidden-js" <?php 
}
?>
>
			<?php 
echo $form->field($model, 'dropping_board_other');
?>
开发者ID:ThijsBosch,项目名称:batboxes,代码行数:31,代码来源:form.php

示例10:

" title="<?php 
echo Yii::t('admin', 'Go to admin panel');
?>
" data-toggle="tooltip" data-placement="bottom">
        <img src="<?php 
echo $asset->baseUrl;
?>
/images/icon-logo.svg" alt="OakCMS">
        <?php 
echo Yii::t('admin', 'Admin panel');
?>
    </a>

    <div class="live-edit">
        <?php 
echo Html::checkbox('', LIVE_EDIT, ['class' => 'simple-switch', 'data-url' => Url::to(['/system/default/live-edit'])]);
?>
        <i class="glyphicon glyphicon-pencil"></i>
        <span><?php 
echo Yii::t('admin', 'Live edit');
?>
</span>
    </div>

    <div class="user-menu">
        <a href="#"><?php 
echo $userIdentity->username;
?>
</a>
        <div class="sub-wrapper">
            <ul class="submenu">
开发者ID:oakcms,项目名称:oakcms,代码行数:31,代码来源:admin_bar.php


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