本文整理汇总了PHP中form_radio函数的典型用法代码示例。如果您正苦于以下问题:PHP form_radio函数的具体用法?PHP form_radio怎么用?PHP form_radio使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了form_radio函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_settings
public function display_settings($data = [])
{
if (!ee()->subscribe_model->check()) {
ee()->table->add_row('<h3>Error</h3>', '<div class="subtext ss_notice">Your configuration is not working, please visit the settings page and update your username/password.</div>');
return;
}
$list = isset($data['list']) ? $data['list'] : false;
$type = isset($data['type']) ? $data['type'] : false;
$text = isset($data['text']) ? $data['text'] : false;
$auto = isset($data['auto']) ? $data['auto'] : false;
$field = isset($data['field']) ? $data['field'] : false;
$groups = ee()->subscribe_model->lists();
$options = [];
foreach ($groups->all() as $id => $group) {
$options[$group['id']] = $group['name'];
}
ee()->table->add_row('List <div class="subtext">Selet the list users will sign up to.</div>', form_dropdown('subscribe_list', $options, $list));
ee()->table->add_row('Type of Signup <div class="subtext">
<strong>Always</strong> - user will automatically be added to the list<br>
<strong>Opt-In</strong> - user will need to Opt-In to be added to the list
</div>', '<label style="padding:0 5px">Always</label>' . form_radio('subscribe_type', 'always', $type == 'always') . '<label style="padding:0 5px">Opt-In</label>' . form_radio('subscribe_type', 'opt-in', $type != 'always'));
ee()->table->add_row('Opt-In Autocheck <div class="subtext">Autocheck Checkbox if Opt-In is selected</div>', '<label style="padding:0 5px">Enabled</label>' . form_checkbox('subscribe_auto', 'true', $auto == 'true'));
ee()->table->add_row('Opt-In Text <div class="subtext">Displayed with Checkbox if Opt-In is selected</div>', form_input('subscribe_opt-in_text', $text));
ee()->table->add_row('Email Field<div class="subtext">If the input field on the page is not "email" please entrer the name. (exp. the marketo form used "work_email")</div>', form_input('subscribe_field', $field));
}
示例2: _display_field
private function _display_field($data, $container = 'fieldset')
{
array_merge($this->settings, $this->settings_vars);
$text_direction = isset($this->settings['field_text_direction']) ? $this->settings['field_text_direction'] : 'ltr';
$field_options = $this->_get_field_options($data);
if (REQ == 'CP') {
if ($data === TRUE) {
$data = 'y';
} elseif ($data === FALSE) {
$data = 'n';
}
return ee('View')->make('radio:publish')->render(array('field_name' => $this->field_name, 'selected' => $data, 'options' => $field_options));
}
$selected = $data;
$r = '';
$class = 'choice mr';
foreach ($field_options as $key => $value) {
$selected = $key == $data;
$r .= '<label>' . form_radio($this->field_name, $value, $selected) . NBS . $key . '</label>';
}
switch ($container) {
case 'grid':
$r = $this->grid_padding_container($r);
break;
default:
$r = form_fieldset('') . $r . form_fieldset_close();
break;
}
return $r;
}
示例3: form_control
function form_control(&$setting)
{
switch ($setting->type) {
default:
case 'text':
$form_control = form_input(array('id' => $setting->slug, 'name' => $setting->slug, 'value' => $setting->value, 'class' => 'text width-20'));
break;
case 'textarea':
$form_control = form_textarea(array('id' => $setting->slug, 'name' => $setting->slug, 'value' => $setting->value, 'class' => 'width-20'));
break;
case 'password':
$form_control = form_password(array('id' => $setting->slug, 'name' => $setting->slug, 'value' => $setting->value, 'class' => 'text width-20'));
break;
case 'select':
$form_control = form_dropdown($setting->slug, $this->_format_options($setting->options), $setting->value, 'class="width-20"');
break;
case 'checkbox':
case 'radio':
$func = $setting->type == 'checkbox' ? 'form_checkbox' : 'form_radio';
$form_control = '';
foreach ($this->_format_options($setting->options) as $value => $label) {
$form_control .= ' ' . form_radio(array('id' => $setting->slug, 'name' => $setting->slug, 'checked' => $setting->value == $value, 'value' => $value)) . ' ' . $label;
}
break;
}
return $form_control;
}
示例4: display_settings
/**
* Display settings sub-form for this variable type
*
* @param mixed $var_id The id of the variable: 'new' or numeric
* @param array $var_settings The settings of the variable
* @return array
*/
function display_settings($var_id, $var_settings)
{
// -------------------------------------
// Init return value
// -------------------------------------
$r = array();
// -------------------------------------
// Check current value from settings
// -------------------------------------
$rows = $this->get_setting('rows', $var_settings);
// -------------------------------------
// Build settings for rows
// -------------------------------------
$r[] = array($this->setting_label(lang('variable_rows')), form_input(array('name' => $this->input_name('rows'), 'value' => $rows, 'maxlength' => '4', 'class' => 'x-small')));
// -------------------------------------
// Build settings text_direction
// -------------------------------------
$dir_options = '';
foreach (array('ltr', 'rtl') as $dir) {
$dir_options .= '<label class="low-radio">' . form_radio($this->input_name('text_direction'), $dir, $this->get_setting('text_direction', $var_settings) == $dir) . ' ' . lang("text_direction_{$dir}") . '</label>';
}
$r[] = array($this->setting_label(lang('text_direction')), $dir_options);
// -------------------------------------
// Return output
// -------------------------------------
return $r;
}
示例5: display_settings
/**
* Display settings sub-form for this variable type
*
* @param mixed $var_id The id of the variable: 'new' or numeric
* @param array $var_settings The settings of the variable
* @return array
*/
function display_settings($var_id, $var_settings)
{
// -------------------------------------
// Init return value
// -------------------------------------
$r = array();
// -------------------------------------
// Check current value from settings
// -------------------------------------
$maxlength = $this->get_setting('maxlength', $var_settings);
$size = $this->get_setting('size', $var_settings);
$pattern = $this->get_setting('pattern', $var_settings);
$text_direction = $this->get_setting('text_direction', $var_settings);
// -------------------------------------
// Build rows for values
// -------------------------------------
$r[] = array($this->setting_label(lang('variable_maxlength')), form_input(array('name' => $this->input_name('maxlength'), 'value' => $maxlength, 'size' => '4', 'maxlength' => '4', 'class' => 'x-small')));
$r[] = array($this->setting_label(lang('variable_size')), form_dropdown($this->input_name('size'), array('large' => lang('large'), 'medium' => lang('medium'), 'small' => lang('small'), 'x-small' => lang('x-small')), $size));
$r[] = array($this->setting_label(lang('variable_pattern'), lang('variable_pattern_help')), form_input(array('name' => $this->input_name('pattern'), 'value' => $pattern, 'class' => 'medium')));
// -------------------------------------
// Build settings text_direction
// -------------------------------------
$dir_options = '';
foreach (array('ltr', 'rtl') as $dir) {
$dir_options .= '<label class="low-radio">' . form_radio($this->input_name('text_direction'), $dir, $this->get_setting('text_direction', $var_settings) == $dir) . ' ' . lang("text_direction_{$dir}") . '</label>';
}
$r[] = array($this->setting_label(lang('text_direction')), $dir_options);
// -------------------------------------
// Return output
// -------------------------------------
return $r;
}
示例6: iconbox
function iconbox($name, $folder, $selected, $attrs = '')
{
$folder = 'webroot/images/' . $folder;
$folder_array = directory_map($folder, True);
for ($i = 0; $i < count($folder_array); $i++) {
if (preg_match('/(.png|.jpg|.jpeg|.gif)$/', $folder_array[$i])) {
$nicename = explode(".", $folder_array[$i]);
$icons_array[$i + 1] = $folder_array[$i];
//$nicename[0];
$nicename = "";
}
}
unset($folder_array);
asort($icons_array);
$html = '';
#$html .= '<div class="iconbox">';
foreach ($icons_array as $icon) {
$checked = $icon == $selected ? true : false;
$data = array('name' => $name, 'id' => 'icon' . $icon, 'value' => $icon, 'checked' => $checked);
$html .= '<div class="g' . "{$checked}" . '">';
$html .= '<label class="ni" for="icon' . $icon . '"><img src="' . $folder . '/' . $icon . '" alt="' . $icon . '" title="' . $icon . '" width="16" height="16" /></label>';
$html .= '<p>' . "\n" . form_radio($data, NULL, NULL, $attrs) . '</p>';
$html .= '</div>' . "\n";
}
#$html .= '</div>';
return $html;
}
示例7: form_output
/**
* Output form input
*
* @param array
* @param array
* @return string
*/
public function form_output($params, $entry_id, $field)
{
$return = null;
$choices = $this->_choices_to_array($params['custom']['choice_data'], $params['custom']['choice_type'], $field->is_required);
// Put it into a drop down
if ($params['custom']['choice_type'] == 'dropdown') {
$return = form_dropdown($params['form_slug'], $choices, $params['value'], 'id="' . $params['form_slug'] . '"');
} else {
// If these are checkboxes, then break up the vals
if ($params['custom']['choice_type'] == 'checkboxes') {
// We may have an array from $_POST or a string
// from the data
if (is_string($params['value'])) {
$vals = explode("\n", $params['value']);
} else {
$vals = $params['value'];
}
foreach ($vals as $k => $v) {
$vals[$k] = trim($v);
}
}
$return .= '<ul class="form_list">';
foreach ($choices as $choice_key => $choice) {
if ($params['custom']['choice_type'] == 'radio') {
$params['value'] == $choice_key ? $selected = TRUE : ($selected = FALSE);
$return .= '<li><label>' . form_radio($params['form_slug'], $choice_key, $selected) . ' ' . $choice . '</label></li>';
} else {
in_array($choice_key, $vals) ? $selected = TRUE : ($selected = FALSE);
$return .= '<li><label>' . form_checkbox($params['form_slug'] . '[]', $choice_key, $selected, 'id="' . $choice_key . '"') . ' ' . $choice . '</label></li>';
}
}
$return .= '</ul>';
}
return $return;
}
示例8: param_hide_typing
/**
* Yes or no box to hide typing
*
* @access public
* @param [array - param]
* @return string
*/
public function param_hide_typing($params = false)
{
$selected = $params == 'no' ? 'no' : 'yes';
$yes_select = $selected == 'yes' ? true : false;
$no_select = $selected == 'no' ? true : false;
$form = '<ul><li><label>' . form_radio('hide_typing', 'yes', $yes_select) . ' Yes </label></li>';
$form .= '<li><label>' . form_radio('hide_typing', 'no', $no_select) . ' No </label></li></ul>';
return $form;
}
示例9: _display_field
/**
* Display Field
*/
function _display_field($data, $field_name)
{
$this->prep_field_data($data);
$r = '';
foreach ($this->settings['options'] as $option_name => $option) {
$selected = (string) $option_name === (string) $data;
$r .= '<label>' . form_radio($field_name, $option_name, $selected) . NBS . $option . '</label>';
}
return $r;
}
示例10: _display_field
/**
* Display Field
*/
function _display_field($data, $field_name)
{
$this->prep_field_data($data);
$r = '';
$field_id = str_replace(array('[', ']'), array('_', '_'), $field_name);
foreach ($this->settings['options'] as $option_name => $option) {
$field_data = array('name' => $field_name, 'id' => $field_id . '_' . $option_name, 'value' => $option_name, 'checked' => (string) $option_name === (string) $data);
$r .= '<label for="' . $field_data['id'] . '">' . form_radio($field_data) . NBS . $option . '</label>';
}
return $r;
}
示例11: form_output
/**
* Output form input
*
* @param array
* @param array
* @return string
*/
public function form_output($params, $entry_id, $field)
{
$choices = $this->_choices_to_array($params['custom']['choice_data'], $params['custom']['choice_type'], $field->is_required);
// Only put in our brs for the admin
$line_end = defined('ADMIN_THEME') ? '<br />' : null;
if ($params['custom']['choice_type'] == 'dropdown') {
// -------------------------------
// Dropdown
// -------------------------------
// Drop downs are easy - the value is
// always a string, and the choices
// are just in an array from the field.
// -------------------------------
return form_dropdown($params['form_slug'], $choices, $params['value'], 'id="' . $params['form_slug'] . '"');
} else {
// -------------------------------
// Checkboxes and Radio buttons
// -------------------------------
// Parse the value coming in.
// If these are checkboxes, we need to put
// the incoming data through some special processes
if ($params['custom']['choice_type'] == 'checkboxes') {
// We may have an array from $_POST or a string
// from the saved form data in the case
// or checkboxes
if (is_string($params['value'])) {
$vals = explode("\n", $params['value']);
} elseif (is_array($params['value'])) {
$vals = $params['value'];
} else {
$vals = array();
}
// If we have an array of values, trim each one
if (is_array($vals)) {
foreach ($vals as $k => $v) {
$vals[$k] = trim($v);
}
}
}
// Go through each choice and create
// a input element.
$return = null;
foreach ($choices as $choice_key => $choice) {
if ($params['custom']['choice_type'] == 'radio') {
$selected = $params['value'] == $choice_key ? true : false;
$return .= '<label class="radio">' . form_radio($params['form_slug'], $this->format_choice($choice_key), $selected, $this->active_state($choice)) . ' ' . $this->format_choice($choice) . '</label>' . $line_end;
} else {
$selected = in_array($choice_key, $vals) ? true : false;
$return .= '<label class="checkbox">' . form_checkbox($params['form_slug'] . '[]', $this->format_choice($choice_key), $selected, 'id="' . $this->format_choice($choice_key) . '" ' . $this->active_state($choice)) . ' ' . $this->format_choice($choice) . '</label>' . $line_end;
}
}
}
return $return;
}
示例12: radiobutton
public function radiobutton($data, $obj_name)
{
$filter_name = $obj_name . '_' . $data['attr_name'];
$filter_label = $data['attr_label'];
//$filter_type=$data['attr_field_type'];
$radio_filter = array('name' => $filter_name);
$html_componant = "<div class='control-group'>" . $this->label($filter_label, $filter_name);
$html_componant .= "<div class='controls'>" . "<label class='radio inline'>" . form_radio($radio_filter) . "aa</label>";
$html_componant .= "<label class='radio inline'>" . form_radio($radio_filter) . "aa</label></div></div>\r\n\t\t ";
return $html_componant;
}
示例13: settings_form
public function settings_form($settings)
{
return form_open('', array('class' => 'dashForm')) . '<p>' . form_label(lang('wgt_cp_analytics_chart_title')) . form_input('title', $settings->title) . '</p>
<p>' . form_label(lang('wgt_cp_analytics_chart_days')) . form_radio('days', '30', $settings->days == '30' ? TRUE : FALSE) . NBS . '30 days' . NBS . NBS . form_radio('days', '14', $settings->days == '14' ? TRUE : FALSE) . NBS . '14 days' . '</p>
<p>' . form_label(lang('wgt_cp_analytics_chart_labels')) . form_radio('labels', 'y', $settings->labels == 'y' ? TRUE : FALSE) . NBS . 'Yes' . NBS . NBS . form_radio('labels', 'n', $settings->labels == 'n' ? TRUE : FALSE) . NBS . 'No' . '</p>
<p>' . form_submit('save', lang('save')) . '</p>
' . form_close();
}
示例14: param_filter_theme
/**
* Should we filter by the current theme
* and what languages they support?
*
* @access public
* @param string
* @return string
*/
public function param_filter_theme($value = null)
{
if ($value == 'no') {
$no_select = true;
$yes_select = false;
} else {
$no_select = false;
$yes_select = true;
}
$form = '<ul><li><label>' . form_radio('filter_theme', 'yes', $yes_select) . ' Yes</label></li>';
$form .= '<li><label>' . form_radio('filter_theme', 'no', $no_select) . ' No</label></li>';
return $form;
}
示例15: display_field
function display_field($data)
{
array_merge($this->settings, $this->settings_vars);
$text_direction = $this->settings['field_text_direction'] == 'rtl' ? 'rtl' : 'ltr';
$field_options = $this->_get_field_options($data);
// If they've selected something we'll make sure that it's a valid choice
$selected = $data;
//$this->EE->input->post($this->field_name);
$r = form_fieldset('');
foreach ($field_options as $option) {
$selected = $option == $data;
$r .= '<label>' . form_radio($this->field_name, $option, $selected) . NBS . $option . '</label>';
}
return $r . form_fieldset_close();
}