Compare commits
3 Commits
c1ffddfdb2
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e77ac243b | ||
| 42d3f01176 | |||
|
|
c4d62ac658 |
@@ -217,6 +217,14 @@ div.headline h2{
|
|||||||
visibility: visible;
|
visibility: visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#icon-download {
|
||||||
|
position:absolute;
|
||||||
|
top: 6px;
|
||||||
|
left: 5px;
|
||||||
|
pointer-events: none;
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
|
||||||
.input-table{
|
.input-table{
|
||||||
padding-left: 2px;
|
padding-left: 2px;
|
||||||
padding-right: 2px;
|
padding-right: 2px;
|
||||||
|
|||||||
36
app/public/download_table.php
Normal file
36
app/public/download_table.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
include("../scripts/connection.php");
|
||||||
|
include("../scripts/functions.php");
|
||||||
|
$user_data = check_admin($con);
|
||||||
|
|
||||||
|
if(isset($_GET['table'])) {
|
||||||
|
$table = $_GET['table'];
|
||||||
|
}
|
||||||
|
|
||||||
|
ob_start('ob_gzhandler'); #compressing data which is sent to the browser, the browser will decompress the data automatically
|
||||||
|
header('Content-type: text/csv; charset="UTF-8" ');
|
||||||
|
header('Content-Disposition: attachment; filename="table.csv" ');
|
||||||
|
|
||||||
|
function download_table($stmt) {
|
||||||
|
$output = fopen('php://output', 'w');
|
||||||
|
$header = true;
|
||||||
|
while ($row = $stmt->fetch()) {
|
||||||
|
if ($header) {
|
||||||
|
fputcsv($output, array_keys($row));
|
||||||
|
$header = false;
|
||||||
|
}
|
||||||
|
fputcsv($output, $row);
|
||||||
|
}
|
||||||
|
fclose($output);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($table == "total-score") {
|
||||||
|
$total_score = get_total_score($con);
|
||||||
|
download_table($total_score);
|
||||||
|
} else {
|
||||||
|
$station = get_station($con, $table);
|
||||||
|
download_table($station);
|
||||||
|
}
|
||||||
|
?>
|
||||||
@@ -74,6 +74,16 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>\n";
|
</div>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($user_data['user_group'] == 'admin') {
|
||||||
|
echo "<div class=\"btn-div\">
|
||||||
|
<form action=\"download_table.php\" method=\"get\">
|
||||||
|
<span class=\"gg-software-download icon\" id=\"icon-download\"></span>
|
||||||
|
<input type=\"hidden\" name=\"table\" value=\"$session\">
|
||||||
|
<input type=\"submit\" value=\"\">
|
||||||
|
</form>
|
||||||
|
</div>";
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-div">
|
<div class="table-div">
|
||||||
|
|||||||
Reference in New Issue
Block a user