本文整理汇总了PHP中grocery_CRUD::callback_field方法的典型用法代码示例。如果您正苦于以下问题:PHP grocery_CRUD::callback_field方法的具体用法?PHP grocery_CRUD::callback_field怎么用?PHP grocery_CRUD::callback_field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grocery_CRUD
的用法示例。
在下文中一共展示了grocery_CRUD::callback_field方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
//Inisialisasi
$crud = new grocery_CRUD();
$crud->set_subject('Pasien');
$crud->set_table('tbl_pasien');
//Label Fields
$crud->display_as('idPasien', 'ID Pasien');
$crud->display_as('namaPasien', 'Nama');
$crud->display_as('umur', 'Umur');
$crud->display_as('tanggalLahir', 'Tanggal Lahir');
$crud->display_as('jenisKelamin', 'Jenis Kelamin');
$crud->display_as('status', 'Status');
$crud->display_as('alamat', 'Alamat');
$crud->display_as('pekerjaan', 'Pekerjaan');
$crud->display_as('no_telp', 'Nomor Telepon');
//Kolom Input dan Callbacks
$crud->fields('idPasien', 'namaPasien', 'umur', 'tanggalLahir', 'jenisKelamin', 'status', 'alamat', 'pekerjaan', 'no_telp');
$crud->field_type('idPasien', 'invisible');
$crud->callback_field('jenisKelamin', array($this, 'jenisKelamin_callback'));
$crud->field_type('status', 'dropdown', array('Menikah' => 'Menikah', 'Belum Menikah' => 'Belum Menikah'));
$crud->field_type('pekerjaan', 'dropdown', array('Pegawai Negeri' => 'Pegawai Negeri', 'Wiraswasta' => 'Wiraswasta', 'Karyawan Swasta' => 'Karyawan Swasta', 'Mahasiswa' => 'Mahasiswa', 'Ibu Rumah Tangga' => 'Ibu Rumah Tangga', 'Pensiunan' => 'Pensiunan', 'Lainnya' => 'Lainnya'));
//Aturan Pengisian Form
$crud->required_fields('namaPasien', 'umur', 'tanggalLahir', 'jenisKelamin', 'status', 'alamat', 'pekerjaan');
$crud->set_rules('umur', 'Umur', array('required', 'max_length[2]', 'numeric'));
$crud->set_rules('no_telp', 'Nomor Telepon', 'numeric');
$crud->set_language("indonesian");
//Cetak Tabel
$output = $crud->render();
$this->_example_output($output);
}
示例2: 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();
}
示例3: users
public function users()
{
$crud = new grocery_CRUD();
$crud->set_table('users');
$crud->set_subject('Users');
$crud->columns('username', 'email', 'groups', 'active');
if ($this->uri->segment(3) !== 'read') {
$crud->add_fields('username', 'first_name', 'last_name', 'email', 'phone', 'groups', 'password', 'password_confirm');
$crud->edit_fields('username', 'first_name', 'last_name', 'email', 'phone', 'groups', 'last_login', 'old_password', 'new_password');
} else {
$crud->set_read_fields('username', 'first_name', 'last_name', 'email', 'phone', 'groups', 'last_login');
}
$crud->set_relation_n_n('groups', 'users_groups', 'groups', 'user_id', 'group_id', 'name');
//VALIDATION
$crud->required_fields('username', 'first_name', 'last_name', 'email', 'phone', 'password', 'password_confirm');
$crud->set_rules('email', 'E-mail', 'required|valid_email');
$crud->set_rules('phone', 'Phone', 'required|numeric');
$crud->set_rules('password', 'Password', 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[password_confirm]');
$crud->set_rules('new_password', 'New password', 'min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']');
//FIELD TYPES
$crud->change_field_type('last_login', 'readonly');
$crud->change_field_type('password', 'password');
$crud->change_field_type('password_confirm', 'password');
$crud->change_field_type('old_password', 'password');
$crud->change_field_type('new_password', 'password');
//CALLBACKS
$crud->callback_insert(array($this, 'create_user_callback'));
$crud->callback_update(array($this, 'edit_user_callback'));
$crud->callback_field('last_login', array($this, 'last_login_callback'));
$crud->callback_column('active', array($this, 'active_callback'));
//VIEW
$output = $crud->render();
$data['judul'] = 'Users';
$data['crumb'] = array('Users' => '');
$template = 'admin_template';
$view = 'grocery';
$this->outputview->output_admin($view, $template, $data, $output);
}
示例4: index
public function index()
{
//Inisialisasi
$crud = new grocery_CRUD();
$crud->set_subject('Ruangan');
$crud->set_table('tbl_ruangan');
//Label Fields
$crud->display_as('kdRuangan', 'Kode Ruangan');
$crud->display_as('namaRuangan', 'Nama Ruangan');
$crud->display_as('jenis', 'Jenis');
$crud->display_as('kelas', 'Kelas');
$crud->display_as('status', 'Status');
//Kolom Input dan Callbacks
$crud->fields('kdRuangan', 'kelas', 'jenis', 'namaRuangan', 'status');
$crud->field_type('kdRuangan', 'invisible');
$crud->field_type('jenis', 'dropdown', array('Jelly Bean' => 'Jelly Bean', 'KitKat' => 'KitKat', 'Lollipop' => 'Lollipop', 'Marshmallow' => 'Marshmallow'));
$crud->field_type('kelas', 'dropdown', array('Kelas I' => 'Kelas I', 'Kelas II' => 'Kelas II', 'Kelas III' => 'Kelas III', 'Kelas VIP' => 'Kelas VIP'));
$crud->callback_field('status', array($this, 'status_callback'));
//Aturan Pengisian Form
$crud->set_language('indonesian');
//Cetak Tabel
$output = $crud->render();
$this->_example_output($output);
}
示例5: kegiatan_lama
public function kegiatan_lama()
{
$status = $this->input->get("status");
$crud = new grocery_CRUD();
$crud->where("tbl_kegiatan_transaksi.status", "Lama");
$crud->set_table('tbl_kegiatan_transaksi');
$crud->set_subject('Kegiatan Lama');
$crud->set_relation('change_by', 'tbl_user', 'email');
$crud->set_relation('id_user', 'tbl_user', '{nama_depan} {nama_belakang}');
$crud->set_relation('id_kegiatan_butir', 'view_kegiatan_butir', '{unsur} - {subunsur} - {butir}');
$crud->set_primary_key('id_kegiatan_butir', 'view_kegiatan_butir');
$crud->required_fields('tanggal_kegiatan', 'tanggal_kegiatan_selesai');
$crud->fields('id_user', 'id_kegiatan_butir', 'tanggal_kegiatan', 'tanggal_kegiatan_selesai', 'lembur', 'keterangan', 'status', 'change_by', 'change_date');
$crud->columns('id_user', 'id_kegiatan_butir', 'tanggal_kegiatan', 'tanggal_kegiatan_selesai', 'status');
$crud->display_as("id_kegiatan_butir", "Butir Kegiatan")->display_as("tanggal_kegiatan", "Tanggal Mulai")->display_as("tanggal_kegiatan_selesai", "Tanggal Selesai")->display_as("id_user", "Oleh")->display_as("change_date", "Tanggal")->display_as("id_periode", "Periode")->display_as("id_kegiatan_jabatan", "Bertindak Sebagai");
$crud->callback_add_field('id_user', array($this, '_form_get_user_callback'));
$crud->callback_edit_field('id_user', array($this, '_form_get_user_callback'));
$crud->callback_add_field('status', array($this, '_kegiatan_lama_get_status_callback'));
$crud->callback_edit_field('status', array($this, '_kegiatan_lama_get_status_callback'));
$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('id_user', 'readonly');
$crud->change_field_type('change_by', 'readonly');
$crud->change_field_type('change_date', 'readonly');
$crud->add_action('Unggah Bukti', '', 'pegawai/daftar_kegiatan_berkas', 'fa fa-upload');
$crud->unset_read();
$crud->order_by('id_kegiatan_transaksi', 'desc');
$sitemap = $this->get_sitemap();
$output = $crud->render($sitemap);
$this->load->view('theme/theme_pegawai', $output);
}
示例6: pesan
public function pesan()
{
try {
$status = $this->input->get("status");
$crud = new grocery_CRUD();
if (isset($status) and !empty($status)) {
$crud->where('tbl_pertanyaan_user.status', $status);
}
$crud->set_table('tbl_pertanyaan_user');
$crud->set_subject('Pesan');
$crud->set_relation('change_by', 'tbl_user', 'email');
$crud->set_relation('id_user', 'tbl_user', '{nama_depan} {nama_belakang}');
$crud->required_fields('jawaban');
$crud->fields('id_user', 'judul', 'pertanyaan', 'jawaban', 'status', 'change_by', 'change_date');
$crud->columns('id_user', 'judul', 'pertanyaan', 'status');
$crud->display_as("id_user", "Penanya");
$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('id_user', 'readonly');
$crud->change_field_type('judul', 'readonly');
$crud->change_field_type('pertanyaan', 'readonly');
$crud->change_field_type('change_by', 'readonly');
$crud->change_field_type('change_date', 'readonly');
$crud->unset_export();
$crud->unset_print();
$crud->unset_save();
$crud->unset_add();
$crud->unset_edit();
$crud->unset_delete();
$crud->order_by('id_pertanyaan_user', 'desc');
$sitemap = $this->get_sitemap();
$output = $crud->render($sitemap);
$this->load->view('theme/theme_pegawai', $output);
} catch (Exception $e) {
show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
}
}
示例7: myaccount
function myaccount()
{
$crud = new grocery_CRUD();
$crud->set_table('tbl_admin');
$crud->where('matrix_id', $this->session->userdata('matrix_id'));
$crud->set_subject('Password');
$crud->unset_delete();
$crud->unset_add();
$crud->required_fields('matrix_id');
$crud->columns('matrix_id', 'role');
$crud->fields('password');
$crud->callback_field('password', array($this, 'password_field_callback'));
$crud->callback_before_update(array($this, 'encode_password_callback'));
$crud->display_as('password', 'New Password');
$data['title'] = "Change Password";
$data['crud'] = $crud->render();
$this->template->load('admin/theme', 'admin/manage_crud', $data);
}
示例8: array
function _set_common_report_crud($columns)
{
$crud = new grocery_CRUD();
// default columns excludes: token address_id simply because FMS/FMS-endpoint doesn't use them
$default_columns = array('report_id', 'status', 'requested_datetime', 'updated_datetime', 'expected_datetime', 'priority', 'category_id', 'media_url', 'status_notes', 'description', 'agency_responsible', 'service_notice', 'address', 'postal_code', 'lat', 'long', 'device_id', 'source_client', 'account_id', 'first_name', 'last_name', 'email', 'phone', 'engineer');
$columns = $columns ? $columns : $default_columns;
foreach ($columns as &$colname) {
if ($colname == 'report_id') {
$colname = 'xxx_report_id';
}
}
$crud->columns($columns);
$crud->order_by('requested_datetime', 'desc');
$crud->edit_fields($default_columns);
$crud->set_theme('twitter-bootstrap');
$crud->set_table('reports');
$crud->set_subject('Report');
$crud->set_relation('category_id', 'categories', 'category_name', null, 'category_name ASC');
$crud->set_relation('priority', 'priorities', 'prio_name', null, 'prio_value ASC');
$crud->set_relation('status', 'statuses', 'status_name', null, 'status_name ASC');
$crud->set_primary_key('url_slug', 'agencies');
$crud->set_relation('agency_responsible', 'agencies', 'name', null, 'name ASC');
$crud->set_relation('source_client', 'open311_clients', '<a href="admin/open311_clients/{id}">{name}</a>', null, 'name ASC');
$crud->display_as('client_id', 'Client');
$crud->callback_column('media_url', array($this, '_linkify'));
$crud->callback_column('external_id', array($this, '_get_external_url'));
$crud->callback_edit_field('media_url', array($this, '_text_media_url_field'));
$crud->display_as('requested_datetime', 'Received')->display_as('updated_datetime', 'Last Updated')->display_as('expected_datetime', 'Expected')->display_as('category_id', 'Category')->display_as('media_url', 'Media URL');
$external_id_col_name = config_item('external_id_col_name');
$crud->display_as('external_id', empty($external_id_col_name) ? 'External ID' : $external_id_col_name);
$crud->unset_texteditor('description', 'address', 'status_notes', 'service_notice');
$crud->add_action('View', site_url('assets/fms-endpoint/images/report.png'), 'admin/report');
$crud->callback_column('xxx_report_id', array($this, '_report_id_link_field'));
$crud->callback_column('requested_datetime', array($this, '_report_datetime_field'));
$crud->callback_column('updated_datetime', array($this, '_report_datetime_field'));
$crud->callback_column('description', array($this, '_report_description_field'));
$crud->callback_column($this->unique_field_name('status'), array($this, '_report_status_button'));
$crud->callback_column($this->unique_field_name('category_id'), array($this, '_report_category_button'));
$crud->display_as('xxx_report_id', 'ID');
$crud->callback_edit_field('xxx_report_id', array($this, '_read_only_report_id_field'));
//$crud->fields($default_columns);
//$crud->field_type('updated_datetime','invisible');
//$crud->callback_before_update(function($post_array){
// $post_array['updated_datetime'] = date('Y-m-d H:i:s');
// return $post_array;
//});
$crud->callback_field('updated_datetime', array($this, '_set_update_time'));
$crud->callback_field('requested_datetime', array($this, '_set_requested_datetime'));
$crud->field_type('report_id', 'readonly');
$crud->callback_before_update(array($this, '_fix_zero_prio_callback'));
$crud->callback_after_update(array($this, '_check_for_status_update_after'));
if (!$this->ion_auth->is_admin()) {
$crud->unset_delete();
}
// If we're not an admin restrict list to reports we have permissions for
if (!$this->ion_auth->is_admin()) {
return $this->filter_query_permissions($crud);
} else {
return $crud;
}
}
示例9: konfigurasi_email
public function konfigurasi_email()
{
try {
$crud = new grocery_CRUD();
$crud->set_table('tbl_email_konfigurasi');
$crud->set_subject('Konfigurasi Email');
$crud->set_relation('change_by', 'tbl_user', 'email');
//$crud->required_fields('smtp_host', 'smtp_user', 'smtp_pass');
$crud->fields('useragent', 'protocol', 'mailpath', 'smtp_host', 'smtp_user', 'name', 'smtp_pass', 'smtp_port', 'smtp_timeout', 'smtp_crypto', 'wordwrap', 'wrapchars', 'mailtype', 'charset', 'validate', 'priority', 'crlf', 'newline', 'bcc_batch_mode', 'bcc_batch_size', 'subjek', 'pesan_berhasil', 'pesan_gagal', 'change_by', 'change_date');
$crud->display_as('modified_by', 'Input / Edit oleh')->display_as('subjek', 'Subjek Hubungi Kami')->display_as('format_email_balasan', 'Format Hubungi Kami')->display_as('name', 'Nama Pengirim')->display_as('change_date', 'Input / Edit Tanggal')->display_as('change_by', 'Input / Edit Oleh');
$crud->columns('smtp_host', 'smtp_user', '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_print();
$crud->unset_export();
$crud->unset_delete();
$crud->unset_add();
$crud->unset_read();
$sitemap = $this->get_sitemap();
$output = $crud->render($sitemap);
$this->load->view('theme/theme_default', $output);
} catch (Execption $e) {
show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
}
}