Codeigniter продуктовый круд
Я пытаюсь сделать выпадающий список здесь в следующем коде:
public function loadservices()
{
$crud = new grocery_CRUD();
$crud->set_table('tbl_services');
$crud->set_subject('Services');
$crud->set_relation('s_type','tbl_service_cat','service_desc');
$crud->set_relation('s_country','tbl_country','country');
$crud->set_relation('s_district','tbl_district','district');
$output = $crud->render();
$this->_admin_output($output);
}
Но здесь, в этом коде, данные вставляются в таблицу администраторов. Но вместо страны, штата, района их идентификатор вставляется в базу данных. Пожалуйста, предоставьте подходящее решение для этой проблемы. Кроме того, я хочу получить опцию множественного выбора для service_desc
$crud->set_relation('s_type','tbl_service_cat','service_desc');
1 ответ
I want to sort the displaying table by two columns.Here is my code
public function e_counseling_mgt() {
$counId = $this->session->all_userdata();
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('book_e_counseling_mst');
$crud->set_subject('E-counseling');
$crud->display_as('eemp_id', 'Employee Name')
->display_as('ec_age', 'Date of Birth')
->display_as('ec_marital', 'Marital Status')
->display_as('ec_gender', 'Gender')
->display_as('CaseId', 'Case ID')
->display_as('flag', 'Case Status')
->display_as('counseler_id', 'Counselor ID & Name')
->display_as('ec_question4', 'In the last two weeks have you been feeling down ?')
->display_as('ec_question5', 'Have you ever experieced voilence or abuse?')
->display_as('ec_question6', 'Is there anything that you will be doing differently once your issue is resolved ?')
->display_as('ec_question7', 'Please tell us a little bit about yourself, your education, your likes and dislikes ?')
->display_as('ec_question8', 'Please describe your family background and anything else that you would like to share about your family ?')
->display_as('ec_question9', 'If you were categorize your issue what broad category will it fall under according to you ?')
->display_as('ec_question10', 'Please briefly describe the issue that you are facing currently. if you do not know what to say then just write whatever comes to mind and we will help you to take it forward from there by asking you more pointed questions ?')
->display_as('ec_question11', 'Please share here what some effortes that you have already made to resolve your issue ?')
->display_as('ec_question12', 'Any another comment that you want to share?')
->display_as('ec_created_date', 'Date Of Registration');
$crud->set_relation('flag', 'case_status_mstr', 'CaseStatusName', array('id !=' => '1'), 'CaseStatusName ASC');
//$crud->set_relation('flag', 'case_status_mstr', 'CaseStatusName',array('flag' => 2));
$crud->set_relation('counseler_id', 'users', '{EmpCode}-{name}', array('type' => 2, 'status' => '1', 'ProfileStatus' => '1'), 'EmpCode ASC');
// $crud->set_relation('counselor_name', 'users', 'name');
$crud->set_relation('eemp_id', 'end_employee_master', '{name} {lname}');
$crud->columns('CaseId', 'flag', 'eemp_id', 'ec_age', 'ec_marital', 'ec_gender', 'ec_created_date', 'notifications');
//$crud->required_fields('counselor_name');
$crud->order_by('flag', 'desc');
$crud->order_by('ec_created_date','desc');
$crud->callback_column('notifications', array($this, 'notification_callback'));
// $crud->unset_delete();
$crud->unset_print();
$crud->unset_add();
$crud->where('counseler_id', $counId['logged_in']['id']);
/* $crud->add_action('Feedback', 'http://www.grocerycrud.com/assets/uploads/general/smiley.png', 'counselor/counselor_home/EcounselingFeedback'); */
$crud->add_action('Conversation', base_url().'images/smiley.png', 'counselor/counselor_home/EcounselingFeedback');
$crud->order_by('flag', 'asc');
$output = $crud->render();
$output->bradcum = 'E-Counseling Cases';
$output->ecou_css = 1;
$this->_example_output($output);
//function to when closing any case and reply to be sent for feed back
}