/** * 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(); // ------------------------------------- // Build setting: options // ------------------------------------- $options = $this->get_setting('options', $var_settings); $r[] = array($this->setting_label(lang('variable_options'), lang('variable_options_help')), form_textarea(array('name' => $this->input_name('options'), 'value' => $options, 'rows' => '7', 'cols' => '40', 'style' => 'width:75%'))); // ------------------------------------- // Build setting: multiple? // ------------------------------------- $multiple = $this->get_setting('multiple', $var_settings); $r[] = array($this->setting_label(lang('allow_multiple_items')), '<label class="low-checkbox">' . form_checkbox($this->input_name('multiple'), 'y', $multiple == 'y', 'class="low-allow-multiple"') . lang('allow_multiple_items_label') . '</label>'); // ------------------------------------- // Build setting: separator // ------------------------------------- $separator = $this->get_setting('separator', $var_settings); $r[] = array($this->setting_label(lang('separator_character')), $this->separator_select($separator)); // ------------------------------------- // Build setting: multi interface // ------------------------------------- $multi_interface = $this->get_setting('multi_interface', $var_settings); $r[] = array($this->setting_label(lang('multi_interface')), $this->interface_select($multi_interface)); // ------------------------------------- // Return output // ------------------------------------- return $r; }
public function index() { $offset = $this->general_lib->get_offset(); $limit = $this->general_lib->get_limit(); $total = $this->servis_mdl->count_all(); $xdata['action'] = 'servis/search' . $this->_filter(); $xdata['action_delete'] = 'servis/delete' . $this->_filter(); $xdata['add_btn'] = anchor('servis/add', '<span class="glyphicon glyphicon-plus"></span> Tambah', array('class' => 'btn btn-success btn-sm')); $xdata['delete_btn'] = '<button id="delete-btn" class="btn btn-danger btn-sm"><span class="glyphicon glyphicon-trash"></span> Delete Checked</button>'; $this->table->set_template(tbl_tmp()); $head_data = array('nomor' => 'Nomor', 'nopol' => 'Kendaraan', 'tanggal' => 'Tanggal', 'tipe_nama' => 'Tipe', 'kilometer' => 'Kilometer', 'jumlah_satuan' => 'Jumlah Satuan', 'total_harga' => 'Total Harga'); $heading[] = form_checkbox(array('id' => 'selectAll', 'value' => 1)); $heading[] = '#'; foreach ($head_data as $r => $value) { $heading[] = anchor('servis' . $this->_filter(array('order_column' => "{$r}", 'order_type' => $this->general_lib->order_type($r))), "{$value} " . $this->general_lib->order_icon("{$r}")); } $heading[] = 'Action'; $this->table->set_heading($heading); $result = $this->servis_mdl->get()->result(); $i = 1 + $offset; foreach ($result as $r) { $this->table->add_row(array('data' => form_checkbox(array('name' => 'check[]', 'value' => $r->id)), 'width' => '10px'), $i++, $r->nomor, $r->nopol, format_dmy($r->tanggal), $r->tipe_nama, $r->kilometer, array('data' => number_format($r->jumlah_satuan), 'align' => 'right'), array('data' => number_format($r->total_harga), 'align' => 'right'), anchor('servis/edit/' . $r->id . $this->_filter(), 'Edit') . " | " . anchor('servis/delete/' . $r->id . $this->_filter(), 'Delete', array('onclick' => "return confirm('you sure')")) . " | " . anchor('servis/print_detail/' . $r->id, 'Print', array('target' => '_blank'))); } $xdata['table'] = $this->table->generate(); $xdata['total'] = page_total($offset, $limit, $total); $config = pag_tmp(); $config['base_url'] = site_url("servis" . $this->_filter()); $config['total_rows'] = $total; $config['per_page'] = $limit; $this->pagination->initialize($config); $xdata['pagination'] = $this->pagination->create_links(); $data['content'] = $this->load->view('servis_list', $xdata, true); $this->load->view('template', $data); }
public function initialize($cajero = NULL) { $CI =& get_instance(); $CI->load->helper(array('form', 'bancofield')); $existeObjeto = $cajero != NULL ? 1 : 0; $this->id = form_hidden('id', $existeObjeto ? $cajero->id : $CI->input->post('id')); $this->banco_id = BancoField('banco_id', $existeObjeto ? $cajero->banco_id : $CI->input->post('banco_id')); $this->nombre = form_input('nombre', $existeObjeto ? $cajero->nombre : $CI->input->post('nombre')); $this->horario = form_input('horario', $existeObjeto ? $cajero->horario : $CI->input->post('horario')); $this->direccion = form_input('direccion', $existeObjeto ? $cajero->direccion : $CI->input->post('direccion')); $this->latitud = form_input('latitud', $existeObjeto ? $cajero->latitud : $CI->input->post('latitud')); $this->longitud = form_input('longitud', $existeObjeto ? $cajero->longitud : $CI->input->post('longitud')); $this->banred = form_checkbox('banred', '1', $existeObjeto ? $cajero->banred : $CI->input->post('banred')); $this->pacificard = form_checkbox('pacificard', '1', $existeObjeto ? $cajero->pacificard : $CI->input->post('pacificard')); $this->american_express = form_checkbox('american_express', '1', $existeObjeto ? $cajero->american_express : $CI->input->post('american_express')); $this->bankard = form_checkbox('bankard', '1', $existeObjeto ? $cajero->bankard : $CI->input->post('bankard')); $this->nexo = form_checkbox('nexo', '1', $existeObjeto ? $cajero->nexo : $CI->input->post('nexo')); $this->visa_debito = form_checkbox('visa_debito', '1', $existeObjeto ? $cajero->visa_debito : $CI->input->post('visa_debito')); $this->visa = form_checkbox('visa', '1', $existeObjeto ? $cajero->visa : $CI->input->post('visa')); $this->plus = form_checkbox('plus', '1', $existeObjeto ? $cajero->plus : $CI->input->post('plus')); $this->mastercard = form_checkbox('mastercard', '1', $existeObjeto ? $cajero->mastercard : $CI->input->post('mastercard')); $this->cirrus = form_checkbox('cirrus', '1', $existeObjeto ? $cajero->cirrus : $CI->input->post('cirrus')); $this->maestro = form_checkbox('maestro', '1', $existeObjeto ? $cajero->maestro : $CI->input->post('maestro')); $this->diners = form_checkbox('diners', '1', $existeObjeto ? $cajero->diners : $CI->input->post('diners')); $this->estado = form_dropdown('estado', array('AC' => 'Activo', 'IN' => 'Inactivo'), $existeObjeto ? $cajero->estado : $CI->input->post('estado')); }
public function index() { $offset = $this->general_lib->get_offset(); $limit = $this->general_lib->get_limit(); $total = $this->user_mdl->count_all(); $xdata['action'] = 'user/search' . $this->_filter(); $xdata['action_delete'] = 'user/delete' . $this->_filter(); $xdata['add_btn'] = anchor('user/add', '<span class="glyphicon glyphicon-plus"></span> Tambah', array('class' => 'btn btn-success btn-sm')); $xdata['delete_btn'] = '<button id="delete-btn" class="btn btn-danger btn-sm"><span class="glyphicon glyphicon-trash"></span> Delete Checked</button>'; $this->table->set_template(tbl_tmp()); $head_data = array('fullname' => 'Fullname', 'username' => 'Username', 'level_name' => 'Level', 'ip_login' => 'Last IP Login', 'user_agent' => 'Last User Agent', 'date_login' => 'Last Login', 'status_name' => 'Status'); $heading[] = form_checkbox(array('id' => 'selectAll', 'value' => 1)); $heading[] = '#'; foreach ($head_data as $r => $value) { $heading[] = anchor('user' . $this->_filter(array('order_column' => "{$r}", 'order_type' => $this->general_lib->order_type($r))), "{$value} " . $this->general_lib->order_icon("{$r}")); } $heading[] = 'Action'; $this->table->set_heading($heading); $result = $this->user_mdl->get()->result(); $i = 1 + $offset; foreach ($result as $r) { $this->table->add_row(array('data' => form_checkbox(array('name' => 'check[]', 'value' => $r->id)), 'width' => '10px'), $i++, $r->fullname, $r->username, $r->level_nama, $r->ip_login, $r->user_agent, $r->date_login, '<label class="label label-' . ($r->status_kode == 'ON' ? 'success' : 'danger') . '">' . $r->status_nama . '</label>', anchor('user/edit/' . $r->id . $this->_filter(), 'Edit') . " | " . anchor('user/delete/' . $r->id . $this->_filter(), 'Delete', array('onclick' => "return confirm('you sure')"))); } $xdata['table'] = $this->table->generate(); $xdata['total'] = page_total($offset, $limit, $total); $config = pag_tmp(); $config['base_url'] = site_url("user" . $this->_filter()); $config['total_rows'] = $total; $config['per_page'] = $limit; $this->pagination->initialize($config); $xdata['pagination'] = $this->pagination->create_links(); $data['content'] = $this->load->view('user_list', $xdata, true); $this->load->view('template', $data); }
function obtener_canciones($user) { //extraemos id usuario $this->db->select('id')->where('username', $user); $idUser = $this->db->get('usuarios')->result_array()[0]['id']; $this->db->select('id, nombre')->where('usuario', $idUser); //extraemos numero perfiles $perfiles = $this->db->get('perfiles'); //$perfiles->num_rows(); $songstable = ""; //$result = ""; //para cada perfil sacamos las canciones que estan en el foreach ($perfiles->result() as $perfil) { // echo $perfil->id; $this->table->set_heading('ID', 'Titulo', 'Artista', 'Album', 'Acciones'); $this->table->set_caption($perfil->nombre); $canciones = $this->db->select('cancion_Id')->where('perfil_Id', $perfil->id)->get('cancionesperfiles'); foreach ($canciones->result() as $cancion) { $rowCancion = $this->db->select('id, titulo, artista, album')->where('id', $cancion->cancion_Id)->get('canciones'); foreach ($rowCancion->result() as $row) { $links = anchor('canciones/edit/' . $row->id, 'Editar'); $links .= anchor('canciones/delete/' . $row->id, ' Borrar'); $this->table->add_row(form_checkbox('values[]', $row->id), $row->titulo, $row->artista, $row->album, $links); } // $perfil->nombre; } //$this->table->set_caption($perfil->nombre); $songstable .= $this->table->generate(); } $this->table->clear(); //print_r($result); return $songstable; }
/** * 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); // ------------------------------------- // Build settings for code format // ------------------------------------- $r[] = array($this->setting_label(lang('enable_code_format')), '<label class="low-checkbox">' . form_checkbox($this->input_name('code_format'), 'y', $this->get_setting('code_format', $var_settings)) . ' ' . lang('use_code_format') . '</label>'); // ------------------------------------- // Return output // ------------------------------------- return $r; }
/** * Text Input Field With Enable/Disable Checkbox * * @access public * @param mixed * @param string * @param string * @param string * @param string * @param bool * @return string */ function fpbx_form_input_check($data = '', $value = '', $extra = '', $label = 'Enable', $disabled_value = 'DEFAULT', $check_enables = true) { if (!is_array($data)) { $data['name'] = $data['id'] = $data; } if (!isset($data['id'])) { $data['id'] = $data['name']; } if (!isset($data['value'])) { $data['value'] = $value; } if (!empty($data['disabled'])) { $data['value'] = $disabled_value; } $cbdata['name'] = $data['name'] . '_cb'; $cbdata['id'] = $data['id'] . '_cb'; $cbdata['checked'] = isset($data['disabled']) ? !$data['disabled'] : true; $cbdata['data-disabled'] = $disabled_value; if ($check_enables) { $cbdata['class'] = "input_checkbox_toggle_false"; } else { $cbdata['class'] = "input_checkbox_toggle_true"; $cbdata['checked'] = !$cbdata['checked']; } return form_input($data) . form_checkbox($cbdata) . form_label($label, $cbdata['id']); }
function build() { $output = ""; $this->_getValue(); switch ($this->status) { case "disabled": case "show": if (!isset($this->value)) { $output = RAPYD_FIELD_SYMBOL_NULL; } elseif ($this->value == "") { $output = ""; } else { $output = $this->value; } break; case "create": case "modify": $onchange = ""; $onclick = ""; if ($this->onchange != "") { $onchange = ' onchange="' . $this->onchange . '"'; } if ($this->onclick != "") { $onclick = ' onclick="' . $this->onclick . '"'; } $id = ' id="' . $this->name . '"'; $output = form_checkbox($this->name, $this->true_value, $this->checked, $id . $onchange . $onclick) . $this->extra_output; break; case "hidden": $output = form_hidden($this->name, $this->value); break; default: } $this->output = $output; }
public function show($options = array(), $data) { // dump($data);die; $mysql_table = end($this->ci->uri->segment_array()); $path = site_url("lib_generic/method/forms/active_box/save_action"); // die($path); //todo tirar de alert e colocar num bonito $js = <<<EOT \t\t\t\$(".active_box_plugin").click(function(){ \t\t\t\tdata_send = { \t\t\t\t\t"field_name" : \$(this).attr("active_box_field"), \t\t\t\t\t"pk"\t\t: \$(this).attr("active_box_pk"), \t\t\t\t\t"pk_val"\t : \$(this).attr("active_box_id"), \t\t\t\t\t"checked"\t : \$(this).attr("checked") \t\t\t\t}; \t\t\t\t\$.getJSON('{$path}', data_send, function(data) { \t\t\t\t\t// alert(JSON.stringify(data)); \t\t\t\t}); \t\t\t}); \t\t\t\t\t EOT; // Assets::add_js($js,"inline",true); $data_send = array('value' => $data['value'], 'checked' => $data['value'] == "1", "active_box_id" => $data['pk'], "active_box_field" => $data['field_name'], "active_box_pk" => $data['pk_name'], "data_path" => $path, "data_table" => $mysql_table, "class" => "active_box_plugin"); // dump($data);die; return form_checkbox($data_send); }
/** * 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) { // ------------------------------------- // Check current value from settings // ------------------------------------- $options = $this->get_setting('options', $var_settings); $options = $this->explode_options($options); // ------------------------------------- // Prep current data // ------------------------------------- $current = explode($this->separators[$this->get_setting('separator', $var_settings)], $var_data); // ------------------------------------- // Init return value // ------------------------------------- $r = ''; // ------------------------------------- // Build checkboxes // ------------------------------------- foreach ($options as $key => $val) { $checked = in_array($key, $current) ? TRUE : FALSE; $r .= '<label class="low-checkbox">' . form_checkbox("var[{$var_id}][]", $key, $checked) . htmlspecialchars($val) . '</label>'; } // ------------------------------------- // Return checkboxes // ------------------------------------- return $r; }
function list_node_image_terms() { global $term_dir; $files = file_scan_directory($term_dir, '.*_(full|summ).*'); if (!count($files)) { print 'No node_images for terms; update script does not support node images.'; return; } $header = array(t('Term'), t('Image'), t('Migrate'), t('Delete')); foreach ($files as $image) { $image->tid = migrate_term_image_get_tid($image->name); list($image->width, $image->height) = getimagesize($image->filename); if ($image->height > 100) { $image->height = $image->height / 2; $image->width = $image->width / 2; } $img = "<img src='{$image->filename} ' width='{$image->width}' height='{$image->height}' />"; $term = taxonomy_get_term($image->tid); $t_i_image = db_fetch_object(db_query('SELECT path FROM {term_image} WHERE tid = %d', $image->tid)); if ($t_i_image) { $term->has_image = true; } unset($t_i_image); $item = $term->name . '($image->name)'; $migrate = form_checkbox(NULL, "migrate][" . $image->name, 1, $term->has_image ? 0 : 1); $delete = form_checkbox(NULL, "delete][" . $image->name, 1, $term->has_image ? 1 : 0); $rows[] = array('data' => $item, $img, $migrate, $delete); } $table = theme('table', $header, $rows); $table .= '<em>Checked rows do not have an existing taxonomy_image entry</em><br/>'; $form = form($table . form_submit('Migrate')); print $form; }
function get_all_sites_html() { $this->_secure(); $result = ''; $url_params = $this->uri->uri_to_assoc(3); $user = $this->session->all_userdata(); $this->load->model('model_sites'); $sites = $this->model_sites->get_records(array('client_id' => $user['client_id'], 'site_displayed_flag' => '1')); if (!empty($sites)) { $columns = 1; if (isset($url_params['columns']) && !empty($url_params['columns'])) { $columns = $url_params['columns']; } $sites_per_column = ceil(sizeof($sites) / $columns); $site_counter = 0; foreach ($sites as $site) { if ($site_counter % $sites_per_column == 0) { if ($site_counter > 0) { $result .= '</div>'; } $result .= '<div class="all_sites_column">'; } $id = 'all_site_id_' . $site['site_id']; $value = $site['site_id']; $field_data = array('name' => 'data[site_id][]', 'id' => $id, 'class' => 'all_site'); $result .= '<div class="form_field">' . form_checkbox($field_data, $value) . '<label for="' . $id . '" class="tooltip" title="' . $site['site_title'] . '">' . teaser($site['site_title'], 30) . '</label></div>'; $site_counter++; } $result .= '</div>'; } $data = array(); $data['any'] = $result; $data['action_view'] = 'misc/any'; $this->load->view('layouts/blank', $data); }
/** * lists页面的view代码 */ function lists_view($filter, $email_value, $begin_value, $rows, $page_html) { //目前是写死的,到时候应该是在controller中将逻辑写好,在view层与页面控件结合 $group1 = matrix_a_btn(array('href' => '#', 'text' => '未完成(100)'), 'info', ''); $group2 = matrix_a_btn(array('href' => '#', 'text' => '已完成(2)'), 'info', ''); $group3 = matrix_a_btn(array('href' => '#', 'text' => '已退货(21)'), 'info', 'active'); $btn_groups = array(array($group1, $group2, $group3)); //超链接按钮 $buttons = array(matrix_a_btn(array('href' => base_url('user/add'), 'text' => '添加用户'))); //过滤条件 $options = array(0 => '包含', 1 => '等于', 2 => '开头', 3 => '完与'); $select = form_dropdown('filter', $options, $filter); //单选下拉框 $select = matrix_select($select, true); $email_attr = quick_input_attr('email', 'span3', '请输入邮箱'); $email = form_input($email_attr, $email_value); $begin_attr = quick_input_attr('begin', 'span2', '开始注册时间'); $begin = my97DatePicker($begin_attr, $begin_value); $inputs = array(array($select, $email), array($begin)); //table列表 //设置表头 排序的icon可以根据逻辑做修改 这里是写死的 $ths = array(table_th(form_checkbox(), '5%'), table_th(table_a('#', '<i class="icon-sort"></i>邮箱'), '35%'), table_th(table_a('#', '<i class="icon-caret-down"></i>角色'), '20%'), table_th('上次登录时间', '20%'), table_th('操作', '20%')); $trs = array(); foreach ($rows as $key => $row) { $a1 = table_a(base_url('user/add', array('id' => $row['id'])), '查看'); $attrs = array('data-id' => $row['id'], 'data-name' => "xx", 'class' => 'warning', 'data-href' => base_url('user/add'), 'data-prompt' => '您确定这个订单吗?'); $a2 = table_a_btn($attrs, '删除'); $tds = array(table_format_td(form_checkbox()), table_format_td($row['email']), table_format_td(matrix_badge(array('text' => $row['role']))), table_format_td($row['time']), table_format_td($a1 . $a2)); $trs[] = table_format_tr($tds, array('data-sort' => $key, 'data-id' => $row['id'])); } $table_attrs = array('data-type' => 'dragsort', 'data-ajax' => 'ajax/sort.php', 'data-td' => $row['id']); $table = table_format($ths, $trs, $page_html, $table_attrs); return query_form($inputs, $buttons, $btn_groups) . $table; }
function random_pages_widget_form($num = 1) { $widget = 'random_pages_widget_' . $num; // имя для формы и опций = виджет + номер // получаем опции $options = mso_get_option($widget, 'plugins', array()); if (!isset($options['header'])) { $options['header'] = ''; } if (!isset($options['count'])) { $options['count'] = 3; } if (!isset($options['page_type'])) { $options['page_type'] = 'blog'; } if (!isset($options['page_content'])) { $options['page_content'] = false; } // вывод самой формы $CI =& get_instance(); $CI->load->helper('form'); $form = mso_widget_create_form(t('Заголовок'), form_input(array('name' => $widget . 'header', 'value' => $options['header'])), ''); $form .= mso_widget_create_form(t('Количество'), form_input(array('name' => $widget . 'count', 'value' => $options['count'])), ''); $form .= mso_widget_create_form(t('Тип страниц'), form_input(array('name' => $widget . 'page_type', 'value' => $options['page_type'])), ''); $form .= mso_widget_create_form(' ', form_checkbox(array('name' => $widget . 'page_content', 'checked' => $options['page_content'], 'value' => 'page_content')) . ' ' . t('Показывать содержимое'), ''); return $form; }
public function index() { $offset = $this->general_lib->get_offset(); $limit = $this->general_lib->get_limit(); $total = $this->model->count_all(); $xdata['action'] = $this->section_master . '/search' . $this->_filter(); $xdata['action_delete'] = $this->section_master . '/delete' . $this->_filter(); $xdata['add_btn'] = anchor($this->section_master . '/add', '<span class="glyphicon glyphicon-plus"></span> Tambah', array('class' => 'btn btn-success btn-sm')); $xdata['delete_btn'] = '<button id="delete-btn" class="btn btn-danger btn-sm"><span class="glyphicon glyphicon-trash"></span> Delete Checked</button>'; $this->table->set_template(tbl_tmp()); $head_data = array('kode' => 'Kode', 'nama' => 'Nama'); $heading[] = form_checkbox(array('id' => 'selectAll', 'value' => 1)); $heading[] = '#'; foreach ($head_data as $r => $value) { $heading[] = anchor($this->section_master . $this->_filter(array('order_column' => "{$r}", 'order_type' => $this->general_lib->order_type($r))), "{$value} " . $this->general_lib->order_icon("{$r}")); } $heading[] = 'Action'; $this->table->set_heading($heading); $result = $this->model->get()->result(); $i = 1 + $offset; foreach ($result as $r) { $this->table->add_row(array('data' => form_checkbox(array('name' => 'check[]', 'value' => $r->id)), 'width' => '10px'), $i++, $r->kode, $r->nama, anchor($this->section_master . '/edit/' . $r->id . $this->_filter(), 'Edit') . " | " . anchor($this->section_master . '/delete/' . $r->id . $this->_filter(), 'Delete', array('onclick' => "return confirm('you sure')"))); } $xdata['table'] = $this->table->generate(); $xdata['total'] = page_total($offset, $limit, $total); $config = pag_tmp(); $config['base_url'] = site_url($this->section_master . $this->_filter()); $config['total_rows'] = $total; $config['per_page'] = $limit; $this->pagination->initialize($config); $xdata['pagination'] = $this->pagination->create_links(); $data['content'] = $this->load->view('master_list', $xdata, true); $this->load->view('template', $data); }
/** * 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; }
function list_cols($cols = false, $purs = false) { if ($cols === false) { return "<li>nothing...</li>"; } if ($purs and is_string($purs)) { $purs = explode(",", $purs); } $list = ""; foreach ($cols as $k => $v) { $purview = ""; if (is_array($v['purview']) and $v['purview']) { foreach ($v['purview'] as $pk => $pv) { $checked = false; if ($purs and is_array($purs) and in_array($pv['uri'], $purs)) { $checked = true; } $purview .= '<label class="checkbox">' . form_checkbox('purview[]', $pv['uri'], $checked) . $pv['title'] . '</label>'; } } $more = ""; if ($v['more'] and is_array($v['more'])) { $more .= list_cols($v['more'], $purs); } $list .= '<li data-cid="' . $v['cid'] . '" > ' . '<input type="checkbox" class="checkline" /> <span class="depth' . $v['cdepth'] . '">' . $v['ctitle'] . '</span>' . '<div class="btn-group pull-right form-inline">' . $purview . '</div>' . $more . ' </li>'; } return $list; }
public function products_list() { ci()->load->model('admin/categories_model'); ci()->page_title(lang('products_list'), lang('products_list')); $options = array('order_by' => 'product_order', 'direction' => 'ASC', 'limit' => 10, 'offset' => '0', 'iTotalRecords' => '0', 'iTotalDisplayRecords' => '0'); $col_map = array('product_order', 'product_id', 'product_title', 'cat_id', 'regular_price'); $categories = ci()->categories_model->get_sorted_cats_select(); /* Ordering */ // if (1==1 or ($order_by = ci()->input->get('iSortCol_0')) !== FALSE) if (($order_by = ci()->input->get('iSortCol_0')) !== FALSE) { if (isset($col_map[$order_by])) { $options['order_by'] = $col_map[$order_by]; $options['dir'] = ci()->input->get('sSortDir_0'); if ($col_map[$order_by] == 'cat_id') { $options['join']['table'] = 'categories c'; $options['join']['cond'] = ' products.cat_id=c.cat_id'; $options['join']['type'] = 'left'; $options['order_by'] = 'cat_name'; } } $options['limit'] = ci()->input->get_post('perpage') ? (int) ci()->input->get_post('perpage') : 10; $options['offset'] = (int) ci()->input->get_post('iDisplayStart'); $vars['sEcho'] = (int) ci()->input->get_post('sEcho'); $get = ci()->input->get_post('keyword'); if ($gr = ci()->input->get_post('cat_id')) { $options['where']['products.cat_id'] = $gr; } if (!ci()->input->get_post('exact_match')) { $options['custom'] = "(product_title like '%{$get}%' or product_description like '%{$get}%' or product_ingredients like '%{$get}%')"; } else { $options['custom'] = "(product_title = '{$get}' or product_description = '{$get}' or product_ingredients = '{$get}')"; } $ajax = TRUE; } $vars['default_sort'] = array(0, 'asc'); $vars['non_sortable_columns'] = array(5, 6, 7); $vars['perpage_select_options'] = array('10' => '10 ' . lang('results'), '25' => '25 ' . lang('results'), '50' => '50 ' . lang('results'), '75' => '75 ' . lang('results'), '100' => '100 ' . lang('results'), '150' => '150 ' . lang('results')); $vars['aaData'] = array(); $products = ci()->_model->get($options); $options['count'] = TRUE; $vars['iTotalRecords'] = $vars['iTotalDisplayRecords'] = ci()->_model->get($options); $vars['perpage'] = $options['limit']; $c = 0; foreach ($products as $v) { $vars['aaData'][] = array('<span class="ui-icon ui-icon-arrowthick-2-n-s" trid="s_' . $v['product_id'] . '_' . $v['product_order'] . '"></span>' . form_hidden("product_order[{$v['product_id']}]", $v['product_order']), $v['product_id'], "<a href='{$this->_view_base}edit_product?product_id={$v['product_id']}'> {$v['product_title']} </a>", @$categories[$v['cat_id']], $v['regular_price'], '<a href="' . $this->_view_base . 'edit_product?product_id=' . $v['product_id'] . '">' . lang('edit') . '</a>', '<a href="' . $this->_view_base . 'remove_product?product_id=' . $v['product_id'] . '" class="delete">' . lang('delete') . '</a>', form_checkbox('bulk[]', $v['product_id'], '', 'class="bulk"')); } $vars['categories'] = ci()->categories_model->get_sorted_cats_select(); if (!@$ajax) { $js = $this->_datatables_js($this->_view_base . 'products_list', $vars['non_sortable_columns'], $vars['default_sort'], $options['limit']); $vars['js'] = $js; $vars['data'] = $products; } else { ci()->output->send_ajax_response($vars); } ci()->javascript->output(ci()->load->view($this->_view_base . 'javascript/products.js', '', true)); ci()->javascript->compile(); ci()->load->view($this->_view_base . 'products', $vars); }
function ractivo($cobrado, $numero) { if ($cobrado == 'S') { $retorna = array('name' => $numero, 'id' => $cobrado, 'value' => 'accept', 'checked' => TRUE); } else { $retorna = array('name' => $numero, 'id' => $cobrado, 'value' => 'accept', 'checked' => FALSE); } return form_checkbox($retorna); }
/** * Display form for adding/editing a shift entry. * @param string $angel * @param string $date * @param string $location * @param string $title * @param string $type * @param string $comment * * @return string */ function ShiftEntry_edit_view($angel, $date, $location, $title, $type, $comment, $freeloaded, $freeload_comment, $user_admin_shifts = false) { if ($user_admin_shifts) { $freeload_form = array(form_checkbox('freeloaded', _("Freeloaded"), $freeloaded), form_textarea('freeload_comment', _("Freeload comment (Only for shift coordination):"), $freeload_comment)); } else { $freeload_form = array(); } return page_with_title(_("Edit shift entry"), array(form(array(form_info(_("Angel:"), $angel), form_info(_("Date, Duration:"), $date), form_info(_("Location:"), $location), form_info(_("Title:"), $title), form_info(_("Type:"), $type), form_textarea('comment', _("Comment (for your eyes only):"), $comment), join("", $freeload_form), form_submit('submit', _("Save")))))); }
function listSearchesGUI() { global $months; h3("Vis artikler fra gitt måned"); form_start_post(); select_open("month"); for ($i = 1; $i < 10; $i++) { option_open("0" . $i); echo $months[$i]; option_close(); } for ($i = 10; $i < 13; $i++) { option_open($i); echo $months[$i]; option_close(); } select_close(); form_hidden("m_c", "monthSearchResultGUI"); form_select_number("year", 2004, date("Y"), date("Y")); form_submit("submit", "Søk"); form_end(); br(); br(); h3("Fritekstsøk"); $author_usernames = array(); $author_names = array(); $author_usernames[] = "0"; $author_names[] = "(ikke begrens)"; $author_usernames = array_merge($author_usernames, getAllAuthorsUsernames()); $author_names = array_merge($author_names, getAllAuthorsNames()); form_start_post(); form_textfield("text", ""); br(); echo "Sjekk mot hele ord "; form_checkbox("nopartialmatch", "1", "1"); br(); echo "Søk i kommentarer "; form_checkbox("searchcomments", "1", "0"); form_hidden("m_c", "textSearchResultGUI"); br(); echo "Begrens til én forfatter "; form_dropdown("author", $author_usernames, $author_names, 0); br(); form_submit("submit", "Fritekstsøk"); form_end(); br(); br(); h3("Vis alle kommentarer av gitt bruker"); $author_usernames = getAllUsersUsernames(); $author_names = getAllUsersNames(); form_start_post(); echo "Velg forfatter "; form_dropdown("author", $author_usernames, $author_names, 0); form_submit("submit", "Vis kommentarer"); form_hidden("m_c", "listCommentsSearchResultGUI"); form_end(); }
public function orders_list() { ci()->load->model('admin/categories_model'); ci()->page_title(lang('orders_list'), lang('orders_list')); $options = array('order_by' => 'order_date', 'direction' => 'DESC', 'limit' => 10, 'offset' => '0', 'iTotalRecords' => '0', 'iTotalDisplayRecords' => '0'); $col_map = array('is_new', 'order_id', 'order_date', 'billing_name', 'order_total', 'order_status'); $statuses = $this->_model->get_statuses(); /* Ordering */ if (($order_by = ci()->input->get('iSortCol_0')) !== FALSE) { if (isset($col_map[$order_by])) { $options['order_by'] = $col_map[$order_by]; $options['dir'] = ci()->input->get('sSortDir_0'); } $options['limit'] = ci()->input->get_post('perpage') ? (int) ci()->input->get_post('perpage') : self::DATATABLES_PAGE_SIZE; $options['offset'] = (int) ci()->input->get_post('iDisplayStart'); $vars['sEcho'] = (int) ci()->input->get_post('sEcho'); if ($get = ci()->input->get_post('status')) { $options['where']['order_status'] = $get; } if ($get = ci()->input->get_post('date1')) { $time = strtotime($get . " 00:00:00"); $options['where']['order_date >='] = $time; } if ($get = ci()->input->get_post('date2')) { $time = strtotime($get . ' 23:59:59'); $options['where']['order_date <='] = $time; } if ($get = ci()->input->get_post('order_id')) { $options['where']['order_id'] = $get; } $ajax = TRUE; } $vars['default_sort'] = array(2, 'desc'); $vars['non_sortable_columns'] = array(6, 7, 8); $vars['perpage_select_options'] = array('10' => '10 ' . lang('results'), '25' => '25 ' . lang('results'), '50' => '50 ' . lang('results'), '75' => '75 ' . lang('results'), '100' => '100 ' . lang('results'), '150' => '150 ' . lang('results')); $vars['aaData'] = array(); $vars['statuses'] = $statuses; $orders = $this->_model->get($options); $options['count'] = TRUE; $vars['iTotalRecords'] = $vars['iTotalDisplayRecords'] = ci()->_model->get($options); $vars['perpage'] = $options['limit']; $c = 0; foreach ($orders as $v) { $vars['aaData'][] = array($v['is_new'] == 'y' ? "<span style='background:#FFA366;padding:2px;margin:0px;color:#ffffff'>New</span>" : "", "<a href='{$this->_view_base}view_order?order_id={$v['order_id']}'> {$v['order_id']} </a>", date('m/d/Y H:i', $v['order_date']), $v['billing_name'], $v['order_total'], $v['order_status'], '<a href="' . $this->_view_base . 'view_order?order_id=' . $v['order_id'] . '">' . lang('view_order') . '</a>', '<a href="' . $this->_view_base . 'remove_order?order_id=' . $v['order_id'] . '" class="delete">' . lang('delete') . '</a>', form_checkbox('bulk[]', $v['order_id'], '', 'class="bulk"')); } if (!@$ajax) { $js = $this->_datatables_js($this->_view_base . 'orders_list', $vars['non_sortable_columns'], $vars['default_sort'], $options['limit']); $vars['js'] = $js; $vars['data'] = $orders; } else { ci()->output->send_ajax_response($vars); } ci()->javascript->output(ci()->load->view($this->_view_base . 'javascript/orders.js', '', true)); ci()->javascript->compile(); ci()->load->view($this->_view_base . 'orders', $vars); }
function ractivo($nombre, $activo, $modulo) { if (!empty($activo)) { $bandera = $activo == 'S' ? 1 : 0; $retorna = form_checkbox("{$nombre}|{$modulo}", 'accept', $bandera); } else { $retorna = "NI"; } return $retorna; }
/** * 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; }
public function coupons_list() { ci()->page_title(lang('coupons_list'), lang('coupons_list')); $options = array('order_by' => 'coupon_code', 'direction' => 'ASC', 'limit' => 10, 'offset' => '0', 'iTotalRecords' => '0', 'iTotalDisplayRecords' => '0'); $col_map = array('coupon_id', 'coupons.member_id', 'use_type', 'coupon_code', 'valid_to', 'amount', 'used'); $members = ci()->members_model->get_members(); /* Ordering */ if (($order_by = ci()->input->get('iSortCol_0')) !== FALSE) { if (isset($col_map[$order_by])) { $col = $col_map[$order_by]; $options['order_by'] = $col; $options['dir'] = ci()->input->get('sSortDir_0'); } $options['limit'] = ci()->input->get_post('perpage') ? (int) ci()->input->get_post('perpage') : self::DATATABLES_PAGE_SIZE; $options['offset'] = (int) ci()->input->get_post('iDisplayStart'); $vars['sEcho'] = (int) ci()->input->get_post('sEcho'); $get = ci()->input->get_post('keyword'); if ($gr = ci()->input->get_post('member_id')) { $options['where']['coupons.member_id'] = $gr; } if ($gr = ci()->input->get_post('used')) { $options['where']['used'] = $gr; } if (!ci()->input->get_post('exact_match')) { $options['custom'] = "(coupon_code like '%{$get}%')"; } else { $options['custom'] = "(coupon_code = '{$get}')"; } $ajax = TRUE; } $vars['default_sort'] = array(2, 'asc'); $vars['non_sortable_columns'] = array(6, 7, 8); $vars['perpage_select_options'] = array('10' => '10 ' . lang('results'), '25' => '25 ' . lang('results'), '50' => '50 ' . lang('results'), '75' => '75 ' . lang('results'), '100' => '100 ' . lang('results'), '150' => '150 ' . lang('results')); $vars['aaData'] = array(); $coupons = ci()->_model->get($options); $options['count'] = TRUE; $vars['iTotalRecords'] = $vars['iTotalDisplayRecords'] = ci()->_model->get($options); $vars['perpage'] = $options['limit']; $c = 0; foreach ($coupons as $v) { $vars['aaData'][] = array($v['coupon_id'], "<a href='{$this->_view_base}edit_coupon?coupon_id={$v['coupon_id']}'> {$v['coupon_code']} </a>", $v['use_type'], $v['valid_to'], $v['amount'], $v['used'], '<a href="' . $this->_view_base . 'edit_coupon?coupon_id=' . $v['coupon_id'] . '">' . lang('edit') . '</a>', '<a href="' . $this->_view_base . 'remove_coupon?coupon_id=' . $v['coupon_id'] . '" class="delete">' . lang('delete') . '</a>', form_checkbox('bulk[]', $v['coupon_id'], '', 'class="bulk"')); } $vars['members'] = array('' => 'All Members') + $members; if (!@$ajax) { $js = $this->_datatables_js($this->_view_base . 'coupons_list', $vars['non_sortable_columns'], $vars['default_sort'], $options['limit']); $vars['js'] = $js; $vars['data'] = $coupons; } else { ci()->output->send_ajax_response($vars); } ci()->javascript->output(ci()->load->view($this->_view_base . 'javascript/coupons.js', '', true)); ci()->javascript->compile(); ci()->load->view($this->_view_base . 'coupons', $vars); }
/** * Moblog Homepage * * @access public * @return string */ function index() { ee()->load->library('table'); ee()->table->set_columns(array('moblog_id' => array('header' => array('data' => lang('id'), 'width' => '4%')), 'moblog_full_name' => array('header' => lang('moblog_view')), 'check_moblog' => array('header' => lang('check_moblog'), 'sort' => FALSE), '_check' => array('header' => form_checkbox('toggle_all', 'true', FALSE), 'sort' => FALSE))); $defaults = array('sort' => array('moblog_id' => 'asc')); $params = array('per_page' => 100); $data = ee()->table->datasource('_table_datasource', $defaults, $params); $vars = array('table_html' => $data['table_html'], 'pagination_html' => $data['pagination_html'], 'total_rows' => $data['pagination']['total_rows'], 'cp_page_title' => lang('moblog')); ee()->cp->set_right_nav(array('create_moblog' => BASE . AMP . 'C=addons_modules' . AMP . 'M=show_module_cp' . AMP . 'module=moblog' . AMP . 'method=create_modify')); return ee()->load->view('index', $vars, TRUE); }
/** * Display Field */ function _display_field($data, $field_name) { $this->prep_field_data($data); $r = form_hidden($field_name, 'n'); foreach ($this->settings['options'] as $option_name => $option_label) { $selected = in_array($option_name, $data) ? 1 : 0; $r .= '<label>' . form_checkbox($field_name . '[]', $option_name, $selected) . NBS . $option_label . '</label> '; } $r .= '<div style="clear:left"></div>'; return $r; }
/** * Display Field */ function _display_field($data, $field_name) { $this->prep_field_data($data); $r = form_hidden($field_name, 'n'); $field_id = str_replace(array('[', ']'), array('_', '_'), $field_name); foreach ($this->settings['options'] as $option_name => $option_label) { $field_data = array('name' => $field_name . '[]', 'id' => $field_id . '_' . $option_name, 'value' => $option_name, 'checked' => in_array($option_name, $data) ? 1 : 0); $r .= '<label for="' . $field_data['id'] . '">' . form_checkbox($field_data) . NBS . $option_label . '</label> '; } $r .= '<div style="clear:left"></div>'; return $r; }
public function render_views($params) { $filename = isset($params['filename']) ? $params['filename'] : ''; $vars = isset($params['vars']) ? $params['vars'] : ''; //if (!isset($vars['fields']) || empty($vars['fields']) || !is_array($vars['fields'])) // return; $form_fields = ''; die('<pre>' . print_r($vars['fields'], true)); $this->ci->load->helper('form'); foreach ($vars['fields'] as $name => $opts) { switch (strtolower($opts['field_type'])) { case 'checkbox': $form_fields .= form_checkbox($name, 1); break; case 'date': $form_fields .= form_date(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>")); break; case 'datetime': $form_fields .= form_datetime(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>")); break; case 'dropdown': $options = isset($opts['options']) ? $opts['options'] : array(); $form_fields .= form_dropdown(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>"), $options); break; case 'email': $form_fields .= form_email(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>")); break; case 'input': $form_fields .= form_input(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>")); break; case 'month': $form_fields .= form_month(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>")); break; case 'number': $form_fields .= form_number(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>")); break; case 'range': $form_fields .= form_range(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>")); break; case 'textarea': $rows = 10; $cols = 40; $form_fields .= form_input(array('name' => $name, 'class' => 'input-xxlarge', 'value' => "<?php echo set_value('{$name}') ?>", 'rows' => $rows, 'cols' => $cols)); break; case 'url': $form_fields .= form_url(array('name' => $name, 'class' => 'input-xlarge', 'value' => "<?php echo set_value('{$name}') ?>")); break; } } //echo '<pre>'; //die(print_r($params)); $this->tpl = str_replace('{form_fields}', $form_fields, $this->tpl); }
/** * Display Cell Settings */ function display_cell_settings($data) { $this->_prep_settings($data); return array( array(lang('maxl'), form_input('maxl', $data['maxl'], 'class="matrix-textarea"')), array(lang('multiline'), form_checkbox('multiline', 'y', ($data['multiline'] == 'y'))), array(lang('formatting'), form_dropdown('fmt', $data['field_fmt_options'], $data['fmt'])), //array(lang('direction'), form_dropdown('dir', array('ltr'=>lang('ltr'), 'rtl'=>lang('rtl')), $data['dir'])), array(lang('content'), form_dropdown('content', $data['field_content_options_text'], $data['content'])) ); }