本文整理汇总了PHP中grocery_CRUD::callback_before_insert方法的典型用法代码示例。如果您正苦于以下问题:PHP grocery_CRUD::callback_before_insert方法的具体用法?PHP grocery_CRUD::callback_before_insert怎么用?PHP grocery_CRUD::callback_before_insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grocery_CRUD
的用法示例。
在下文中一共展示了grocery_CRUD::callback_before_insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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('usuario');
$crud->set_subject('Usuário');
$crud->unset_columns('id', 'senha', 'senha_anterior1', 'senha_anterior2', 'senha_anterior3', 'ultima_troca', 'cadastro');
$crud->fields('id', 'nome', 'login', 'email', 'grupos', 'tipo_usuario_id', 'situacao_usuario_id', 'senha', 'senha_anterior1', 'senha_anterior2', 'senha_anterior3');
$crud->unset_texteditor('id', 'senha', 'senha_anterior1', 'senha_anterior2', 'senha_anterior3', 'ultima_troca', 'cadastro');
$crud->change_field_type('id', 'invisible');
$crud->change_field_type('senha', 'invisible');
$crud->change_field_type('senha_anterior1', 'invisible');
$crud->change_field_type('senha_anterior2', 'invisible');
$crud->change_field_type('senha_anterior3', 'invisible');
$crud->set_relation('situacao_usuario_id', 'situacao_usuario', 'descricao');
$crud->display_as('situacao_usuario_id', 'Situacao');
$crud->set_relation('tipo_usuario_id', 'tipo_usuario', 'descricao');
$crud->display_as('tipo_usuario_id', 'Tipo de Usuário');
$crud->set_relation_n_n('grupos', 'grupo_usuario_x_usuario', 'grupo_usuario', 'usuario_id', 'grupo_usuario_id', 'descricao');
/* regras e campos obrigatórios */
$crud->required_fields('login', 'grupos', 'tipo_usuario_id', 'situacao_usuario_id');
$crud->set_rules('login', 'Login', 'required|min_length[2]');
$crud->set_rules('grupos', 'Grupos', 'required');
$crud->set_rules('tipo_usuario_id', 'Tipo de Usuário', 'required');
$crud->set_rules('situacao_usuario_id', 'Situação do Usuário', 'required');
$crud->callback_before_insert(array($this, 'checking_new_user'));
return $crud->render();
}
示例2: index
public function index()
{
$bol_del_before_date = $this->m_conndb->dateBeforeDelete();
try {
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('tempahan');
$crud->set_subject('Booking Room');
$crud->set_relation('m_id', 'masa', 'm_desc');
$crud->set_relation('bm_id', 'bilik_meeting', 'bm_desc');
$crud->display_as('t_datereg', 'Date Reg.')->display_as('t_date', 'Book Date')->display_as('t_day', 'Book Day')->display_as('m_id', 'Time')->display_as('t_perkara', 'Club / Item')->display_as('bm_id', 'Meeting Room')->display_as('t_status', 'Status');
$crud->columns('t_date', 't_day', 'm_id', 't_perkara', 'bm_id');
$crud->fields('t_date', 'm_id', 't_perkara', 'bm_id', 't_datereg', 't_day');
$crud->field_type('t_datereg', 'hidden');
$crud->field_type('t_day', 'hidden');
$crud->required_fields('t_date', 'm_id', 't_perkara', 'bm_id');
$umaq = $this->uri->segment(3);
if (!($this->uri->segment(3) && $umaq == 'umaqkacak')) {
$crud->unset_delete();
$crud->unset_edit();
}
$crud->callback_before_insert(array($this, 'setAutoTempahan'));
$output = $crud->render();
$this->viewpage('v_bookroom', $output);
} catch (Exception $e) {
show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
}
}
示例3: index
public function index($categoryid = 0)
{
$session_data = $this->session->userdata('logged_in');
$data['username'] = $session_data['username'];
$data['cat_id'] = $categoryid;
// $form_subject = ($categoryid==0 ? "Category" : "Sub Category");
if ($categoryid == 0) {
$form_subject = "Category";
$data['cat_title'] = "Categories";
} else {
$this->category->getTitle($categoryid);
$data['cat_title'] = $this->category->getTitle($categoryid) . " - Sub Categories";
$form_subject = "Sub Category";
}
$crud = new grocery_CRUD();
$crud->set_table('dbx_categories');
$crud->where('pid', $categoryid);
$crud->set_subject($form_subject);
$crud->required_fields('title');
$crud->columns('title');
$crud->callback_column('title', array($this, 'link_title'));
$crud->set_rules('title', 'Title', 'trim|required|xss_clean|is_unique[dbx_categories.title]');
$crud->add_action('Sub Categories', '', '', 'cat-icon', array($this, 'goto_sub'));
$crud->fields('title', 'desc', 'published', 'type', 'pid', 'ownerid', 'created_date');
$crud->field_type('pid', 'hidden', $categoryid);
$crud->field_type('published', 'dropdown', array('0' => 'No', '1' => 'Yes'));
$crud->field_type('type', 'dropdown', array('C' => 'Celebrity', 'M' => 'Movie', 'P' => 'Parent'));
$crud->change_field_type('ownerid', 'invisible');
$crud->change_field_type('created_date', 'invisible');
$crud->callback_before_insert(array($this, 'before_insert'));
$output = $crud->render($data);
$this->load->view('header_view', $data);
$this->load->view('categories_view', $output);
$this->load->view('footer_view', $data);
}
示例4: 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());
}
}
示例5: 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();
}
示例6: usuarios
public function usuarios()
{
$crud = new grocery_CRUD();
$crud->set_table("usuarios");
$crud->required_fields('email', 'clave', 'nombre');
$crud->field_type('clave', 'password');
$crud->set_relation('idrol', 'roles', 'descripcion');
$crud->display_as('idrol', 'Rol');
$crud->callback_before_insert(array($this->User_Model, 'encrypt_password_callback'));
$output = $crud->render();
$this->cargarVista($output);
}
示例7: 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);
}
}
示例8: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_table('pengumuman');
$crud->columns('isi', 'created_at', 'updated_at', 'status');
$crud->unset_export();
$crud->unset_print();
$crud->unset_texteditor('isi');
$crud->change_field_type('created_at', 'invisible');
$crud->change_field_type('updated_at', 'invisible');
$crud->callback_before_insert(array($this, "_timestamp"));
$output = $crud->render();
$output->title = 'Kelola Pengumuman';
$this->template->load('template/template_main', 'admin/pengumuman', $output);
}
示例9: 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;
}
示例10: index
public function index()
{
$this->authlibrary->hasPrivilege("announcement");
$crud = new grocery_CRUD();
$crud->set_table('announcement');
$crud->columns('isi', 'created_at', 'updated_at', 'status');
$crud->unset_export();
$crud->unset_print();
$crud->unset_texteditor('isi');
$crud->change_field_type('created_at', 'invisible');
$crud->change_field_type('updated_at', 'invisible');
$crud->callback_before_insert(array($this, "_timestamp"));
$output = $crud->render();
$output->menu = "announcement";
$output->title = 'Announcement';
$this->template->load('backend/template', 'backend/grocery_crud_view', $output);
}
示例11: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_table('admin');
$crud->columns('nama', 'username', 'email', 'last_login', 'role');
$crud->unset_export();
$crud->unset_print();
$crud->unset_read();
$crud->unset_edit_fields('password');
$crud->callback_before_insert(array($this, "_timestamp"));
$crud->change_field_type('created_at', 'invisible');
$crud->change_field_type('updated_at', 'invisible');
$crud->change_field_type('last_login', 'invisible');
$output = $crud->render();
$output->title = 'Kelola Admin';
$this->template->load('template/template_main', 'admin/contents', $output);
}
示例12:
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');
}
示例13: salidas
function salidas()
{
if ($this->session->userdata('id')) {
try {
/* Creamos el objeto */
$crud = new grocery_CRUD();
/* Seleccionamos el tema */
$crud->set_theme('flexigrid');
/* Seleccionmos el nombre de la tabla de nuestra base de datos*/
$crud->set_table('salida');
/* Le asignamos un nombre */
$crud->set_subject('Salidas de productos');
$crud->set_relation('producto', 'productos', 'nombre');
$crud->set_relation('cliente', 'clientes', 'nombre');
//$crud->display_as('proveedor','Proveedor');
//$crud->set_subject('productos');
/* Asignamos el idioma español */
$crud->set_language('spanish');
/* Aqui le decimos a grocery que estos campos son obligatorios */
$crud->required_fields('producto', 'cantidad', 'cliente', 'folio', 'comentarios', 'precio', 'total');
/* Aqui le indicamos que campos deseamos mostrar */
$crud->columns('id', 'producto', 'cantidad', 'cliente', 'folio', 'comentarios', 'precio', 'total');
$crud->callback_column('precio', array($this, 'valuePeso'));
$crud->callback_column('total', array($this, 'valuePeso'));
$crud->callback_before_insert(array($this, 'checking_post_cantidad'));
$crud->unset_delete();
$crud->unset_edit();
$crud->unset_export();
//$crud->add_action('Smileys', 'http://www.grocerycrud.com/assets/uploads/general/smiley.png', 'demo/action_smiley');
//$crud->callback_edit_field('cantidad',array($this,'edit_field_callback_1'));
//$crud->callback_add_field('cantidad',array($this,'edit_field_callback_2'));
/* Generamos la tabla */
$output = $crud->render();
/* La cargamos en la vista situada en
/applications/views/productos/administracion.php */
$this->_example_output($output);
} catch (Exception $e) {
/* Si algo sale mal cachamos el error y lo mostramos */
show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
}
} else {
redirect('Login');
}
}
示例14: 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);
}
示例15: 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);
}