本文整理汇总了PHP中grocery_CRUD::callback_read_field方法的典型用法代码示例。如果您正苦于以下问题:PHP grocery_CRUD::callback_read_field方法的具体用法?PHP grocery_CRUD::callback_read_field怎么用?PHP grocery_CRUD::callback_read_field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grocery_CRUD
的用法示例。
在下文中一共展示了grocery_CRUD::callback_read_field方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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()
{
$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);
}
示例3: 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);
}
示例4: 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);
}
示例5: 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);
}