Compare commits
No commits in common. "main" and "refactoring_object_handling" have entirely different histories.
main
...
refactorin
|
@ -1,3 +0,0 @@
|
||||||
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,73 +1,3 @@
|
||||||
.activeWatch {
|
.active {
|
||||||
background-color: lightgray;
|
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,6 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
require $_SERVER['DOCUMENT_ROOT'] . '/spreadSheetReader/read_write_xlsx.php';
|
require $_SERVER['DOCUMENT_ROOT'] . '/spreadSheetReader/read_write_xlsx.php';
|
||||||
require $_SERVER['DOCUMENT_ROOT'] . '/databaseConnection/databaseConnection.php';
|
|
||||||
$fileName = $_SERVER['DOCUMENT_ROOT'] . '/data/data.xlsx';
|
$fileName = $_SERVER['DOCUMENT_ROOT'] . '/data/data.xlsx';
|
||||||
function objectToArray($object, $fullJSON) {
|
function objectToArray($object, $fullJSON) {
|
||||||
return [$object -> id,
|
return [$object -> id,
|
||||||
|
@ -14,62 +13,43 @@ function objectToArray($object, $fullJSON) {
|
||||||
$object -> countWatchD];
|
$object -> countWatchD];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function findRowIndex($id, $data) {
|
||||||
$conn = getDatabaseConnection();
|
$rowCounter = -1;
|
||||||
// Check connection
|
foreach ($data as $row) {
|
||||||
if ($conn->connect_error) {
|
$rowCounter ++;
|
||||||
die("Connection failed: " . $conn->connect_error);
|
if($row[0] == $id) {
|
||||||
} else {
|
return $rowCounter;
|
||||||
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;
|
return $rowCounter + 1;
|
||||||
}
|
|
||||||
|
|
||||||
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":[]}]}';
|
$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');
|
$entityBody = file_get_contents('php://input');
|
||||||
$entityBodyObject = json_decode($entityBody);
|
$entityBodyObject = json_decode($entityBody);
|
||||||
|
|
||||||
echo "POST Request received.<br>";
|
echo "POST Request received.<br>";
|
||||||
|
|
||||||
if(property_exists($entityBodyObject, "id")) {
|
if(property_exists($entityBodyObject, "id")) {
|
||||||
if(! ($entityBodyObject->countWatchM + $entityBodyObject->countWatchW + $entityBodyObject->countWatchD === 0)){
|
$data = read_xls_file($fileName);
|
||||||
saveToDatabase(objectToArray($entityBodyObject, $entityBody), $conn);
|
|
||||||
echo "<br>Data saved.<br>";
|
foreach ($data as $row) {
|
||||||
|
echo "new Row: <br>";
|
||||||
|
foreach ($row as $cell) {
|
||||||
|
echo $cell." ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$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();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
<?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);
|
|
||||||
}
|
|
259
index.html
259
index.html
|
@ -1,193 +1,130 @@
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<link rel="stylesheet" href="css/custom.css">
|
||||||
<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">
|
<link rel="stylesheet" href="css/bootstrap.css">
|
||||||
<title>Genderwatch-protocol</title>
|
<title>Genderwatch-protocol</title>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- <nav class="navbar navbar-expand-lg navbar-light bg-light">-->
|
<section>
|
||||||
<!-- <a class="navbar-brand" href="index.html">Genderwatch-protocol </a>-->
|
<div class="container">
|
||||||
<!-- <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>-->
|
<h1>Genderwatch-protocol</h1>
|
||||||
<!-- <div class="navbar-collapse collapse show" id="navbarSupportedContent">-->
|
<a href="data/data.xlsx">Anonyme Daten herunterladen</a>
|
||||||
<!-- <ul class="navbar-nav mr-auto">-->
|
<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>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- <li class="nav-item active"> <a class="nav-link" href="index.html">Home</a> </li>-->
|
<div class="container">
|
||||||
|
|
||||||
<!-- <li class="nav-item"> <a class="nav-link" href="beschreibung.php">Über uns</a> </li>-->
|
|
||||||
|
<H2>Abgeschlossene Themen</H2>
|
||||||
|
<button class="" onclick="buttonDeleteAllClosedTopics()">alle Löschen</button>
|
||||||
<!-- </ul>-->
|
<table class="table-bordered">
|
||||||
<!-- <form class="form-inline my-2 my-lg-0">-->
|
<thead>
|
||||||
<!-- </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>
|
<tr>
|
||||||
<td colspan="2">
|
<th style="min-width: 100px;">
|
||||||
<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>
|
|
||||||
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="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
|
Thema
|
||||||
</th>
|
</th>
|
||||||
<th class="tableHeader">
|
<th style="min-width: 100px;">
|
||||||
M
|
M
|
||||||
</th>
|
</th>
|
||||||
<th class="tableHeader">
|
<th style="min-width: 100px;">
|
||||||
W
|
W
|
||||||
</th>
|
</th>
|
||||||
<th class="tableHeader">
|
<th style="min-width: 100px;">
|
||||||
D
|
D
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="closedTopicsTable">
|
<tbody id="closedTopicsTable">
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
</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>
|
</div>
|
||||||
</footer>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
<script src="js/functions.js"></script>
|
<script src="js/functions.js"></script>
|
||||||
<script>
|
<script>
|
||||||
try {
|
closedTopics = JSON.parse(localStorage.getItem("closedTopics"))
|
||||||
closedTopics = JSON.parse(localStorage.getItem("closedTopics"))
|
|
||||||
} catch (e) {
|
|
||||||
closedTopics = []
|
|
||||||
}
|
|
||||||
if(!closedTopics) {
|
if(!closedTopics) {
|
||||||
closedTopics = []
|
closedTopics = []
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
actualTopic = JSON.parse(localStorage.getItem("actualTopic"))
|
||||||
actualTopic = JSON.parse(localStorage.getItem("actualTopic"))
|
|
||||||
} catch (e) {
|
|
||||||
initializeNewTopic()
|
|
||||||
}
|
|
||||||
if(!actualTopic) {
|
if(!actualTopic) {
|
||||||
initializeNewTopic()
|
initializeNewTopic()
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,9 +138,9 @@ function refreshWatch(watchIndex) {
|
||||||
let timeCell = document.getElementById("time-" + watchIndex)
|
let timeCell = document.getElementById("time-" + watchIndex)
|
||||||
timeCell.textContent = timeToISO(sumForWatch(actualTopic.watches[watchIndex]))
|
timeCell.textContent = timeToISO(sumForWatch(actualTopic.watches[watchIndex]))
|
||||||
if(actualTopic.watches[watchIndex]["actions"].length !== 0 && actualTopic.watches[watchIndex]["actions"].slice(-1)[0]["type"] === "start"){
|
if(actualTopic.watches[watchIndex]["actions"].length !== 0 && actualTopic.watches[watchIndex]["actions"].slice(-1)[0]["type"] === "start"){
|
||||||
timeCell.classList.add("activeWatch")
|
timeCell.classList.add("active")
|
||||||
} else {
|
} else {
|
||||||
timeCell.classList.remove("activeWatch")
|
timeCell.classList.remove("active")
|
||||||
}
|
}
|
||||||
let countCell = document.getElementById("count-" + watchIndex)
|
let countCell = document.getElementById("count-" + watchIndex)
|
||||||
countCell.textContent = countForWatch(actualTopic.watches[watchIndex]) + " Wortmeldungen"
|
countCell.textContent = countForWatch(actualTopic.watches[watchIndex]) + " Wortmeldungen"
|
||||||
|
@ -192,26 +192,10 @@ function saveActualTopicName() {
|
||||||
function saveActualTopic() {
|
function saveActualTopic() {
|
||||||
//save it to LocalStorage
|
//save it to LocalStorage
|
||||||
localStorage.setItem("actualTopic", JSON.stringify(actualTopic))
|
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() {
|
function saveClosedTopics() {
|
||||||
|
//save it to LocalStorage
|
||||||
localStorage.setItem("closedTopics", JSON.stringify(closedTopics))
|
localStorage.setItem("closedTopics", JSON.stringify(closedTopics))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
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){
|
function read_xls_file($filename){
|
||||||
$fileContent = [];
|
$fileContent = [];
|
||||||
if ($xlsx = SimpleXLSX::parse($filename)) {
|
if ($xlsx = SimpleXLSX::parse($filename)) {
|
||||||
|
@ -17,13 +16,4 @@ function read_xls_file($filename){
|
||||||
function write_xlsxFile($filename, $data) {
|
function write_xlsxFile($filename, $data) {
|
||||||
$xlsx = SimpleXLSXGen::fromArray($data);
|
$xlsx = SimpleXLSXGen::fromArray($data);
|
||||||
$xlsx->saveAs($filename);
|
$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