Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
48 righe
1.7 KiB
48 righe
1.7 KiB
<? |
|
use \PhpOffice\PhpSpreadsheet\Reader\Html; |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
$error = true; |
|
$id_modulo = "criteri"; |
|
$cmd_info = gara::getInfoModulo($id_modulo); |
|
$error = true; |
|
if (!empty($_GET["codice_gara"]) |
|
&& !empty($_GET["codice_round"]) |
|
&& !empty($_SESSION["utente"]) |
|
&& $_SESSION["utente"]->permission($cmd_info["modulo_riferimento"],$_GET["codice_gara"],$id_modulo)) { |
|
|
|
$gara = gara::init($_GET["codice_gara"],$_GET["codice_round"]); |
|
if (!empty($gara)) { |
|
if (!empty($_GET["codice_lotto"])) { |
|
$gara->setLotto($_GET["codice_lotto"]); |
|
} else { |
|
$gara->setLotto($gara->getLotti()[0]["codice"]); |
|
} |
|
ob_start(); |
|
$gara->printCriteriaTable(); |
|
$table = ob_get_clean(); |
|
if (!empty($table)) { |
|
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Html(); |
|
$spreadsheet = $reader->loadFromString($table); |
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls'); |
|
$file_path = sys_get_temp_dir() . "/{$_SESSION["utente"]->codice}"; |
|
if (!is_dir($file_path)) { |
|
mkdir($file_path); |
|
} |
|
$file_path .= "/export.xls"; |
|
$writer->save($file_path); |
|
$error = false; |
|
header("Content-Type: application/vnd.ms-excel; charset=utf-8"); |
|
header("Content-Disposition: attachment; filename=export.xls"); //File name extension was wrong |
|
header("Expires: 0"); |
|
header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); |
|
header("Cache-Control: private",false); |
|
readfile($file_path); |
|
} |
|
} |
|
} |
|
if ($error) { |
|
header('HTTP/1.0 400 Bad Request'); |
|
die(); |
|
} |
|
?>
|