function showData($data) { if ($this->file_name == '') { switch ($this->module) { case "payment": $this->file_name = 'payment' . $this->id; break; } } //echo "export show data"; switch ($this->format) { case "print": echo $data; break; case "pdf": pdfThis($data, $this->file_location, $this->file_name); $this->file_location == "download" ? exit : ""; break; case "file": $invoice = getInvoice($this->id); $preference = getPreference($invoice['preference_id']); //xls/doc export no longer uses the export template //$template = "export"; header("Content-type: application/octet-stream"); //header("Content-type: application/x-msdownload"); switch ($this->module) { case "statement": header('Content-Disposition: attachment; filename="statement.' . addslashes($this->file_type) . '"'); break; case "payment": header('Content-Disposition: attachment; filename="payment' . addslashes($this->id . '.' . $this->file_type) . '"'); break; default: header('Content-Disposition: attachment; filename="' . addslashes($preference[pref_inv_heading] . $this->id . '.' . $this->file_type) . '"'); break; } header("Pragma: no-cache"); header("Expires: 0"); echo $data; break; } }
function showData($data) { $SI_PREFERENCES = new SimpleInvoices_Db_Table_Preferences(); if($this->file_name =='') { switch ($this->module) { case "payment": { $this->file_name = 'payment'.$this->id; break; } } } //echo "export show data"; switch ($this->format) { case "print": { echo($data); break; } case "pdf": { pdfThis($data, $this->file_location, $this->file_name); $this->file_location == "download" ? exit():"" ; break; } case "file": { //xls/doc export no longer uses the export template //$template = "export"; header("Content-type: application/octet-stream"); //header("Content-type: application/x-msdownload"); switch ($this->module) { case "statement": { header('Content-Disposition: attachment; filename="statement.'.addslashes($this->file_type).'"'); break; } case "payment": { header('Content-Disposition: attachment; filename="payment'.addslashes($this->id.'.'.$this->file_type).'"'); break; } case "database": { $today = date("YmdGisa"); header('Content-Disposition: attachment; filename="simple_invoices_backup_'.$today.'.'.$this->file_type.'"'); break; } default: { $invoice = getInvoice($this->id); $preference = $SI_PREFERENCES->getPreferenceById($invoice['preference_id']); header('Content-Disposition: attachment; filename="'.addslashes($preference[pref_inv_heading].$this->id.'.'.$this->file_type).'"'); break; } } header("Pragma: no-cache"); header("Expires: 0"); echo($data); break; } } }