本文整理汇总了PHP中grocery_CRUD::unique_fields方法的典型用法代码示例。如果您正苦于以下问题:PHP grocery_CRUD::unique_fields方法的具体用法?PHP grocery_CRUD::unique_fields怎么用?PHP grocery_CRUD::unique_fields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grocery_CRUD
的用法示例。
在下文中一共展示了grocery_CRUD::unique_fields方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_table('hotels');
$crud->set_subject('Hotels');
$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);
//var_dump($agents);
// $crud->set_relation('hotel_agent_id', 'io_users', '{first_name} {last_name}', array('active' => 1));
$crud->display_as('hotel_agent_id', 'Agent Name');
$crud->display_as('hotel_name', 'Hotel Name');
$crud->display_as('hotel_rooms', 'Rooms');
$crud->display_as('hotel_tariffs', 'Tariffs');
$crud->display_as('hotel_country', 'Country');
$crud->display_as('hotel_city', 'City');
$crud->display_as('hotel_street', 'Street');
$crud->display_as('hotel_state', 'State');
$crud->display_as('hotel_postCode', 'PostCode');
$crud->display_as('hotel_phoneNumber', 'Phone Number');
$crud->display_as('hotel_emailId', 'Email ID');
$crud->display_as('hotel_website', 'Website');
$crud->display_as('hotel_facebook', 'Facebook');
$crud->display_as('hotel_googleMap', 'Google Map');
$crud->display_as('hotel_related', 'Related Hotels');
$crud->display_as('hotel_status', 'Status');
$crud->columns('hotel_name', 'hotel_agent_id', 'hotel_phoneNumber', 'hotel_website', 'hotel_facebook', 'hotel_googleMap', 'hotel_status');
$crud->required_fields('hotel_agent_id');
$crud->field_type('hotel_stars', 'dropdown', range(0, 5));
/*
* For related hotels
* on add list all the hotels
* on edit, list all except own name
*/
$hrf = array();
if ($crud->getState() == 'edit') {
$hrf = $this->generic_model->get_by('hotels', array('hotel_status' => 1, 'hotel_id !=' => $crud->getStateInfo()->primary_key), 'hotel_id');
} else {
$hrf = $this->generic_model->get_by('hotels', array('hotel_status' => 1), 'hotel_id');
}
$hrf = $this->generic_model->array_from_db($hrf, 'hotel_id, hotel_name');
$crud->field_type('hotel_related', 'multiselect', $hrf);
$crud->callback_column('hotel_image', array($this, 'set_image'));
$crud->set_field_upload('hotel_image', $this->upload_path);
$hf = $this->generic_model->get_by('hotel_facilities', array('hf_status' => 1), 'hf_id');
$hf = $this->generic_model->array_from_db($hf, 'hf_id, hf_facility');
$crud->field_type('hotel_facilities', 'multiselect', $hf);
$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('hotel_room_facilities', 'multiselect', $hrf);
$crud->unique_fields('hotel_slug');
$crud->add_action('Photo Gallery', '', 'hotels/gallery', 'ui-icon ui-icon-image');
$output = $crud->render();
$data = array('main_content' => 'list', 'output' => $output, 'pagetitle' => 'Hotels', 'pagedesc' => 'Hotels', 'contenttitle' => 'Hotels List Records');
$this->load->view('gc_admin_wrapper', $data);
}
示例2: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('categoria')->set_subject('categoria')->columns('nombre');
$crud->required_fields('nombre');
$crud->unique_fields('nombre');
$crud->unset_texteditor('descripcion', 'full_text');
$crud->unset_fields('fecharegistro');
$crud->unset_print();
$output = $crud->render();
$this->_example_output($output);
}
示例3: index
public function index()
{
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('clientes')->set_subject('Clientes')->columns('nombre');
$crud->required_fields('nombre');
$crud->unique_fields('nombre');
$crud->unset_fields('fecharegistro');
$crud->unset_print();
$crud->set_field_upload('imagen', 'assets/uploads/files');
$output = $crud->render();
$this->_example_output($output);
}
示例4: sitemap
public function sitemap()
{
try {
$crud = new grocery_CRUD();
$state = $crud->getState();
$crud->set_table('tbl_sitemap');
$crud->set_subject('Sitemap');
if ($state == 'edit' or $state == 'add') {
$crud->set_relation('id_parent', 'tbl_sitemap', 'deskripsi');
}
$crud->required_fields('sitemap');
$crud->unique_fields('sitemap');
$crud->fields('id_parent', 'sitemap', 'deskripsi', 'judul', 'url', 'no_urut');
$crud->columns('sitemap', 'judul', 'no_urut');
$crud->order_by('id_sitemap', 'desc');
//$crud->unset_save();
$crud->unset_read();
$sitemap = $this->get_sitemap();
$output = $crud->render($sitemap);
$this->load->view('theme/theme_default', $output);
} catch (Exception $e) {
show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
}
}
示例5: issuing_organization
public function issuing_organization()
{
$crud = new grocery_CRUD('default');
$crud->set_table('issuing_organization');
$crud->set_subject('Issuing Organization');
$crud->unique_fields('Bank_Name');
$crud->unset_add_fields('created_date');
$crud->unset_edit_fields('created_date');
$crud->unset_columns('created_date');
$data = $crud->render();
$this->load->view('admin/crud_view', $data);
}
示例6: assignment
function assignment()
{
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('assignment');
$crud->set_subject('Assignment');
//$crud->columns('customerName','phone','addressLine1','creditLimit');
$crud->display_as('patient_name', 'Last and First name');
//$crud->field_tip('patient_name', 'info');
$crud->set_relation('respondent', 'user', 'user_name');
$crud->field_type('status', 'dropdown', array('New' => 'New', 'In progress' => 'In progress', 'Finished' => 'Finished'));
$crud->required_fields('date', 'respondent', 'status');
$crud->unique_fields('cnp');
$drp = $this->session->userdata('user_type');
//print_r($drp);
if ($drp != "admin") {
$crud->unset_add();
$crud->unset_delete();
$crud->unset_edit_fields('date', 'cnp', 'patient_name', 'pci_date_time', 'respondent');
}
$output = $crud->render();
$this->_admin_output($output);
}
示例7: 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);
}
示例8: 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);
}
示例9: patients
function patients()
{
$drp = $this->session->userdata('user_type');
//primesc data din calendar
$day_get = $_GET["day"];
// setez data din calendar variabila sesiune
// $this->session->set_userdata('data_cal',$_GET['data']);
$ids_ui_ses = $this->session->userdata('ids_ui');
$date_cal = array(96, 95, 89);
// var_dump($date_cal);
// echo "<br>";
// var_dump($ids_ui_ses);
// print_r($day_get);
//die();
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
//nu merge cu asta
//$crud->or_where('productName','Car');
//$id = 95;
$crud->set_table('patients');
$crud->set_subject('Patient');
foreach ($ids_ui_ses as $key => $id) {
$pat_fup = $this->date_followup($id);
$zi_fup = $this->day($pat_fup);
// extrag luna si anul din data follow-up-lui pentru cumparare
$luna_fup = $this->month($pat_fup);
// formatez ziua pentru afisare in calendar
$zi_fup = $this->good_day($zi_fup);
if ($zi_fup == $day_get) {
$crud->or_where('patients.id', $id);
}
}
//$crud->or_where('patients.id', $id);
// aici pun filtrele pt admin
//$crud->where('admin',1);
$crud->display_as('fo_nr', 'Medical Record number');
$crud->field_tip('fo_nr', 'eg: 1234/2016');
$crud->display_as('city', 'City or Locality');
$crud->display_as('gp_phone', 'GP Phone');
$crud->display_as('GP_info', 'Notes');
// User Level Unset
if ($drp == "user") {
$crud->unset_delete();
$crud->unset_export();
$crud->unset_print();
// afisare fara statistici // data 24.01.2017
$crud->columns('id', 'fo_nr', 'cnp', 'last_name', 'first_name', 'follow_up_date', 'status', 'signature');
}
// afisare in admin coloane cu statistici // data 24.01.2017
$crud->columns('id', 'cnp', 'last_name', 'first_name', 'No_of_PCIs', 'Completed_FU_events', 'follow_up_date', 'status', 'signature', 'admin');
$crud->field_tip('cnp', 'Personal ID No.');
$crud->field_tip('gender', 'The gender of the patient');
$crud->field_tip('height', 'Height in cm');
$crud->field_tip('weight', 'Weight in kg');
$crud->required_fields('cnp', 'first_name', 'last_name', 'admin', 'status');
$crud->field_type('gender', 'dropdown', array('Male' => 'Male', 'Female' => 'Female'));
$crud->field_type('country', 'dropdown', array('Romania' => 'Romania', 'Other' => 'Other', 'Unknown' => 'Unknown'));
$crud->set_relation('county', 'county', 'county');
$crud->set_relation('signature', 'user', 'user_name');
$crud->set_relation('admin', 'user', 'user_name');
$crud->add_action('Interventions', '', '', 'ui-icon-heart', array($this, 'go_intervention'));
$crud->add_action('Follow-Up', '', '', 'ui-icon-calculator', array($this, 'go_followup'));
$crud->callback_column('follow_up_date', array($this, '_followup'));
$crud->callback_column('Completed_FU_events', array($this, '_nofollowup'));
$crud->callback_column('No_of_PCIs', array($this, '_nointerv'));
/*// log- user activities
$crud->callback_after_insert(array($this, 'log_user_after_insert_patient'));
$crud->callback_after_update(array($this, 'log_user_after_update_patient'));
$crud->callback_after_delete(array($this, 'log_user_after_delete_patient'));
*/
$crud->unique_fields('cnp');
$crud->field_type('status', 'dropdown', array('New' => 'New', 'In progress' => 'In progress', 'Finished' => 'Finished', 'Delete' => 'Delete'));
$crud->unset_add();
$crud->unset_edit();
$crud->unset_delete();
//$extra = "info";
//$output = $crud->render($extra);
$output = $crud->render();
// $output->extra = '<h3>Pacient</h3>'; Adauga valori extra pentru view
$this->_admin_output($output);
}
示例10: tanggal_merah
public function tanggal_merah()
{
try {
$crud = new grocery_CRUD();
$crud->set_table('tbl_tanggal_merah');
$crud->set_subject('Tanggal Merah');
$crud->required_fields('tanggal_merah');
$crud->unique_fields('tanggal_merah');
$crud->fields('tanggal_merah', 'keterangan');
$crud->columns('tanggal_merah', 'keterangan');
$crud->unset_save();
$crud->unset_read();
$crud->order_by('tanggal_merah', 'asc');
$sitemap = $this->get_sitemap();
$output = $crud->render($sitemap);
$this->load->view('theme/theme_default', $output);
} catch (Exception $e) {
show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
}
}