Popravek downloada pdf porocila za nijz
This commit is contained in:
parent
4f214b58f9
commit
0537fda51d
@ -344,7 +344,8 @@ class SurveyNIJZ{
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
||||
$pdf_report = $site_url.RESULTS_FOLDER.'/report_'.$this->usr_id.'.pdf';
|
||||
//$pdf_report = $site_url.RESULTS_FOLDER.'/report_'.$this->usr_id.'.pdf';
|
||||
$pdf_name = 'report_'.$this->usr_id;
|
||||
|
||||
// Testiranje - izpis errorjev
|
||||
/*if($admin_type == 0){
|
||||
@ -355,6 +356,28 @@ class SurveyNIJZ{
|
||||
echo '</div>';
|
||||
}*/
|
||||
|
||||
// Pripravimo file za download
|
||||
if(file_exists($site_path . RESULTS_FOLDER . '/'.$pdf_name.'.pdf')){
|
||||
|
||||
$file = $site_path . RESULTS_FOLDER . '/'.$pdf_name.'.pdf';
|
||||
|
||||
header('Content-Description: File Transfer');
|
||||
header('Content-Disposition: attachment; filename='.basename(''.$pdf_name.'.pdf'));
|
||||
|
||||
header("Content-type: text/x-csv; charset=utf-8");
|
||||
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Expires: 0');
|
||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
header('Pragma: public');
|
||||
header('Content-Length: ' . filesize($file));
|
||||
|
||||
ob_clean();
|
||||
flush();
|
||||
|
||||
readfile($file);
|
||||
}
|
||||
|
||||
// Na koncu pobrisemo zacasne datoteke
|
||||
$this->deleteTemp();
|
||||
|
||||
@ -479,11 +502,17 @@ class SurveyNIJZ{
|
||||
global $site_path;
|
||||
|
||||
$temp_folder = $site_path . TEMP_FOLDER.'/';
|
||||
$results_folder = $site_path . RESULTS_FOLDER.'/';
|
||||
|
||||
// Pobrisemo zacasno CSV datoteko s podatki
|
||||
if (file_exists($temp_folder.'/nijz_'.$this->usr_id.'.csv')) {
|
||||
unlink($temp_folder.'/nijz_'.$this->usr_id.'.csv');
|
||||
}
|
||||
|
||||
// Pobrisemo PDF porocilo
|
||||
if (file_exists($results_folder.'/report_'.$this->usr_id.'.pdf')) {
|
||||
unlink($results_folder.'/report_'.$this->usr_id.'.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
// Pobrisemo sliko grafa
|
||||
|
Loading…
x
Reference in New Issue
Block a user