inlineCheckBoxList() public static method

Generates an inline check box list.
public static inlineCheckBoxList ( string $name, mixed $select, array $data, array $htmlOptions = [] ) : string
$name string name of the check box list.
$select mixed selection of the check boxes.
$data array $data value-label pairs used to generate the check box list.
$htmlOptions array additional HTML attributes.
return string the generated list.
//array que ir� receber as plataformas selecionadas
$selected_platforms = array();
//para cada plataforma, insere os id_plataforma escolhidos no array
foreach ($model->platforms as $platform) {
    array_push($selected_platforms, $platform->id);
}
?>
			
			<div>
                            	<?php 
echo TbHtml::label($model->getAttributeLabel('platforms'), 'Platforms');
?>
				
				<div class="portlet-content">
				<?php 
echo TbHtml::inlineCheckBoxList('Platforms', $selected_platforms, CHtml::listData(Platforms::model()->findAll(), 'id', 'name'), array('template' => '{input} {label}'));
?>
				<?php 
echo $form->error($model, 'platforms');
?>
				</div>
			</div>
			
			</br></br>
			<?php 
//array que ir� receber os sados selecionados
$selected_languages = array();
//para cada plataforma
foreach ($model->languages as $language) {
    array_push($selected_languages, $language->id);
}
示例#2
0
?>
    </div>
    <pre class="prettyprint linenums">
&lt;?php echo TbHtml::checkBox('checkBox', '',
    array('label' => 'Option one is this and that—be sure to include why it\'s great')); ?>

&lt;?php echo TbHtml::radioButtonList('optionsRadios', '', array(
    'option1' => 'Option one is this and that—be sure to include why it\'s great',
    'option2' => 'Option two can be something else and selecting it will deselect option one',
)); ?></pre>

    <h4>Inline checkboxes</h4>

    <div class="bs-docs-example">
        <?php 
echo TbHtml::inlineCheckBoxList('inlineCheckbox', '', array('option1' => '1', 'option2' => '2', 'option3' => '3'));
?>
    </div>
    <pre class="prettyprint linenums">
&lt;?php echo TbHtml::inlineCheckBoxList('inlineCheckbox', '', array(
    'option1' => '1',
    'option2' => '2',
    'option3' => '3',
)); ?></pre>

    <h3>Selects</h3>

    <div class="bs-docs-example">
        <?php 
echo TbHtml::dropDownList('dropDown', '', array('1', '2', '3', '4', '5'));
?>
示例#3
0
 public function testInlineCheckBoxList()
 {
     $I = $this->codeGuy;
     $html = TbHtml::inlineCheckBoxList('checkboxList', null, array('Option 1', 'Option 2', 'Option 3'));
     $span = $I->createNode($html, 'span');
     $I->seeNodeNumChildren($span, 3);
     $I->seeNodeChildren($span, array('label.checkbox.inline', 'label.checkbox.inline', 'label.checkbox.inline'));
 }