function download() { $data = filter_forwarded_data($this); $this->load->helper('report'); $report = $this->_report->report_to_array($data['t']); # download CSV if ($data['t'] == 'download_csv') { send_download_headers("file_" . strtotime('now') . ".csv"); echo array2csv($report); die; } else { if ($data['t'] == 'download_pdf') { $this->load->model('_file'); $reportType = $this->native_session->get('__report_type') ? $this->native_session->get('__report_type') : 'procurement_plan_tracking'; $this->_file->generate_pdf(generate_report_html($report, $reportType), UPLOAD_DIRECTORY . 'file_' . strtotime('now') . '.pdf', 'download', array('size' => 'A4', 'orientation' => 'landscape')); } } }
function download() { $data = filter_forwarded_data($this); $this->load->model('_file'); $this->load->helper('report'); if (!empty($data['d'])) { $plan = $this->_procurement_plan->all_details($data['d']); } if (empty($plan['list'])) { $data['msg'] = 'ERROR: The procurement plan details can not be resolved'; } $this->_file->generate_pdf(generate_report_html($plan, 'procurement_plan', $this), UPLOAD_DIRECTORY . 'file_' . strtotime('now') . '.pdf', 'download', array('size' => 'A4', 'orientation' => 'landscape')); }