load->model('pagination/CareRequests_model', 'model'); } function getLists() { $data = $row = array(); // Fetch member's records $witData = $this->model->getRows($_POST); $i = $_POST['start']; $current_url = $_POST['currentURL']; foreach ($witData as $row) { $buttons = "". ""; $insured = $row->user_lastname.' '.$row->user_firstname; if(isset($row->beneficiary_id)){ $insured = $row->beneficiary_lastname.' '.$row->beneficiary_firstname; } $data[] = array($row->request_id , $insured, $this->lang->line($row->to), $row->user_phone, $row->act_code , $row->act_name, mb_strtoupper($this->lang->line($row->state),'UTF-8'), $row->created_at , $row->state === 'UNDER_VALIDATION' ? $buttons : null); } $output = array( "draw" => $_POST['draw'], "recordsTotal" => $this->model->countAll($_POST), "recordsFiltered" => $this->model->countFiltered($_POST), "data" => $data, ); // Output to JSON format echo json_encode($output); } }