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


PHP grocery_CRUD::callback_before_update方法代码示例

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


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

示例1: index

 public function index()
 {
     $crud = new grocery_CRUD();
     $crud->set_theme('bootstrap');
     $crud->set_table('user');
     $crud->set_subject('Gebruiker');
     // hide fields
     $crud->columns('is_super_user', 'is_active', 'screen_name', 'email', 'gebruikersgroepen');
     // new_password and new_password repeat are needed to make formvalidation work
     // id is needed to make the email unique check work
     $crud->fields('id', 'is_active', 'screen_name', 'email', 'gebruikersgroepen', 'password', 'new_password', 'new_password_repeat');
     $crud->required_fields('email', 'screen_name', 'is_active');
     $crud->set_relation_n_n('gebruikersgroepen', 'user_x_user_group', 'user_group', 'user_id', 'user_group_id', 'name');
     $crud->field_type('id', 'hidden');
     $crud->field_type('new_password_repeat', 'hidden');
     $crud->field_type('password', 'hidden');
     $crud->display_as('is_active', 'Actief');
     $crud->display_as('screen_name', 'Schermnaam');
     $crud->display_as('is_super_user', '');
     $crud->display_as('new_password', 'Wachtwoord');
     if ($crud->getState() == 'read') {
         $crud->field_type('new_password', 'hidden');
     } else {
         $crud->callback_field('new_password', array($this, 'edit_field_callback_new_password'));
     }
     $crud->field_type('is_active', 'dropdown', array('yes' => 'ja', 'no' => 'nee'));
     $crud->callback_column('is_active', array($this, 'callback_list_is_active'));
     $crud->callback_column('is_super_user', array($this, 'callback_list_is_super_user'));
     $crud->callback_before_insert(array($this, 'before_insert_update_callback'));
     $crud->callback_before_update(array($this, 'before_insert_update_callback'));
     $crud->callback_after_insert(array($this, 'after_insert_callback'));
     $crud->callback_after_update(array($this, 'after_update_callback'));
     if ($crud->getState() === 'update_validation' or $crud->getState() === 'insert_validation') {
         $crud->set_rules('email', 'E-mail', 'required|valid_email|callback_email_unique_check');
         $crud->set_rules('screen_name', 'Schermnaam', 'required');
         if ($this->input->post('new_password') != '' or !$this->input->post('id')) {
             $crud->set_rules('new_password', 'Nieuw wachtwoord', 'required|min_length[10]|matches[new_password_repeat]');
             $crud->set_rules('new_password_repeat', 'Herhaal nieuw wachtwoord', '');
         }
         $this->form_validation->set_message('matches', 'De wachtwoorden zijn niet aan elkaar gelijk.');
     }
     // render the crud HTML
     $crud_output = $crud->render();
     //get the needed css and javascript files
     $this->javascript_files = $crud->get_js_files();
     $this->css_files = $crud->get_css_files();
     // put the crud content in the right position
     $this->views['content'] = $crud_output->output;
     $this->css[] = $this->load->view('admin/user/css/index.css', array(), true);
     // add javascript and css to make the password generate and change function possible
     if ($crud->getState() === 'add' or $crud->getState() === 'edit') {
         $this->css[] = $this->load->view('admin/user/css/edit_user.css', array(), true);
         $this->javascript[] = $this->load->view('admin/user/js/edit_user.js', array(), true);
     }
     // create the layout-HTML and show it to the user
     $this->_layout();
 }
开发者ID:BitmanNL,项目名称:traffictower-cms,代码行数:57,代码来源:TT_user.php

示例2: index

 public function index($categoryid = 0)
 {
     $session_data = $this->session->userdata('logged_in');
     $data['username'] = $session_data['username'];
     $data['lo'] = 2;
     //value used to identify section movie or celebrity
     $data['categoryid'] = $categoryid;
     //value used to identify section movie or celebrity
     if ($categoryid != 0) {
         $data['cat_id'] = $categoryid;
         $cat_title = $this->category->getTitle($categoryid);
         $data['cat_title'] = $cat_title . " - Movies";
         $form_subject = $cat_title;
         $crud = new grocery_CRUD();
         $crud->set_table('dbx_movies');
         $crud->where('catid', $categoryid);
         $crud->set_subject('Movie');
         $crud->required_fields('title', 'year');
         $crud->columns('title');
         //                $crud->callback_column('name',array($this,'link_title'));
         //                $crud->set_rules('title','Title','trim|required|xss_clean|is_unique[dbx_categories.title]');
         $crud->add_action('Large Image', '', '', 'custom_icon limg-icon img_crop', array($this, 'set_imgurl'));
         $crud->add_action('Small Image', '', '', 'custom_icon simg-icon img_crop', array($this, 'set_imgurl'));
         $crud->fields('catid', 'title', 'year', 'release_date', 'cast', 'director', 'producer', 'music', 'writer', 'lyrics', 'synopsis', 'seo_url', 'ownerid', 'created_date', 'lastupdate_date');
         //                 $crud->field_type('catid', 'hidden', $categoryid);
         $crud->set_relation('catid', 'dbx_categories', 'title', array('type' => 'M'), null, $categoryid);
         $crud->display_as('catid', 'Category');
         //
         $crud->callback_add_field('cast', array($this, 'add_field_cast'));
         $crud->callback_add_field('synopsis', array($this, 'add_field_synopsis'));
         $crud->callback_edit_field('cast', array($this, 'edit_field_cast'));
         $crud->callback_edit_field('synopsis', array($this, 'edit_field_synopsis'));
         $crud->change_field_type('ownerid', 'invisible');
         $crud->change_field_type('created_date', 'invisible');
         $crud->change_field_type('seo_url', 'invisible');
         $crud->change_field_type('lastupdate_date', 'invisible');
         $crud->callback_before_insert(array($this, 'before_insert'));
         $crud->callback_before_update(array($this, 'before_update'));
         $crud->callback_after_insert(array($this, 'after_insert'));
         $crud->unset_jquery();
         $state = $crud->getState();
         //                 echo($state);
         $data['state'] = $state;
         $output = $crud->render($data);
         $this->load->view('header_view', $data);
         $this->load->view('movies_view', $output);
         $this->load->view('footer_view', $data);
     }
 }
开发者ID:sali141,项目名称:bportal,代码行数:49,代码来源:movies.php

示例3: incidencias

 public function incidencias()
 {
     $crud = new grocery_CRUD();
     $crud->set_table('incidencias');
     $crud->set_subject('Incidents');
     $crud->set_relation('idtipo', 'tipos_incidencias', 'descripcion_incidencia');
     $crud->field_type('idusuario', 'hidden');
     $crud->field_type('fecha_alta', 'hidden');
     $crud->field_type('fecha_fin', 'hidden');
     $crud->field_type('numero', 'hidden');
     $crud->edit_fields("descripcion", "estado", "numero", "fecha_fin");
     $crud->callback_before_insert(array($this, "new_incident_callback"));
     $crud->callback_before_update(array($this, "edit_incident_callback"));
     return $crud->render();
 }
开发者ID:edgarshurtado,项目名称:CodeIgniterProject,代码行数:15,代码来源:Crud_output.php

示例4: master

 private function master()
 {
     $crud = new grocery_CRUD();
     $crud->set_table('contents');
     $crud->unset_columns('jenis', 'slug', 'isi');
     $crud->callback_before_insert(array($this, "_timestamp"));
     $crud->callback_before_update(array($this, "_timestamp"));
     $crud->unset_export();
     $crud->unset_print();
     $crud->unset_read();
     $crud->change_field_type('jenis', 'invisible');
     $crud->change_field_type('slug', 'invisible');
     $crud->change_field_type('created_at', 'invisible');
     $crud->change_field_type('updated_at', 'invisible');
     return $crud;
 }
开发者ID:anggakes,项目名称:voltusfx,代码行数:16,代码来源:Contents.php

示例5:

 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

示例6: 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

示例7: index

 public function index($categoryid = 0)
 {
     $session_data = $this->session->userdata('logged_in');
     $data['username'] = $session_data['username'];
     $data['lo'] = 1;
     //value used to identify section movie or celebrity
     if ($categoryid != 0) {
         $data['cat_id'] = $categoryid;
         $cat_title = $this->category->getTitle($categoryid);
         $data['cat_title'] = $cat_title . " ";
         $form_subject = $cat_title;
         $crud = new grocery_CRUD();
         $crud->set_table('dbx_celebrities');
         $crud->where('catid', $categoryid);
         $crud->set_subject($form_subject);
         $crud->required_fields('name');
         $crud->columns('name');
         //                $crud->callback_column('name',array($this,'link_title'));
         //                $crud->set_rules('title','Title','trim|required|xss_clean|is_unique[dbx_categories.title]');
         $crud->add_action('Large Image', '', '', 'custom_icon limg-icon img_crop', array($this, 'set_imgurl'));
         $crud->add_action('Small Image', '', '', 'custom_icon simg-icon img_crop', array($this, 'set_imgurl'));
         $crud->fields('catid', 'name', 'alt_name1', 'alt_name2', 'alt_name3', 'alt_name4', 'title', 'desc', 'sign', 'birth_date', 'birth_place', 'first_film', 'awards', 'height', 'weight', 'seo_url', 'ownerid', 'created_date', 'lastupdate_date');
         //                  $crud->field_type('catid', 'hidden', $categoryid);
         $crud->set_relation('catid', 'dbx_categories', 'title', array('type' => 'C'), null, $categoryid);
         $crud->display_as('catid', 'Category');
         $crud->callback_add_field('desc', array($this, 'add_field_desc'));
         $crud->callback_add_field('awards', array($this, 'add_field_awards'));
         $crud->callback_edit_field('desc', array($this, 'edit_field_desc'));
         $crud->callback_edit_field('awards', array($this, 'edit_field_awards'));
         $crud->field_type('sign', 'dropdown', array('Aries' => 'Aries', 'Taurus' => 'Taurus', 'Gemini1' => 'Gemini', 'Cancer' => 'Cancer', 'Leo' => 'Leo', 'Virgo' => 'Virgo', 'Libra' => 'Libra', 'Scorpio' => 'Scorpio', 'Sagittarius' => 'Sagittarius', 'Capricorn' => 'Capricorn', 'Aquarius' => 'Aquarius', 'Pisces' => 'Pisces'));
         $crud->change_field_type('ownerid', 'invisible');
         $crud->change_field_type('created_date', 'invisible');
         $crud->change_field_type('seo_url', 'invisible');
         $crud->change_field_type('lastupdate_date', 'invisible');
         $crud->callback_before_insert(array($this, 'before_insert'));
         $crud->callback_before_update(array($this, 'before_update'));
         $crud->unset_jquery();
         $output = $crud->render($data);
         $this->load->view('header_view', $data);
         $this->load->view('celebrities_view', $output);
         $this->load->view('footer_view', $data);
     }
 }
开发者ID:sali141,项目名称:bportal,代码行数:43,代码来源:celebrities.php

示例8: index

 public function index()
 {
     $crud = new grocery_CRUD();
     $crud->set_table('usrmgr');
     $crud->change_field_type('password', 'password');
     $crud->callback_edit_field('password', array($this, 'decrypt_password_callback'));
     $crud->columns('username', 'nama_lengkap', 'email', 'level', 'blokir');
     $crud->callback_before_insert(array($this, 'encrypt_password_callback'));
     $crud->callback_before_update(array($this, 'encrypt_password_callback'));
     $crud->set_subject('Users');
     $crud->fields('nama_lengkap', 'username', 'password', 'email', 'level', 'access_control', 'blokir');
     $crud->required_fields('nama_lengkap', 'username', 'level', 'blokir');
     $crud->set_relation_n_n('access_control', 'usrmgr_access', 'modul', 'id_users', 'id_modul', 'nama_modul', 'priority');
     //$crud->set_relation('salesRepEmployeeNumber','employees','lastName');
     $output = $crud->render();
     $data['subject'] = 'Pengaturan Pengguna';
     $data['content'] = $this->load->view('crud.php', $output, true);
     $this->load->view('base_theme', $data);
 }
开发者ID:ardiexplaine,项目名称:ina_mendidik,代码行数:19,代码来源:Usrmgr.php

示例9: index

 /**
  * Index Page for CRUD sample controller.
  */
 public function index()
 {
     if (!$this->ion_auth->logged_in()) {
         redirect('auth/login', 'refresh');
     }
     $data['page_title'] = 'Crud sample';
     $this->load->library('grocery_CRUD');
     $crud = new grocery_CRUD();
     $crud->set_table('items');
     $crud->fields('name', 'updated', 'description', 'published');
     $crud->required_fields('name');
     $crud->field_type('updated', 'invisible');
     $crud->unset_jquery();
     $crud->set_theme('flexigrid-bootstrap3');
     $crud->callback_before_update(array($this, '_crud_index_before_insert_or_update'));
     $crud->callback_before_insert(array($this, '_crud_index_before_insert_or_update'));
     $data = array_merge($data, (array) $crud->render());
     $this->_make_layout('crud', $data);
 }
开发者ID:groucho75,项目名称:ci_html5_auth_crud,代码行数:22,代码来源:crud.php

示例10:

 /**
  * 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

示例11: listarUsuariosAdministradores

 public function listarUsuariosAdministradores()
 {
     $adm = $this->usuarios_model->buscarAdministrador($this->session->userdata('usuario'));
     $administrador = array();
     foreach ($adm as $dato) {
         $administrador[$dato->usuario] = $dato->nombres;
     }
     $crud = new grocery_CRUD();
     $crud->set_table('usuarios_backend');
     $crud->columns('usuario', 'nombres', 'dni', 'correo', 'nivel', 'estado', 'codigo', 'autoriza', 'caduca', 'registro');
     $crud->display_as('registroId', 'from usuarios_backend')->display_as('usuario', 'Usuario')->display_as('contrasena', 'Contraseña');
     $crud->change_field_type('clave', 'password');
     $crud->set_subject('Usuario');
     $crud->field_type('nivel', 'dropdown', array('1' => 'Administrador', '2' => 'Operador'));
     $crud->field_type('estado', 'dropdown', array('1' => 'Activo', '2' => 'Inactivo'));
     $crud->field_type('autoriza', 'dropdown', $administrador);
     $crud->callback_before_insert(array($this, 'encrypt_password_callback'));
     $crud->callback_before_update(array($this, 'encrypt_password_callback'));
     $crud->unset_read();
     $output = $crud->render();
     $this->_example_output($output);
 }
开发者ID:alejandrob1519,项目名称:nwsp,代码行数:22,代码来源:usuario.php

示例12: article

 public function article()
 {
     $crud = new grocery_CRUD();
     $crud->set_table('blog_article');
     $crud->columns('article_title', 'content', 'Categories', 'author_user_id', 'date', 'allow_comment');
     $crud->edit_fields('article_title', 'article_url', 'content', 'Categories', 'date', 'author_user_id', 'allow_comment');
     $crud->add_fields('article_title', 'article_url', 'content', 'Categories', 'date', 'author_user_id', 'allow_comment');
     $crud->display_as('article_title', 'Title')->display_as('article_url', 'URL')->display_as('content', 'Content')->display_as('date', 'Date Created')->display_as('author_user_id', 'Author');
     $crud->set_subject('Article');
     $crud->callback_before_insert(array($this, 'before_insert_article'));
     $crud->callback_before_update(array($this, 'before_insert_article'));
     $crud->set_relation_n_n('Categories', 'blog_category_article', 'blog_category', 'article_id', 'category_id', 'category_name');
     $crud->set_relation('author_user_id', 'cms_user', 'real_name');
     $crud->change_field_type('author_user_id', 'hidden');
     $crud->change_field_type('date', 'hidden');
     $crud->change_field_type('article_url', 'hidden');
     $crud->change_field_type('allow_comment', 'true_false');
     $crud->add_action('Photos', base_url() . 'modules/blog/assets/images/photo.png', 'blog/photo');
     $crud->add_action('Comments', base_url() . 'modules/blog/assets/images/comment.png', 'blog/comment');
     $output = $crud->render();
     $this->view('grocery_CRUD', $output, 'blog_article');
 }
开发者ID:remoharsono,项目名称:No-CMS,代码行数:22,代码来源:blog.php

示例13: array

 /**
  * function ni digunakan untuk kv urus maklumat kursus kolej pada crud
  * input: -
  * author: Mior Mohd Hanif
  * Date: 28 Jun 2013
  * Modification Log: 4 Julai 2013 by Mior - fixed bug insert
  * 					18 Julai 2013 by Mior - fixed bug before insert and update
  */
 function college_course_management()
 {
     $user_login = $this->ion_auth->user()->row();
     $col_id = $user_login->col_id;
     $crud = new grocery_CRUD();
     $crud->set_theme('flexigrid');
     $crud->set_subject('Kursus Kolej');
     $crud->set_table('college_course');
     $crud->set_relation('cou_id', 'course', '{cou_course_code} - {cou_name}');
     $crud->columns('cou_course_code', 'cou_name', 'cou_cluster');
     $crud->callback_column('cou_course_code', array($this, '_callback_cou_course_code'));
     $crud->callback_column('cou_name', array($this, '_callback_cou_name'));
     $crud->callback_column('cou_cluster', array($this, '_callback_cou_cluster'));
     $crud->display_as('cou_id', 'Kursus')->display_as('cou_course_code', 'Kod Kursus')->display_as('cou_name', 'Nama Kursus')->display_as('cou_cluster', 'Kluster');
     $crud->required_fields('cou_id');
     $crud->field_type('col_id', 'invisible');
     $crud->callback_before_insert(array($this, 'callback_col_id'));
     $crud->callback_before_update(array($this, 'callback_col_id'));
     $crud->where('col_id', $col_id);
     $output = $crud->render();
     $header = "<legend><h4>Penyelenggaraan Kursus Kolej</h4></legend>";
     $this->_main_output($output, $header);
 }
开发者ID:NeroJz,项目名称:ekv,代码行数:31,代码来源:management.php

示例14: index

 public function index()
 {
     $crud = new grocery_CRUD();
     $crud->set_theme('datatables')->set_table('user')->set_subject('User');
     /*
      *	This is a sample callback function in groceryCRUD.
      * 	What it does is, if a user updates a record in `user` table.
      * 	Before it updates a particular record in the table,
      * 	it first run a function and then do the update query.
      **/
     $crud->callback_before_update(function ($post_array) {
         $post_array['password'] = $this->encryption->encrypt($post_array['password']);
         return $post_array;
         // You need to return it, so that it will receive the edited $post_array value
     });
     $output = $crud->render();
     $this->load->view('admin/admin_header_view', $output);
     $this->load->view('admin/admin_main_view');
     if ($this->session->is_admin && $this->session->is_admin_loggedin) {
         $this->load->view('admin/admin_profile_view', $output);
     }
     $this->load->view('admin/admin_footer_view');
 }
开发者ID:eminence43rd,项目名称:ci,代码行数:23,代码来源:Admin.php

示例15: user

 public function user()
 {
     $this->load->model('login_model');
     if ($this->__check_auth()) {
         if ($this->login_model->get_access_level() >= 10) {
             try {
                 // new object
                 $crud = new grocery_CRUD();
                 // sets table to use
                 $crud->set_table('user');
                 $crud->set_subject('Utilisateur');
                 // callbacks for password editing
                 $crud->callback_edit_field('password_hash', array($this, '__clean_field'));
                 $crud->callback_before_insert(array($this, '__password_user_before_insert'));
                 $crud->callback_before_update(array($this, '__password_user_before_update'));
                 // links foreign keys
                 $crud->set_relation('user_type_id', 'user_type', 'name');
                 $crud->set_relation('user_state_id', 'user_state', 'name');
                 $crud->set_relation('department_id', 'department', 'name');
                 // renders the table in output
                 $output = $crud->render();
                 // sets some text to determine which table is edited
                 $output->current = 'Utilisateur';
                 // display all
                 $this->_view_output($output);
             } catch (Exception $e) {
                 show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
             }
         } else {
             show_error('L\'utilisateur n\'a pas les privilèges nécessaires.');
             die;
         }
     } else {
         // if not authentified send back to login
         redirect('login');
     }
 }
开发者ID:OrifInformatique,项目名称:stock,代码行数:37,代码来源:Admin.php


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