activeCheckBox() public static method

Generates a check box for a model attribute.
public static activeCheckBox ( CModel $model, string $attribute, array $htmlOptions = [] ) : string
$model CModel the data model.
$attribute string the attribute.
$htmlOptions array additional HTML attributes.
return string the generated check box.
Beispiel #1
0
	</div><br/>
	
	<div style="width: 45%;">
		<p class="hint">
		<?php 
echo TbHtml::link(UserModule::t("Register"), Yii::app()->getModule('user')->registrationUrl);
?>
<br/><?php 
echo TbHtml::link(UserModule::t("Lost Password?"), Yii::app()->getModule('user')->recoveryUrl);
?>
		</p>
	</div>
	<!--
	<div class="row-fluid rememberMe">
		<?php 
echo TbHtml::activeCheckBox($model, 'rememberMe');
?>
		<?php 
echo TbHtml::activeLabelEx($model, 'rememberMe');
?>
	</div> -->

	<div class="row-fluid submit">
		<?php 
echo TbHtml::submitButton(UserModule::t("Login"), array('color' => TbHtml::BUTTON_COLOR_PRIMARY, 'submit' => ''));
?>
	</div>
	
<?php 
echo TbHtml::endForm();
?>
Beispiel #2
0
 public function testActiveCheckBox()
 {
     $I = $this->codeGuy;
     $html = TbHtml::activeCheckBox(new Dummy(), 'checkbox', array('class' => 'input', 'label' => 'Label text'));
     $body = $I->createNode($html, 'body');
     $hidden = $body->filter('input[type=hidden]');
     $I->seeNodeAttributes($hidden, array('id' => 'ytDummy_checkbox', 'name' => 'Dummy[checkbox]', 'value' => '0'));
     $label = $body->filter('label');
     $I->seeNodeCssClass($label, 'checkbox');
     $checkbox = $label->filter('input[type=checkbox]');
     $I->seeNodeAttributes($checkbox, array('class' => 'input', 'id' => 'Dummy_checkbox', 'name' => 'Dummy[checkbox]', 'value' => '1'));
     $I->seeNodePattern($label, '/> Label text$/');
 }
 /**
  * Renders a checkbox for a model attribute.
  * @param CModel $model the data model.
  * @param string $attribute the attribute.
  * @param array $htmlOptions additional HTML attributes.
  * @return string the generated check box.
  * @see TbHtml::activeCheckBox
  */
 public function checkBox($model, $attribute, $htmlOptions = array())
 {
     return TbHtml::activeCheckBox($model, $attribute, $htmlOptions);
 }
Beispiel #4
0
 /**
  * Renders a checkbox for a model attribute.
  * This method is a wrapper of {@link TbHtml::activeCheckBox}.
  * Please check {@link TbHtml::activeCheckBox} for detailed information
  * about the parameters for this method.
  * @param CModel $model the data model
  * @param string $attribute the attribute
  * @param array $htmlOptions additional HTML attributes.
  * @return string the generated check box
  */
 public function checkBox($model, $attribute, $htmlOptions = array())
 {
     return $this->wrapControl(TbHtml::activeCheckBox($model, $attribute, $htmlOptions));
 }
//echo TbHtml::activeLabelEx($model, 'description', array('class'=>'fl-l w-100', 'title' => $sDescMaxLength, 'alt' => $sDescMaxLength));
?>
        <div class="controls" style="margin-left: 100px;">
            <?php 
//echo TbHtml::activeTextField($model, 'description', array('name' => $baseName . '[description]', 'span' => 8, 'placeholder'=>'portfolio description'));
?>
        </div>
    </div>-->
    
    <div class="<?php 
echo $checkBoxClass;
?>
">
        <?php 
echo TbHtml::activeLabelEx($model, 'is_active', array('class' => 'fl-l w-100', 'style' => 'margin-right: 10px;'));
echo TbHtml::activeCheckBox($model, 'is_active', array('name' => $baseName . '[is_active]', 'placeholder' => 'portfolio is_active'));
?>
    </div>
    
</div>

<div class="qq-uploader" style="margin-bottom: 20px;">
    <div class="qq-upload-drop-area">
        <span>{dragZoneText}</span>
    </div>

    <div class="qq-upload-button btn" id="btnSelectFiles" style="width: 140px;">
        <span>{uploadButtonText}</span> 
    </div>

    <!--<div class="triggerUpload btn">
Beispiel #6
0
 public function testUncheckValueOptionForCheckboxesAndRadioInputs()
 {
     $I = $this->codeGuy;
     $items = array(0);
     $model = new Dummy();
     $outputsWithHidden = array('checkbox' => TbHtml::checkBox('cb1', false, array('uncheckValue' => 1)), 'checkboxList' => TbHtml::checkBoxList('cb2', 0, $items, array('uncheckValue' => 1)), 'radio' => TbHtml::radioButton('rd1', false, array('uncheckValue' => 1)), 'radioList' => TbHtml::radioButtonList('rd2', 0, $items, array('uncheckValue' => 1)), 'activeCheckbox' => TbHtml::activeCheckBox($model, 'checkboxList'), 'activeCheckboxList' => TbHtml::activeCheckBoxList($model, 'checkboxList', $items), 'activeRadio' => TbHtml::activeRadioButton($model, 'radioList'), 'activeRadioList' => TbHtml::activeRadioButtonList($model, 'radioList', $items));
     foreach ($outputsWithHidden as $output) {
         $I->seeNodeChildren($I->createNode($output), array('input[type=hidden]'));
     }
     // comparing against null 'uncheckValue' option
     $noHiddenOptions = array('uncheckValue' => null);
     $outputsWithoutHidden = array('checkbox' => TbHtml::checkBox('cb1'), 'checkboxList' => TbHtml::checkBoxList('cb2', 0, $items), 'radio' => TbHtml::radioButton('rd1'), 'radioList' => TbHtml::radioButtonList('rd2', 0, $items), 'activeCheckbox' => TbHtml::activeCheckBox($model, 'checkboxList', $noHiddenOptions), 'activeCheckboxList' => TbHtml::activeCheckBoxList($model, 'checkboxList', $items, $noHiddenOptions), 'activeRadio' => TbHtml::activeRadioButton($model, 'radioList', $noHiddenOptions), 'activeRadioList' => TbHtml::activeRadioButtonList($model, 'radioList', $items, $noHiddenOptions));
     foreach ($outputsWithoutHidden as $output) {
         $I->dontSeeNodeChildren($I->createNode($output), array('input[type=hidden]'));
     }
 }