Compare commits
65 Commits
refactorin
...
main
Author | SHA1 | Date |
---|---|---|
schrom01 | b7c01aa46b | |
schrom01 | ba39872b9e | |
schrom01 | 3866e62e72 | |
schrom01 | c14dc6978e | |
schrom01 | 6aa0eb362d | |
schrom01 | 32df2cde0a | |
schrom01 | e506a864bf | |
schrom01 | 456afc6a12 | |
schrom01 | f0a1149558 | |
schrom01 | ec71770847 | |
schrom01 | 9cc8fb405c | |
schrom01 | bb33e4b319 | |
schrom01 | 5cf7dc2e89 | |
schrom01 | e6c89a06d3 | |
schrom01 | c3f787f14a | |
schrom01 | 5fca34c303 | |
schrom01 | d1768eec8b | |
schrom01 | 0f5c96cffc | |
schrom01 | 987f2138b4 | |
schrom01 | 1a44a68894 | |
schrom01 | a085556519 | |
schrom01 | 3c9dd63f71 | |
schrom01 | 3995f8af9f | |
schrom01 | de0d09f9c8 | |
schrom01 | 80ea8c84f9 | |
schrom01 | d788e22471 | |
schrom01 | 3ecbade48d | |
schrom01 | 0e656e1f6b | |
schrom01 | 5aba2420f8 | |
schrom01 | 170e258b6e | |
schrom01 | 1c22109df7 | |
schrom01 | 7ee78f7f5c | |
schrom01 | f459f4d4a1 | |
schrom01 | 9501370fae | |
schrom01 | 8e2e2ecb61 | |
schrom01 | 5c8dcb4ca4 | |
schrom01 | 46021df0e5 | |
schrom01 | 90cf02939f | |
schrom01 | ad99e62609 | |
schrom01 | 610546c3bd | |
schrom01 | 5642867c93 | |
schrom01 | 856d5a41db | |
schrom01 | 8b2796d00a | |
schrom01 | 41d160b8dc | |
schrom01 | 5a56668c93 | |
schrom01 | 0dccb4bab2 | |
schrom01 | d044804cbb | |
schrom01 | 59eb7aa3ae | |
schrom01 | 6eb32f2b5b | |
schrom01 | cad39e5adb | |
schrom01 | c4795fe336 | |
schrom01 | 6ef5a86477 | |
schrom01 | f66bfa7d51 | |
schrom01 | e797580812 | |
schrom01 | 973e5da155 | |
schrom01 | 0e5864370f | |
schrom01 | 8251d3d97f | |
schrom01 | 4d50ad03bf | |
schrom01 | cc604420f3 | |
schrom01 | 67c5550de6 | |
schrom01 | 20618367e0 | |
schrom01 | 21bf206458 | |
schrom01 | cc4f6d97c0 | |
schrom01 | fbbd126cd6 | |
schrom01 | a9cad34e71 |
|
@ -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'
|
|
@ -1,3 +1,73 @@
|
|||
.active {
|
||||
.activeWatch {
|
||||
background-color: lightgray;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin-left: 10px;
|
||||
margin-top: 25px !important;
|
||||
}
|
||||
|
||||
.table-bordered {
|
||||
width: 100%;
|
||||
table-layout: fixed;
|
||||
text-align: center;
|
||||
/*border: 1px solid #0e0017 !important;*/
|
||||
|
||||
}
|
||||
|
||||
td {
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
button {
|
||||
/*background-color: lightgray;*/
|
||||
/*border: none;*/
|
||||
/*color: white;*/
|
||||
padding: 1% 5%;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
/*font-size: 16px;*/
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
button, .form-group{
|
||||
margin: 5px !important;
|
||||
}
|
||||
|
||||
input {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.stopButton, .resetButton {
|
||||
width: 98% !important;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
width: 98%;
|
||||
}
|
||||
|
||||
.tableHeader {
|
||||
min-width: 100px;
|
||||
}
|
||||
|
||||
html, body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
.wrapper {
|
||||
min-height: 100%;
|
||||
|
||||
/* Equal to height of footer */
|
||||
/* But also accounting for potential margin-bottom of last child */
|
||||
margin-bottom: -200px;
|
||||
}
|
||||
footer,
|
||||
.push {
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
vertical-align: top;
|
||||
text-align: left;
|
||||
}
|
BIN
data/data.xlsx
BIN
data/data.xlsx
Binary file not shown.
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
require $_SERVER['DOCUMENT_ROOT'] . '/spreadSheetReader/read_write_xlsx.php';
|
||||
require $_SERVER['DOCUMENT_ROOT'] . '/databaseConnection/databaseConnection.php';
|
||||
$fileName = $_SERVER['DOCUMENT_ROOT'] . '/data/data.xlsx';
|
||||
function objectToArray($object, $fullJSON) {
|
||||
return [$object -> id,
|
||||
|
@ -13,43 +14,62 @@ function objectToArray($object, $fullJSON) {
|
|||
$object -> countWatchD];
|
||||
}
|
||||
|
||||
function findRowIndex($id, $data) {
|
||||
$rowCounter = -1;
|
||||
foreach ($data as $row) {
|
||||
$rowCounter ++;
|
||||
if($row[0] == $id) {
|
||||
return $rowCounter;
|
||||
}
|
||||
|
||||
$conn = getDatabaseConnection();
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
} else {
|
||||
echo "connection sucessful<br>";
|
||||
}
|
||||
|
||||
function saveToDatabase($contentArray, $conn) {
|
||||
echo "sending Query to Database<br>";
|
||||
$sql1 = "SELECT * FROM `topics` WHERE id='".$contentArray[0]."'";
|
||||
$result1 = $conn->query($sql1);
|
||||
echo "Select Query sent<br>";
|
||||
if($result1->num_rows === 0) {
|
||||
$sql = "INSERT INTO `topics` (`id`, `lastSave`, `fullJSON`, `timeWatchM`,`timeWatchW`, `timeWatchD`, `countWatchM`, `countWatchW`, `countWatchD`) values ('".$contentArray[0]."', ".$contentArray[1]." , '".$contentArray[2]."', ".$contentArray[3].", ".$contentArray[4].", ".$contentArray[5].", ".$contentArray[6].", ".$contentArray[7].", ".$contentArray[8].") ON DUPLICATE KEY UPDATE `id` = '".$contentArray[0]."'";
|
||||
$result = $conn->query($sql);
|
||||
echo "Insert Query sent<br> Result: " . $result;
|
||||
} else {
|
||||
$sql = "UPDATE `topics` SET `id`='".$contentArray[0]."',`lastSave`='".$contentArray[1]."',`fullJSON`='".$contentArray[2]."',`timeWatchM`='".$contentArray[3]."',`timeWatchW`='".$contentArray[4]."',`timeWatchD`='".$contentArray[5]."',`countWatchM`='".$contentArray[6]."',`countWatchW`='".$contentArray[7]."',`countWatchD`='".$contentArray[8]."' WHERE `id` = '".$contentArray[0]."'";
|
||||
$result = $conn->query($sql);
|
||||
echo "Update Query sent<br> Result: " . $result;
|
||||
}
|
||||
return $rowCounter + 1;
|
||||
return;
|
||||
}
|
||||
|
||||
function getFromDatabase($conn) {
|
||||
$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":[]}]}';
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$entityBody = file_get_contents('php://input');
|
||||
$entityBodyObject = json_decode($entityBody);
|
||||
|
||||
echo "POST Request received.<br>";
|
||||
|
||||
if(property_exists($entityBodyObject, "id")) {
|
||||
$data = read_xls_file($fileName);
|
||||
|
||||
foreach ($data as $row) {
|
||||
echo "new Row: <br>";
|
||||
foreach ($row as $cell) {
|
||||
echo $cell." ";
|
||||
}
|
||||
if(! ($entityBodyObject->countWatchM + $entityBodyObject->countWatchW + $entityBodyObject->countWatchD === 0)){
|
||||
saveToDatabase(objectToArray($entityBodyObject, $entityBody), $conn);
|
||||
echo "<br>Data saved.<br>";
|
||||
}
|
||||
|
||||
$rowIndex = findRowIndex($entityBodyObject->id, $data);
|
||||
$data[$rowIndex] = objectToArray($entityBodyObject, $entityBody);
|
||||
write_xlsxFile($fileName, $data);
|
||||
echo "<br>Data saved.<br>";
|
||||
}
|
||||
} elseif($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
download_xlsxFile(getFromDatabase($conn));
|
||||
} else {
|
||||
echo "invalid Request.<br> Type: ".$_SERVER['REQUEST_METHOD'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$conn->close();
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
function getDatabaseConnection() {
|
||||
$databaseAddress = "127.0.0.1";
|
||||
$databasePort = "3306";
|
||||
$databaseName = "u517357132_genderwatchpro";
|
||||
$databaseUser = "u517357132_genderwatchpro";
|
||||
$databasePassword = "zU!7gRHA6x";
|
||||
return new mysqli($databaseAddress, $databaseUser, $databasePassword, $databaseName);
|
||||
}
|
263
index.html
263
index.html
|
@ -1,130 +1,193 @@
|
|||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="css/custom.css">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="css/custom.css?v=1.1">
|
||||
<link rel="stylesheet" href="css/bootstrap.css">
|
||||
<title>Genderwatch-protocol</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<section>
|
||||
<div class="container">
|
||||
<h1>Genderwatch-protocol</h1>
|
||||
<a href="data/data.xlsx">Anonyme Daten herunterladen</a>
|
||||
<h2 style="margin-left: 10px;">Aktuelles Thema</h2>
|
||||
<table class="table-bordered">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input class="form-control" type="text" id="topicInput" placeholder="Thema hier eingeben">
|
||||
</td>
|
||||
<td>
|
||||
<button class="" onclick="closeTopic()">
|
||||
Thema abschliessen
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
M
|
||||
</th>
|
||||
<th>
|
||||
W
|
||||
</th>
|
||||
<th>
|
||||
D
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td id="time-0">
|
||||
0
|
||||
</td>
|
||||
<td id="time-1">
|
||||
0
|
||||
</td>
|
||||
<td id="time-2">
|
||||
0
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="count-0">
|
||||
0
|
||||
</td>
|
||||
<td id="count-1">
|
||||
0
|
||||
</td>
|
||||
<td id="count-2">
|
||||
0
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<button class="" onclick="start(0)">Beginnt zu Reden</button>
|
||||
</td>
|
||||
<td>
|
||||
<button class="" onclick="start(1)">Beginnt zu Reden</button>
|
||||
</td>
|
||||
<td>
|
||||
<button class="" onclick="start(2)">Beginnt zu Reden</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<button class="" style="width: 98%;" onclick="stop()">Hört auf zu Reden, -> Stille</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<button class="" style="width: 98%;" onclick="resetButton()">Reset</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- <nav class="navbar navbar-expand-lg navbar-light bg-light">-->
|
||||
<!-- <a class="navbar-brand" href="index.html">Genderwatch-protocol </a>-->
|
||||
<!-- <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="true" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button>-->
|
||||
<!-- <div class="navbar-collapse collapse show" id="navbarSupportedContent">-->
|
||||
<!-- <ul class="navbar-nav mr-auto">-->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
<H2>Abgeschlossene Themen</H2>
|
||||
<button class="" onclick="buttonDeleteAllClosedTopics()">alle Löschen</button>
|
||||
<table class="table-bordered">
|
||||
<thead>
|
||||
<!-- <li class="nav-item active"> <a class="nav-link" href="index.html">Home</a> </li>-->
|
||||
|
||||
<!-- <li class="nav-item"> <a class="nav-link" href="beschreibung.php">Über uns</a> </li>-->
|
||||
|
||||
|
||||
<!-- </ul>-->
|
||||
<!-- <form class="form-inline my-2 my-lg-0">-->
|
||||
<!-- </form>-->
|
||||
<!-- </div>-->
|
||||
<!-- </nav>-->
|
||||
<div class="wrapper">
|
||||
<section>
|
||||
<div class="container">
|
||||
<h1>Genderwatch-protocol</h1>
|
||||
<a href="dataCollector/dataCollector.php">Alle Daten herunterladen (anonymisiert)</a>
|
||||
<h2>Aktuelles Thema</h2>
|
||||
<table class="table-bordered">
|
||||
<tr>
|
||||
<th style="min-width: 100px;">
|
||||
Thema
|
||||
</th>
|
||||
<th style="min-width: 100px;">
|
||||
<td colspan="2">
|
||||
<div class="form-group">
|
||||
<input class="form-control" type="text" id="topicInput" placeholder="Thema hier eingeben">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<button class="" onclick="closeTopic()">
|
||||
Thema abschliessen
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
M
|
||||
</th>
|
||||
<th style="min-width: 100px;">
|
||||
<th>
|
||||
W
|
||||
</th>
|
||||
<th style="min-width: 100px;">
|
||||
<th>
|
||||
D
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="closedTopicsTable">
|
||||
|
||||
</tbody>
|
||||
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
<tr>
|
||||
<td id="time-0">
|
||||
0
|
||||
</td>
|
||||
<td id="time-1">
|
||||
0
|
||||
</td>
|
||||
<td id="time-2">
|
||||
0
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="count-0">
|
||||
0
|
||||
</td>
|
||||
<td id="count-1">
|
||||
0
|
||||
</td>
|
||||
<td id="count-2">
|
||||
0
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<button class="" onclick="start(0)">Beginnt zu Reden</button>
|
||||
</td>
|
||||
<td>
|
||||
<button class="" onclick="start(1)">Beginnt zu Reden</button>
|
||||
</td>
|
||||
<td>
|
||||
<button class="" onclick="start(2)">Beginnt zu Reden</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<button class="stopButton" onclick="stop()">Hört auf zu Reden, -> Stille</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<button class="resetButton" onclick="resetButton()">Reset</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
<H2>Abgeschlossene Themen</H2>
|
||||
<button class="" onclick="buttonDeleteAllClosedTopics()">alle Löschen</button>
|
||||
<table class="table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableHeader">
|
||||
Thema
|
||||
</th>
|
||||
<th class="tableHeader">
|
||||
M
|
||||
</th>
|
||||
<th class="tableHeader">
|
||||
W
|
||||
</th>
|
||||
<th class="tableHeader">
|
||||
D
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="closedTopicsTable">
|
||||
|
||||
</tbody>
|
||||
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
<div class="push"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<footer class="text-center">
|
||||
<div class="container footer">
|
||||
<div class="row">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="footer">
|
||||
<div class="col-12">
|
||||
<p><span><b>Impressum</b></span><br>
|
||||
Maurus Pfalzgraf<br>
|
||||
<a href="mailto:info@genderwatchprotocol.com">info@genderwatchprotocol.com</a></p>
|
||||
</div>
|
||||
</td>
|
||||
<td class="footer">
|
||||
<div class="col-12">
|
||||
<p><span><b>Erstellt durch</b></span><br>
|
||||
Silias KLG<br>
|
||||
Toggenburgstrasse 31<br>
|
||||
8245 Feuerthalen<br>
|
||||
<a href="https://www.silias.ch" target="_blank">www.silias.ch</a><br>
|
||||
<a href="mailto:info@silias.ch">info@silias.ch</a><br>
|
||||
<a href="https://gitea.silias.ch/Silias-Public/genderwatchprotocol">Projekt Repository</a>
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</footer>
|
||||
|
||||
<script src="js/functions.js"></script>
|
||||
<script>
|
||||
closedTopics = JSON.parse(localStorage.getItem("closedTopics"))
|
||||
try {
|
||||
closedTopics = JSON.parse(localStorage.getItem("closedTopics"))
|
||||
} catch (e) {
|
||||
closedTopics = []
|
||||
}
|
||||
if(!closedTopics) {
|
||||
closedTopics = []
|
||||
}
|
||||
|
||||
actualTopic = JSON.parse(localStorage.getItem("actualTopic"))
|
||||
try{
|
||||
actualTopic = JSON.parse(localStorage.getItem("actualTopic"))
|
||||
} catch (e) {
|
||||
initializeNewTopic()
|
||||
}
|
||||
if(!actualTopic) {
|
||||
initializeNewTopic()
|
||||
}
|
||||
|
|
|
@ -138,9 +138,9 @@ function refreshWatch(watchIndex) {
|
|||
let timeCell = document.getElementById("time-" + watchIndex)
|
||||
timeCell.textContent = timeToISO(sumForWatch(actualTopic.watches[watchIndex]))
|
||||
if(actualTopic.watches[watchIndex]["actions"].length !== 0 && actualTopic.watches[watchIndex]["actions"].slice(-1)[0]["type"] === "start"){
|
||||
timeCell.classList.add("active")
|
||||
timeCell.classList.add("activeWatch")
|
||||
} else {
|
||||
timeCell.classList.remove("active")
|
||||
timeCell.classList.remove("activeWatch")
|
||||
}
|
||||
let countCell = document.getElementById("count-" + watchIndex)
|
||||
countCell.textContent = countForWatch(actualTopic.watches[watchIndex]) + " Wortmeldungen"
|
||||
|
@ -192,10 +192,26 @@ function saveActualTopicName() {
|
|||
function saveActualTopic() {
|
||||
//save it to LocalStorage
|
||||
localStorage.setItem("actualTopic", JSON.stringify(actualTopic))
|
||||
|
||||
//save it to Server
|
||||
fetch(document.URL + "dataCollector/dataCollector.php", {
|
||||
method: 'POST',
|
||||
headers: { 'Content-type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
"lastSave": new Date().getTime(),
|
||||
"timeWatchM": sumForWatch(actualTopic.watches[0]),
|
||||
"timeWatchW": sumForWatch(actualTopic.watches[1]),
|
||||
"timeWatchD": sumForWatch(actualTopic.watches[2]),
|
||||
"countWatchM": countForWatch(actualTopic.watches[0]),
|
||||
"countWatchW": countForWatch(actualTopic.watches[1]),
|
||||
"countWatchD": countForWatch(actualTopic.watches[2]),
|
||||
"id": actualTopic.id,
|
||||
"watches": actualTopic.watches
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function saveClosedTopics() {
|
||||
//save it to LocalStorage
|
||||
localStorage.setItem("closedTopics", JSON.stringify(closedTopics))
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
require $_SERVER['DOCUMENT_ROOT'] . '/spreadSheetReader/SimpleXLSX.php';
|
||||
require $_SERVER['DOCUMENT_ROOT'] . '/spreadSheetReader/SimpleXLSXGen.php';
|
||||
|
||||
function read_xls_file($filename){
|
||||
$fileContent = [];
|
||||
if ($xlsx = SimpleXLSX::parse($filename)) {
|
||||
|
@ -16,4 +17,13 @@ function read_xls_file($filename){
|
|||
function write_xlsxFile($filename, $data) {
|
||||
$xlsx = SimpleXLSXGen::fromArray($data);
|
||||
$xlsx->saveAs($filename);
|
||||
}
|
||||
|
||||
function download_xlsxFile($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");
|
||||
}
|
Loading…
Reference in New Issue