DataDownload

This commit is contained in:
schrom01 2023-02-15 17:26:23 +01:00
parent 9501370fae
commit f459f4d4a1
3 changed files with 10 additions and 8 deletions

View File

@ -43,8 +43,14 @@ function saveToDatabase($contentArray, $conn) {
return; return;
} }
function getFromDatabase() { function getFromDatabase($conn) {
return []; $sql = "SELECT `id`, `firstSave`, `lastSave`, `fullJSON`, `timeWatchM`,`timeWatchW`, `timeWatchD`, `countWatchM`, `countWatchW`, `countWatchD` FROM `topics`";
$result = $conn->query($sql);
$dataArray = Array();
while($row = $result->fetch_assoc()) {
array_push($dataArray, [$row["id"],$row["firstSave"],$row["lastSave"],$row["fullJSON"],$row["timeWatchM"],$row["timeWatchW"],$row["timeWatchD"],$row["countWatchM"],$row["countWatchW"],$row["countWatchD"]]);
}
return $dataArray;
} }
$entityBody = '{"lastSave": 0, "timeWatchM": 0, "timeWatchW": 0, "timeWatchD": 0, "countWatchM": 0, "countWatchW": 0, "countWatchD": 0, "id":"test","watches":[{"actions":[]},{"actions":[]},{"actions":[]}]}'; $entityBody = '{"lastSave": 0, "timeWatchM": 0, "timeWatchW": 0, "timeWatchD": 0, "countWatchM": 0, "countWatchW": 0, "countWatchD": 0, "id":"test","watches":[{"actions":[]},{"actions":[]},{"actions":[]}]}';
@ -61,7 +67,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} }
} }
} elseif($_SERVER['REQUEST_METHOD'] === 'GET') { } elseif($_SERVER['REQUEST_METHOD'] === 'GET') {
download_xlsxFile(getFromDatabase()); download_xlsxFile(getFromDatabase($conn));
} else { } else {
echo "invalid Request.<br> Type: ".$_SERVER['REQUEST_METHOD']; echo "invalid Request.<br> Type: ".$_SERVER['REQUEST_METHOD'];
} }

View File

@ -1,4 +0,0 @@
<?php
require $_SERVER['DOCUMENT_ROOT'] . '/spreadSheetReader/read_write_xlsx.php';
download_xlsxFile([]);

View File

@ -10,7 +10,7 @@
<section> <section>
<div class="container"> <div class="container">
<h1>Genderwatch-protocol</h1> <h1>Genderwatch-protocol</h1>
<a href="dataCollector/download.php">Anonyme Daten herunterladen (aktuell in Entwicklung)</a> <a href="dataCollector/dataCollector.php">Anonyme Daten herunterladen (aktuell in Entwicklung)</a>
<h2 style="margin-left: 10px;">Aktuelles Thema</h2> <h2 style="margin-left: 10px;">Aktuelles Thema</h2>
<table class="table-bordered"> <table class="table-bordered">
<tr> <tr>