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


PHP form::radio方法代码示例

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


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

示例1: yesno

 function yesno($name, $value = '')
 {
     // 1||0//Y||N//y||n//YES||NO - autodetect
     $html = "";
     switch ($value) {
         case '0':
         case '1':
             $values = array(1, 0);
             break;
         case 'Y':
         case 'N':
             $values = array('Y', 'N');
         case 'y':
         case 'n':
             $values = array('y', 'n');
         case 'YES':
         case 'NO':
             $values = array('YES', 'NO');
         default:
             $values = array('YES', 'NO');
     }
     $html .= form::radio($name, $values[0], Lang::item('common.yes'), $value);
     $html .= form::radio($name, $values[1], Lang::item('common.no'), $value);
     return $html;
 }
开发者ID:phill104,项目名称:branches,代码行数:25,代码来源:form_helper.php

示例2: buildForm

 private function buildForm()
 {
     $options = array('method' => "POST", 'enctype' => "multipart/form-data", 'action' => '/blog/formular/add', 'width' => '400px');
     $form = new \form('testing', $options);
     $form->label('checkbox');
     $form->checkbox('checkbox test', 'testcheckbox', 'check', '');
     $form->checkbox('checkbox test2', 'testcheckbox', 'check2', true);
     $form->label('radio');
     $form->radio('radio test', 'testradio', 'radio', '');
     $form->radio('radio test 2', 'testradio', 'radio2', true);
     $form->label('textarea');
     $form->text('textarea', ' ', ['error' => $this->error['textarea']]);
     $form->select('autos', ['a' => 'audi', 'b' => 'vw', 'c' => 'toyota'], 'b', ['label' => 'auto select']);
     $form->text('username', '', ['placeholder' => 'username', 'label' => 'Username', 'error' => $this->error['username']]);
     $form->password('password', '', ['label' => 'Password', 'error' => $this->error['password']]);
     $form->button('senden', ['type' => 'submit']);
     return $form;
 }
开发者ID:karimo255,项目名称:blog,代码行数:18,代码来源:formular.php

示例3: testRadioColumn

 /**
  * Test radio column
  */
 public function testRadioColumn()
 {
     $SUT = new Grid_Column_Radio();
     $SUT->name('someOption');
     $data = array('id' => 42);
     $cell = $SUT->render($data);
     $radio = form::radio('someOption', 42);
     $this->assertEquals($radio, $cell);
 }
开发者ID:vimofthevine,项目名称:grid,代码行数:12,代码来源:UnitTest.php

示例4: meta_custom

function meta_custom()
{
    $form = new form('details', null);
    $form->text('name', array('label' => 'Text Field'));
    $form->image('image', array('label' => 'Image Field', 'button' => 'Add Your Image'));
    $form->file('file', array('label' => 'File Field', 'button' => 'Select a File'));
    $form->textarea('address', array('label' => 'Textarea', 'validate' => 'html'));
    $form->select('rooms', array('one', 'two', 'three'), array('label' => 'Select List'));
    $form->radio('baths', array('blue', 'green', 'red'), array('label' => 'Radio Buttons'));
    $form->editor('baths', 'WYSIWYG Editor');
}
开发者ID:juan88ac,项目名称:foundation_s,代码行数:11,代码来源:index.php

示例5: RadioGroup

 public static function RadioGroup($name, $checks, $check_checked = null, $styles = null)
 {
     $ret = null;
     foreach ($checks as $value => $label) {
         $checkradio = FALSE;
         if (isset($check_checked[$value])) {
             $checkradio = TRUE;
         }
         $ret .= "<p>" . form::radio("{$name}", $value, $checkradio) . "{$label}</p>";
     }
     return $ret;
 }
开发者ID:brojasmeneses,项目名称:floreriarosabel,代码行数:12,代码来源:fpp.php

示例6: _create_rating

 protected function _create_rating($attributes = array())
 {
     $result = array();
     if ($this->scale == 0) {
         throw new Kohana_Exception('Morf::_create_rating() scale of zero is not allowed', $this->scale);
     }
     $i = $this->range[0];
     $limit = $this->range[1];
     for ($i; $i < $limit + $this->scale; $i += $this->scale) {
         $result[(string) $i] = form::radio($attributes, $i, $this->value == $i ? TRUE : FALSE);
     }
     return $result;
 }
开发者ID:samsoir,项目名称:morf,代码行数:13,代码来源:Morf_Rating.php

示例7: render

 public function render(&$render_variables, $errors = array())
 {
     $result = parent::render($render_variables, $errors);
     // Clean attributes
     $id = $this->_clean_attributes($result['attributes'], 'id');
     $buffer = array();
     foreach ($this->options as $value => $title) {
         if ($this->value == $value) {
             $buffer[inflector::underscore($title)] = form::radio($result['attributes'], $value, TRUE);
         } else {
             $buffer[inflector::underscore($title)] = form::radio($result['attributes'], $value);
         }
     }
     $result['template']->element = $buffer;
     return (string) $result['template']->render();
 }
开发者ID:samsoir,项目名称:morf,代码行数:16,代码来源:Morf_Radiogroup.php

示例8: getHtmlField

 public function getHtmlField($aPostedData)
 {
     $return = '';
     switch ($this->type) {
         # Champ texte
         default:
         case 1:
             $return = '<p class="field" id="' . $this->html_id . '-wrapper">' . '<label for="' . $this->html_id . '"' . ($this->status == 2 ? ' class="required" title="' . __('c_c_required_field') . '"' : '') . '>' . html::escapeHTML($this->title) . '</label>' . form::text($this->html_id, 60, 255, $aPostedData[$this->id]) . '</p>';
             break;
             # Zone de texte
         # Zone de texte
         case 2:
             $return = '<p class="field" id="' . $this->html_id . '-wrapper">' . '<label for="' . $this->html_id . '"' . ($this->status == 2 ? ' class="required" title="' . __('c_c_required_field') . '"' : '') . '>' . html::escapeHTML($this->title) . '</label>' . form::textarea($this->html_id, 58, 10, $aPostedData[$this->id]) . '</p>';
             break;
             # Menu déroulant
         # Menu déroulant
         case 3:
             $values = array_filter((array) unserialize($this->value));
             $return = '<p class="field" id="' . $this->html_id . '-wrapper">' . '<label for="' . $this->html_id . '"' . ($this->status == 2 ? ' class="required" title="' . __('c_c_required_field') . '"' : '') . '>' . html::escapeHTML($this->title) . '</label>' . form::select($this->html_id, array_flip($values), $aPostedData[$this->id]) . '</p>';
             break;
             # Boutons radio
         # Boutons radio
         case 4:
             $values = array_filter((array) unserialize($this->value));
             $str = '';
             foreach ($values as $k => $v) {
                 $str .= '<li><label>' . form::radio(array($this->html_id, $this->html_id . '_' . $k), $k, $k == $aPostedData[$this->id]) . html::escapeHTML($v) . '</label></li>';
             }
             $return = '<p class="field" id="' . $this->html_id . '-wrapper">' . '<span class="fake-label">' . html::escapeHTML($this->title) . '</span></p>' . '<ul class="checklist">' . $str . '</ul>';
             break;
             # Cases à cocher
         # Cases à cocher
         case 5:
             $values = array_filter((array) unserialize($this->value));
             $str = '';
             foreach ($values as $k => $v) {
                 $str .= '<li><label>' . form::checkbox(array($this->html_id . '[' . $k . ']', $this->html_id . '_' . $k), $k, in_array($k, $aPostedData[$this->id])) . html::escapeHTML($v) . '</label></li>';
             }
             $return = '<p class="field" id="' . $this->html_id . '-wrapper">' . '<span class="fake-label">' . html::escapeHTML($this->title) . '</span></p>' . '<ul class="checklist">' . $str . '</ul>';
             break;
     }
     return $return;
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:43,代码来源:class.users.fields.recordset.php

示例9: render

 public function render(&$render_variables, $errors = array())
 {
     // Load base template and attributes
     $result = parent::render($render_variables, $errors);
     // Discover the type
     switch ($this->type) {
         case 'input':
             $result['template']->element = form::input($result['attributes'], $this->value);
             break;
         case 'password':
             $result['template']->element = form::password($result['attributes'], $this->value);
             break;
         case 'submit':
             $result['template']->element = form::submit($result['attributes'], $this->value);
             $render_variables['submit'] = TRUE;
             break;
         case 'radio':
             $result['template']->element = form::radio($result['attributes'], $this->value);
             break;
         case 'checkbox':
             $result['attributes']['value'] = $this->value;
             if ($this->value = Input::instance()->post($this->name)) {
                 $result['template']->element = form::checkbox($result['attributes'], $this->value, TRUE);
             } else {
                 $result['template']->element = form::checkbox($result['attributes'], $this->value);
             }
             break;
         case 'hidden':
             $result['template']->element = form::hidden($this->name, $this->value);
             break;
         case 'file':
             $result['template']->element = form::upload($result['attributes'], $this->value);
             $render_variables['enctype'] = 'multipart/form-data';
             break;
     }
     // Return the resulting output
     return (string) $result['template']->render();
 }
开发者ID:samsoir,项目名称:morf,代码行数:38,代码来源:Morf_Input.php

示例10: _e

</label>
				<?php 
echo form::text('add_title', 40, 255, html::escapeHTML($aAddLanguageData['title']));
?>
</p>

				<p id="add_active_container" class="col">
					<?php 
echo form::radio(array('add_active', 'add_active_1'), 1, $aAddLanguageData['active'] == 1);
?>
<label for="add_active_1"><?php 
_e('c_c_action_Enable');
?>
</label>
					<?php 
echo form::radio(array('add_active', 'add_active_0'), 0, $aAddLanguageData['active'] == 0);
?>
<label for="add_active_0"><?php 
_e('c_c_action_Disable');
?>
</label>
				</p>
			</div>

			<div class="two-cols">
				<p class="field col"><label for="add_code" title="<?php 
_e('c_c_required_field');
?>
" class="required"><?php 
_e('c_a_config_l10n_code');
?>
开发者ID:jewelhuq,项目名称:okatea,代码行数:31,代码来源:languages.php

示例11:

		<p><label for="db_prefix">Préfixe des tables:</label><br/>
		<?php 
    echo form::field('db_prefix', 20, 20, $params['km_dbprefix']);
    ?>
</p>
	</fieldset><br/>
	<fieldset>
		<legend>Graphiques</legend>
		<p>Les librairies graphiques à utiliser et leurs options.</p>
		<p><label for="graphic_lib">Librairie graphique:</label><br/>
		<?php 
    echo form::radio('graphic_lib', 'gd', $use_gd);
    ?>
GD
		<?php 
    echo form::radio('graphic_lib', 'im', $use_im);
    ?>
Imagemagick
		</p>
		<p><label for="graphic_lib">Taille des miniatures:</label><br/>
		<?php 
    echo form::field('thumb_width', 3, 3, $params['km_thumbwidth']);
    ?>
 *
		<?php 
    echo form::field('thumb_height', 3, 3, $params['km_thumbheight']);
    ?>
 pixels
		</p>
		<p><label for="graphic_thumbtype">Type de miniatures:</label><br/>
		<?php 
开发者ID:BackupTheBerlios,项目名称:kermert-svn,代码行数:31,代码来源:config.php

示例12: _get_selector_textarea

 /**
  * Generate TextArea Field Entry Form
  * @param int $form_id The id no. of the form
  * @param int $field_id The id no. of the field
  */
 private function _get_selector_textarea($form_id = 0, $field_id = "")
 {
     if (is_numeric($field_id)) {
         $field = ORM::factory('form_field', $field_id);
         if ($field->loaded == true) {
             $field_name = $field->field_name;
             $field_default = $field->field_default;
             $field_required = $field->field_required;
             $field_width = $field->field_width;
             $field_height = $field->field_height;
             $field_maxlength = $field->field_maxlength;
             $field_isdate = $field->field_isdate;
         }
     } else {
         $field_id = "";
         $field_name = "";
         $field_default = "";
         $field_required = "0";
         $field_width = "";
         $field_height = "";
         $field_maxlength = "";
         $field_isdate = "0";
     }
     $html = "";
     $html .= "<input type=\"hidden\" name=\"form_id\" id=\"form_id\" value=\"" . $form_id . "\">";
     $html .= "<input type=\"hidden\" name=\"field_id\" id=\"field_id\" value=\"\">";
     $html .= "<input type=\"hidden\" name=\"field_isdate\" id=\"field_id\" value=\"0\">";
     $html .= "<div id=\"form_result_" . $form_id . "\" class=\"forms_fields_result\"></div>";
     $html .= "<div class=\"forms_item\">";
     $html .= "\t<strong>" . Kohana::lang('ui_admin.field_name') . ":</strong><br />";
     $html .= form::input('field_name', $field_name, ' class="text"');
     $html .= "</div>";
     $html .= "<div class=\"forms_item\">";
     $html .= "\t<strong>" . Kohana::lang('ui_admin.field_default') . "?:</strong><br />";
     $html .= form::input('field_default', $field_default, ' class="text"');
     $html .= "</div>";
     $html .= "<div class=\"forms_item\">";
     $html .= "\t<strong>" . Kohana::lang('ui_admin.required') . "?</strong><br />";
     if ($field_required != 1) {
         $html .= Kohana::lang('ui_admin.yes') . " " . form::radio('field_required', '1', FALSE) . "&nbsp;&nbsp;";
         $html .= Kohana::lang('ui_admin.no') . " " . form::radio('field_required', '0', TRUE);
     } else {
         $html .= Kohana::lang('ui_admin.yes') . " " . form::radio('field_required', '1', TRUE) . "&nbsp;&nbsp;";
         $html .= Kohana::lang('ui_admin.no') . " " . form::radio('field_required', '0', FALSE);
     }
     $html .= "</div>";
     //$html .="<div class=\"forms_item\">";
     //$html .="	<strong>Width (Columns):</strong><br />";
     //$html .= 	form::input('field_width', '', ' class="text short"');
     //$html .="</div>";
     $html .= "<div class=\"forms_item\">";
     $html .= "\t<strong>" . Kohana::lang('ui_admin.field_height') . ":</strong><br />";
     $html .= form::input('field_height', $field_height, ' class="text short"');
     $html .= "</div>";
     $html .= "<div style=\"clear:both;\"></div>";
     $html .= "<div class=\"forms_item\">";
     $html .= "\t<div id=\"form_loading_" . $form_id . "\" class=\"forms_fields_loading\"></div>";
     $html .= "\t<input type=\"image\" src=\"" . url::base() . "media/img/admin/btn-save.gif\" />";
     $html .= "</div>";
     $html .= "<div style=\"clear:both;\"></div>";
     $html .= $this->_get_selector_js($form_id);
     return $html;
 }
开发者ID:nebogeo,项目名称:borrowed-scenery,代码行数:68,代码来源:forms.php

示例13: L

    	<th align="right"  valign="top"><?php 
echo L('index_page');
?>
:</th>
        <td valign="top"><?php 
echo form::radio(array('0' => L('no'), '1' => L('yes')), '0', 'name="special[ispage]"');
?>
        </td>
    </tr>
    <tr>
    	<th align="right"  valign="top"><?php 
echo L('special_status');
?>
:</th>
        <td valign="top"><?php 
echo form::radio(array('0' => L('open'), '1' => L('pause')), '0', 'name="special[disabled]"');
?>
        </td>
    </tr>
    <tr>
    	<th align="right"  valign="top"><?php 
echo L('template_style');
?>
:</th>
    	<td valign="top"><?php 
echo form::select($template_list, $info['default_style'], 'name="special[style]" id="style" onchange="load_file_list(this.value)"', L('please_select'));
?>
    	<script type="text/javascript">$.getJSON('?m=admin&c=category&a=public_tpl_file_list&style=<?php 
echo $info['default_style'];
?>
&module=special&templates=index|list|show&name=special', function(data){$('#index_template').html(data.index_template);$('#list_template').html(data.list_template);$('#show_template').html(data.show_template);});</script>
开发者ID:zhouzhouxs,项目名称:Progect,代码行数:31,代码来源:special_add.tpl.php

示例14: creat_form

/**
 * 生成标签选项
 * @param $id HTML ID号
 * @param $data 生成条件
 * @param $value 当前值
 * @param $op 操作名
 * @return html 返回HTML代码
 */
function creat_form($id, $data, $value = '', $op = '') {
	pc_base::load_sys_class('form', '', 0);
	if (empty($value)) $value = $data['defaultvalue'];
	$str = $ajax = '';
	if($data['ajax']['name']) {
		if($data['ajax']['m']) {
			$url = '$.get(\'?m=content&c=push&a=public_ajax_get\', {html: this.value, id:\''.$data['ajax']['id'].'\', action: \''.$data['ajax']['action'].'\', module: \''.$data['ajax']['m'].'\', pc_hash: \''.$_SESSION['pc_hash'].'\'}, function(data) {$(\'#'.$id.'_td\').html(data)});';
		} else {
			$url = '$.get(\'?m=template&c=file&a=public_ajax_get\', { html: this.value, id:\''.$data['ajax']['id'].'\', action: \''.$data['ajax']['action'].'\', op: \''.$op.'\', style: \'default\', pc_hash: \''.$_SESSION['pc_hash'].'\'}, function(data) {$(\'#'.$id.'_td\').html(data)});';
		}
	}
	switch ($data['htmltype']) {
		case 'input':
			if($data['ajax']['name']) {
				$ajax = 'onblur="'.$url.'"';
			}
			$str .= '<input type="text" name="'.$id.'" id="'.$id.'" value="'.$value.'" size="30" />';
			
			break;
		case 'select':
			if($data['ajax']['name']) {
				$ajax = 'onchange="'.$url.'"';
			}
			$str .= form::select($data['data'], $value, "name='$id' id='$id' $ajax");
			break;
		case 'checkbox':
			if($data['ajax']['name']) {
				$ajax = ' onclick="'.$url.'"';
			}
			if (is_array($value)) implode(',', $value);
			$str .= form::checkbox($data['data'], $value, "name='".$id."[]'".$ajax, '', '120');
			break;
		case 'radio':
			if($data['ajax']['name']) {
				$ajax = ' onclick="'.$url.'"';
			}
			$str .= form::radio($data['data'], $value, "name='$id'$ajax", '', '120');
			break;
		case 'input_select':
			if($data['ajax']['name']) {
				$ajax = ';'.$url;
			}
			$str .= '<input type="text" name="'.$id.'" id="'.$id.'" value="'.$value.'" size="30" />'.form::select($data['data'], $value, "name='select_$id' id='select_$id' onchange=\"$('#$id').val(this.value);$ajax\"");
			break;
		
		case 'input_select_category':
			if($data['ajax']['name']) {
				$ajax = ';'.$url;
			}
			$str .= '<input type="text" name="'.$id.'" id="'.$id.'" value="'.$value.'" size="30" />'.form::select_category('', $value, "name='select_$id' id='select_$id' onchange=\"$('#$id').val(this.value);$ajax\"", '', (isset($data['data']['modelid']) ? $data['data']['modelid'] : 0), (isset($data['data']['type']) ? $data['data']['type'] : -1), (isset($data['data']['onlysub']) ? $data['data']['onlysub'] : 0));
			break;

		case 'select_yp_model':
			if($data['ajax']['name']) {
				$ajax = ';'.$url;
			}
			$yp_models = getcache('yp_model', 'commons');
			$d = array(L('please_select'));
			if (is_array($yp_models) && !empty($yp_models)) {
				foreach ($yp_models as $k =>$v) {
					$d[$k] = $v['name'];
				}
			}
			$str .= '<input type="text" name="'.$id.'" id="'.$id.'" value="'.$value.'" size="30" />'.form::select($d, $value, "name='select_$id' id='select_$id' onchange=\"$('#$id').val(this.value);$ajax\"");
			break;
	}
	if (!empty($data['validator'])) {
		$str .= '<script type="text/javascript">$(function(){$("#'.$id.'").formValidator({onshow:"'.L('input').$data['name'].'。",onfocus:"'.L('input').$data['name'].'。"'.($data['empty'] ? ',empty:true' : '').'})';
		if ($data['htmltype'] != 'select' && (isset($data['validator']['min']) || isset($data['validator']['max']))) {
			$str .= ".inputValidator({".(isset($data['validator']['min']) ? 'min:'.$data['validator']['min'].',' : '').(isset($data['validator']['max']) ? 'max:'.$data['validator']['max'].',' : '')." onerror:'".$data['name'].L('should', '', 'template').(isset($data['validator']['min']) ? ' '.L('is_greater_than', '', 'template').$data['validator']['min'].L('lambda', '', 'template') : '').(isset($data['validator']['max']) ? ' '.L('less_than', '', 'template').$data['validator']['max'].L('lambda', '', 'template') : '')."。'})";
			
		}
		if ($data['htmltype'] != 'checkbox' && $data['htmltype'] != 'radio' && isset($data['validator']['reg'])) {
			$str .= '.regexValidator({regexp:"'.$data['validator']['reg'].'"'.(isset($data['validator']['reg_param']) ? ",param:'".$data['validator']['reg_param']."'" : '').(isset($data['validator']['reg_msg']) ? ',onerror:"'.$data['validator']['reg_msg'].'"' : '').'})';
		}
		$str .=";});</script>";
	}
	return $str;
}
开发者ID:panhongsheng,项目名称:zl_cms,代码行数:87,代码来源:global.func.php

示例15: box

 function box($field, $value, $fieldinfo)
 {
     $setting = string2array($fieldinfo['setting']);
     if ($value == '') {
         $value = $this->fields[$field]['defaultvalue'];
     }
     $options = explode("\n", $this->fields[$field]['options']);
     foreach ($options as $_k) {
         $v = explode("|", $_k);
         $k = trim($v[1]);
         $option[$k] = $v[0];
     }
     $values = explode(',', $value);
     $value = array();
     foreach ($values as $_k) {
         if ($_k != '') {
             $value[] = $_k;
         }
     }
     $value = implode(',', $value);
     switch ($this->fields[$field]['boxtype']) {
         case 'radio':
             $string = form::radio($option, $value, "name='info[{$field}]' {$fieldinfo['formattribute']}", $setting['width'], $field);
             break;
         case 'checkbox':
             $string = form::checkbox($option, $value, "name='info[{$field}][]' {$fieldinfo['formattribute']}", 1, $setting['width'], $field);
             break;
         case 'select':
             $string = form::select($option, $value, "name='info[{$field}]' id='{$field}' {$fieldinfo['formattribute']}");
             break;
         case 'multiple':
             $string = form::select($option, $value, "name='info[{$field}][]' id='{$field} ' size=2 multiple='multiple' style='height:60px;' {$fieldinfo['formattribute']}");
             break;
     }
     return $string;
 }
开发者ID:zhouzhouxs,项目名称:Progect,代码行数:36,代码来源:content_form.class.php


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