本文整理汇总了PHP中grocery_CRUD::callback_edit_field方法的典型用法代码示例。如果您正苦于以下问题:PHP grocery_CRUD::callback_edit_field方法的具体用法?PHP grocery_CRUD::callback_edit_field怎么用?PHP grocery_CRUD::callback_edit_field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grocery_CRUD
的用法示例。
在下文中一共展示了grocery_CRUD::callback_edit_field方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_table('hotel_rooms');
$crud->set_subject('Hotel Rooms');
// $crud->unset_fields('ht_id');
$crud->display_as('room_hotel', 'Hotel Name');
$crud->display_as('hotel_title', 'Room Name');
$crud->display_as('room_desc', 'Room Description');
$crud->display_as('room_basic_price', 'Selling Price');
$crud->display_as('room_cost_price', 'Cost Price');
$crud->display_as('room_market_price', 'Market Price');
$crud->display_as('room_service_charge', 'Service Charge');
$crud->display_as('room_vat', 'VAT');
$crud->columns(array('room_hotel', 'room_title', 'room_vat', 'room_service_charge', 'room_cost_price', 'room_basic_price', 'room_basic_discount', 'room_order', 'room_quantity', 'room_added_on', 'room_status'));
$crud->callback_column('room_basic_price', array($this, 'set_price'));
//
$crud->callback_read_field('room_basic_price', array($this, 'set_price'));
// crud library modified SAM for read_field
$crud->callback_column('room_basic_discount', array($this, 'set_price'));
//
$crud->callback_read_field('room_basic_discount', array($this, 'set_price'));
// crud library modified SAM for read_field
$crud->callback_add_field('room_cost_price', function ($value, $primary_key) {
return "USD <input id='field-room_cost_price' class='form-control' name='room_cost_price' type='text' value='' maxlength='20'>";
});
$crud->callback_add_field('room_market_price', function ($value, $primary_key) {
return "USD <input id='field-room_market_price' class='form-control' name='room_market_price' type='text' value='' maxlength='20'>";
});
$crud->callback_edit_field('room_cost_price', function ($value, $primary_key) {
return "USD <input id='field-room_cost_price' class='form-control' name='room_cost_price' type='text' value='{$value}' maxlength='20'>";
});
$crud->callback_edit_field('room_market_price', function ($value, $primary_key) {
return "USD <input id='field-room_market_price' class='form-control' name='room_market_price' type='text' value='{$value}' maxlength='20'>";
});
$crud->callback_add_field('room_basic_price', function ($value, $primary_key) {
return "USD <input id='field-room_basic_price' class='form-control' name='room_basic_price' type='text' value='' maxlength='20'>";
});
$crud->callback_edit_field('room_basic_price', function ($value, $primary_key) {
return "USD <input id='field-room_basic_price' class='form-control' name='room_basic_price' type='text' value='{$value}' maxlength='20'>";
});
$crud->callback_add_field('room_basic_discount', function ($value, $primary_key) {
return "USD <input id='field-room_basic_discount' class='form-control' name='room_basic_discount' type='text' value='' maxlength='20'>";
});
$crud->callback_edit_field('room_basic_discount', function ($value, $primary_key) {
return "USD <input id='field-room_basic_discount' class='form-control' name='room_basic_discount' type='text' value='{$value}' maxlength='20'>";
});
$crud->set_relation('room_hotel', 'hotels', '{hotel_name}');
$hrf = $this->generic_model->get_by('hotel_room_facilities', array('hrf_status' => 1), 'hrf_id');
$hrf = $this->generic_model->array_from_db($hrf, 'hrf_id, hrf_facility');
$crud->field_type('room_facilities', 'multiselect', $hrf);
$output = $crud->render();
$data = array('main_content' => 'list', 'output' => $output, 'pagetitle' => 'Hotel Tariffs', 'pagedesc' => 'Hotel Tariffs', 'contenttitle' => 'Hotel Tariffs List Records');
$this->load->view('gc_admin_wrapper', $data);
}
示例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);
}
}
示例3: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_table('booking_refunds');
$crud->set_subject('Booking Refund');
$crud->unset_add();
$crud->unset_delete();
// $crud->unset_columns('booking_ref_no');
$crud->unset_fields('booking_ref_no');
$crud->field_type('refund_status', 'dropdown', array('1' => 'Requested', '0' => 'Rejected', '2' => 'Refunded'));
// $crud->field_type('refund_status', 'dropdown', array('1'=>'Requested', '0'=>'Rejected', '2' => 'Refunded'));
// $crud->callback_column('refund_status', function($value, $primary_key){
// $status = array('1'=>'Requested', '0'=>'Rejected', '2' => 'Refunded');
// return $status[$value];
// });
$crud->field_type('item_type', 'readonly');
$crud->callback_column('item_type', function ($value, $primary_key) {
return ucfirst($value);
});
$crud->callback_edit_field('item_type', function ($value, $primary_key) {
return ucfirst($value);
});
// $crud->callback_before_update(array($this, 'modified_date_callback'));
$crud->callback_column('booking_ref_no', array($this, '_show_invoice'));
$output = $crud->render();
$data = array('main_content' => 'list', 'output' => $output, 'pagetitle' => 'Booking Refund', 'pagedesc' => 'Booking Refund', 'contenttitle' => 'Booking Refund List Records');
$this->load->view('gc_admin_wrapper', $data);
}
示例4: 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);
}
}
示例5: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_table('bookings');
$crud->set_subject('Bookings');
// $agents = $this->ion_auth->get_all_agents();
// $user = $this->ion_auth->user()->row();
// $agents += array($user->id => $user->first_name . " " . $user->last_name);
// $crud->field_type('hotel_agent_id', 'dropdown', $agents);
$crud->set_relation('booking_agent', 'io_users', '{first_name} {last_name} [{email}]', array('active' => 1));
$crud->set_relation('agent_id', 'io_users', '{first_name} {last_name} [{email}]', array('active' => 1));
$crud->set_relation('booking_to', 'io_users', '{first_name} {last_name} [{email}]', array('active' => 1));
$crud->display_as('agent_id', 'Agent of Hotel/Package');
$crud->display_as('booking_company_commission', 'Company Commission');
$crud->display_as('booking_status', 'Status (Change Status)');
$crud->display_as('booking_agent', 'Booked By');
// $crud->display_as('hotel_name', 'Hotel Name');
// $crud->display_as('hotel_rooms', 'Rooms');
// $crud->display_as('hotel_tariffs', 'Tariffs');
$crud->field_type('booking_ref_no', 'readonly');
$crud->field_type('paypal_transaction_id', 'readonly');
$crud->field_type('booking_agent_commission', 'readonly');
$crud->field_type('booking_company_commission', 'readonly');
$crud->field_type('booking_type', 'readonly');
$crud->field_type('booking_item_title', 'readonly');
$crud->field_type('booking_date', 'readonly');
$crud->field_type('booking_payment_type', 'readonly');
$crud->field_type('booking_total', 'readonly');
$crud->field_type('booking_agent', 'readonly');
$crud->field_type('agent_id', 'readonly');
$crud->field_type('booking_to', 'readonly');
$crud->unset_columns('booking_item', 'booking_subitem', 'booking_paymethod_tax', 'ip_address', 'booking_nights');
$crud->unset_fields('booking_item', 'booking_subitem', 'booking_paymethod_tax', 'ip_address', 'booking_nights');
$crud->where('agent_id', $this->ion_auth->get_user_id());
// $crud->columns('hotel_name', 'hotel_agent_id', 'hotel_phoneNumber', 'hotel_website', 'hotel_facebook' ,'hotel_googleMap', 'hotel_status');
// $state = $crud->getState();
//
// if($state =='list' || $state =='ajax_list')
// {
$crud->set_js("assets/frontend/js/custom_functions_sam.js");
// }
$crud->add_action('Conversation', 'http://www.grocerycrud.com/assets/uploads/general/smiley.png', '', 'ui-icon-image', array($this, '_booking_conversation'));
$crud->callback_column('booking_ref_no', array($this, '_show_invoice'));
$crud->callback_edit_field('booking_status', array($this, '_edit_field_callback'));
$crud->callback_column('booking_status', array($this, '_booking_status'));
$crud->unset_add();
$output = $crud->render();
$data = array('main_content' => 'list', 'output' => $output, 'pagetitle' => 'Bookings', 'pagedesc' => 'Bookings', 'contenttitle' => 'Booking List Records', 'left_menu' => 'agents_menu');
$this->load->view('gc_admin_wrapper', $data);
}
示例6: 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);
}
示例7: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_table('hotel_tariffs');
$crud->set_subject('Hotel Tariffs');
// $crud->unset_fields('ht_id');
$crud->display_as('hotels_hotel_id', 'Hotel Name');
$crud->display_as('ht_hotelRoom', 'Hotel Room');
$crud->display_as('ht_hotelTariffs', 'Hotel Tariffs');
$crud->callback_column('ht_hotelTariffs', array($this, 'set_price'));
$crud->callback_read_field('ht_hotelTariffs', array($this, 'set_price'));
// crud library modified SAM for read_field
$crud->callback_add_field('ht_hotelTariffs', array($this, 'add_price1'));
$crud->callback_edit_field('ht_hotelTariffs', array($this, 'edit_price1'));
$crud->set_relation('hotels_hotel_id', 'hotels', '{hotel_name}');
$output = $crud->render();
$data = array('main_content' => 'list', 'output' => $output, 'pagetitle' => 'Hotel Tariffs', 'pagedesc' => 'Hotel Tariffs', 'contenttitle' => 'Hotel Tariffs List Records');
$this->load->view('gc_admin_wrapper', $data);
}
示例8: 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');
}
}
示例9: users
function users()
{
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('user');
$crud->display_as('login', 'Username');
$crud->display_as('user_name', 'Name');
$crud->set_subject('User');
$crud->columns('login', 'user_type', 'user_name', 'email', 'mobile');
$crud->required_fields('login', 'user_type', 'user_name', 'email', 'mobile');
$crud->set_rules('email', 'Email', 'trim|required|valid_email');
$crud->change_field_type('password', 'password');
// Cripatare password
$crud->callback_before_insert(array($this, 'encrypt_password_callback'));
$crud->callback_edit_field('password', array($this, 'set_password_input_to_empty'));
$crud->callback_before_update(array($this, 'encrypt_password_callback'));
//$crud->callback_edit_field('password',array($this,'decrypt_password_callback'));
// Realatii baza de date
//$crud->set_relation('grup','grup','grup_name');
//$crud->set_field_upload('imagine_monitor','assets/uploads/files');
$crud->field_type('user_type', 'dropdown', array('admin' => 'admin', 'user' => 'user'));
$output = $crud->render();
$this->_admin_output($output);
}
示例10: hotel_rooms
public function hotel_rooms()
{
$agent_id = $this->ion_auth->user()->row()->id;
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_table('hotel_rooms');
$crud->set_subject('Hotel Rooms');
// $crud->unset_fields('ht_id');
$crud->display_as('room_hotel', 'Hotel Name');
$crud->display_as('hotel_title', 'Room Name');
$crud->display_as('room_desc', 'Room Description');
$crud->columns(array('room_hotel', 'room_title', 'room_basic_price', 'room_basic_discount', 'room_order', 'room_quantity', 'room_added_on', 'room_status'));
$crud->callback_column('room_basic_price', array($this, 'set_price'));
//
$crud->callback_read_field('room_basic_price', array($this, 'set_price'));
// crud library modified SAM for read_field
$crud->callback_column('room_basic_discount', array($this, 'set_price'));
//
$crud->callback_read_field('room_basic_discount', array($this, 'set_price'));
// crud library modified SAM for read_field
//
$crud->callback_add_field('room_basic_price', function ($value, $primary_key) {
return "USD <input id='field-room_basic_price' class='form-control' name='room_basic_price' type='text' value='' maxlength='20'>";
});
$crud->callback_edit_field('room_basic_price', function ($value, $primary_key) {
return "USD <input id='field-room_basic_price' class='form-control' name='room_basic_price' type='text' value='{$value}' maxlength='20'>";
});
$crud->callback_add_field('room_basic_discount', function ($value, $primary_key) {
return "USD <input id='field-room_basic_discount' class='form-control' name='room_basic_discount' type='text' value='' maxlength='20'>";
});
$crud->callback_edit_field('room_basic_discount', function ($value, $primary_key) {
return "USD <input id='field-room_basic_discount' class='form-control' name='room_basic_discount' type='text' value='{$value}' maxlength='20'>";
});
$hrf = $this->generic_model->get_by('hotel_room_facilities', array('hrf_status' => 1), 'hrf_id');
$hrf = $this->generic_model->array_from_db($hrf, 'hrf_id, hrf_facility');
$crud->field_type('room_facilities', 'multiselect', $hrf);
$agent_hotels = $this->db->select('hotel_id')->get_where('hotels', array('hotel_status' => 1, 'hotel_agent_id' => $agent_id))->result();
// var_dump($agent_hotels);
//getting only rooms that belong to hotels of the agent
foreach ($agent_hotels as $k => $v) {
$hotels_id[] = $v->hotel_id;
}
$ids = '(0)';
if (!empty($hotels_id)) {
$ids = '(';
$ids .= implode(',', $hotels_id);
$ids .= ')';
}
//custom where_in function like in CI
$crud->in_where('room_hotel', $ids);
// $crud->set_relation('room_hotel', 'hotels', '{hotel_name}');
/*
* for hotels list added by agent
*/
$hrf = $this->generic_model->get_by('hotels', array('hotel_status' => 1, 'hotel_agent_id' => $this->ion_auth->get_user_id()), 'hotel_id');
$hrf = $this->generic_model->array_from_db($hrf, 'hotel_id, hotel_name');
$crud->field_type('room_hotel', 'dropdown', $hrf);
$output = $crud->render();
$data = array('main_content' => 'list', 'output' => $output, 'pagetitle' => 'Hotel Rooms', 'pagedesc' => 'Hotel Rooms', 'contenttitle' => 'Hotel Room List Records', 'left_menu' => 'agents_menu');
$this->load->view('gc_admin_wrapper', $data);
}
示例11: kegiatan_butir
public function kegiatan_butir()
{
try {
$this->load->model("kegiatan_m");
$data = $this->kegiatan_m->get_kegiatan_subunsur(array("id_kegiatan_subunsur" => $this->uri->segment(4)));
$subunsur = isset($data[0]->subunsur) ? $data[0]->subunsur : "";
$subjek = ' <a href="' . base_url() . 'admin/kegiatan_subunsur/' . $this->uri->segment(3) . '">
Butir Kegiatan </a>: ' . $subunsur . '';
$crud = new grocery_CRUD();
$state = $crud->getState();
$crud->where('tbl_kegiatan_butir.id_kegiatan_subunsur', $this->uri->segment(4));
$crud->set_table('tbl_kegiatan_butir');
$crud->set_subject($subjek);
//$crud->getModel()->set_add_value('order_date', date("Y-m-d"));
$crud->set_relation('change_by', 'tbl_user', 'email');
$crud->set_relation('id_kegiatan_subunsur', 'tbl_kegiatan_subunsur', 'subunsur');
$crud->set_relation_n_n('Jenjang', 'tbl_kegiatan_jenjang', 'tbl_jenjang_jabatan', 'id_kegiatan_butir', 'id_jenjang_jabatan', 'jenjang_jabatan', NULL, array('id_jenjang_auditor' => $this->uri->segment(3)));
$crud->required_fields('Jenjang ', 'butir', 'angka_kredit', 'satuan_hasil');
//$crud->unique_fields('butir');
$crud->fields('Jenjang', 'id_kegiatan_subunsur', 'kode', 'butir', 'angka_kredit', 'satuan_hasil');
$crud->columns('Jenjang', 'id_kegiatan_subunsur', 'kode', 'butir', 'angka_kredit', 'satuan_hasil');
$crud->display_as('id_kegiatan_subunsur', 'Sub Unsur');
$crud->order_by('id_kegiatan_butir', 'asc');
$crud->callback_before_update(array($this, 'get_change_by_callback'));
$crud->callback_before_insert(array($this, 'kegiatan_butir_before_insert_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->callback_add_field('id_kegiatan_subunsur', array($this, 'kegiatan_butir_form_callback'));
$crud->callback_edit_field('id_kegiatan_subunsur', array($this, 'kegiatan_butir_form_callback'));
$crud->unset_read();
$crud->unset_save();
$sitemap = $this->get_sitemap();
$output = $crud->render($sitemap);
$this->load->view('theme/theme_default', $output);
} catch (Exception $e) {
show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
}
}
示例12: config
public function config()
{
$crud = new grocery_CRUD();
$crud->set_table('cms_config');
$crud->set_subject('Configuration');
$crud->columns('config_name', 'value', 'description');
$crud->edit_fields('config_name', 'value', 'description');
$crud->add_fields('config_name', 'value', 'description');
$crud->display_as('config_name', 'Configuration Key')->display_as('value', 'Configuration Value')->display_as('description', 'Description');
$crud->unset_texteditor('description');
$crud->unset_texteditor('value');
if ($crud->getState() == 'edit') {
$crud->callback_edit_field('config_name', array($this, 'read_only_config_name'));
$crud->callback_edit_field('description', array($this, 'read_only_config_description'));
}
$output = $crud->render();
$this->view('main/config', $output, 'main_config_management');
}
示例13: isset
function peserta_kkn_management_all()
{
$session = isset($_SESSION['username_belajar']) ? $_SESSION['username_belajar'] : '';
if ($session != "") {
$pecah = explode("|", $session);
$data["NIM"] = $pecah[0];
$data["NAMA"] = $pecah[1];
$data["STATUS"] = $pecah[3];
if ($data["STATUS"] == "Admin") {
try {
/* This is only for the autocompletion */
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
//$crud->where('SUDAH','2');
$crud->set_table('KKN_MHS');
$crud->set_language("indonesian");
$crud->display_as('NIM', 'Data Pribadi');
$crud->set_relation('NIM', 'D_MAHASISWA', 'Nim :{NIM}, Angkatan :{ANGKATAN},Nama :{NAMA},Jk: {J_KELAMIN},Asal: {ALAMAT_MHS}, Golongan Darah: {GOL_DARAH},HP Mhs: {HP_MHS},Telp Keluarga: {TELP_MHS}');
$crud->display_as('FAK', 'Fakultas')->display_as('NO', 'No Pendaftaran')->display_as('ALAMAT_JOGJA', 'Alamat di Jogja')->display_as('NM_KEC_JOGJA', 'Kec di Jogja')->display_as('NM_KAB_JOGJA', 'Kab di Jogja')->display_as('PRESTASI', 'Keahlian')->display_as('RT_JOGJA', 'RT di Jogja')->display_as('DESA_JOGJA', 'Desa di Jogja')->display_as('KODE_POS_JOGJA', 'Kod Pos di Jogja')->display_as('TRANSPORTASI', 'Transportasi')->display_as('PATH_SK_DOKTER', 'Upload SK Dokter')->display_as('PATH_SK_GOLONGAN_DARAH', 'Upload SK Gol Darah')->display_as('PATH_SK_CUTI', 'Upload SK Cuti Kerja')->display_as('PATH_SK_TIDAK_HAMIL', 'Upload SK Tidak Hamil');
$crud->unset_edit();
$crud->unset_delete();
$crud->unset_edit_fields('SUDAH');
$crud->unset_add();
$crud->unset_add_fields('NO', 'SUDAH');
$crud->set_subject('Peserta KKN');
$crud->required_fields('ALAMAT_JOGJA');
$crud->columns('NIM', 'FAK', 'ALAMAT_JOGJA', 'PRESTASI', 'NM_KEC_JOGJA', 'NM_KAB_JOGJA');
$crud->set_field_upload('PATH_SK_DOKTER', 'assets/kesehatan');
$crud->set_field_upload('PATH_SK_GOLONGAN_DARAH', 'assets/goldarah');
$crud->set_field_upload('PATH_SK_CUTI', 'assets/cutikerja');
$crud->set_field_upload('PATH_SK_TIDAK_HAMIL', 'assets/tidakhamil');
//$crud->edit_fields('NIM','KD_FAK','ALAMAT_JOGJA','PRESTASI','KD_KEC','KD_KAB');
$crud->callback_edit_field('NIM', array($this, 'edit_field_callback_nim'));
$crud->callback_edit_field('NO', array($this, 'edit_field_callback_no'));
$output = $crud->render();
$this->_manage_output($output);
} catch (Exception $e) {
show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
}
} else {
?>
<script type="text/javascript" language="javascript">
alert("Anda tidak berhak masuk ke Control Panel Admin...!!!");
</script>
<?php
echo "<meta http-equiv='refresh' content='0; url=" . base_url() . "kkn'>";
}
} else {
?>
<script type="text/javascript" language="javascript">
alert("Anda belum Log In...!!!\nAnda harus Log In untuk mengakses halaman ini...!!!");
</script>
<?php
echo "<meta http-equiv='refresh' content='0; url=" . base_url() . "kkn'>";
}
}
示例14: index
public function index()
{
$crud = new grocery_CRUD();
$user_id = $this->ion_auth->user()->row()->id;
$crud->set_table('packages');
$crud->set_subject('Packages');
$crud->unset_fields('package_id');
$crud->unset_columns('package_id');
$crud->unset_columns('package_thingsToConsider');
$crud->unset_columns('package_weatherCondition');
$crud->unset_columns('package_itinerary');
$crud->display_as('package_weatherCondition', 'Weather Condition');
$crud->display_as('package_thingsToConsider', 'Things to consider');
$crud->display_as('package_adventureRegion', 'Adventure Region');
$crud->display_as('package_basic_price', 'Price');
$crud->display_as('package_basic_before_discount', 'Before Discount Price');
$crud->display_as('package_related', 'Related Packages');
$crud->set_field_upload('package_image', $this->upload_path);
$crud->unique_fields('package_slug');
$crud->where('package_agent', $user_id);
$crud->set_relation('package_category', 'packages_types_settings', 'sett_name', 'sett_type = "ttypes"', 'sett_id');
$crud->field_type('package_agent', 'hidden', $user_id);
$this->load->model('agents_m');
/*
* For related packages
* on add list all the packages created by the agent
* on edit, list all except own name
*/
if ($crud->getState() == 'edit') {
$hrf = $this->db->select('package_id, package_title')->get_where('packages', array('package_status' => 1, 'package_agent' => $user_id, 'package_id !=' => $crud->getStateInfo()->primary_key))->result();
} else {
$hrf = $this->db->select('package_id, package_title')->get_where('packages', array('package_status' => 1, 'package_agent' => $user_id))->result();
}
$hrf = $this->agents_m->array_from_db($hrf, 'package_id, package_title');
// empty data for multiselect field generates error
if (empty($hrf)) {
$hrf = array('');
} else {
$hrf = $this->generic_model->array_from_db($hrf, 'hotel_id, hotel_name');
}
$crud->field_type('package_related', 'multiselect', $hrf);
$crud->callback_column('package_image', array($this, 'set_image'));
$crud->callback_read_field('package_basic_price', array($this, 'set_price'));
$crud->callback_read_field('package_basic_discount', array($this, 'set_price'));
$crud->callback_column('package_basic_price', array($this, 'set_price'));
$crud->callback_column('package_basic_discount', array($this, 'set_price'));
$crud->callback_add_field('package_basic_price', function ($value, $primary_key) {
return "USD <input id='field-package_basic_price' class='form-control' name='package_basic_price' type='text' value='{$value}' maxlength='20'>";
});
$crud->callback_add_field('package_basic_discount', function ($value, $primary_key) {
return "USD <input id='field-package_basic_discount' class='form-control' name='package_basic_discount' type='text' value='{$value}' maxlength='20'>";
});
$crud->callback_edit_field('package_basic_price', function ($value, $primary_key) {
return "USD <input id='field-package_basic_price' class='form-control' name='package_basic_price' type='text' value='{$value}' maxlength='20'>";
});
$crud->callback_edit_field('package_basic_discount', function ($value, $primary_key) {
return "USD <input id='field-package_basic_discount' class='form-control' name='package_basic_discount' type='text' value='{$value}' maxlength='20'>";
});
$crud->add_action('Photo Gallery', '', 'agents/packages/gallery', 'ui-icon ui-icon-image');
$output = $crud->render();
$data = array('main_content' => 'list', 'output' => $output, 'pagetitle' => 'Packages', 'pagedesc' => 'Packages', 'contenttitle' => 'Packages List Records', 'left_menu' => 'agents_menu');
$this->load->view('gc_admin_wrapper', $data);
}
示例15: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_table('packages');
$crud->set_subject('Packages');
$crud->unset_fields('package_id');
$crud->unset_columns('package_id');
$crud->unset_columns('package_thingsToConsider');
$crud->unset_columns('package_weatherCondition');
$crud->unset_columns('package_itinerary');
$crud->display_as('package_weatherCondition', 'Weather Condition');
$crud->display_as('package_thingsToConsider', 'Things to consider');
$crud->display_as('package_adventureRegion', 'Adventure Region');
$crud->display_as('package_cost_price', 'Cost Price');
$crud->display_as('package_basic_price', 'Selling Price');
$crud->display_as('package_market_price', 'Market Price');
$crud->display_as('package_service_charge', 'Service Charge');
$crud->display_as('package_vat', 'VAT');
$crud->display_as('package_basic_price', 'Price');
$crud->display_as('package_basic_before_discount', 'Before Discount Price');
$crud->display_as('package_related', 'Related Packages');
$crud->set_field_upload('package_image', $this->upload_path);
$crud->unique_fields('package_slug');
$agents = $this->ion_auth->get_all_agents();
$user = $this->ion_auth->user()->row();
$agents += array($user->id => $user->first_name . " " . $user->last_name);
$crud->field_type('package_agent', 'dropdown', $agents);
$crud->required_fields('package_agent');
/*
* For related packages
* on add list all the packages
* on edit, list all except own name
*/
if ($crud->getState() == 'edit') {
$hrf = $this->generic_model->get_by('packages', array('package_status' => 1, 'package_id !=' => $crud->getStateInfo()->primary_key), 'package_id');
} else {
$hrf = $this->generic_model->get_by('packages', array('package_status' => 1), 'package_id');
}
$hrf = $this->generic_model->array_from_db($hrf, 'package_id, package_title');
$crud->field_type('package_related', 'multiselect', $hrf);
// $crud->set_relation('package_agent', 'agents', '{agent_companyName}');
//$agents = $this->ion_auth->get_all_agents();
// $crud->field_type('package_agent', 'dropdown', $agents);
// $crud->field_type('package_agent', 'hidden', $this->ion_auth->user()->row()->id);
$crud->field_type('package_difficulty', 'dropdown', array('1' => 'Easy', '2' => 'Basic', '3' => 'Beginner', '4' => 'Intermediate', '5' => 'Advanced'));
$crud->set_relation('package_category', 'packages_types_settings', 'sett_name', 'sett_type = "ttypes"', 'sett_id');
$crud->callback_column('package_image', array($this, 'set_image'));
$crud->callback_column('package_basic_price', array($this, 'set_price'));
$crud->callback_column('package_basic_discount', array($this, 'set_price'));
$crud->callback_read_field('package_basic_price', array($this, 'set_price'));
$crud->callback_read_field('package_basic_discount', array($this, 'set_price'));
$crud->callback_add_field('package_cost_price', function ($value, $primary_key) {
return "USD <input id='field-package_cost_price' class='form-control' name='package_cost_price' type='text' value='' maxlength='20'>";
});
/*$crud->callback_add_field('package_difficulty', function ($value, $primary_key) {
return '<select id="field-package_difficulty" class="form-control" name="package_difficulty">
<option value="1" data-html="Easy">Easy</option>
<option value="2" data-html="Basic">Basic</option>
<option value="3" data-html="Beginner">Beginner</option>
<option value="3" data-html="Intermediate">Intermediate</option>
<option value="3" data-html="Advanced">Advanced</option>
</select>';
});*/
$crud->callback_add_field('package_market_price', function ($value, $primary_key) {
return "USD <input id='field-package_market_price' class='form-control' name='package_market_price' type='text' value='' maxlength='20'>";
});
$crud->callback_edit_field('package_cost_price', function ($value, $primary_key) {
return "USD <input id='field-package_cost_price' class='form-control' name='package_cost_price' type='text' value='{$value}' maxlength='20'>";
});
$crud->callback_edit_field('package_market_price', function ($value, $primary_key) {
return "USD <input id='field-package_market_price' class='form-control' name='package_market_price' type='text' value='{$value}' maxlength='20'>";
});
$crud->callback_add_field('package_basic_price', function () {
return "USD <input id='field-package_basic_price' class='form-control' name='package_basic_price' type='text' value='' maxlength='20'>";
});
$crud->callback_add_field('package_basic_discount', function () {
return "USD <input id='field-package_basic_discount' class='form-control' name='package_basic_discount' type='text' value='' maxlength='20'>";
});
$crud->callback_edit_field('package_basic_price', function ($value, $primary_key) {
return "USD <input id='field-package_basic_price' class='form-control' name='package_basic_price' type='text' value='{$value}' maxlength='20'>";
});
$crud->callback_edit_field('package_basic_discount', function ($value, $primary_key) {
return "USD <input id='field-package_basic_discount' class='form-control' name='package_basic_discount' type='text' value='{$value}' maxlength='20'>";
});
$crud->unique_fields('package_slug');
$crud->add_action('Photo Gallery', '', 'packages/gallery', 'ui-icon ui-icon-image');
$output = $crud->render();
$data = array('main_content' => 'list', 'output' => $output, 'pagetitle' => 'Packages', 'pagedesc' => 'Packages', 'contenttitle' => 'Packages List Records');
$this->load->view('gc_admin_wrapper', $data);
}