Compare commits
No commits in common. "930bd7de4bb4917caa5033fd0b3054f691484ef7" and "403099ebd6405c1450651ee085b9ba9bffd8a686" have entirely different histories.
930bd7de4b
...
403099ebd6
BIN
data/data.xlsx
BIN
data/data.xlsx
Binary file not shown.
|
@ -1,44 +0,0 @@
|
||||||
<?php
|
|
||||||
$fileName = $_SERVER['DOCUMENT_ROOT'] . '/data/data.xlsx';
|
|
||||||
function objectToArray($object, $fullJSON) {
|
|
||||||
return [$object -> id,
|
|
||||||
$object -> lastSave,
|
|
||||||
$fullJSON,
|
|
||||||
$object -> timeWatchM,
|
|
||||||
$object -> timeWatchW,
|
|
||||||
$object -> timeWatchD,
|
|
||||||
$object -> countWatchM,
|
|
||||||
$object -> countWatchW,
|
|
||||||
$object -> countWatchD];
|
|
||||||
}
|
|
||||||
|
|
||||||
function findRowIndex($id, $data) {
|
|
||||||
$rowCounter = -1;
|
|
||||||
foreach ($data as $row) {
|
|
||||||
$rowCounter ++;
|
|
||||||
if($row[0] == $id) {
|
|
||||||
return $rowCounter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $rowCounter + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$entityBody = '{"lastSave": 0, "timeWatchM": 23, "timeWatchW": 89, "timeWatchD": 34, "countWatchM": 65, "countWatchW": 56, "countWatchD": 9, "id":"test","watches":[{"actions":[]},{"actions":[]},{"actions":[]}]}';
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'PUT') {
|
|
||||||
$entityBody = file_get_contents('php://input');
|
|
||||||
}
|
|
||||||
|
|
||||||
$entityBodyObject = json_decode($entityBody);
|
|
||||||
|
|
||||||
|
|
||||||
require $_SERVER['DOCUMENT_ROOT'] . '/spreadSheetReader/read_write_xlsx.php';
|
|
||||||
if(property_exists($entityBodyObject, "id")) {
|
|
||||||
$data = read_xls_file($fileName);
|
|
||||||
$rowIndex = findRowIndex($entityBodyObject->id, $data);
|
|
||||||
$data[$rowIndex] = objectToArray($entityBodyObject, $entityBody);
|
|
||||||
write_xlsxFile($fileName, $data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
281
index.html
281
index.html
|
@ -1,141 +1,142 @@
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel="stylesheet" href="css/custom.css">
|
<link rel="stylesheet" href="css/custom.css">
|
||||||
<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>
|
||||||
<section>
|
<section>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Genderwatch-protocol</h1>
|
<h1>Genderwatch-protocol</h1>
|
||||||
<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>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<input class="form-control" type="text" id="topicInput" placeholder="Thema hier eingeben">
|
<input class="form-control" type="text" id="topicInput" placeholder="Thema hier eingeben">
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="" onclick="closeTopic()">
|
<button class="" onclick="closeTopic()">
|
||||||
Thema abschliessen
|
Thema abschliessen
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
M
|
M
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
W
|
W
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
D
|
D
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td id="time-0">
|
<td id="time-0">
|
||||||
0
|
0
|
||||||
</td>
|
</td>
|
||||||
<td id="time-1">
|
<td id="time-1">
|
||||||
0
|
0
|
||||||
</td>
|
</td>
|
||||||
<td id="time-2">
|
<td id="time-2">
|
||||||
0
|
0
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td id="count-0">
|
<td id="count-0">
|
||||||
0
|
0
|
||||||
</td>
|
</td>
|
||||||
<td id="count-1">
|
<td id="count-1">
|
||||||
0
|
0
|
||||||
</td>
|
</td>
|
||||||
<td id="count-2">
|
<td id="count-2">
|
||||||
0
|
0
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<button class="" onclick="start(0)">Beginnt zu Reden</button>
|
<button class="" onclick="start(0)">Beginnt zu Reden</button>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="" onclick="start(1)">Beginnt zu Reden</button>
|
<button class="" onclick="start(1)">Beginnt zu Reden</button>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="" onclick="start(2)">Beginnt zu Reden</button>
|
<button class="" onclick="start(2)">Beginnt zu Reden</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3">
|
<td colspan="3">
|
||||||
<button class="" style="width: 98%;" onclick="stop()">Hört auf zu Reden, -> Stille</button>
|
<button class="" style="width: 98%;" onclick="stop()">Hört auf zu Reden, -> Stille</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3">
|
<td colspan="3">
|
||||||
<button class="" style="width: 98%;" onclick="resetButton()">Reset</button>
|
<button class="" style="width: 98%;" onclick="resetButton()">Reset</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
|
|
||||||
<H2>Abgeschlossene Themen</H2>
|
<H2>Abgeschlossene Themen</H2>
|
||||||
<button class="" onclick="buttonDeleteAllClosedTopics()">alle Löschen</button>
|
<button class="" onclick="buttonDeleteAllClosedTopics()">alle Löschen</button>
|
||||||
<table class="table-bordered">
|
<table class="table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="min-width: 100px;">
|
<th style="min-width: 100px;">
|
||||||
Thema
|
Thema
|
||||||
</th>
|
</th>
|
||||||
<th style="min-width: 100px;">
|
<th style="min-width: 100px;">
|
||||||
M
|
M
|
||||||
</th>
|
</th>
|
||||||
<th style="min-width: 100px;">
|
<th style="min-width: 100px;">
|
||||||
W
|
W
|
||||||
</th>
|
</th>
|
||||||
<th style="min-width: 100px;">
|
<th style="min-width: 100px;">
|
||||||
D
|
D
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="closedTopicsTable">
|
<tbody id="closedTopicsTable">
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
<script src="js/functions.js"></script>
|
<script src="js/functions.js"></script>
|
||||||
<script>
|
<script>
|
||||||
closedTopics = JSON.parse(localStorage.getItem("closedTopics"))
|
closedTopics = JSON.parse(localStorage.getItem("closedTopics"))
|
||||||
if(!closedTopics) {
|
if(!closedTopics) {
|
||||||
closedTopics = []
|
closedTopics = []
|
||||||
}
|
}
|
||||||
|
|
||||||
actualTopic = JSON.parse(localStorage.getItem("actualTopic"))
|
actualTopic = JSON.parse(localStorage.getItem("actualTopic"))
|
||||||
if(!actualTopic) {
|
if(!actualTopic) {
|
||||||
initializeNewTopic()
|
actualTopic = {}
|
||||||
}
|
reset()
|
||||||
document.getElementById("topicInput").value = actualTopic.name
|
}
|
||||||
|
document.getElementById("topicInput").value = actualTopic.name
|
||||||
document.getElementById("topicInput").addEventListener('keyup', saveActualTopicName);
|
|
||||||
refreshClosedTopics()
|
document.getElementById("topicInput").addEventListener('keyup', saveActualTopicName);
|
||||||
setInterval(() => {
|
refreshClosedTopics()
|
||||||
refreshWatch(0)
|
setInterval(() => {
|
||||||
refreshWatch(1)
|
refreshWatch(0)
|
||||||
refreshWatch(2)
|
refreshWatch(1)
|
||||||
}, 100);
|
refreshWatch(2)
|
||||||
</script>
|
}, 100);
|
||||||
</body>
|
</script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -1,12 +1,6 @@
|
||||||
function initializeNewTopic() {
|
|
||||||
actualTopic = {"name": "", "id": randomId()}
|
|
||||||
reset()
|
|
||||||
document.getElementById("topicInput").value = actualTopic.name
|
|
||||||
}
|
|
||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
actualTopic.watches = [{"actions": []}, {"actions": []}, {"actions": []}]
|
actualTopic.watches = [{"actions": []}, {"actions": []}, {"actions": []}]
|
||||||
saveActualTopic()
|
saveActualTopicToLocalStorage()
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetButton() {
|
function resetButton() {
|
||||||
|
@ -18,7 +12,7 @@ function resetButton() {
|
||||||
function buttonDeleteAllClosedTopics() {
|
function buttonDeleteAllClosedTopics() {
|
||||||
if(confirm("Sollen alle abgeschlossenen Themen gelöscht werden?")) {
|
if(confirm("Sollen alle abgeschlossenen Themen gelöscht werden?")) {
|
||||||
closedTopics = []
|
closedTopics = []
|
||||||
saveClosedTopics()
|
saveClosedTopicsToLocalStorage()
|
||||||
refreshClosedTopics()
|
refreshClosedTopics()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,14 +43,17 @@ function closeTopic() {
|
||||||
}
|
}
|
||||||
actualTopic.name = name
|
actualTopic.name = name
|
||||||
closedTopics.push(actualTopic)
|
closedTopics.push(actualTopic)
|
||||||
saveClosedTopics()
|
actualTopic = {"name": ""}
|
||||||
|
reset()
|
||||||
|
document.getElementById("topicInput").value = actualTopic.name
|
||||||
|
saveActualTopicToLocalStorage()
|
||||||
|
saveClosedTopicsToLocalStorage()
|
||||||
refreshClosedTopics()
|
refreshClosedTopics()
|
||||||
initializeNewTopic()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteTopic(topicIndex) {
|
function deleteTopic(topicIndex) {
|
||||||
closedTopics = closedTopics.slice(0, topicIndex).concat(closedTopics.slice(topicIndex+1))
|
closedTopics = closedTopics.slice(0, topicIndex).concat(closedTopics.slice(topicIndex+1))
|
||||||
saveClosedTopics()
|
saveClosedTopicsToLocalStorage()
|
||||||
refreshClosedTopics()
|
refreshClosedTopics()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,14 +64,14 @@ function reopenTopic(topicIndex) {
|
||||||
actualTopic = closedTopics[topicIndex]
|
actualTopic = closedTopics[topicIndex]
|
||||||
document.getElementById("topicInput").value = actualTopic.name
|
document.getElementById("topicInput").value = actualTopic.name
|
||||||
deleteTopic(topicIndex)
|
deleteTopic(topicIndex)
|
||||||
saveClosedTopics()
|
saveClosedTopicsToLocalStorage()
|
||||||
saveActualTopic()
|
saveActualTopicToLocalStorage()
|
||||||
}
|
}
|
||||||
|
|
||||||
function start(watchIndex) {
|
function start(watchIndex) {
|
||||||
stop()
|
stop()
|
||||||
actualTopic.watches[watchIndex].actions.push({"type": "start", "time": new Date().getTime()})
|
actualTopic.watches[watchIndex].actions.push({"type": "start", "time": new Date().getTime()})
|
||||||
saveActualTopic()
|
saveActualTopicToLocalStorage()
|
||||||
}
|
}
|
||||||
|
|
||||||
function stop() {
|
function stop() {
|
||||||
|
@ -85,7 +82,7 @@ function stop() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
saveActualTopic()
|
saveActualTopicToLocalStorage()
|
||||||
}
|
}
|
||||||
|
|
||||||
function calcPercForWatch(watchIndex, topic) {
|
function calcPercForWatch(watchIndex, topic) {
|
||||||
|
@ -184,18 +181,14 @@ function refreshClosedTopics() {
|
||||||
|
|
||||||
function saveActualTopicName() {
|
function saveActualTopicName() {
|
||||||
actualTopic.name = document.getElementById("topicInput").value
|
actualTopic.name = document.getElementById("topicInput").value
|
||||||
saveActualTopic()
|
saveActualTopicToLocalStorage()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function saveActualTopicToLocalStorage() {
|
||||||
|
|
||||||
function saveActualTopic() {
|
|
||||||
//save it to LocalStorage
|
|
||||||
localStorage.setItem("actualTopic", JSON.stringify(actualTopic))
|
localStorage.setItem("actualTopic", JSON.stringify(actualTopic))
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveClosedTopics() {
|
function saveClosedTopicsToLocalStorage() {
|
||||||
//save it to LocalStorage
|
|
||||||
localStorage.setItem("closedTopics", JSON.stringify(closedTopics))
|
localStorage.setItem("closedTopics", JSON.stringify(closedTopics))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,10 +204,4 @@ function elt (type, attrs, ...children) {
|
||||||
else node.appendChild(document.createTextNode(child))
|
else node.appendChild(document.createTextNode(child))
|
||||||
}
|
}
|
||||||
return node
|
return node
|
||||||
}
|
|
||||||
|
|
||||||
// random.ts
|
|
||||||
function randomId() {
|
|
||||||
const uint32 = window.crypto.getRandomValues(new Uint32Array(1))[0];
|
|
||||||
return uint32.toString(16);
|
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,28 +0,0 @@
|
||||||
<?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)) {
|
|
||||||
$fileContent = ($xlsx->rows());
|
|
||||||
} else {
|
|
||||||
echo SimpleXLSX::parseError();
|
|
||||||
}
|
|
||||||
return $fileContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function write_xlsxFile($filename, $data) {
|
|
||||||
|
|
||||||
foreach ($data as $row) {
|
|
||||||
echo "new Row: <br>";
|
|
||||||
foreach ($row as $cell) {
|
|
||||||
echo $cell." ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$xlsx = SimpleXLSXGen::fromArray($data);
|
|
||||||
$xlsx->saveAs($filename);
|
|
||||||
}
|
|
Loading…
Reference in New Issue