DataDownload
This commit is contained in:
parent
8e2e2ecb61
commit
9501370fae
|
@ -0,0 +1,3 @@
|
||||||
|
CREATE TABLE `u517357132_genderwatchpro`.`topics` ( `id` VARCHAR(8) CHARACTER SET ascii COLLATE ascii_bin NOT NULL , `lastSave` INT NULL DEFAULT CURRENT_TIMESTAMP , `fullJSON` JSON NOT NULL , `timeWatchM` INT NOT NULL , `timeWatchW` INT NOT NULL , `timeWatchD` INT NOT NULL , `countWatchM` INT NOT NULL , `countWatchW` INT NOT NULL , `countWatchD` INT NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB;
|
||||||
|
|
||||||
|
INSERT INTO `topics` (`id`, `lastSave`, `fullJSON`, `timeWatchM`,`timeWatchW`, `timeWatchD`, `countWatchM`, `countWatchW`, `countWatchD`) values ('test', 2014, '{}', 10, 10, 10, 10, 40, 10) ON DUPLICATE KEY UPDATE `id` = 'test'
|
BIN
data/data.xlsx
BIN
data/data.xlsx
Binary file not shown.
|
@ -0,0 +1,4 @@
|
||||||
|
<?php
|
||||||
|
require $_SERVER['DOCUMENT_ROOT'] . '/spreadSheetReader/read_write_xlsx.php';
|
||||||
|
|
||||||
|
download_xlsxFile([]);
|
|
@ -10,7 +10,7 @@
|
||||||
<section>
|
<section>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Genderwatch-protocol</h1>
|
<h1>Genderwatch-protocol</h1>
|
||||||
<a href="data/data.xlsx">Anonyme Daten herunterladen (aktuell in Entwicklung)</a>
|
<a href="dataCollector/download.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>
|
||||||
|
|
|
@ -2,8 +2,28 @@
|
||||||
require $_SERVER['DOCUMENT_ROOT'] . '/spreadSheetReader/SimpleXLSX.php';
|
require $_SERVER['DOCUMENT_ROOT'] . '/spreadSheetReader/SimpleXLSX.php';
|
||||||
require $_SERVER['DOCUMENT_ROOT'] . '/spreadSheetReader/SimpleXLSXGen.php';
|
require $_SERVER['DOCUMENT_ROOT'] . '/spreadSheetReader/SimpleXLSXGen.php';
|
||||||
|
|
||||||
|
function read_xls_file($filename){
|
||||||
|
$fileContent = [];
|
||||||
|
if ($xlsx = SimpleXLSX::parse($filename)) {
|
||||||
|
$fileContent = ($xlsx->rows());
|
||||||
|
} else {
|
||||||
|
echo SimpleXLSX::parseError();
|
||||||
|
}
|
||||||
|
return $fileContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function write_xlsxFile($filename, $data) {
|
||||||
|
$xlsx = SimpleXLSXGen::fromArray($data);
|
||||||
|
$xlsx->saveAs($filename);
|
||||||
|
}
|
||||||
|
|
||||||
function download_xlsxFile($data) {
|
function download_xlsxFile($data) {
|
||||||
$xlsx = SimpleXLSXGen::fromArray($data);
|
$xlsxArray = read_xls_file($_SERVER['DOCUMENT_ROOT'] ."/data/data.xlsx");
|
||||||
|
foreach ($data as $row) {
|
||||||
|
array_push($xlsxArray, $row);
|
||||||
|
}
|
||||||
|
$xlsx = SimpleXLSXGen::fromArray($xlsxArray);
|
||||||
$xlsx->downloadAs("data.xlsx");
|
$xlsx->downloadAs("data.xlsx");
|
||||||
}
|
}
|
Loading…
Reference in New Issue