當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CHtml::radioButton方法代碼示例

本文整理匯總了PHP中CHtml::radioButton方法的典型用法代碼示例。如果您正苦於以下問題:PHP CHtml::radioButton方法的具體用法?PHP CHtml::radioButton怎麽用?PHP CHtml::radioButton使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CHtml的用法示例。


在下文中一共展示了CHtml::radioButton方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: run

 public function run()
 {
     /*
     <div class="switch-toggle switch-3 switch-ios large-9 columns" data="<?php echo $checked->accepted ?>">
     <input id="DataItem_<?php echo $genId ?>_accepted_0" name="DataItem[<?php echo $genId ?>][accepted]" type="radio" value="1" <?php echo $checked->accepted==1?'checked':''?> />
     <label for="DataItem_<?php echo $genId ?>_accepted_0" onclick="">Yes</label>
     
     <input id="DataItem_<?php echo $genId ?>_accepted_1" name="DataItem[<?php echo $genId ?>][accepted]" type="radio" value="-1" <?php echo $checked->accepted==-1?'checked':''?> />
     <label for="DataItem_<?php echo $genId ?>_accepted_1" onclick="">No</label>
     
     <input id="DataItem_<?php echo $genId ?>_accepted_2" name="DataItem[<?php echo $genId ?>][accepted]" type="radio" value="0" <?php echo $checked->accepted==0?'checked':''?> />
     <label for="DataItem_<?php echo $genId ?>_accepted_2" onclick="">N/A</label>
     
     <a></a>
     </div>
     */
     $cs = Yii::app()->getClientScript();
     $assets = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets');
     $cs->registerCssFile($assets . DIRECTORY_SEPARATOR . 'toggle-switch.css');
     $cs->registerScriptFile($assets . DIRECTORY_SEPARATOR . 'script.js', CClientScript::POS_BEGIN);
     $nOfItems = count($this->data);
     if ($this->type == 'switch-toggle') {
         //You can add up to 5 items by using the .switch-3, .switch-4 and .switch-5 classes.
         echo CHtml::openTag('div', array('class' => 'switch-toggle switch-' . $nOfItems . ' ' . $this->scheme . ' columns'));
         foreach ($this->data as $key => $label) {
             $checked = $this->selected == $key;
             echo CHtml::radioButton($this->name, $checked, array('value' => $key, 'id' => $this->name . '_' . $key));
             echo CHtml::label($label, $this->name . '_' . $key, array('onclick' => ''));
         }
         echo CHtml::tag('a', array(), '', true);
         echo CHtml::closeTag('div');
     }
     if ($this->type == 'switch-light') {
         echo CHtml::openTag('label', array('class' => 'switch-light ' . $this->scheme, 'onclick' => ''));
         echo CHtml::checkBox('');
         echo CHtml::openTag('span');
         echo CHtml::tag('span', array(), 'Off');
         echo CHtml::tag('span', array(), 'On');
         echo CHtml::closeTag('span');
         echo CHtml::tag('a', array(), '', true);
         echo CHtml::closeTag('label');
     }
 }
開發者ID:sjnlabs2013,項目名稱:sampleyii,代碼行數:43,代碼來源:JToggleSwitch.php

示例2: radioButtonList

 public static function radioButtonList($name, $select, $data, $htmlOptions = array())
 {
     $template = isset($htmlOptions['template']) ? $htmlOptions['template'] : '{input} {label}';
     $separator = isset($htmlOptions['separator']) ? $htmlOptions['separator'] : "<br/>\n";
     unset($htmlOptions['template'], $htmlOptions['separator']);
     $labelOptions = isset($htmlOptions['labelOptions']) ? $htmlOptions['labelOptions'] : array();
     unset($htmlOptions['labelOptions']);
     $items = array();
     $baseID = CHtml::getIdByName($name);
     $id = 0;
     foreach ($data as $value => $item) {
         $checked = !strcmp($value, $select);
         $htmlOptions['value'] = $value;
         $labelOptions['id'] = $baseID . '_label_' . $id;
         $htmlOptions['id'] = $baseID . '_' . $id++;
         $labelOptions['title'] = $item['title'];
         $htmlOptions['class'] = 'ui-icon ui-state-default ' . $item['class'];
         $option = CHtml::radioButton($name, $checked, $htmlOptions);
         if (!empty($item['icon'])) {
             $item['caption'] = '<span style="float:left;" class="ui-icon ' . $item['icon'] . '"> ' . $item['caption'] . '</span>' . $item['caption'];
         }
         $label = CHtml::label($item['caption'], $htmlOptions['id'], $labelOptions);
         $items[] = strtr($template, array('{input}' => $option, '{label}' => $label));
     }
     return CHtml::tag('span', array('id' => $baseID), implode($separator, $items));
 }
開發者ID:rosko,項目名稱:Tempo-CMS,代碼行數:26,代碼來源:ButtonSet.php

示例3: renderButtons

 /**
  * Returns the formatted button
  * @return string the resulting HTML
  */
 public function renderButtons()
 {
     list($name, $id) = $this->resolveNameID();
     $buttons = array();
     $checked = $this->hasModel() ? !$this->model->{$this->attribute} : true;
     $buttons[] = \CHtml::radioButton($name, $checked, array('id' => $id . '_on', 'value' => 1));
     $buttons[] = \CHtml::label($this->offLabel, $id . '_on');
     $checked = $checked ? false : true;
     $buttons[] = \CHtml::radioButton($name, $checked, array('id' => $id . '_off', 'value' => 1));
     $buttons[] = \CHtml::label($this->onLabel, $id . '_off');
     $buttons[] = '<span></span>';
     return \CHtml::tag('div', $this->htmlOptions, implode("\n", $buttons));
 }
開發者ID:2amigos,項目名稱:yiifoundation,代碼行數:17,代碼來源:SwitchButton.php

示例4: renderButtons

 /**
  *### .'nextCentury'=> gT('Next century'),()
  *
  * Renders the button group
  */
 public function renderButtons()
 {
     list($name, $id) = $this->resolveNameID();
     echo CHtml::openTag('div', array('class' => "btn-group", 'id' => $name, 'data-toggle' => "buttons")) . "\n";
     $i = 1;
     foreach ($this->selectOptions as $value => $caption) {
         echo CHtml::openTag('label', array('class' => $value == $this->value ? 'btn btn-default active' : 'btn btn-default'));
         echo CHtml::radioButton($name, $value == $this->value, array('name' => $name, 'id' => $name . '_opt' . $i, 'value' => $value));
         echo CHtml::encode($caption);
         echo CHtml::closeTag('label') . "\n";
         $i++;
     }
     echo CHtml::closeTag('div') . "\n";
 }
開發者ID:sickpig,項目名稱:LimeSurvey,代碼行數:19,代碼來源:WhButtonGroup.php

示例5: array

echo CHtml::checkBox('admin_enabled_epaybg', $enabled_paypal == "yes" ? true : false, array('value' => "yes", 'class' => "icheck"));
?>
 
</div>

<div class="uk-form-row">
  <label class="uk-form-label"><?php 
echo Yii::t("default", "Mode");
?>
</label>
  <?php 
echo CHtml::radioButton('admin_mode_epaybg', $paypal_mode == "sandbox" ? true : false, array('value' => "sandbox", 'class' => "icheck"));
?>
  Sandbox 
  <?php 
echo CHtml::radioButton('admin_mode_epaybg', $paypal_mode == "live" ? true : false, array('value' => "live", 'class' => "icheck"));
?>
	
  Live 
</div>

<h3><?php 
echo Yii::t("default", "Sandbox");
?>
</h3>

<div class="uk-form-row">
  <label class="uk-form-label"><?php 
echo Yii::t("default", "MIN");
?>
</label>
開發者ID:ashishvazirani,項目名稱:food,代碼行數:31,代碼來源:epaybg.php

示例6: getIsDefaultHtml

 public function getIsDefaultHtml($admin_mail = 0)
 {
     if ($this->active) {
         if (!$admin_mail && $this->main == 1 || $admin_mail && $this->admin_mail == 1) {
             $onclick = 'return false;';
         } else {
             $onclick = "changeDefault(" . $this->id . ", " . $admin_mail . ");";
         }
         return $admin_mail ? CHtml::radioButton("admin_mail", $this->admin_mail == 1, array('onclick' => $onclick)) : CHtml::radioButton("main", $this->main == 1, array('onclick' => $onclick));
     }
 }
開發者ID:barricade86,項目名稱:raui,代碼行數:11,代碼來源:Lang.php

示例7: array

?>
:</b></label>  

<ul>
 <li>  
  <?php 
echo CHtml::radioButton('wd_bank_fields', yii::app()->functions->getOptionAdmin('wd_bank_fields') == "default" ? true : false, array('class' => "icheck", 'value' => "default"));
?>
  <?php 
echo t("Use Default");
?>
 </li>
 
 <li style="padding-left:170px;">  
  <?php 
echo CHtml::radioButton('wd_bank_fields', yii::app()->functions->getOptionAdmin('wd_bank_fields') == "au" ? true : false, array('class' => "icheck", 'value' => "au"));
?>
  <?php 
echo t("Use Australia Bank Fields");
?>
 </li>
</ul>
</div>


<div class="uk-form-row">
<label class="uk-form-label"><?php 
echo t("Minimum Payout Amount");
?>
:</label>  
<?php 
開發者ID:ashishvazirani,項目名稱:food,代碼行數:31,代碼來源:withdrawal-settings.php

示例8: run

 /**
  * (non-PHPdoc)
  * @see framework/CWidget::run()
  */
 public function run()
 {
     $cs = Yii::app()->getClientScript();
     list($name, $id) = $this->resolveNameID();
     if (isset($this->htmlOptions['id'])) {
         $id = $this->htmlOptions['id'];
     } else {
         $this->htmlOptions['id'] = $id;
     }
     if (isset($this->htmlOptions['name'])) {
         $name = $this->htmlOptions['name'];
     } else {
         $this->htmlOptions['name'] = $name;
     }
     if ($this->buttonType == 'buttonset') {
         echo CHtml::closeTag($this->htmlTag);
         $cs->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').buttonset();");
     } else {
         switch ($this->buttonType) {
             case 'submit':
                 echo CHtml::submitButton($this->caption, $this->htmlOptions) . "\n";
                 break;
             case 'button':
                 echo CHtml::htmlButton($this->caption, $this->htmlOptions) . "\n";
                 break;
             case 'link':
                 echo CHtml::link($this->caption, $this->url, $this->htmlOptions) . "\n";
                 break;
             case 'radio':
                 if ($this->hasModel()) {
                     echo CHtml::activeRadioButton($this->model, $this->attribute, $this->htmlOptions);
                     echo CHtml::label($this->caption, CHtml::activeId($this->model, $this->attribute)) . "\n";
                 } else {
                     echo CHtml::radioButton($name, $this->value, $this->htmlOptions);
                     echo CHtml::label($this->caption, $id) . "\n";
                 }
                 break;
             case 'checkbox':
                 if ($this->hasModel()) {
                     echo CHtml::activeCheckbox($this->model, $this->attribute, $this->htmlOptions);
                     echo CHtml::label($this->caption, CHtml::activeId($this->model, $this->attribute)) . "\n";
                 } else {
                     echo CHtml::checkbox($name, $this->value, $this->htmlOptions);
                     echo CHtml::label($this->caption, $id) . "\n";
                 }
                 break;
             default:
                 throw new CException(Yii::t('zii', 'The button type "{type}" is not supported.', array('{type}' => $this->buttonType)));
         }
         $options = empty($this->options) ? '' : CJavaScript::encode($this->options);
         if (isset($this->onclick)) {
             if (strpos($this->onclick, 'js:') !== 0) {
                 $this->onclick = 'js:' . $this->onclick;
             }
             $click = CJavaScript::encode($this->onclick);
             $cs->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').button({$options}).click({$click});");
         } else {
             $cs->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').button({$options});");
         }
     }
 }
開發者ID:charlymanja,項目名稱:traceper,代碼行數:65,代碼來源:CJuiButton.php

示例9: renderStars

 /**
  * Renders the stars.
  * @param string the ID of the container
  * @param string the name of the input
  */
 protected function renderStars($id, $name)
 {
     $inputCount = (int) (($this->maxRating - $this->minRating) / $this->ratingStepSize + 1);
     $starSplit = (int) ($inputCount / $this->starCount);
     $selection = $this->hasModel() ? $this->model->{$this->attribute} : $this->value;
     $options = $starSplit > 1 ? array('class' => "{split:{$starSplit}}") : array();
     for ($value = $this->minRating, $i = 0; $i < $inputCount; ++$i, $value += $this->ratingStepSize) {
         $options['id'] = $id . '_' . $i;
         $options['value'] = $value;
         if (isset($this->titles[$value])) {
             $options['title'] = $this->titles[$value];
         } else {
             unset($options['title']);
         }
         echo CHtml::radioButton($name, !strcmp($value, $selection), $options) . "\n";
     }
 }
開發者ID:ata,項目名稱:DompetJebol,代碼行數:22,代碼來源:CStarRating.php

示例10: array

for ($i = 0; $i <= 3; $i++) {
    ?>
      <div class="well">
        <div class="form-group">
          <?php 
    echo CHtml::label('Respuesta ' . ($i + 1), 'respuesta');
    ?>
          <?php 
    echo CHtml::textField('respuesta[]', $respuestas[$i]['respuesta'] ? $respuestas[$i]['respuesta'] : '', array('class' => 'form-control', 'maxlength' => 255));
    ?>
        </div>

        <div class="radio">
          <label>
            <?php 
    echo CHtml::radioButton('es_correcta', $respuestas[$i]['es_correcta'] ? true : false, array('value' => "{$i}"));
    ?>
            <?php 
    echo CHtml::label('correcta', 'correcta');
    ?>
          </label>
        </div>
      </div>
    <?php 
}
?>

      <div class="form-group">
        <?php 
echo CHtml::submitButton('Guardar', array('class' => 'btn btn-success'));
?>
開發者ID:Telemedellin,項目名稱:puntos,代碼行數:31,代碼來源:form.php

示例11: array

echo Yii::t('admin', '<p>Choose the theme you wish to use by selecting the graphic and clicking Make Active to switch to the theme. Change options for the currently active theme below the image. Your currently active theme is always listed first.</p>', array('{color}' => _xls_regionalize('color')));
echo Yii::t('admin', '<p>You can also Preview any theme by clicking the relevant <strong>Preview</strong> link.</p>');
?>
		</div>
		<div class="clearfix spaceafter"></div>
		<div id="thememanage">
			<?php 
echo CHtml::beginForm('manage', 'post', array('id' => 'manage'));
?>


			<?php 
echo CHtml::hiddenField('task', '', array('id' => 'task'));
foreach ($arrThemes as $key => $objTheme) {
    echo '<div class="span4 theme"><div class="themetitle">' . $objTheme['name'] . '</div><div class="themeversion">' . $objTheme['version'] . $objTheme['beta'] . '</div><div class="clearfix"></div><div class="themeselect" >';
    echo CHtml::radioButton('theme', $key == $currentTheme ? true : false, array('id' => $key, 'value' => $key));
    echo '</div>';
    echo CHtml::tag('div', array('class' => 'themeicon ' . ($key == $currentTheme ? "selected" : ""), 'id' => 'img' . $key, 'onClick' => 'js:
									$("#"+picked).attr("checked", false);
									$("#img"+picked).removeClass("selected");
									$("#' . $key . '").attr("checked", true);
									picked = "' . $key . '";
									$("#img"+picked).addClass("selected")'), $objTheme['img']);
    if ($key == $currentTheme && Yii::app()->getRequest()->getQuery('n')) {
        $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'label' => 'Upgrade Theme', 'type' => 'danger', 'size' => 'mini', 'htmlOptions' => array('id' => 'btnUpgrade', 'name' => 'btnUpgrade', 'value' => 'btnUpgrade')));
    } else {
        echo CHtml::tag('div', array('class' => 'themeoptions'), $key == $currentTheme ? $objTheme['options'] : $objTheme['preview']);
    }
    echo '</div>';
}
?>
開發者ID:uiDeveloper116,項目名稱:webstore,代碼行數:31,代碼來源:manage.php

示例12: foreach

	<?php 
if (!empty($_POST)) {
    $eye_id = @$_POST['eye_id'];
} else {
    $eye_id = $episode->eye_id;
}
?>
	<section class="element element-data">
		<fieldset>
			<legend class="data-title">Principal eye:</legend>
			<?php 
foreach (Eye::model()->findAll(array('order' => 'display_order')) as $eye) {
    ?>
				<label class="inline">
					<?php 
    echo CHtml::radioButton('eye_id', $eye->id == $eye_id, array('value' => $eye->id, 'class' => 'episodeSummaryRadio'));
    ?>
					<?php 
    echo $eye->name;
    ?>
				</label>
			<?php 
}
?>
		</fieldset>
	</section>

	<section class="element element-data">
		<div class="row">
			<div class="large-6 column">
				<h3 class="data-title">Start Date</h3>
開發者ID:openeyes,項目名稱:openeyes,代碼行數:31,代碼來源:updateEpisode.php

示例13: array

                <td colspan="4">
                    <span class="alert alert-info" style="display: inline-block; padding-top: 8px; padding-bottom: 8px">
                        <?php 
echo CHtml::radioButton('Repair[repair_status]', false, array('value' => 'wait'));
?>
 <?php 
echo Yii::t('lang', 'wait_repair');
?>
                        <?php 
echo CHtml::radioButton('Repair[repair_status]', true, array('value' => 'do'));
?>
 <?php 
echo Yii::t('lang', 'in_progress');
?>
                        <?php 
echo CHtml::radioButton('Repair[repair_status]', false, array('value' => 'complete'));
?>
 <?php 
echo Yii::t('lang', 'complete_repaired');
?>
                    </span>
                </td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <a class="btn btn-info">
                        <i class="glyphicon glyphicon-ok"></i>
                        <?php 
echo Yii::t('lang', 'save');
?>
開發者ID:adsavin,項目名稱:air,代碼行數:31,代碼來源:StartRepair.php

示例14: array

$form = $this->beginWidget('ActiveForm', array('htmlOptions' => array('role' => 'form', 'class' => 'form'), 'method' => 'get', 'action' => array('/results/statistics', 'name' => 'best-podiums')));
?>
    <div class="form-group row">
      <?php 
foreach (array_chunk(Events::getNormalTranslatedEvents(), 3, true) as $events) {
    ?>
      <div class="col-md-4 col-xs-6">
        <div class="row">
        <?php 
    foreach ($events as $eventId => $name) {
        ?>
          <div class="col-xs-4">
            <div class="checkbox">
              <label>
                <?php 
        echo CHtml::radioButton('event', $eventId == $event, array('value' => $eventId));
        ?>
                <?php 
        echo CHtml::tag('span', array('class' => 'event-icon event-icon-' . $eventId), '&nbsp;');
        ?>
              </label>
            </div>
          </div>
        <?php 
    }
    ?>
        </div>
      </div>
      <?php 
}
?>
開發者ID:sunshy360,項目名稱:cubingchina,代碼行數:31,代碼來源:bestPodiums.php

示例15: array

		        
              <?php 
$form = $this->beginWidget('CActiveForm', array('action' => Yii::app()->createUrl('message/message/createmessage'), 'id' => 'addservicetype', 'enableClientValidation' => true, 'clientOptions' => array('validateOnSubmit' => true)));
?>
					<fieldset>
						<label>Add Service Type</label>
						
                        <section><label>To</label>
							<div>
							      <label>Customer</label> 
							      <?php 
echo CHtml::radioButton('btn', false, array('value' => 'customer', 'name' => 'Customer', 'uncheckValue' => null));
?>
                                   <label>Company</label>
	                              <?php 
echo CHtml::radioButton('btn', true, array('value' => 'company', 'name' => 'Company', 'checked' => 'checked', 'uncheckValue' => null));
?>
							</div>
						</section>  


						<section><?php 
echo $form->labelEx($model, 'reciver_id', array('label' => 'Email'));
?>
							<div>
							      <?php 
echo $form->textField($model, 'reciver_id', array('id' => 'email', 'value' => " "));
?>
	                              <?php 
echo $form->error($model, 'reciver_id');
?>
開發者ID:KaranSofat,項目名稱:yii,代碼行數:30,代碼來源:createmessage.php


注:本文中的CHtml::radioButton方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。