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


PHP grocery_CRUD::add_fields方法代码示例

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


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

示例1: manage_posts

 public function manage_posts()
 {
     if (!$this->session->is_admin || !$this->session->is_admin_loggedin) {
         redirect('admin');
     }
     $crud = new grocery_CRUD();
     $crud->set_theme('datatables')->set_table('post')->set_subject('Post')->columns('title', 'post', 'date_posted');
     // the columns from the table to be displayed in particular
     /* display_as('field_name', 'Label') function is use if you want to customize your field names on the table */
     $crud->display_as('title', 'Post Title')->display_as('post', 'User\'s Post')->display_as('date_posted', 'Date');
     /*
     	add_fields() function is very useful when you want to add a new record to a table
     	but only with the specific fields. Say, you don't need to set an `id` field
     	because id is already set to auto_increment. So, here in Grocery CRUD, when you want to
     	add a new record, you can customize what particular fields you want to be displayed.
     
     	edit_fields() function is use when you want to edit a record from a table
     	but you only want specific fields to be updated because there are fields
     	that is not neccessary to be updated. In this case, we only want the fields:
     	'id','user_id', 'title', 'post', 'slug' to be editable from a table and date_posted is not neccessary.
     
     	required_fields() function simply a rule when you add or update a record from a table
     	which fields must not be null or in other words, in the add/edit form which fields are required.
     */
     $crud->add_fields('user_id', 'title', 'post', 'slug');
     $crud->edit_fields('id', 'user_id', 'title', 'post', 'slug');
     $crud->required_fields('id', 'user_id', 'title', 'post', 'slug');
     $output = $crud->render();
     $this->load->view('admin/admin_header_view', $output);
     $this->load->view('admin/admin_nav_view');
     $this->load->view('admin/admin_panel_view', $output);
     $this->load->view('admin/admin_footer_view');
 }
开发者ID:eminence43rd,项目名称:ci,代码行数:33,代码来源:Admin.php

示例2: faq_daftar

 public function faq_daftar()
 {
     try {
         $crud = new grocery_CRUD();
         $crud->set_table('tbl_faq');
         $crud->set_relation('id_faq_kategori', 'tbl_faq_kategori', 'kategori');
         $crud->set_relation('change_by', 'tbl_user', 'email');
         $crud->set_subject('Daftar FAQ');
         $crud->required_fields('id_faq_kategori', 'pertanyaan', 'jawaban', 'tampilkan');
         $crud->display_as('id_faq_kategori', 'Kategori');
         $crud->add_fields('id_faq_kategori', 'pertanyaan', 'jawaban', 'tampilkan', 'change_by', 'change_date');
         $crud->edit_fields('id_faq_kategori', 'pertanyaan', 'jawaban', 'tampilkan', 'change_by', 'change_date');
         $crud->columns('pertanyaan', 'id_faq_kategori', 'tampilkan', 'change_by');
         $crud->callback_before_update(array($this, 'get_change_by_callback'));
         $crud->callback_before_insert(array($this, 'get_change_by_callback'));
         $crud->callback_field('change_date', array($this, 'format_date_callback'));
         $crud->change_field_type('change_by', 'readonly');
         $crud->change_field_type('change_date', 'readonly');
         $crud->unset_save();
         $crud->unset_read();
         $crud->order_by('id_faq', 'desc');
         $sitemap = $this->get_sitemap();
         $output = $crud->render($sitemap);
         $this->load->view('theme/theme_default', $output);
     } catch (Exception $e) {
         show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
     }
 }
开发者ID:selametsubu,项目名称:e-ppid,代码行数:28,代码来源:admin.php

示例3: get_crud

 private function get_crud()
 {
     $this->data['message'] = $this->session->flashdata('message');
     $crud = new grocery_CRUD();
     $crud->set_theme(GROCERY_CRUD_THEME);
     $crud->set_table('tipo_orcamento');
     $crud->set_subject('Tipo de Orçamento');
     $crud->columns('id', 'descricao');
     $crud->edit_fields('descricao');
     $crud->add_fields('descricao');
     return $crud->render();
 }
开发者ID:riosfernandes,项目名称:sooe,代码行数:12,代码来源:tipo_orcamento.php

示例4: get_crud

 private function get_crud()
 {
     $this->data['message'] = $this->session->flashdata('message');
     $crud = new grocery_CRUD();
     $crud->set_theme(GROCERY_CRUD_THEME);
     $crud->set_table('fase_projeto');
     $crud->set_subject('Fase de Projeto');
     $crud->columns('id', 'descricao');
     $crud->edit_fields('descricao');
     $crud->add_fields('descricao');
     $crud->required_fields('descricao');
     return $crud->render();
 }
开发者ID:riosfernandes,项目名称:sooe,代码行数:13,代码来源:fase_projeto.php

示例5: category

 public function category()
 {
     $crud = new grocery_CRUD();
     $crud->set_table('blog_category');
     $crud->columns('category_name', 'description');
     $crud->edit_fields('category_name', 'description');
     $crud->add_fields('category_name', 'description');
     $crud->display_as('category_name', 'Category')->display_as('description', 'Description');
     $crud->set_subject('Category');
     $crud->set_relation_n_n('Articles', 'blog_category_article', 'blog_article', 'category_id', 'article_id', 'article_title');
     $output = $crud->render();
     $this->view('grocery_CRUD', $output, 'blog_category');
 }
开发者ID:rheaa,项目名称:Neo-CMS,代码行数:13,代码来源:blog.php

示例6:

 function machines_management()
 {
     $crud = new grocery_CRUD();
     $crud->set_table('maquinas');
     $crud->set_theme('datatables');
     $crud->columns('nombre', 'procesos');
     $crud->edit_fields('nombre', 'procesos');
     $crud->add_fields('nombre', 'procesos');
     $crud->set_subject('Maquina');
     $crud->set_relation_n_n('procesos', 'maquinas_procesos', 'procesos', 'id_maquina', 'id_proceso', 'nombre');
     $crud->unset_delete();
     $output = $crud->render();
     $this->_output_crud($output, 'Maquinas');
 }
开发者ID:joercamu,项目名称:indicadores-produccion,代码行数:14,代码来源:machines.php

示例7: get_crud

 private function get_crud()
 {
     $this->data['message'] = $this->session->flashdata('message');
     $crud = new grocery_CRUD();
     $crud->set_theme(GROCERY_CRUD_THEME);
     $crud->set_table('tipo_insumo');
     $crud->set_subject('Tipo de Insumo');
     $crud->columns('id', 'descricao');
     $crud->edit_fields('descricao');
     $crud->add_fields('descricao');
     /* regras e campos obrigatórios */
     $crud->required_fields('descricao');
     $crud->set_rules('descricao', 'Descrição', 'required|min_length[3]');
     return $crud->render();
 }
开发者ID:riosfernandes,项目名称:sooe,代码行数:15,代码来源:tipo_insumo.php

示例8:

 function users_management()
 {
     $crud = new grocery_CRUD();
     $crud->set_table('operarios');
     $crud->set_subject('Usuario');
     $crud->set_theme('datatables');
     $crud->columns('id', 'nombre');
     $crud->edit_fields('nombre', 'clave', 'eliminado');
     $crud->add_fields('id', 'nombre', 'clave');
     $crud->required_fields('id', 'nombre', 'clave');
     $crud->change_field_type('clave', 'password');
     $crud->callback_before_insert(array($this, '_encrypt_password_callback'));
     $crud->callback_before_update(array($this, '_encrypt_password_callback'));
     $crud->unset_delete();
     $output = $crud->render();
     $this->_output_crud($output, 'Usuarios');
 }
开发者ID:joercamu,项目名称:indicadores-produccion,代码行数:17,代码来源:users.php

示例9: get_crud

 private function get_crud()
 {
     $this->data['message'] = $this->session->flashdata('message');
     $crud = new grocery_CRUD();
     $crud->set_theme(GROCERY_CRUD_THEME);
     $crud->set_table('grupo_servico');
     $crud->set_subject('Grupo de Serviço');
     $crud->columns('id', 'grupo_id', 'codigo', 'descricao');
     $crud->edit_fields('grupo_id', 'codigo', 'descricao');
     $crud->add_fields('grupo_id', 'codigo', 'descricao');
     $crud->set_relation('grupo_id', 'grupo_servico', 'codigo');
     $crud->display_as('grupo_id', 'Grupo Pai');
     $crud->required_fields('codigo', 'descricao');
     $crud->set_rules('codigo', 'Código', 'required|min_length[3]');
     $crud->set_rules('descricao', 'Descrição', 'required|min_length[3]');
     return $crud->render();
 }
开发者ID:riosfernandes,项目名称:sooe,代码行数:17,代码来源:grupo_servico.php

示例10: index

 public function index($stat = '')
 {
     try {
         $crud = new grocery_CRUD();
         $crud->set_theme('datatables');
         switch ($stat) {
             case '':
             default:
                 $user_ward_id = $this->session->userdata('nw_id');
                 $crud->set_table('nus_bed');
                 $crud->where('nus_bed.nw_id', $user_ward_id);
                 $crud->columns('nb_bed_no', 'np_pmi_id', 'nbs_id', 'nb_datetime', 'ns_id');
                 $crud->display_as('nb_bed_no', 'Bed No.')->display_as('np_pmi_id', 'Patient Name')->display_as('nbs_id', 'Remarks')->display_as('nb_datetime', 'Date/Time Registered')->display_as('ns_id', 'Nurse');
                 $crud->set_relation('nbs_id', 'nus_bed_status', 'nbs_desc');
                 $crud->set_relation('ns_id', 'nus_staff', 'ns_fullname');
                 $crud->set_relation('np_pmi_id', 'nus_patient', 'np_fullname');
                 //                        $crud->unset_add();
                 //                        $crud->unset_delete();
                 $crud->edit_fields('np_pmi_id', 'nbs_id', 'nb_datetime', 'ns_id');
                 $crud->add_fields('nb_bed_no', 'nw_id', 'nbs_id');
                 $crud->field_type('nw_id', 'hidden');
                 //                        $crud->field_type('nbs_id', 'hidden');
                 $crud->required_fields('nb_bed_no');
                 $crud->unset_read();
                 //                        $crud->change_field_type('nb_bed_no', 'readonly');
                 $crud->change_field_type('ns_id', 'readonly');
                 $crud->callback_before_update(array($this, 'autoRegisterBed'));
                 $crud->callback_before_insert(array($this, 'addBed'));
                 break;
             case 'patient':
                 $crud->set_table('nus_patient');
                 $crud->set_relation('np_gender', 'nus_patient_gender', 'npg_desc');
                 $crud->required_fields('np_pmi_no', 'np_fullname', 'np_ic', 'np_passport', 'np_gender');
                 $crud->fields('np_pmi_id', 'np_fullname', 'np_ic', 'np_passport', 'np_gender');
                 $crud->field_type('np_pmi_id', 'hidden');
                 $crud->display_as('np_pmi_id', 'PMI No.')->display_as('np_fullname', 'Full Name')->display_as('np_ic', 'IC No.')->display_as('np_passport', 'Passport No.')->display_as('np_gender', 'Gender');
                 $crud->callback_before_insert(array($this, 'autoInsertPriKeyPatient'));
                 break;
         }
         $output = $crud->render();
         $this->viewpage('v_mainpage', $output);
     } catch (Exception $e) {
         show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
     }
 }
开发者ID:umaqgeek,项目名称:ENurseSystem,代码行数:45,代码来源:nurses.php

示例11: get_crud

 private function get_crud()
 {
     $this->data['message'] = $this->session->flashdata('message');
     $crud = new grocery_CRUD();
     $crud->set_theme(GROCERY_CRUD_THEME);
     $crud->set_table('familia_servico');
     $crud->set_subject('Família de Serviço');
     $crud->columns('id', 'cla_servico_id', 'codigo', 'descricao');
     $crud->set_relation('cla_servico_id', 'cla_servico', 'codigo');
     $crud->display_as('cla_servico_id', 'Clã');
     $crud->edit_fields('cla_servico_id', 'codigo', 'descricao');
     $crud->add_fields('cla_servico_id', 'codigo', 'descricao');
     /* regras e campos obrigatórios */
     $crud->required_fields('cla_servico_id', 'codigo', 'descricao');
     $crud->set_rules('cla_servico_id', 'Clã', 'required');
     $crud->set_rules('codigo', 'Código', 'required|min_length[2]');
     $crud->set_rules('descricao', 'Descrição', 'required|min_length[3]');
     return $crud->render();
 }
开发者ID:riosfernandes,项目名称:sooe,代码行数:19,代码来源:familia_servico.php

示例12: data_topic

 public function data_topic()
 {
     $crud = new grocery_CRUD();
     // table name
     $crud->set_table("help_topic");
     // displayed columns on list
     $crud->columns('title', 'group_id', 'content');
     // displayed columns on edit operation
     $crud->edit_fields('title', 'group_id', 'content');
     // displayed columns on add operation
     $crud->add_fields('title', 'url', 'group_id', 'content');
     // caption of each columns
     $crud->display_as('group_id', 'Group')->display_as('title', 'Title')->display_as('content', 'Content');
     $crud->change_field_type('url', 'hidden');
     $crud->set_relation('group_id', 'help_group', 'name');
     $crud->callback_before_insert(array($this, 'before_insert_topic'));
     // render
     $output = $crud->render();
     $this->view("grocery_CRUD", $output, "help_topic");
 }
开发者ID:remoharsono,项目名称:No-CMS,代码行数:20,代码来源:help.php

示例13:

 /**
  * Función para contruir el Grocecy CRUD de la tabla Usuarios
  */
 function abm_usuarios()
 {
     //Defino submenu
     $this->menu['submenuSeleccionado'] = 'Usuarios';
     //Creo el objeto crud
     $crud = new grocery_CRUD();
     //Defino Template como datatables.
     //$crud->set_theme('datatables');
     //Defino tabla sobre la que trabajo y tipo de 'Objeto'
     $crud->set_table('Usuarios');
     $crud->set_subject('Usuario');
     //Agrego acción para cambiar contraseña.
     $crud->add_action('Cambiar Contraseña', base_url() . 'assets/grocery_crud/themes/flexigrid/css/images/key.png', 'administracion/usuarios/cambiar_contrasena');
     //Un usuario puede tener un idPersonal asociado.
     $crud->set_relation('idPersonal', 'Personal', 'nombreApellido');
     //Relación con los roles.
     $crud->set_relation_n_n('roles', 'RolesPorUsuario', 'Roles', 'idUsuario', 'idRol', 'descripcion');
     //Seteo Reglas para campos
     $crud->set_rules('contrasena', 'Contraseña', 'required|matches[repetirContrasena]');
     $crud->add_fields('nombreUsuario', 'contrasena', 'repetirContrasena', 'roles', 'idPersonal');
     $crud->edit_fields('roles', 'idPersonal');
     $crud->field_type('contrasena', 'password');
     $crud->field_type('repetirContrasena', 'password');
     //Seteo campos requeridos
     $crud->required_fields('nombreUsuario', 'contrasena', 'repetirContrasena', 'roles');
     //Defino Columnas a Mostrar
     $crud->columns('nombreUsuario', 'roles');
     //Defino nombres para cada campo.
     $crud->display_as('nombreUsuario', 'Nombre de Usuario');
     $crud->display_as('contrasena', 'Contraseña');
     $crud->display_as('repetirContrasena', 'Repetir Contraseña');
     $crud->display_as('roles', 'Roles');
     $crud->display_as('idPersonal', 'Persona Asociada');
     //Hago 'callbacks' para transformar datos antes de inserción/actualización.
     $crud->callback_before_insert(array($this, '_transformar_datos'));
     $crud->callback_before_update(array($this, '_transformar_datos_update'));
     //Genero el ABM
     $output = $crud->render();
     //Llamo a la función encargada de mostrar el ABM.
     mostrar_crud($output, '', $this->menu, 'administracion/usuarios/abm_usuarios', '', 'administracion/usuarios/abm_usuarios_final');
 }
开发者ID:BGCX067,项目名称:fagdut-v2-svn-to-git,代码行数:44,代码来源:usuarios.php

示例14: administration

 function administration()
 {
     try {
         $crud = new grocery_CRUD();
         $crud->set_theme('flexigrid');
         $crud->set_table('owners');
         $crud->set_subject('Propietarios de Sitios');
         $crud->set_language('spanish');
         $crud->unset_export();
         $crud->display_as('name', 'Nombre')->display_as('description', 'Descripción')->display_as('email', 'Correo')->display_as('phone', 'Teléfono');
         $crud->add_fields('name', 'email', 'phone', 'description');
         $crud->callback_after_insert(array($this, 'after_insert_log'));
         $crud->callback_before_delete(array($this, 'before_delete_log'));
         $crud->callback_after_update(array($this, 'after_update_log'));
         $output = $crud->render();
         $this->load->view('includes/template', $output);
     } catch (Exception $e) {
         /* Si algo sale mal cachamos el error y lo mostramos */
         show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
     }
 }
开发者ID:jorgemunoz8807,项目名称:admin_portal,代码行数:21,代码来源:owners.php

示例15: crud

 public function crud()
 {
     $crud = new grocery_CRUD();
     $crud->set_theme(THEMA_CRUD);
     $crud->set_table('quadra');
     $crud->set_subject('Quadra');
     //@todo$crud->where('situacao_id', 2); //apenas ativos
     $crud->required_fields('descricao', 'tipo_quadra_id', '');
     $crud->columns('id', 'descricao', 'tipo_quadra_id', 'situacao_quadra_id');
     $crud->edit_fields('descricao', 'tipo_quadra_id', 'situacao_quadra_id');
     $crud->add_fields('descricao', 'tipo_quadra_id', 'situacao_quadra_id');
     //relacionamentos
     $crud->set_relation('situacao_quadra_id', 'situacao_quadra', 'descricao');
     $crud->set_relation('tipo_quadra_id', 'tipo_quadra', 'descricao');
     $crud->callback_insert(array($this, 'create'));
     $crud->callback_delete(array($this, 'delete'));
     $contents = $crud->render();
     $this->template->set('titulo', 'Manter Quadra');
     $this->template->set('subtitle', 'Quadra');
     $this->template->load('template_teste', 'crudpage', $contents);
 }
开发者ID:ninobaldo,项目名称:gaq,代码行数:21,代码来源:quadra.php


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