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));
 }
Example #2
0
 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;
 }
Example #3
0
 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;
 }
Example #4
0
 /**
  * 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;
 }
Example #5
0
 /**
  * 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;
 }
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;
}
 /**
  * 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) . '&nbsp;' . $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 . '"') . '&nbsp;' . $choice . '</label></li>';
             }
         }
         $return .= '</ul>';
     }
     return $return;
 }
 /**
  * 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;
 }
 /**
  * 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;
 }
 /**
  * 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;
 }
Example #11
0
 /**
  * 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)) . '&nbsp;' . $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)) . '&nbsp;' . $this->format_choice($choice) . '</label>' . $line_end;
             }
         }
     }
     return $return;
 }
Example #12
0
 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;
 }
Example #13
0
    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();
    }
Example #14
0
 /**
  * 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;
 }
Example #15
0
 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();
 }
 function publicOrPrivate($name)
 {
     $return_radio = "<p>";
     $data = array('name' => $name, 'value' => '1', 'checked' => TRUE);
     $return_radio .= '<span style="margin-top: 10px; display: inline-block;"> ';
     $return_radio .= form_radio($data);
     $return_radio .= "</span>";
     $return_radio .= '<span style="margin: 0 12px 0 4px; vertical-align: text-bottom;"> Public </span>';
     $data = array('name' => $name, 'value' => '2', 'checked' => FALSE);
     $return_radio .= '<span style="margin-top: 10px; display: inline-block;"> ';
     $return_radio .= form_radio($data);
     $return_radio .= "</span>";
     $return_radio .= '<span style="vertical-align: text-bottom;"> Confidential </span>';
     $return_radio .= "</p>";
     return $return_radio;
 }
Example #17
0
 function build()
 {
     if (!isset($this->style)) {
         $this->style = "width:300px;";
     }
     $this->_getValue();
     $output = "";
     switch ($this->status) {
         case "disabled":
         case "show":
             if (!isset($this->value)) {
                 $output = RAPYD_FIELD_SYMBOL_NULL;
             } else {
                 $output = $this->description;
             }
             break;
         case "create":
         case "modify":
             $onchange = "";
             $style = "";
             if ($this->onchange != "") {
                 $onchange = ' onchange="' . $this->onchange . '"';
             }
             $id = 'id="' . $this->name . '"';
             if ($this->style != "") {
                 $style = ' style="' . $this->style . '"';
             }
             //$output = "<div>";
             foreach ($this->options as $val => $label) {
                 $this->checked = false;
                 if ($this->value == $val) {
                     $this->checked = true;
                 }
                 $output .= form_radio($this->name, $val, $this->checked, $id . $onchange) . $label . $this->separator;
             }
             //$output .= "</div>". $this->extra_output;
             break;
         case "hidden":
             $output = form_hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = $output;
 }
Example #18
0
 function assets_radio_group($setting_name, $options, $selected_value)
 {
     $output = '';
     foreach ($options as $option_value => $option) {
         if ($output) {
             $output .= NBS . NBS . NBS . NBS . NL;
         }
         if (!is_array($option)) {
             $option = array('label' => $option);
         }
         if (is_numeric($option_value)) {
             $option_value = $option['label'];
             $option['label'] = lang($option['label']);
         }
         $is_selected = $option_value == $selected_value;
         $extra = isset($option['extra']) ? $option['extra'] : '';
         $output .= '<label>' . form_radio("assets[{$setting_name}]", $option_value, $is_selected, $extra) . ' ' . $option['label'] . '</label>' . NL;
     }
     return $output;
 }
Example #19
0
 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);
     $selected = $data;
     $r = '';
     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;
 }
Example #20
0
 /**
  * Display input field for regular user
  *
  * @param	int		$var_id			The id of the variable
  * @param	string	$var_data		The value of the variable
  * @param	array	$var_settings	The settings of the variable
  * @return	string
  */
 function display_input($var_id, $var_data, $var_settings)
 {
     // -------------------------------------
     //  Init return value
     // -------------------------------------
     $r = '';
     // -------------------------------------
     //  Check current value from settings
     // -------------------------------------
     $options = $this->get_setting('options', $var_settings);
     $options = $this->explode_options($options);
     // -------------------------------------
     //  Build checkboxes
     // -------------------------------------
     foreach ($options as $key => $val) {
         $r .= '<label class="low-radio">' . form_radio("var[{$var_id}]", $key, $key == $var_data) . htmlspecialchars($val) . '</label>';
     }
     // -------------------------------------
     //  Return checkboxes
     // -------------------------------------
     return $r;
 }
 function _yes_no_row($data, $lang, $data_key, $prefix = FALSE)
 {
     $prefix = $prefix ? $prefix . '_' : '';
     $val_is_y = $data[$data_key] == 'y' ? TRUE : FALSE;
     $this->EE->table->add_row('<strong>' . lang($lang) . '</strong>', form_radio($prefix . $data_key, 'y', $val_is_y, 'id="' . $prefix . $data_key . '_y"') . NBS . lang('yes', $prefix . $data_key . '_y') . NBS . NBS . NBS . NBS . NBS . form_radio($prefix . $data_key, 'n', !$val_is_y, 'id="' . $prefix . $data_key . '_n"') . NBS . lang('no', $prefix . $data_key . '_n'));
 }
Example #22
0
			<?php echo form_input('title', $navigation_link->title, 'maxlength="50" class="text"'); ?>
			<span class="required-icon tooltip"><?php echo lang('required_label');?></span>
		</li>

		<li>
			<label for="navigation_group_id"><?php echo lang('nav_group_label');?></label>
			<?php echo form_dropdown('navigation_group_id', $groups_select, $navigation_link->navigation_group_id) ?>
		</li>

		<li class="even">
			<label for="link_type"><?php echo lang('nav_type_label');?></label>
			<span class="spacer-right">
				<?php echo form_radio('link_type', 'url', $navigation_link->link_type == 'url') ?> <?php echo lang('nav_url_label');?>
				<?php echo form_radio('link_type', 'uri', $navigation_link->link_type == 'uri') ?> <?php echo lang('nav_uri_label');?>
				<?php echo form_radio('link_type', 'module', $navigation_link->link_type == 'module') ?> <?php echo lang('nav_module_label');?>
				<?php echo form_radio('link_type', 'page', $navigation_link->link_type == 'page') ?> <?php echo lang('nav_page_label');?>
			</span>
		</li>

		<li>

			<p style="<?php echo ! empty($navigation_link->link_type) ? 'display:none' : ''; ?>">
				<?php echo lang('nav_link_type_desc'); ?>
			</p>

			<div id="navigation-url" style="<?php echo @$navigation_link->link_type == 'url' ? '' : 'display:none'; ?>">
				<label for="url"><?php echo lang('nav_url_label');?></label>
				<input type="text" id="url" name="url" value="<?php echo empty($navigation_link->url) ? 'http://' : $navigation_link->url; ?>" />
			</div>

			<div id="navigation-module" style="<?php echo @$navigation_link->link_type == 'module' ? '' : 'display:none'; ?>">
Example #23
0
 function form_build_field($field, $html_type = NULL, $data = NULL, $extra = '')
 {
     $field_name = $field['field'];
     $field_type = $field['type'];
     $field_value = $field['value'];
     $extra = $extra . ' id="' . $field_name . '"';
     // Define the HTML type to use from DB field
     // Limited, as the DB types cannot be translated to HTML form types
     if (is_null($html_type)) {
         switch ($field_type) {
             case 'tinyint':
             case 'smallint':
                 // Checkbox (on / off)
                 if ($field['length'] == 1) {
                     $html_type = "checkbox";
                 } else {
                     $html_type = "input";
                 }
                 break;
             case 'float':
             case 'int':
             case 'char':
             case 'tinytext':
                 $html_type = "input";
                 break;
             case 'varchar':
             case 'text':
             case 'longtext':
                 if ($field_type == 'varchar' && $field['length'] < 255) {
                     $html_type = "input";
                 } elseif ($field_type == 'varchar' && $field['length'] < 3000) {
                     $html_type = "textarea";
                 } else {
                     $html_type = "html";
                 }
                 break;
             case 'enum':
                 $html_type = "radio";
                 break;
             case 'date':
             case 'datetime':
                 $html_type = "date";
                 break;
             default:
                 $html_type = "input";
         }
     }
     // No data provided
     if (!is_array($data)) {
         $data = array();
         // Try to get the ENUM possible values
         if ($field_type == 'enum') {
             foreach ($field['length'] as $enum) {
                 $data[$enum] = $enum;
             }
         }
     }
     switch ($html_type) {
         // Select
         // $data is supposed to be an array of keys => displayed labels
         case 'select':
             $extra .= ' class="select"';
             return form_dropdown($field_name, $data, $field_value, $extra);
             break;
         case 'multiselect':
             $extra .= ' class="select multiselect"';
             $selected = explode(',', $field_value);
             $field_name = $field_name . '[]';
             return form_multiselect($field_name, $data, $selected, $extra);
             break;
         case 'input':
             $extra .= ' class="inputtext"';
             return form_input($field_name, $field_value, $extra);
             break;
         case 'textarea':
             $extra .= ' class="textarea"';
             return form_textarea($field_name, $field_value, $extra);
             break;
             // Text Editing textarea (tinyMCE in this case)
         // Text Editing textarea (tinyMCE in this case)
         case 'html':
             $extra .= ' class="tinyTextarea"';
             return form_textarea($field_name, $field_value, $extra);
             break;
         case 'checkbox':
             $extra = ' class="checkbox"';
             $str = '';
             $print_label = TRUE;
             // We consider the checkbox only validate one data, which should be set at 1 or 0.
             if (empty($data)) {
                 $data = array(1 => '');
                 $print_label = FALSE;
             }
             foreach ($data as $value => $label) {
                 $id = 'c_' . uniqid();
                 $extra2 = $extra . ' id="' . $id . '"';
                 $checked = $field_value == $value ? TRUE : FALSE;
                 if ($print_label === TRUE) {
                     $str .= form_label($label, $id);
                 }
                 $str .= form_checkbox($field_name, $value, $checked, $extra2);
             }
             return $str;
             break;
         case 'radio':
             $extra = ' class="radio"';
             $str = '';
             $print_label = TRUE;
             // We consider the checkbox only validate one data, which should be set at 1 or 0.
             if (empty($data)) {
                 $data = array(1 => '');
                 $print_label = FALSE;
             }
             foreach ($data as $value => $label) {
                 $id = 'r_' . uniqid();
                 $extra2 = $extra . ' id="' . $id . '"';
                 $checked = $field_value == $value ? TRUE : FALSE;
                 if ($print_label === TRUE) {
                     $str .= form_label($label, $id);
                 }
                 $str .= form_radio($field_name, $value, $checked, $extra2);
             }
             return $str;
             break;
         case 'date':
             $extra .= ' class="inputtext date"';
             if ($field['type'] == 'datetime') {
                 $field_value = humanize_mdate($field_value, Settings::get('date_format') . ' %H:%i:%s');
             } else {
                 $field_value = humanize_mdate($field_value, Settings::get('date_format'));
             }
             return form_input($field_name, $field_value, $extra);
             break;
         default:
             $extra .= ' class="inputtext"';
             return form_input($field_name, $field_value, $extra);
     }
 }
Example #24
0
echo "</td></tr>\n";
*/
echo "<tr><td class='label'><label for='pname'>".$this->lang->line('kago_name')."</label>";
echo "Original: ".$product['name'];
echo "</td>\n";
$data = array('name'=>'name','id'=>'pname','class'=>'text');
echo "<td>";
echo form_input($data);
echo "</td></tr>\n";

echo "<tr><td class='label'><label for='public'>Public</label></td>\n";
echo "<td>";
echo "Yes";
echo form_radio('public','1', True);
echo "No";
echo form_radio('public','0');
echo "</td></tr>\n";

echo "<tr><td class='label'><label for='short'>".$this->lang->line('kago_short_desc')."</label>";
echo "Original: ".$product['shortdesc'];
echo "</td>\n";
$data = array('name'=>'shortdesc','id'=>'short','class'=>'text');
echo "<td>";
echo form_input($data);
echo "</td></tr>\n";

echo "<tr><td class='label'><label for='long'>".$this->lang->line('kago_long_desc')."</label>";
echo "Original: ".$product['longdesc'];
echo "</td>\n";
$data = array('name'=>'longdesc','id'=>'long','rows'=>'10', 'cols'=>'80');
echo "<td id='nopad' >";
Example #25
0
    /**
     * Template Preferences Manager
     *
     * @access	public
     * @return	type
     */
    function template_preferences_manager($message = '')
    {
        if (!$this->cp->allowed_group('can_access_design') or !$this->cp->allowed_group('can_admin_templates')) {
            show_error($this->lang->line('unauthorized_access'));
        }
        if ($this->input->get_post('id') !== '') {
            $group_id = $this->input->get_post('id');
        }
        $vars['message'] = $message;
        $vars['show_template_manager'] = TRUE;
        // in an error condition, this will go false
        if ($this->session->userdata['group_id'] != 1 && (count($this->session->userdata['assigned_template_groups']) == 0 or $this->cp->allowed_group('can_admin_templates') == FALSE)) {
            $vars['message'] = $this->lang->line('no_templates_assigned');
            $vars['show_template_manager'] = FALSE;
            return $this->load->view('design/template_preferences_manager', $vars);
        }
        $this->load->helper('form');
        $this->load->library('table');
        $this->javascript->output('		
			// select all options for template access restrictions
			$("input.select_all").click(function(){
				$("input[class="+$(this).val()+"]").each(function() {
					this.checked = true;
				});
			});
			
			var the_templates = $(\'div[id^="template_group_div_"]\');
		
			$("#template_groups").change(function() {
				the_templates.hide();
				var openDivs = $(this).val().toString()
				var ids = new Array();
				ids = openDivs.split(",");
								
				for(i=0;i<ids.length;i++)
				{
					$("#template_group_div_"+ids[i]).show();
				}
		
				return false;
			});
		');
        // Retrieve Valid Template Groups and Templates
        $this->db->from('template_groups tg, templates t');
        $this->db->select('tg.group_id, tg.group_name, t.template_id, t.template_name');
        $this->db->where('tg.group_id = t.group_id');
        $this->db->where('tg.site_id', $this->config->item('site_id'));
        if ($this->session->userdata['group_id'] != 1) {
            $this->db->where_in('t.group_id', array_keys($this->session->userdata['assigned_template_groups']));
        }
        $this->db->order_by('tg.group_order, t.group_id, t.template_name');
        $query = $this->db->get();
        if ($query->num_rows() == 0) {
            $vars['message'] = $this->lang->line('no_templates_available');
            $vars['show_template_manager'] = FALSE;
            return $this->load->view('design/template_preferences_manager', $vars);
        }
        // Create MultiSelect Lists
        $current_group = 0;
        $groups = array();
        $tmpl = array();
        $vars['templates'] = array();
        foreach ($query->result_array() as $i => $row) {
            if ($row['group_id'] != $current_group) {
                $groups[$row['group_id']] = form_prep($row['group_name']);
                if ($current_group != 0) {
                    $vars['templates']['template_group_div_' . $current_group]['select'] = form_multiselect('template_group_' . $row['group_id'] . '[]', $tmpl, '', "size='8' class='multiselect' style='width:45%'");
                    $vars['templates']['template_group_div_' . $current_group]['active'] = $current_group == $group_id ? TRUE : FALSE;
                    $tmpl = array();
                }
            }
            $tmpl[$row['template_id']] = form_prep($row['template_name']);
            $current_group = $row['group_id'];
        }
        $groups = form_multiselect('template_groups', $groups, $group_id, "id='template_groups' size='10' class='multiselect' style='width:160px'");
        $vars['templates']['template_group_div_' . $current_group]['select'] = form_multiselect('template_group_' . $row['group_id'] . '[]', $tmpl, '', "size='8' class='multiselect' style='width:45%'");
        $vars['templates']['template_group_div_' . $current_group]['active'] = $current_group == $group_id ? TRUE : FALSE;
        $vars['groups'] = $groups;
        if ($this->input->get_post('U')) {
            $vars['message'] = $this->lang->line('preferences_updated');
        }
        // Template Preference Headings
        $headings = array(array('template_type', $this->lang->line('type')), array('cache', $this->lang->line('cache_enable')), array('refresh', $this->lang->line('refresh_interval') . ' <small>(' . $this->lang->line('refresh_in_minutes') . ')</small>'));
        if ($this->session->userdata['group_id'] == 1) {
            $headings[] = array('allow_php', $this->lang->line('enable_php') . ' <span class="notice">*</span>');
            $headings[] = array('php_parse_location', $this->lang->line('parse_stage'));
        }
        if ($this->config->item('save_tmpl_files') == 'y' and $this->config->item('tmpl_file_basepath') != '') {
            $headings[] = array('save_template_file', $this->lang->line('save_template_file'));
        }
        $headings[] = array('hits', $this->lang->line('hit_counter'));
        $vars['headings'] = $headings;
        // Template Preference Options
        $vars['template_prefs'] = array();
        $template_type_options = array('null' => $this->lang->line('do_not_change'), 'css' => $this->lang->line('css_stylesheet'), 'js' => $this->lang->line('js'), 'feed' => $this->lang->line('rss'), 'static' => $this->lang->line('static'), 'webpage' => $this->lang->line('webpage'), 'xml' => $this->lang->line('xml'));
        $vars['template_prefs']['template_type'] = form_dropdown('template_type', $template_type_options, 'null', 'id="template_type"');
        $yes_no_options = array('null' => $this->lang->line('do_not_change'), 'y' => $this->lang->line('yes'), 'n' => $this->lang->line('no'));
        $vars['template_prefs']['cache'] = form_dropdown('cache', $yes_no_options, 'null', 'id="cache"');
        $vars['template_prefs']['refresh'] = form_input(array('name' => 'refresh', 'value' => '0', 'size' => 5));
        if ($this->session->userdata['group_id'] == 1) {
            $php_i_o_options = array('null' => $this->lang->line('do_not_change'), 'i' => $this->lang->line('input'), 'o' => $this->lang->line('output'));
            $vars['template_prefs']['allow_php'] = form_dropdown('allow_php', $yes_no_options, 'null', 'id="allow_php"');
            $vars['template_prefs']['php_parse_location'] = form_dropdown('php_parse_location', $php_i_o_options, 'null', 'id="php_parse_location"');
        }
        if ($this->config->item('save_tmpl_files') == 'y' and $this->config->item('tmpl_file_basepath') != '') {
            $vars['template_prefs']['save_template_file'] = form_dropdown('save_template_file', $yes_no_options, 'null', 'id="save_template_file"');
        }
        $vars['template_prefs']['hits'] = form_input(array('name' => 'hits', 'value' => '', 'size' => 5));
        // Template Access Restrictions
        $this->db->select('group_id, group_title');
        $this->db->where('site_id', $this->config->item('site_id'));
        $this->db->where('group_id !=', '1');
        $this->db->order_by('group_title');
        $query = $this->db->get('member_groups');
        $vars['template_access'] = array();
        foreach ($query->result() as $row) {
            $vars['template_access'][$row->group_id][] = $row->group_title;
            $radio_options = '';
            foreach ($yes_no_options as $key => $lang) {
                $radio_options .= '<label>' . form_radio('access_' . $row->group_id, $key, '', 'class="access_' . $key . '"') . NBS . $lang . '</label>' . NBS . NBS . NBS . NBS . NBS . NBS . NBS;
            }
            $vars['template_access'][$row->group_id][] = $radio_options;
        }
        $vars['template_access']['select_all'][] = $this->lang->line('select_all');
        $select_all_radios = '<label>' . form_radio('select_all', 'access_null', '', 'class="select_all"') . NBS . $this->lang->line('do_not_change') . '</label>' . NBS . NBS . NBS . NBS . NBS . NBS . NBS;
        $select_all_radios .= '<label>' . form_radio('select_all', 'access_y', '', 'class="select_all"') . NBS . $this->lang->line('yes') . '</label>' . NBS . NBS . NBS . NBS . NBS . NBS . NBS;
        $select_all_radios .= '<label>' . form_radio('select_all', 'access_n', '', 'class="select_all"') . NBS . $this->lang->line('no') . '</label>';
        $vars['template_access']['select_all'][] = $select_all_radios;
        $this->db->select('template_groups.group_name, templates.template_name, templates.template_id');
        $this->db->where('template_groups.group_id = ' . $this->db->dbprefix('templates.group_id'));
        $this->db->where('template_groups.site_id', $this->config->item('site_id'));
        $this->db->order_by('template_groups.group_name, templates.template_name');
        $query = $this->db->get(array('template_groups', 'templates'));
        $vars['no_auth_bounce_options']['null'] = $this->lang->line('do_not_change');
        foreach ($query->result() as $row) {
            $vars['no_auth_bounce_options'][$row->template_id] = $row->group_name . '/' . $row->template_name;
        }
        $vars['enable_http_auth_options'] = $yes_no_options;
        $this->cp->set_variable('cp_page_title', $this->lang->line('template_preferences_manager'));
        $this->cp->set_breadcrumb(BASE . AMP . 'C=design' . AMP . 'M=manager', $this->lang->line('template_manager'));
        $this->javascript->compile();
        $this->load->view('design/template_preferences_manager', $vars);
    }
      <span id="show_username"><?php 
echo $user_name;
?>
</span><span id="show_messsage" style="display:none;padding-left:10px;color:red">已成功提交姓名變更申請</span><input type="button" id="edit_username" value="申請變更姓名" />
      <div id="show_button" style="display:none;"><input type="button" id="save_username" value="送出" /><input type="button" id="cancel" value="取消" /></div>
      </p>

      <p>匿稱:
      <?php 
echo form_input($user_nickname);
?>
      </p>

      <p>性別:
      <?php 
echo form_radio($user_sex_m) . "男" . form_radio($user_sex_f) . "女";
?>
      </p>

      <p>行動電話:
      <?php 
echo form_input($phone);
?>
      </p>

      <p>市內電話:
      <?php 
echo form_input($cellphone);
?>
      </p>
Example #27
0
        $checked1 = '';
        $checked2 = 'checked="checked"';
    } else {
        $checked1 = '';
        $checked2 = 'checked="checked"';
    }
    ?>

						<label class="radio">
							<?php 
    echo form_radio($status, 'Active', $checked2, 'class="required"');
    ?>
							Active</label> 
						<label class="radio">
							<?php 
    echo form_radio($status, 'Inactive', $checked1, 'class="required"');
    ?>
							Inactive
						</label>
                      
                    </div>
                  </div>
                  <?php 
}
?>
	              <div class="form-group">
                    <label class="col-md-3 col-sm-4 control-label">&nbsp;</label>
                    <div class="col-sm-6">
                    <input type="submit" class="btn btn-sm btn-primary" value="Update Profile" name="agent_form" id="agent_form">
                    <?php 
echo anchor('home', 'Cancel', array('title' => 'Cancel', 'class' => 'btn btn-sm btn-default'));
Example #28
0
       
        <div>
            <h4><span><?php 
    echo $question_detail['question'];
    ?>
</span></h4>
            <?php 
    echo form_hidden('q_id', $question_detail['qid']);
    ?>
            <div>            
                <?php 
    foreach ($options as $optionValues) {
        ?>
                    <div class="control-group form-group">
                        <?php 
        echo form_radio(array('name' => 'user_ans', 'value' => $optionValues['id'], 'checked' => set_radio('user_and', FALSE)));
        ?>
                        <?php 
        echo form_label('<span>' . $optionValues['option_name'] . '</span>');
        ?>
                    
                    </div>
                <?php 
    }
    ?>
                <?php 
    echo form_error('user_ans');
    ?>
            </div>
            <div class="button-set">
                <input class="submit btn btn-primary" type="submit" value="Answer" />
Example #29
0
echo '<h2 class="form-signin-heading">Create an account</h2>';
echo '<div class="form-group">';
echo form_input('first_name', set_value('first_name'), 'placeholder="First name" class="form-control"');
echo '</div><div class="form-group">';
echo form_input('last_name', set_value('last_name'), 'placeholder="Last name" class="form-control"');
echo '</div><div class="form-group">';
/*echo form_input('email_address', set_value('email_address'), 'placeholder="Email" class="form-control"');
  echo '</div><div class="form-group">';*/
echo form_input('username', set_value('username'), 'placeholder="Username" class="form-control"');
echo '</div><div class="form-group">';
echo form_input('password', '', 'placeholder="Password" class="form-control"');
echo '</div><div class="form-group">';
echo form_radio('role', '1', FALSE);
echo form_label('Super Admin', 'role');
echo '</div><div class="form-group">';
echo form_radio('role', '2', TRUE);
echo form_label('User', 'role');
echo '</div><div class="form-group">';
/*echo form_password('password2', '', 'placeholder="Password confirm" class="form-control"');
  echo '</div><div class="form-group">';*/
echo form_submit('submit', 'submit', 'class="btn btn-large btn-primary"');
echo '</div>';
echo form_close();
?>
                </div>
                <?php 
include_once 'footer.php';
?>
            </div>
        </div>
        <script src="<?php 
Example #30
0
        } elseif (file_exists($skin->path . 'icon.jpg')) {
            $_icon = $skin->url . 'icon.jpg';
        } elseif (file_exists($skin->path . 'icon.gif')) {
            $_icon = $skin->url . 'icon.gif';
        } else {
            $_icon = NAILS_ASSETS_URL . 'img/admin/modules/settings/blog-skin-no-icon.png';
        }
        $_selected = $skin->slug == $_selected_skin ? TRUE : FALSE;
        $_class = $_selected ? 'selected' : '';
        echo '<li class="skin ' . $_class . '" rel="tipsy" title="' . $_description . '">';
        echo '<div class="icon">' . img($_icon) . '</div>';
        echo '<div class="name">';
        echo $_name;
        echo '<span class="ion-checkmark-circled"></span>';
        echo '</div>';
        echo form_radio('skin', $skin->slug, $_selected);
        echo '</li>';
    }
    echo '</ul>';
    echo '<hr class="clearfix" />';
} else {
    echo '<p class="system-alert error">';
    echo '<strong>Error:</strong> ';
    echo 'I\'m sorry, but I couldn\'t find any skins to use. This is a configuration error and should be raised with the developer.';
    echo '</p>';
}
?>
				<p>
					<?php 
echo form_submit('submit', lang('action_save_changes'), 'style="margin-bottom:0;"');
?>