From 100df25f42a6ac66aa04cdfe07ceea42fb9a9b69 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 14:57:44 +0200 Subject: [PATCH 001/191] Small code improvement for creating experiments --- views/builder/create.php | 61 +++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 32 deletions(-) diff --git a/views/builder/create.php b/views/builder/create.php index b36d8d8123..5049787960 100644 --- a/views/builder/create.php +++ b/views/builder/create.php @@ -152,9 +152,8 @@ function checkPercentageIntervals(dependency){ "); ?> - -
-
+ +
@@ -166,7 +165,6 @@ function checkPercentageIntervals(dependency){
  • Create Experiment
  • -
    @@ -221,36 +219,35 @@ function checkPercentageIntervals(dependency){
    -
    - -
    -
    + \ No newline at end of file From 32a2125060a37d5919e78d79829ad6c4f143db15 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 15:07:29 +0200 Subject: [PATCH 002/191] Small code improvement for creating experiments --- views/builder/create.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/views/builder/create.php b/views/builder/create.php index 5049787960..b6a38cca46 100644 --- a/views/builder/create.php +++ b/views/builder/create.php @@ -152,8 +152,8 @@ function checkPercentageIntervals(dependency){ "); ?> -
    -
    +
    +
    @@ -219,7 +219,6 @@ function checkPercentageIntervals(dependency){
    -
    - -
    \ No newline at end of file + + From 04afa2c4fcde1e261152b9df04d9bb1401e89f27 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 15:09:22 +0200 Subject: [PATCH 003/191] Small code improvement for creating experiments --- views/builder/create.php | 45 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/views/builder/create.php b/views/builder/create.php index b6a38cca46..869874d653 100644 --- a/views/builder/create.php +++ b/views/builder/create.php @@ -219,30 +219,31 @@ function checkPercentageIntervals(dependency){ - From 0853611f2a8919917a8eab0078c78627360a6a2d Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 17:56:54 +0200 Subject: [PATCH 004/191] Expermineting to drag results --- api/ui/results.php | 1 + core/api.php | 13 ++++++++++--- templates/builder/plotbox.template.html | 2 +- views/results/build.php | 8 +++++++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index ab79f90636..943300f9c9 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -64,6 +64,7 @@ public function get() { $element = $builder->getElementFromIdentifier($this->get['type']); $template = $element->getBuildTemplate(); $this->add(base64_encode($template->render(['id' => $this->get['uid'], 'name' => '', 'parameter' => '']))); + echo $this->data; } else { throw new Exception("Not enough data provided for action 'newplot'!"); } diff --git a/core/api.php b/core/api.php index 4f98ac735e..ccd4b5c4fd 100644 --- a/core/api.php +++ b/core/api.php @@ -59,14 +59,21 @@ public function __construct($getVars) { * @throws Exception */ public function get() { - throw new Exception('The action GET is not defined!'); + if(!$this->data==null) { + return $this->data; + } + else { + throw new Exception('$this->data is null'); + } + //throw new Exception('The action GET is not defined!'); } /** * @throws Exception */ - public function post() { - throw new Exception('The action POST is not defined!'); + public function post($data) { + $this->data = $data; + //throw new Exception('The action POST is not defined!'); } /** diff --git a/templates/builder/plotbox.template.html b/templates/builder/plotbox.template.html index 5d9e8e9a89..5403300548 100644 --- a/templates/builder/plotbox.template.html +++ b/templates/builder/plotbox.template.html @@ -1,5 +1,5 @@
    -
    +

    [[title]]

    diff --git a/views/results/build.php b/views/results/build.php index 409322f1e6..dc3009ed70 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -70,7 +70,13 @@ function deletePlot(id){ $(\"#\" + id).remove(); } } - + function swapPlot(arr, index1, index2) { + if (index1 >= 0 && index1 < arr.length && index2 >= 0 && index2 < arr.length) { + var temp = arr[index1]; + arr[index1] = arr[index2]; + arr[index2] = temp; + } + } function saveBuild(){ var top = $('#build-content'); var data = []; From 87c79ff92c54978f99854b5866c5b39e9a2b9e16 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 18:01:32 +0200 Subject: [PATCH 005/191] Expermineting to drag results --- templates/builder/plotbox.template.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/builder/plotbox.template.html b/templates/builder/plotbox.template.html index 5403300548..517cba8f63 100644 --- a/templates/builder/plotbox.template.html +++ b/templates/builder/plotbox.template.html @@ -1,6 +1,10 @@

    [[title]]

    +
    + + +
    From f3896369f457f5c12e2846a03383086ebd677038 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 18:02:45 +0200 Subject: [PATCH 006/191] Expermineting to drag results --- templates/builder/plotbox.template.html | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/templates/builder/plotbox.template.html b/templates/builder/plotbox.template.html index 517cba8f63..5d9e8e9a89 100644 --- a/templates/builder/plotbox.template.html +++ b/templates/builder/plotbox.template.html @@ -1,10 +1,6 @@
    -
    +

    [[title]]

    -
    - - -
    From 2a5a69591799e2f09272175beb8b24e0f53740ed Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 18:04:46 +0200 Subject: [PATCH 007/191] Expermineting to drag results --- templates/experiment/dependentGroup.template.html | 2 +- templates/experiment/group.template.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/experiment/dependentGroup.template.html b/templates/experiment/dependentGroup.template.html index 56763e6403..019771636a 100644 --- a/templates/experiment/dependentGroup.template.html +++ b/templates/experiment/dependentGroup.template.html @@ -1,7 +1,7 @@
    -

    [[title]]

    +

    [[title]] +

    [[content]] diff --git a/templates/experiment/group.template.html b/templates/experiment/group.template.html index 8e47e2fdfe..792d8da597 100644 --- a/templates/experiment/group.template.html +++ b/templates/experiment/group.template.html @@ -1,7 +1,7 @@
    -

    [[title]]

    +

    [[title]] -

    [[content]] From fcb5a524b0130a25d8bd1ce57a56da6dc0cda339 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 18:05:13 +0200 Subject: [PATCH 008/191] Expermineting to drag results --- templates/experiment/dependentGroup.template.html | 2 +- templates/experiment/group.template.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/experiment/dependentGroup.template.html b/templates/experiment/dependentGroup.template.html index 019771636a..56763e6403 100644 --- a/templates/experiment/dependentGroup.template.html +++ b/templates/experiment/dependentGroup.template.html @@ -1,7 +1,7 @@
    -

    [[title]] +

    +

    [[title]]

    [[content]] diff --git a/templates/experiment/group.template.html b/templates/experiment/group.template.html index 792d8da597..8e47e2fdfe 100644 --- a/templates/experiment/group.template.html +++ b/templates/experiment/group.template.html @@ -1,7 +1,7 @@
    -

    [[title]] -

    +

    [[title]]

    [[content]] From db871ec526a7e2133c1d5563b3fb04f89e9b1357 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 18:34:36 +0200 Subject: [PATCH 009/191] Expermineting to drag results --- core/api.php | 33 ++++++++++++------- libraries/graphs/bar-plot/build.template.html | 6 +++- views/results/build.php | 10 ++++-- 3 files changed, 35 insertions(+), 14 deletions(-) diff --git a/core/api.php b/core/api.php index ccd4b5c4fd..e8bfeab4f8 100644 --- a/core/api.php +++ b/core/api.php @@ -59,21 +59,14 @@ public function __construct($getVars) { * @throws Exception */ public function get() { - if(!$this->data==null) { - return $this->data; - } - else { - throw new Exception('$this->data is null'); - } - //throw new Exception('The action GET is not defined!'); + throw new Exception('The action GET is not defined!'); } /** * @throws Exception */ - public function post($data) { - $this->data = $data; - //throw new Exception('The action POST is not defined!'); + public function post() { + throw new Exception('The action POST is not defined!'); } /** @@ -180,7 +173,25 @@ private function buildJsonEnvelope() { } echo json_encode($json); } - + + private function swap($direction, $id) { + echo $this->data; + if($direction==='down') { + foreach ($this->data as $index => $value) { + if (isset($this->data['id']) && this->data['id'] === $id) { + if ($index < count($this->data) - 1) { + // Swap the element with the next element + $temp = $this->data[$index]; + $this->data[$index] = $this->data[$index + 1]; + $this->data[$index + 1] = $temp; + } + // No need to continue the loop once we've found and swapped the element + break; + } + } + echo $this->data; + } + } /** * Destructor: Renders the output diff --git a/libraries/graphs/bar-plot/build.template.html b/libraries/graphs/bar-plot/build.template.html index e739af3db3..643bc704b3 100644 --- a/libraries/graphs/bar-plot/build.template.html +++ b/libraries/graphs/bar-plot/build.template.html @@ -1,6 +1,10 @@
    -
    +

    Bar Plot

    +
    + + +
    diff --git a/views/results/build.php b/views/results/build.php index dc3009ed70..0ef65ed5ac 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -70,12 +70,18 @@ function deletePlot(id){ $(\"#\" + id).remove(); } } - function swapPlot(arr, index1, index2) { - if (index1 >= 0 && index1 < arr.length && index2 >= 0 && index2 < arr.length) { + function movePlots(direction, id) { + if (direction == 'up') { + $this.swapUp('up') var temp = arr[index1]; arr[index1] = arr[index2]; arr[index2] = temp; } + elif (direction == 'down') { + } + else { + alert('direction is neither up or down'); + } } function saveBuild(){ var top = $('#build-content'); From 595ab9ce636a16859e2078f263999f7a09b46df9 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 18:37:05 +0200 Subject: [PATCH 010/191] Expermineting to drag results --- views/results/build.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/views/results/build.php b/views/results/build.php index 0ef65ed5ac..a71ff39e46 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -72,12 +72,10 @@ function deletePlot(id){ } function movePlots(direction, id) { if (direction == 'up') { - $this.swapUp('up') - var temp = arr[index1]; - arr[index1] = arr[index2]; - arr[index2] = temp; + swap('up'); } elif (direction == 'down') { + swap('down'); } else { alert('direction is neither up or down'); From 1ada3038c4a690b40b54cce657213e639c78a054 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 18:37:54 +0200 Subject: [PATCH 011/191] Expermineting to drag results --- libraries/graphs/bar-plot/build.template.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/graphs/bar-plot/build.template.html b/libraries/graphs/bar-plot/build.template.html index 643bc704b3..5dce0d5679 100644 --- a/libraries/graphs/bar-plot/build.template.html +++ b/libraries/graphs/bar-plot/build.template.html @@ -1,7 +1,7 @@
    -
    +

    Bar Plot

    -
    +
    From cbc601b3f8e18cb41c5f521414076a7bc4c16f0e Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 18:43:58 +0200 Subject: [PATCH 012/191] Expermineting to drag results --- api/ui/results.php | 1 - 1 file changed, 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index 943300f9c9..ab79f90636 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -64,7 +64,6 @@ public function get() { $element = $builder->getElementFromIdentifier($this->get['type']); $template = $element->getBuildTemplate(); $this->add(base64_encode($template->render(['id' => $this->get['uid'], 'name' => '', 'parameter' => '']))); - echo $this->data; } else { throw new Exception("Not enough data provided for action 'newplot'!"); } From 9f3a2e3767d1c7da662cfff20ff4e19d375172cf Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 18:47:33 +0200 Subject: [PATCH 013/191] Expermineting to drag results --- views/results/build.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/views/results/build.php b/views/results/build.php index a71ff39e46..8145748d6e 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -72,10 +72,10 @@ function deletePlot(id){ } function movePlots(direction, id) { if (direction == 'up') { - swap('up'); + //swap('up'); } elif (direction == 'down') { - swap('down'); + //swap('down'); } else { alert('direction is neither up or down'); From 2020dbb2fb5c790972b77043365591c02eff2a7b Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 18:51:48 +0200 Subject: [PATCH 014/191] Expermineting to drag results --- libraries/graphs/bar-plot/build.template.html | 4 ---- views/results/build.php | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libraries/graphs/bar-plot/build.template.html b/libraries/graphs/bar-plot/build.template.html index 5dce0d5679..e739af3db3 100644 --- a/libraries/graphs/bar-plot/build.template.html +++ b/libraries/graphs/bar-plot/build.template.html @@ -1,10 +1,6 @@

    Bar Plot

    -
    - - -
    diff --git a/views/results/build.php b/views/results/build.php index 8145748d6e..7932c7df67 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -72,9 +72,11 @@ function deletePlot(id){ } function movePlots(direction, id) { if (direction == 'up') { + alert('moving up'); //swap('up'); } elif (direction == 'down') { + alert('moving down'); //swap('down'); } else { From 86329ccf66317c2ee849600272bda1a12b3b66a5 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 18:54:31 +0200 Subject: [PATCH 015/191] Expermineting to drag results --- views/results/build.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/views/results/build.php b/views/results/build.php index 7932c7df67..a5b7bb4a58 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -70,6 +70,7 @@ function deletePlot(id){ $(\"#\" + id).remove(); } } + function movePlots(direction, id) { if (direction == 'up') { alert('moving up'); @@ -83,6 +84,7 @@ function movePlots(direction, id) { alert('direction is neither up or down'); } } + function saveBuild(){ var top = $('#build-content'); var data = []; From dc7579e29fde77bffea030171caaef92cf3a65a1 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 18:58:58 +0200 Subject: [PATCH 016/191] Expermineting to drag results --- core/api.php | 2 +- views/results/build.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/api.php b/core/api.php index e8bfeab4f8..eed32f3aeb 100644 --- a/core/api.php +++ b/core/api.php @@ -174,7 +174,7 @@ private function buildJsonEnvelope() { echo json_encode($json); } - private function swap($direction, $id) { + public function swap($direction, $id) { echo $this->data; if($direction==='down') { foreach ($this->data as $index => $value) { diff --git a/views/results/build.php b/views/results/build.php index a5b7bb4a58..504880db9c 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -74,11 +74,11 @@ function deletePlot(id){ function movePlots(direction, id) { if (direction == 'up') { alert('moving up'); - //swap('up'); + swap('up'); } elif (direction == 'down') { alert('moving down'); - //swap('down'); + swap('down'); } else { alert('direction is neither up or down'); From cde17367accb1f80efa5fc87ca65148a98d2020a Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 18:59:54 +0200 Subject: [PATCH 017/191] Expermineting to drag results --- views/results/build.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/views/results/build.php b/views/results/build.php index 504880db9c..c0e41e2932 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -74,11 +74,9 @@ function deletePlot(id){ function movePlots(direction, id) { if (direction == 'up') { alert('moving up'); - swap('up'); } elif (direction == 'down') { alert('moving down'); - swap('down'); } else { alert('direction is neither up or down'); From 82d836322c7f9ee22793e0d78ed79a10d7c24cb6 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 19:01:48 +0200 Subject: [PATCH 018/191] Expermineting to drag results --- views/results/build.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/views/results/build.php b/views/results/build.php index c0e41e2932..409322f1e6 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -71,18 +71,6 @@ function deletePlot(id){ } } - function movePlots(direction, id) { - if (direction == 'up') { - alert('moving up'); - } - elif (direction == 'down') { - alert('moving down'); - } - else { - alert('direction is neither up or down'); - } - } - function saveBuild(){ var top = $('#build-content'); var data = []; From 0d32b4e587d46d97530c0924dd9adf9b894b3b6d Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 19:04:51 +0200 Subject: [PATCH 019/191] Expermineting to drag results --- libraries/graphs/bar-plot/build.template.html | 4 ++++ views/results/build.php | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/libraries/graphs/bar-plot/build.template.html b/libraries/graphs/bar-plot/build.template.html index e739af3db3..daadeba140 100644 --- a/libraries/graphs/bar-plot/build.template.html +++ b/libraries/graphs/bar-plot/build.template.html @@ -1,6 +1,10 @@

    Bar Plot

    +
    + + +
    diff --git a/views/results/build.php b/views/results/build.php index 409322f1e6..940e3e0bba 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -65,6 +65,17 @@ function u_btoa(buffer) { return btoa(binary.join('')); } + function movePlots(direction, id) { + if (direction == 'up') { + alert('moving up'); + } + else if (direction == 'down') { + alert('moving down'); + } + else { + alert('direction is neither up or down'); + } + } function deletePlot(id){ if(confirm('Do you really want to delete this plot?')){ $(\"#\" + id).remove(); From fe3b3f70cde1a300211d2e2fc002bd01e3860017 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 19:06:10 +0200 Subject: [PATCH 020/191] Expermineting to drag results --- libraries/graphs/bar-plot/build.template.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/graphs/bar-plot/build.template.html b/libraries/graphs/bar-plot/build.template.html index daadeba140..0b586d3651 100644 --- a/libraries/graphs/bar-plot/build.template.html +++ b/libraries/graphs/bar-plot/build.template.html @@ -2,8 +2,8 @@

    Bar Plot

    - - + +
    From 52affbcbe4317719e00e8ca9dc51d962e1e66708 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 19:08:36 +0200 Subject: [PATCH 021/191] Expermineting to drag results --- views/results/build.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/views/results/build.php b/views/results/build.php index 940e3e0bba..7c0382eff5 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -67,10 +67,11 @@ function u_btoa(buffer) { function movePlots(direction, id) { if (direction == 'up') { - alert('moving up'); + swap('up', id); } else if (direction == 'down') { - alert('moving down'); + swap('down', id); + location.reload(); } else { alert('direction is neither up or down'); From d3d5aabf55357d1ca8a8a2d0d6c59510067d3f05 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 19:10:53 +0200 Subject: [PATCH 022/191] Expermineting to drag results --- views/results/build.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/views/results/build.php b/views/results/build.php index 7c0382eff5..7d6c6cde25 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -67,10 +67,10 @@ function u_btoa(buffer) { function movePlots(direction, id) { if (direction == 'up') { - swap('up', id); + } else if (direction == 'down') { - swap('down', id); + location.reload(); } else { From c05145895dd22ce11f49e5e5d245b296884f10ce Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 19:12:12 +0200 Subject: [PATCH 023/191] Expermineting to drag results --- views/results/build.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/views/results/build.php b/views/results/build.php index 7d6c6cde25..4681e3bf20 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -66,11 +66,7 @@ function u_btoa(buffer) { } function movePlots(direction, id) { - if (direction == 'up') { - - } - else if (direction == 'down') { - + location.reload(); } else { From 07f87a06cacf2cfa535418f4ab2074983ec002db Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 19:13:03 +0200 Subject: [PATCH 024/191] Expermineting to drag results --- views/results/build.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/results/build.php b/views/results/build.php index 4681e3bf20..87945a6312 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -66,7 +66,7 @@ function u_btoa(buffer) { } function movePlots(direction, id) { - + location.reload(); } else { From a0fe7ad4b0c31f3e6fd70b4d5008b38f5bad7a76 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 19:13:22 +0200 Subject: [PATCH 025/191] Expermineting to drag results --- views/results/build.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/views/results/build.php b/views/results/build.php index 87945a6312..38bc9c4c57 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -66,13 +66,10 @@ function u_btoa(buffer) { } function movePlots(direction, id) { - - location.reload(); - } - else { - alert('direction is neither up or down'); - } + + location.reload(); } + function deletePlot(id){ if(confirm('Do you really want to delete this plot?')){ $(\"#\" + id).remove(); From 321a7dfb7e5f350793c3ba866ccf19562122819d Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 19:13:32 +0200 Subject: [PATCH 026/191] Expermineting to drag results --- views/results/build.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/results/build.php b/views/results/build.php index 38bc9c4c57..eb4fc661ec 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -66,7 +66,7 @@ function u_btoa(buffer) { } function movePlots(direction, id) { - + location.reload(); } From d3b8ad63d81c65a479ccb505a0a661565dbab797 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 19:18:36 +0200 Subject: [PATCH 027/191] Expermineting to drag results --- views/results/build.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/results/build.php b/views/results/build.php index eb4fc661ec..7625651fcd 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -66,7 +66,7 @@ function u_btoa(buffer) { } function movePlots(direction, id) { - + swap(direction, id); location.reload(); } From 00be83fd49597f7713e8d7b65f03cec9f072087d Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 19:56:40 +0200 Subject: [PATCH 028/191] Expermineting to drag results --- api/ui/results.php | 12 +++++++++++- core/api.php | 8 ++++++-- views/results/build.php | 14 ++++++++++++-- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index ab79f90636..ab64b8824f 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -68,7 +68,17 @@ public function get() { throw new Exception("Not enough data provided for action 'newplot'!"); } break; - default: + case 'up': + if(!empty($this->get['uid'])) { /*Add Check if previous is set)*/ + $arr[] = $this->get(); + foreach ($arr as $key => $value) { + echo('key: ' . $key . ' value: ' . $value . '\n'); + } + } + + case 'swap_down': + + default: throw new Exception("Unknown action!"); } } diff --git a/core/api.php b/core/api.php index eed32f3aeb..e8c8cfa02c 100644 --- a/core/api.php +++ b/core/api.php @@ -59,9 +59,13 @@ public function __construct($getVars) { * @throws Exception */ public function get() { - throw new Exception('The action GET is not defined!'); + return $this->data; + //throw new Exception('The action GET is not defined!'); + } + public function set($rearrangeddata) { + $this->data = $rearrangeddata; + //throw new Exception('The action SET is not defined!'); } - /** * @throws Exception */ diff --git a/views/results/build.php b/views/results/build.php index 7625651fcd..5d42e0b0cf 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -66,8 +66,18 @@ function u_btoa(buffer) { } function movePlots(direction, id) { - swap(direction, id); - location.reload(); + var direction = $(this).data('direction'); + var id = $(this).data('id'); + $.ajax({ + url : '/api/ui/results/uid=' + id + '/type=' + plotType + '/systemId=" . $data['system']->getId() . "/action=up/resultId=" . $data['resultId'] . "', + type: 'GET', + data: { + id: id + }, + success: function(response) { + alert(response); + }, + }); } function deletePlot(id){ From 8a7632d3f76f0e2f986007a1a7398de73bedbc43 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 19:57:47 +0200 Subject: [PATCH 029/191] Expermineting to drag results --- views/results/build.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/results/build.php b/views/results/build.php index 5d42e0b0cf..ea3f97fd1a 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -69,7 +69,7 @@ function movePlots(direction, id) { var direction = $(this).data('direction'); var id = $(this).data('id'); $.ajax({ - url : '/api/ui/results/uid=' + id + '/type=' + plotType + '/systemId=" . $data['system']->getId() . "/action=up/resultId=" . $data['resultId'] . "', + url : '/api/ui/results/uid=' + id + '/systemId=" . $data['system']->getId() . "/action=up/resultId=" . $data['resultId'] . "', type: 'GET', data: { id: id From 1e88a7c9626e0aee4109cd02fb0b2685176b5958 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 20:00:24 +0200 Subject: [PATCH 030/191] Expermineting to drag results --- views/results/build.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/views/results/build.php b/views/results/build.php index ea3f97fd1a..f483f07a08 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -66,6 +66,8 @@ function u_btoa(buffer) { } function movePlots(direction, id) { + console.log(direction); + console.log(id); var direction = $(this).data('direction'); var id = $(this).data('id'); $.ajax({ From 3a3eeba89cb68570b7ad66ceb2f41e9b7b586bca Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 20:03:25 +0200 Subject: [PATCH 031/191] Expermineting to drag results --- views/results/build.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/views/results/build.php b/views/results/build.php index f483f07a08..daf357166d 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -66,12 +66,8 @@ function u_btoa(buffer) { } function movePlots(direction, id) { - console.log(direction); - console.log(id); - var direction = $(this).data('direction'); - var id = $(this).data('id'); $.ajax({ - url : '/api/ui/results/uid=' + id + '/systemId=" . $data['system']->getId() . "/action=up/resultId=" . $data['resultId'] . "', + url : '/api/ui/results/uid=' + id + '/systemId=" . $data['system']->getId() . '/action=' . direction . "/resultId=" . $data['resultId'] . "', type: 'GET', data: { id: id From fa613351b2e3f021eed510ac75bbb97ea3de3bbe Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 20:07:09 +0200 Subject: [PATCH 032/191] Expermineting to drag results --- views/results/build.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/results/build.php b/views/results/build.php index daf357166d..9b979419e9 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -67,7 +67,7 @@ function u_btoa(buffer) { function movePlots(direction, id) { $.ajax({ - url : '/api/ui/results/uid=' + id + '/systemId=" . $data['system']->getId() . '/action=' . direction . "/resultId=" . $data['resultId'] . "', + url : '/api/ui/results/uid=' + id + '/systemId=" . $data['system']->getId() . "/action=' + direction + '/resultId=" . $data['resultId'] . "', type: 'GET', data: { id: id From 25b4851f1fb5bd0810ee53b7fdd190455ea9f9dc Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 20:09:32 +0200 Subject: [PATCH 033/191] Expermineting to drag results --- api/ui/results.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index ab64b8824f..847c6caea8 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -75,10 +75,10 @@ public function get() { echo('key: ' . $key . ' value: ' . $value . '\n'); } } - - case 'swap_down': - - default: + break; + case 'down': + alert('down'); + default: throw new Exception("Unknown action!"); } } From 64a41cb4b8ac5b603a93c8923ccbf61968f8f21a Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 20:10:07 +0200 Subject: [PATCH 034/191] Expermineting to drag results --- api/ui/results.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index 847c6caea8..c228344ed5 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -77,7 +77,7 @@ public function get() { } break; case 'down': - alert('down'); + echo 'down'; default: throw new Exception("Unknown action!"); } From 8ba9f553fe7df7a5c1e9cd40a0cb99d03e052a22 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 20:10:55 +0200 Subject: [PATCH 035/191] Expermineting to drag results --- views/results/build.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/views/results/build.php b/views/results/build.php index 9b979419e9..163316d5d3 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -66,6 +66,8 @@ function u_btoa(buffer) { } function movePlots(direction, id) { + console.log(direction); + console.log(id); $.ajax({ url : '/api/ui/results/uid=' + id + '/systemId=" . $data['system']->getId() . "/action=' + direction + '/resultId=" . $data['resultId'] . "', type: 'GET', From 87e1f7dceebb34174c46942aa10a60b39826c65b Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 20:11:35 +0200 Subject: [PATCH 036/191] Expermineting to drag results --- api/ui/results.php | 1 + 1 file changed, 1 insertion(+) diff --git a/api/ui/results.php b/api/ui/results.php index c228344ed5..e8231f919d 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -78,6 +78,7 @@ public function get() { break; case 'down': echo 'down'; + break; default: throw new Exception("Unknown action!"); } From eb40c8fbc87b4bfca27f9a29082c229954290407 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 20:13:07 +0200 Subject: [PATCH 037/191] Expermineting to drag results --- api/ui/results.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index e8231f919d..283664bc69 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -71,9 +71,11 @@ public function get() { case 'up': if(!empty($this->get['uid'])) { /*Add Check if previous is set)*/ $arr[] = $this->get(); - foreach ($arr as $key => $value) { - echo('key: ' . $key . ' value: ' . $value . '\n'); - } + echo $arr[0]; + echo $arr[1]; + //foreach ($arr as $key => $value) { + // echo('key: ' . $key . ' value: ' . $value . '\n'); + //} } break; case 'down': From 956bcd2c8101bc095961506ba9fe2713bec54587 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 20:17:24 +0200 Subject: [PATCH 038/191] Expermineting to drag results --- core/api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/api.php b/core/api.php index e8c8cfa02c..847daac865 100644 --- a/core/api.php +++ b/core/api.php @@ -59,7 +59,7 @@ public function __construct($getVars) { * @throws Exception */ public function get() { - return $this->data; + return $this->data->type; //throw new Exception('The action GET is not defined!'); } public function set($rearrangeddata) { From 1f238d1dbd61b9f174872df40f10b4f86e8495e9 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 20:24:53 +0200 Subject: [PATCH 039/191] Expermineting to drag results --- api/ui/results.php | 2 +- core/api.php | 37 +++++++++++++------------------------ 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index 283664bc69..89a3578fda 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -70,7 +70,7 @@ public function get() { break; case 'up': if(!empty($this->get['uid'])) { /*Add Check if previous is set)*/ - $arr[] = $this->get(); + $arr[] = $this->getData(); echo $arr[0]; echo $arr[1]; //foreach ($arr as $key => $value) { diff --git a/core/api.php b/core/api.php index 847daac865..736939299d 100644 --- a/core/api.php +++ b/core/api.php @@ -59,12 +59,20 @@ public function __construct($getVars) { * @throws Exception */ public function get() { - return $this->data->type; - //throw new Exception('The action GET is not defined!'); + throw new Exception('The action GET is not defined!'); + } + + /** + * @throws Exception + */ + public function set() { + throw new Exception('The action SET is not defined!'); } - public function set($rearrangeddata) { - $this->data = $rearrangeddata; - //throw new Exception('The action SET is not defined!'); + public function setData($rearrangeddata) { + $this->data->content = $rearrangeddata; + } + public function getData() { + return $this->data->type; } /** * @throws Exception @@ -177,25 +185,6 @@ private function buildJsonEnvelope() { } echo json_encode($json); } - - public function swap($direction, $id) { - echo $this->data; - if($direction==='down') { - foreach ($this->data as $index => $value) { - if (isset($this->data['id']) && this->data['id'] === $id) { - if ($index < count($this->data) - 1) { - // Swap the element with the next element - $temp = $this->data[$index]; - $this->data[$index] = $this->data[$index + 1]; - $this->data[$index + 1] = $temp; - } - // No need to continue the loop once we've found and swapped the element - break; - } - } - echo $this->data; - } - } /** * Destructor: Renders the output From 916e0f917b13688a3451b78b1782823504bebba5 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 17 Jun 2024 20:49:48 +0200 Subject: [PATCH 040/191] Expermineting to drag results --- api/ui/results.php | 17 ++++++++++------- core/api.php | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index 89a3578fda..ff1448ba3e 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -70,13 +70,16 @@ public function get() { break; case 'up': if(!empty($this->get['uid'])) { /*Add Check if previous is set)*/ - $arr[] = $this->getData(); - echo $arr[0]; - echo $arr[1]; - //foreach ($arr as $key => $value) { - // echo('key: ' . $key . ' value: ' . $value . '\n'); - //} - } + $id = $this->get['id']; + $systemLib = new System(new System($this->get['systemId']));; + $results = json_decode($systemLib->getResultsAll(), true); + echo $results[0]; + foreach ($results['elements'] as $resultId => $val) { + if ($resultId === $id) { + echo "found!"; + } + } + } break; case 'down': echo 'down'; diff --git a/core/api.php b/core/api.php index 736939299d..63cacd4953 100644 --- a/core/api.php +++ b/core/api.php @@ -72,7 +72,7 @@ public function setData($rearrangeddata) { $this->data->content = $rearrangeddata; } public function getData() { - return $this->data->type; + return $this->data->content; } /** * @throws Exception From ddf34f044a21c48a4c25545e05c5be35515b351a Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 14:06:29 +0200 Subject: [PATCH 041/191] Expermineting to drag results --- api/ui/results.php | 15 ++++----------- core/api.php | 2 +- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index ff1448ba3e..9f68d617ba 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -69,17 +69,10 @@ public function get() { } break; case 'up': - if(!empty($this->get['uid'])) { /*Add Check if previous is set)*/ - $id = $this->get['id']; - $systemLib = new System(new System($this->get['systemId']));; - $results = json_decode($systemLib->getResultsAll(), true); - echo $results[0]; - foreach ($results['elements'] as $resultId => $val) { - if ($resultId === $id) { - echo "found!"; - } - } - } + $arr = $this->getData(); + foreach ($arr as $key => $value) { + echo $key . ": " . $value . "\n"; + } break; case 'down': echo 'down'; diff --git a/core/api.php b/core/api.php index 63cacd4953..9f7447f015 100644 --- a/core/api.php +++ b/core/api.php @@ -72,7 +72,7 @@ public function setData($rearrangeddata) { $this->data->content = $rearrangeddata; } public function getData() { - return $this->data->content; + return $this->data; } /** * @throws Exception From 939316606542871ead89f138201ea4ce8cb714cb Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 14:07:32 +0200 Subject: [PATCH 042/191] Expermineting to drag results --- api/ui/results.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/ui/results.php b/api/ui/results.php index 9f68d617ba..ea4619e6af 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -70,6 +70,10 @@ public function get() { break; case 'up': $arr = $this->getData(); + if ($arr === null) { + echo "is nunll"; + break; + } foreach ($arr as $key => $value) { echo $key . ": " . $value . "\n"; } From e893e78a3b2be1b424f5d4b648f48b1176ce4c27 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 14:11:16 +0200 Subject: [PATCH 043/191] Expermineting to drag results --- views/results/build.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/views/results/build.php b/views/results/build.php index 163316d5d3..aab60ced50 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -66,10 +66,11 @@ function u_btoa(buffer) { } function movePlots(direction, id) { + var plotType = $('#plot-form').find('select[name=\"type\"]').val(); console.log(direction); console.log(id); $.ajax({ - url : '/api/ui/results/uid=' + id + '/systemId=" . $data['system']->getId() . "/action=' + direction + '/resultId=" . $data['resultId'] . "', + url : '/api/ui/results/uid=' + id + '/type=' + plotType +'/systemId=" . $data['system']->getId() . "/action=' + direction + '/resultId=" . $data['resultId'] . "', type: 'GET', data: { id: id From 4b10835b2f69e3e3ae0845e8773b72e7d167a7b0 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 14:27:58 +0200 Subject: [PATCH 044/191] Expermineting to drag results --- api/ui/results.php | 11 +++-------- core/api.php | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index ea4619e6af..622de42e6e 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -69,14 +69,9 @@ public function get() { } break; case 'up': - $arr = $this->getData(); - if ($arr === null) { - echo "is nunll"; - break; - } - foreach ($arr as $key => $value) { - echo $key . ": " . $value . "\n"; - } + $system = new System($this->get['systemId']); + $arr = $system->getResultsAll(); + echo $arr; break; case 'down': echo 'down'; diff --git a/core/api.php b/core/api.php index 9f7447f015..0deb1c6484 100644 --- a/core/api.php +++ b/core/api.php @@ -69,7 +69,7 @@ public function set() { throw new Exception('The action SET is not defined!'); } public function setData($rearrangeddata) { - $this->data->content = $rearrangeddata; + $this->data = $rearrangeddata; } public function getData() { return $this->data; From 38543fa8533ecf0760d600eca3094c903e9bf7cb Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 14:30:53 +0200 Subject: [PATCH 045/191] Expermineting to drag results --- api/ui/results.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index 622de42e6e..317efcb760 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -71,7 +71,9 @@ public function get() { case 'up': $system = new System($this->get['systemId']); $arr = $system->getResultsAll(); - echo $arr; + foreach ($arr as $key => $value) { + echo $key . ": " . $value . "\n"; + } break; case 'down': echo 'down'; From 3f412932d453187701d4714fdd6fbc05a4dd9c2d Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 14:31:33 +0200 Subject: [PATCH 046/191] Expermineting to drag results --- api/ui/results.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index 317efcb760..863fe30341 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -71,9 +71,7 @@ public function get() { case 'up': $system = new System($this->get['systemId']); $arr = $system->getResultsAll(); - foreach ($arr as $key => $value) { - echo $key . ": " . $value . "\n"; - } + echo $arr[0]; break; case 'down': echo 'down'; From 0b7b2d186685c6ce46c8280c197cca66590cb9a5 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 14:31:57 +0200 Subject: [PATCH 047/191] Expermineting to drag results --- api/ui/results.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index 863fe30341..b38a417ba1 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -71,7 +71,7 @@ public function get() { case 'up': $system = new System($this->get['systemId']); $arr = $system->getResultsAll(); - echo $arr[0]; + echo $arr[6]; break; case 'down': echo 'down'; From eb22aeb19f9f5e11c516ac879fc9cddfd516c947 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 14:32:24 +0200 Subject: [PATCH 048/191] Expermineting to drag results --- api/ui/results.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index b38a417ba1..622de42e6e 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -71,7 +71,7 @@ public function get() { case 'up': $system = new System($this->get['systemId']); $arr = $system->getResultsAll(); - echo $arr[6]; + echo $arr; break; case 'down': echo 'down'; From 8e39ad01537f19b600a3446b413d76e3eb740f8c Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 14:35:47 +0200 Subject: [PATCH 049/191] Expermineting to drag results --- api/ui/results.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index 622de42e6e..bc2c70b799 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -71,7 +71,8 @@ public function get() { case 'up': $system = new System($this->get['systemId']); $arr = $system->getResultsAll(); - echo $arr; + $jsonJob = json_decode($arr, true); + echo $jsonJob[0]; break; case 'down': echo 'down'; From 78c47809a558f7767a06390f8f00b7ca17362f2a Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 14:36:14 +0200 Subject: [PATCH 050/191] Expermineting to drag results --- api/ui/results.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index bc2c70b799..000af496b1 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -72,7 +72,7 @@ public function get() { $system = new System($this->get['systemId']); $arr = $system->getResultsAll(); $jsonJob = json_decode($arr, true); - echo $jsonJob[0]; + echo $jsonJob[0][0]; break; case 'down': echo 'down'; From 17af2bffe5a9d3bbcd2fdb34ab6b6e37d8c8c976 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 14:39:06 +0200 Subject: [PATCH 051/191] Expermineting to drag results --- api/ui/results.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index 000af496b1..c7a1c35c3d 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -72,7 +72,7 @@ public function get() { $system = new System($this->get['systemId']); $arr = $system->getResultsAll(); $jsonJob = json_decode($arr, true); - echo $jsonJob[0][0]; + echo $jsonJob; break; case 'down': echo 'down'; From fb6a0f3dc19a3c3892307fb107818ae06284f3e6 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 14:39:48 +0200 Subject: [PATCH 052/191] Expermineting to drag results --- api/ui/results.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index c7a1c35c3d..38b472b327 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -72,7 +72,9 @@ public function get() { $system = new System($this->get['systemId']); $arr = $system->getResultsAll(); $jsonJob = json_decode($arr, true); - echo $jsonJob; + foreach ($jsonJob as $job) { + echo $job; + } break; case 'down': echo 'down'; From 8819ad90dda0bd6a4acaf6c8a94754880bcbfbb6 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 14:41:41 +0200 Subject: [PATCH 053/191] Expermineting to drag results --- api/ui/results.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index 38b472b327..d4ee562b26 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -73,7 +73,11 @@ public function get() { $arr = $system->getResultsAll(); $jsonJob = json_decode($arr, true); foreach ($jsonJob as $job) { - echo $job; + echo gettype($job). "
    "; + foreach ($job as $element) { + echo gettype($element). "
    "; + echo 'Element: ' . $element. "
    "; + } } break; case 'down': From 197b8f217afe9b33c553a18f79090a300ca5a75f Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 14:42:18 +0200 Subject: [PATCH 054/191] Expermineting to drag results --- api/ui/results.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index d4ee562b26..9be1c19d6a 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -73,9 +73,9 @@ public function get() { $arr = $system->getResultsAll(); $jsonJob = json_decode($arr, true); foreach ($jsonJob as $job) { - echo gettype($job). "
    "; + echo gettype($job) . "
    "; foreach ($job as $element) { - echo gettype($element). "
    "; + echo gettype($element) . "
    "; echo 'Element: ' . $element. "
    "; } } From f3b978a95d908f226d649a359a03b970b4faaa75 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 14:46:11 +0200 Subject: [PATCH 055/191] Expermineting to drag results --- api/ui/results.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/ui/results.php b/api/ui/results.php index 9be1c19d6a..a566080fce 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -71,9 +71,11 @@ public function get() { case 'up': $system = new System($this->get['systemId']); $arr = $system->getResultsAll(); + echo $arr; $jsonJob = json_decode($arr, true); foreach ($jsonJob as $job) { echo gettype($job) . "
    "; + // $job[0] should be ID foreach ($job as $element) { echo gettype($element) . "
    "; echo 'Element: ' . $element. "
    "; From 2f5ddea49343bd85d71734400f1cc17cacfd0c33 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 14:51:11 +0200 Subject: [PATCH 056/191] Expermineting to drag results --- api/ui/results.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index a566080fce..4e1cf15486 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -77,8 +77,11 @@ public function get() { echo gettype($job) . "
    "; // $job[0] should be ID foreach ($job as $element) { - echo gettype($element) . "
    "; - echo 'Element: ' . $element. "
    "; + //echo gettype($element) . "
    "; + //echo 'Element: ' . $element. "
    "; + if ($element === this->get['uid']) { + echo "found element. swap!"; + } } } break; From d8e3b18baaa7b255c596245263c58d4786cf7ad4 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 14:52:06 +0200 Subject: [PATCH 057/191] Expermineting to drag results --- api/ui/results.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index 4e1cf15486..6aa9fb9916 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -79,7 +79,7 @@ public function get() { foreach ($job as $element) { //echo gettype($element) . "
    "; //echo 'Element: ' . $element. "
    "; - if ($element === this->get['uid']) { + if ($element === $this->get['uid']) { echo "found element. swap!"; } } From 011139213e7286e1c1eb4ee57c0114b6993b1727 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 14:53:02 +0200 Subject: [PATCH 058/191] Expermineting to drag results --- api/ui/results.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index 6aa9fb9916..7639047d22 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -74,12 +74,12 @@ public function get() { echo $arr; $jsonJob = json_decode($arr, true); foreach ($jsonJob as $job) { - echo gettype($job) . "
    "; + //echo gettype($job) . "
    "; // $job[0] should be ID foreach ($job as $element) { //echo gettype($element) . "
    "; //echo 'Element: ' . $element. "
    "; - if ($element === $this->get['uid']) { + if ($element == $this->get['uid']) { echo "found element. swap!"; } } From e1a9809deef145cc90dde3310f920b60c1249091 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 14:53:58 +0200 Subject: [PATCH 059/191] Expermineting to drag results --- api/ui/results.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index 7639047d22..f78759eeb0 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -79,8 +79,9 @@ public function get() { foreach ($job as $element) { //echo gettype($element) . "
    "; //echo 'Element: ' . $element. "
    "; + echo "UID is " .$this->get['uid'] . "\n"; if ($element == $this->get['uid']) { - echo "found element. swap!"; + echo "found element. swap!\n"; } } } From f6937592935c29d6a0cb9067542966456142f6dc Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 14:57:10 +0200 Subject: [PATCH 060/191] Expermineting to drag results --- api/ui/results.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index f78759eeb0..afb91c3b39 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -71,7 +71,7 @@ public function get() { case 'up': $system = new System($this->get['systemId']); $arr = $system->getResultsAll(); - echo $arr; + //echo $arr; $jsonJob = json_decode($arr, true); foreach ($jsonJob as $job) { //echo gettype($job) . "
    "; @@ -81,6 +81,7 @@ public function get() { //echo 'Element: ' . $element. "
    "; echo "UID is " .$this->get['uid'] . "\n"; if ($element == $this->get['uid']) { + echo $element; echo "found element. swap!\n"; } } From c7bb9afce8cb2d5f65cb6efd0c1c3ddfd6168abe Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 14:57:54 +0200 Subject: [PATCH 061/191] Expermineting to drag results --- api/ui/results.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index afb91c3b39..1d6dd841e3 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -80,8 +80,9 @@ public function get() { //echo gettype($element) . "
    "; //echo 'Element: ' . $element. "
    "; echo "UID is " .$this->get['uid'] . "\n"; + echo $element; if ($element == $this->get['uid']) { - echo $element; + echo "found element. swap!\n"; } } From a8466add124fda38cc519026b16689c908f3c544 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 15:02:05 +0200 Subject: [PATCH 062/191] Expermineting to drag results --- api/ui/results.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index 1d6dd841e3..8afa2cb2a5 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -70,20 +70,27 @@ public function get() { break; case 'up': $system = new System($this->get['systemId']); + echo "UID is " .$this->get['uid'] . "\n"; $arr = $system->getResultsAll(); //echo $arr; $jsonJob = json_decode($arr, true); foreach ($jsonJob as $job) { //echo gettype($job) . "
    "; // $job[0] should be ID - foreach ($job as $element) { - //echo gettype($element) . "
    "; - //echo 'Element: ' . $element. "
    "; - echo "UID is " .$this->get['uid'] . "\n"; - echo $element; - if ($element == $this->get['uid']) { + if($job == $this->get['uid']) { + echo "found in job"; + } + else { + foreach ($job as $element) { + //echo gettype($element) . "
    "; + //echo 'Element: ' . $element. "
    "; + + echo $element; + echo gettype($element); + if ($element == $this->get['uid']) { - echo "found element. swap!\n"; + echo "found element. swap!\n"; + } } } } From 69ff97355d5fd9aa0e427e1a6286a5f89302b108 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 15:07:11 +0200 Subject: [PATCH 063/191] Expermineting to drag results --- api/ui/results.php | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index 8afa2cb2a5..ea4a4ab78a 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -70,27 +70,37 @@ public function get() { break; case 'up': $system = new System($this->get['systemId']); - echo "UID is " .$this->get['uid'] . "\n"; + $id = $this->get['uid']; + echo "UID is " . $id . "\n"; $arr = $system->getResultsAll(); //echo $arr; $jsonJob = json_decode($arr, true); foreach ($jsonJob as $job) { //echo gettype($job) . "
    "; // $job[0] should be ID - if($job == $this->get['uid']) { - echo "found in job"; + if($job == $id) { + echo "found in job. \n"; } else { foreach ($job as $element) { //echo gettype($element) . "
    "; //echo 'Element: ' . $element. "
    "; - - echo $element; - echo gettype($element); - if ($element == $this->get['uid']) { - - echo "found element. swap!\n"; + if ($element == $id) { + echo "found in element.\n"; + break; + } + if (gettype($element) == 'string') { + echo $element; } + else { // $element is an array + foreach ($element as $e) { + echo $e; + if($e == $id) { + echo "found in e.\n"; + } + } + } + } } } From f113239091453f2ac500c673cfec99fb36ee7d9d Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 15:09:12 +0200 Subject: [PATCH 064/191] Expermineting to drag results --- api/ui/results.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index ea4a4ab78a..ff7f3f511c 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -94,13 +94,22 @@ public function get() { } else { // $element is an array foreach ($element as $e) { - echo $e; + if (gettype($e) == 'string') { + echo $e; + } if($e == $id) { echo "found in e.\n"; } + foreach ($e as $ok) { + if (gettype($ok) == 'string') { + echo $ok; + } + if($ok == $id) { + echo "found in e.\n"; + } + } } } - } } } From 433787ec99ee8c3f796ed6abcf516cfe84c5e0e3 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 15:10:28 +0200 Subject: [PATCH 065/191] Expermineting to drag results --- api/ui/results.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index ff7f3f511c..7698ba915c 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -100,12 +100,14 @@ public function get() { if($e == $id) { echo "found in e.\n"; } - foreach ($e as $ok) { - if (gettype($ok) == 'string') { - echo $ok; - } - if($ok == $id) { - echo "found in e.\n"; + if (gettype($e)=='array') { + foreach ($e as $ok) { + if (gettype($ok) == 'string') { + echo $ok; + } + if ($ok == $id) { + echo "found in e.\n"; + } } } } From 5415aa6978e05b32d848078f51c68ebf9b416e22 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 15:11:29 +0200 Subject: [PATCH 066/191] Expermineting to drag results --- api/ui/results.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index 7698ba915c..1bc13861e5 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -94,9 +94,6 @@ public function get() { } else { // $element is an array foreach ($element as $e) { - if (gettype($e) == 'string') { - echo $e; - } if($e == $id) { echo "found in e.\n"; } From 492e0e6d8ca789e5f91c936500445f80c7cbe0b1 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 15:13:05 +0200 Subject: [PATCH 067/191] Expermineting to drag results --- api/ui/results.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/ui/results.php b/api/ui/results.php index 1bc13861e5..7698ba915c 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -94,6 +94,9 @@ public function get() { } else { // $element is an array foreach ($element as $e) { + if (gettype($e) == 'string') { + echo $e; + } if($e == $id) { echo "found in e.\n"; } From aa07e553405c21503073d4ab125fccd5390e222f Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 15:16:22 +0200 Subject: [PATCH 068/191] Expermineting to drag results --- api/ui/results.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index 7698ba915c..f828bf3a22 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -76,8 +76,7 @@ public function get() { //echo $arr; $jsonJob = json_decode($arr, true); foreach ($jsonJob as $job) { - //echo gettype($job) . "
    "; - // $job[0] should be ID + var_dump($job); if($job == $id) { echo "found in job. \n"; } @@ -89,22 +88,13 @@ public function get() { echo "found in element.\n"; break; } - if (gettype($element) == 'string') { - echo $element; - } else { // $element is an array foreach ($element as $e) { - if (gettype($e) == 'string') { - echo $e; - } if($e == $id) { echo "found in e.\n"; } if (gettype($e)=='array') { foreach ($e as $ok) { - if (gettype($ok) == 'string') { - echo $ok; - } if ($ok == $id) { echo "found in e.\n"; } From 3bf624f0045f881a6039e7e0c0d6a51b67ef9158 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 15:18:21 +0200 Subject: [PATCH 069/191] Expermineting to drag results --- api/ui/results.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index f828bf3a22..1d0de73b43 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -79,24 +79,29 @@ public function get() { var_dump($job); if($job == $id) { echo "found in job. \n"; + break; } else { foreach ($job as $element) { //echo gettype($element) . "
    "; //echo 'Element: ' . $element. "
    "; - if ($element == $id) { - echo "found in element.\n"; - break; + if (gettype($element)=='string') { + if($element == $id) { + echo "found in element.\n"; + break; + } } else { // $element is an array foreach ($element as $e) { if($e == $id) { echo "found in e.\n"; + break; } if (gettype($e)=='array') { foreach ($e as $ok) { if ($ok == $id) { echo "found in e.\n"; + break; } } } From 158832fe3a98823881b2c390a315121663a7e93c Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 15:24:25 +0200 Subject: [PATCH 070/191] Expermineting to drag results --- api/ui/results.php | 43 ++++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index 1d0de73b43..fda72c1979 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -76,37 +76,30 @@ public function get() { //echo $arr; $jsonJob = json_decode($arr, true); foreach ($jsonJob as $job) { - var_dump($job); - if($job == $id) { - echo "found in job. \n"; - break; - } - else { - foreach ($job as $element) { - //echo gettype($element) . "
    "; - //echo 'Element: ' . $element. "
    "; - if (gettype($element)=='string') { - if($element == $id) { - echo "found in element.\n"; + foreach ($job as $element) { + if (gettype($element)=='string') { + if($element == $id) { + echo "found in element.\n"; + break; + } + } + else { // $element is an array + foreach ($element as $e) { + if($e == $id) { + echo "found in e.\n"; break; } - } - else { // $element is an array - foreach ($element as $e) { - if($e == $id) { - echo "found in e.\n"; - break; - } - if (gettype($e)=='array') { - foreach ($e as $ok) { - if ($ok == $id) { - echo "found in e.\n"; - break; - } + if (gettype($e)=='array') { + foreach ($e as $ok) { + var_dump($job); + if ($ok == $id) { + echo "found in e.\n"; + break; } } } } + } } } From d6d86e159d9e4fd6cb404622b8eddab551bb991e Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 15:26:23 +0200 Subject: [PATCH 071/191] Expermineting to drag results --- api/ui/results.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index fda72c1979..a6cadb551d 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -91,11 +91,19 @@ public function get() { } if (gettype($e)=='array') { foreach ($e as $ok) { - var_dump($job); if ($ok == $id) { echo "found in e.\n"; break; } + if (gettype($ok)=='array') { + foreach ($ok as $smallest) { + var_dump($smallest); + if ($smallest == $id) { + echo "found in smallest.\n"; + break; + } + } + } } } } From 1ae8af8771b43bdd7abfb3a80fc8831bba2064ab Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 15:31:08 +0200 Subject: [PATCH 072/191] Expermineting to drag results --- api/ui/results.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index a6cadb551d..5c721f2c31 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -96,10 +96,12 @@ public function get() { break; } if (gettype($ok)=='array') { + var_dump($ok); foreach ($ok as $smallest) { - var_dump($smallest); + //var_dump($smallest); if ($smallest == $id) { echo "found in smallest.\n"; + break; } } @@ -120,4 +122,4 @@ public function get() { } } } -} \ No newline at end of file +} From d347a6cfbe3eeec726e6931a4da5db1853b59208 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 15:38:52 +0200 Subject: [PATCH 073/191] Expermineting to drag results --- api/ui/results.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index 5c721f2c31..460618911e 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -73,7 +73,7 @@ public function get() { $id = $this->get['uid']; echo "UID is " . $id . "\n"; $arr = $system->getResultsAll(); - //echo $arr; + echo $arr; $jsonJob = json_decode($arr, true); foreach ($jsonJob as $job) { foreach ($job as $element) { From 17ae44f6304ec3783af4636add5e796807e714be Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 15:43:55 +0200 Subject: [PATCH 074/191] Expermineting to drag results --- api/ui/results.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/ui/results.php b/api/ui/results.php index 460618911e..20392789f1 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -97,8 +97,11 @@ public function get() { } if (gettype($ok)=='array') { var_dump($ok); + $slot = array_search($id, $ok); + echo $slot; foreach ($ok as $smallest) { //var_dump($smallest); + if ($smallest == $id) { echo "found in smallest.\n"; From 45dc153d323059a68e171b8a4c0c1b6e5c104ba5 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 15:45:26 +0200 Subject: [PATCH 075/191] Expermineting to drag results --- api/ui/results.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index 20392789f1..f7005c11d5 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -97,7 +97,7 @@ public function get() { } if (gettype($ok)=='array') { var_dump($ok); - $slot = array_search($id, $ok); + $slot = strpos($id, $ok); echo $slot; foreach ($ok as $smallest) { //var_dump($smallest); From e75be328aecaa268a580edd76d226e007e794a48 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 18 Jun 2024 15:46:26 +0200 Subject: [PATCH 076/191] Expermineting to drag results --- api/ui/results.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index f7005c11d5..d1077ef318 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -97,7 +97,7 @@ public function get() { } if (gettype($ok)=='array') { var_dump($ok); - $slot = strpos($id, $ok); + $slot = strpos($ok, $id); echo $slot; foreach ($ok as $smallest) { //var_dump($smallest); From 59b5987a4dd31fa8ed1ba94b0367e0fa8ed28952 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 02:31:17 +0200 Subject: [PATCH 077/191] Expermineting to drag results --- api/ui/Rearranger.php | 92 +++++++++++++++++++++++++++++++++++++++++++ api/ui/results.php | 59 +++++++-------------------- 2 files changed, 106 insertions(+), 45 deletions(-) create mode 100644 api/ui/Rearranger.php diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php new file mode 100644 index 0000000000..a12d7382af --- /dev/null +++ b/api/ui/Rearranger.php @@ -0,0 +1,92 @@ +seekAndSwap($element, $goal, $direction); + } + else if (gettype($element) == 'string' && $element == $goal) { + $array = $this->swap($array, $goal, $direction); + } + } + return $array; + } + else { + return "error, element not found?"; + } + } + public function swap($array, $goal, $direction) { + $temp = ''; + $counter = 0; + if ($direction == 'up') { + foreach ($array as $element) { + if ($element == $goal && $counter > 0) { + $temp2 = $element; + $array[$temp] = $element; + $array[$temp2] = $temp; + //return $array; in place or not? + break; + } + else if ($element == $goal && $counter == 0) { + echo "found, but already at head"; + break; + } + $counter++; + $temp = $element; + } + } + else if ($direction == 'down') { + $temp = ''; + foreach ($array as $element) { + if ($temp != '') { // previous element in temp2 is the goal, $element is the one to be swapped + $array[$temp] = $element; + $array[$element] = $temp; + break; + } + if ($element == $goal && $counter < count($array)) { // TODO count(array) or -1? + $temp = $element; + //return $array; in place or not? + } + else if ($element == $goal && $counter == count($array)) { + echo "found, but already at end"; + } + $counter++; + } + } + return $array; + } +} \ No newline at end of file diff --git a/api/ui/results.php b/api/ui/results.php index d1077ef318..bdc397fb09 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -25,6 +25,7 @@ SOFTWARE. */ +include ("Rearranger.php"); class Results_API extends API { public $patch_access = Auth_Library::A_LOGGEDIN; @@ -70,55 +71,23 @@ public function get() { break; case 'up': $system = new System($this->get['systemId']); + $arr = $system->getResultsAll(); $id = $this->get['uid']; echo "UID is " . $id . "\n"; - $arr = $system->getResultsAll(); - echo $arr; - $jsonJob = json_decode($arr, true); - foreach ($jsonJob as $job) { - foreach ($job as $element) { - if (gettype($element)=='string') { - if($element == $id) { - echo "found in element.\n"; - break; - } - } - else { // $element is an array - foreach ($element as $e) { - if($e == $id) { - echo "found in e.\n"; - break; - } - if (gettype($e)=='array') { - foreach ($e as $ok) { - if ($ok == $id) { - echo "found in e.\n"; - break; - } - if (gettype($ok)=='array') { - var_dump($ok); - $slot = strpos($ok, $id); - echo $slot; - foreach ($ok as $smallest) { - //var_dump($smallest); - - if ($smallest == $id) { - echo "found in smallest.\n"; - - break; - } - } - } - } - } - } - - } - } - } + $arr = json_decode($arr, true); + $rearranger = new Rearranger(); + $swapped_arr = $rearranger->seekAndSwap($arr, $id, 'up'); + $system->setResultsAll(json_encode($swapped_arr)); break; case 'down': - echo 'down'; + $system = new System($this->get['systemId']); + $arr = $system->getResultsAll(); + $id = $this->get['uid']; + echo "UID is " . $id . "\n"; + $arr = json_decode($arr, true); + $rearranger = new Rearranger(); + $swapped_arr = $rearranger->seekAndSwap($arr, $id, 'down'); + $system->setResultsAll(json_encode($swapped_arr)); break; default: throw new Exception("Unknown action!"); From db2deca2fc79c88e9f488120321d55f421bbe059 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 02:33:12 +0200 Subject: [PATCH 078/191] Expermineting to drag results --- api/ui/results.php | 1 - 1 file changed, 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index bdc397fb09..bb93331ee7 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -83,7 +83,6 @@ public function get() { $system = new System($this->get['systemId']); $arr = $system->getResultsAll(); $id = $this->get['uid']; - echo "UID is " . $id . "\n"; $arr = json_decode($arr, true); $rearranger = new Rearranger(); $swapped_arr = $rearranger->seekAndSwap($arr, $id, 'down'); From 8580b1e3bee6e7271b0268ea5dcaf3664a4278f1 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 02:43:27 +0200 Subject: [PATCH 079/191] Expermineting to drag results --- core/api.php | 7 +------ views/results/build.php | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/core/api.php b/core/api.php index 0deb1c6484..09766803c7 100644 --- a/core/api.php +++ b/core/api.php @@ -68,12 +68,7 @@ public function get() { public function set() { throw new Exception('The action SET is not defined!'); } - public function setData($rearrangeddata) { - $this->data = $rearrangeddata; - } - public function getData() { - return $this->data; - } + /** * @throws Exception */ diff --git a/views/results/build.php b/views/results/build.php index aab60ced50..aee1af4ff2 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -76,7 +76,7 @@ function movePlots(direction, id) { id: id }, success: function(response) { - alert(response); + location.reload(); }, }); } From 95be99f047bb4bac3d46914e571429cdfb6b5976 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 02:46:49 +0200 Subject: [PATCH 080/191] Expermineting to drag results --- api/ui/Rearranger.php | 1 + 1 file changed, 1 insertion(+) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index a12d7382af..43e57a3721 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -78,6 +78,7 @@ public function swap($array, $goal, $direction) { break; } if ($element == $goal && $counter < count($array)) { // TODO count(array) or -1? + echo "found " . $element; $temp = $element; //return $array; in place or not? } From 33c4651b197b700193a78dc87112bea8d33a0f58 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 02:47:34 +0200 Subject: [PATCH 081/191] Expermineting to drag results --- views/results/build.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/results/build.php b/views/results/build.php index aee1af4ff2..aab60ced50 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -76,7 +76,7 @@ function movePlots(direction, id) { id: id }, success: function(response) { - location.reload(); + alert(response); }, }); } From 547553a170116e4971d67bd6d7e4e2bb4c17c967 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 02:49:29 +0200 Subject: [PATCH 082/191] Expermineting to drag results --- api/ui/Rearranger.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 43e57a3721..827d760d76 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -73,12 +73,15 @@ public function swap($array, $goal, $direction) { $temp = ''; foreach ($array as $element) { if ($temp != '') { // previous element in temp2 is the goal, $element is the one to be swapped + echo "initiating swap...\n"; + echo "Array before swap: \n" . $array . "\n"; $array[$temp] = $element; $array[$element] = $temp; + echo "Array after swap: \n" . $array . "\n"; break; } if ($element == $goal && $counter < count($array)) { // TODO count(array) or -1? - echo "found " . $element; + echo "found " . $element . "\n"; $temp = $element; //return $array; in place or not? } From 67923bca0c3639f1e4dbe1677777246abeeccb8f Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 02:51:27 +0200 Subject: [PATCH 083/191] Expermineting to drag results --- api/ui/Rearranger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 827d760d76..05c1ea92fd 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -74,10 +74,10 @@ public function swap($array, $goal, $direction) { foreach ($array as $element) { if ($temp != '') { // previous element in temp2 is the goal, $element is the one to be swapped echo "initiating swap...\n"; - echo "Array before swap: \n" . $array . "\n"; + echo "Array before swap: \n" . print_r($array) . "\n"; $array[$temp] = $element; $array[$element] = $temp; - echo "Array after swap: \n" . $array . "\n"; + echo "Array after swap: \n" . print_r($array) . "\n"; break; } if ($element == $goal && $counter < count($array)) { // TODO count(array) or -1? From 49bb0e51f2197e85be03923d505846efac462ff3 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 02:53:24 +0200 Subject: [PATCH 084/191] Expermineting to drag results --- api/ui/Rearranger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 05c1ea92fd..3171a27176 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -74,10 +74,10 @@ public function swap($array, $goal, $direction) { foreach ($array as $element) { if ($temp != '') { // previous element in temp2 is the goal, $element is the one to be swapped echo "initiating swap...\n"; - echo "Array before swap: \n" . print_r($array) . "\n"; + echo "Array before swap: \n" . print_r($array, false) . "\n"; $array[$temp] = $element; $array[$element] = $temp; - echo "Array after swap: \n" . print_r($array) . "\n"; + echo "Array after swap: \n" . print_r($array, false) . "\n"; break; } if ($element == $goal && $counter < count($array)) { // TODO count(array) or -1? From 02dee0d31f5923a463bb2682e7ccbfa6e12782f9 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 03:05:06 +0200 Subject: [PATCH 085/191] Expermineting to drag results --- api/ui/Rearranger.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 3171a27176..f377307d50 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -58,12 +58,11 @@ public function swap($array, $goal, $direction) { $temp2 = $element; $array[$temp] = $element; $array[$temp2] = $temp; - //return $array; in place or not? - break; + return $array; } else if ($element == $goal && $counter == 0) { echo "found, but already at head"; - break; + return $array; } $counter++; $temp = $element; @@ -78,17 +77,14 @@ public function swap($array, $goal, $direction) { $array[$temp] = $element; $array[$element] = $temp; echo "Array after swap: \n" . print_r($array, false) . "\n"; - break; + return $array; } - if ($element == $goal && $counter < count($array)) { // TODO count(array) or -1? + // if element is at last position, $temp will be set but nothing is swapped, foreach is over + else if ($element == $goal) { echo "found " . $element . "\n"; $temp = $element; //return $array; in place or not? } - else if ($element == $goal && $counter == count($array)) { - echo "found, but already at end"; - } - $counter++; } } return $array; From a4f9ec59825c05079b787cb5a23c415c20c0d833 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 03:25:34 +0200 Subject: [PATCH 086/191] Expermineting to drag results --- api/ui/Rearranger.php | 47 ++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index f377307d50..4511951f3e 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -31,33 +31,42 @@ class Rearranger { /** * @var string */ - private $goal; + private $goalkey; public function seekAndSwap($array, $goal, $direction) { if (gettype($array) == 'array') { - foreach ($array as $element) { - if (gettype($element) == 'array') { - $this->seekAndSwap($element, $goal, $direction); - } - else if (gettype($element) == 'string' && $element == $goal) { - $array = $this->swap($array, $goal, $direction); + $goalkey = $this->searchInside($array, $goal); + if($goalkey) { + $array = $this->swap($array, $goal, $goalkey, $direction); + } + else { + foreach ($array as $element) { + if (gettype($element) == 'array') { + $this->seekAndSwap($element, $goal, $direction); + } } } - return $array; } - else { - return "error, element not found?"; + return $array; + } + public function searchInside ($subarray, $goal) { + if (gettype($subarray) == 'array') { + foreach ($subarray as $key => $element) { + if (gettype($element) == 'string' && $element == $goal) { + return $key; + } + } } + return null; } - public function swap($array, $goal, $direction) { + public function swap($array, $goal, $goalkey, $direction) { $temp = ''; $counter = 0; if ($direction == 'up') { - foreach ($array as $element) { + foreach ($array as $key => $element) { if ($element == $goal && $counter > 0) { - $temp2 = $element; - $array[$temp] = $element; - $array[$temp2] = $temp; + $array[$tempkey] = $element; + $array[$goalkey] = $temp; return $array; } else if ($element == $goal && $counter == 0) { @@ -66,16 +75,17 @@ public function swap($array, $goal, $direction) { } $counter++; $temp = $element; + $tempkey = $key; } } else if ($direction == 'down') { $temp = ''; - foreach ($array as $element) { + foreach ($array as $key => $element) { if ($temp != '') { // previous element in temp2 is the goal, $element is the one to be swapped echo "initiating swap...\n"; echo "Array before swap: \n" . print_r($array, false) . "\n"; - $array[$temp] = $element; - $array[$element] = $temp; + $array[$goalkey] = $element; + $array[$key] = $temp; echo "Array after swap: \n" . print_r($array, false) . "\n"; return $array; } @@ -83,7 +93,6 @@ public function swap($array, $goal, $direction) { else if ($element == $goal) { echo "found " . $element . "\n"; $temp = $element; - //return $array; in place or not? } } } From cb58a9c22b7f614adf679b603585b0db643317ef Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 03:28:33 +0200 Subject: [PATCH 087/191] Expermineting to drag results --- api/ui/Rearranger.php | 1 + 1 file changed, 1 insertion(+) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 4511951f3e..c0209e5696 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -36,6 +36,7 @@ class Rearranger { public function seekAndSwap($array, $goal, $direction) { if (gettype($array) == 'array') { $goalkey = $this->searchInside($array, $goal); + echo $goalkey; if($goalkey) { $array = $this->swap($array, $goal, $goalkey, $direction); } From f6ec835cdedfa6fe6a38d00d948a4d8222ec0823 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 03:31:05 +0200 Subject: [PATCH 088/191] Expermineting to drag results --- api/ui/Rearranger.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index c0209e5696..7d9bec4147 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -35,8 +35,10 @@ class Rearranger { public function seekAndSwap($array, $goal, $direction) { if (gettype($array) == 'array') { - $goalkey = $this->searchInside($array, $goal); - echo $goalkey; + foreach ($array as $key => $value) { + $goalkey = $this->searchInside($value, $goal); + echo $goalkey; + } if($goalkey) { $array = $this->swap($array, $goal, $goalkey, $direction); } From 8f547c6a724a7fd1241986fd3dddc4ca359493ee Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 03:32:02 +0200 Subject: [PATCH 089/191] Expermineting to drag results --- api/ui/Rearranger.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 7d9bec4147..d61bf62502 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -36,8 +36,11 @@ class Rearranger { public function seekAndSwap($array, $goal, $direction) { if (gettype($array) == 'array') { foreach ($array as $key => $value) { - $goalkey = $this->searchInside($value, $goal); - echo $goalkey; + if($this->searchInside($value, $goal)) { + $goalkey = $key; + echo $goalkey; + } + } if($goalkey) { $array = $this->swap($array, $goal, $goalkey, $direction); From 49caf516a5db20492473caef6766c54a1055478a Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 03:32:12 +0200 Subject: [PATCH 090/191] Expermineting to drag results --- api/ui/Rearranger.php | 1 - 1 file changed, 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index d61bf62502..f53a0e4239 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -40,7 +40,6 @@ public function seekAndSwap($array, $goal, $direction) { $goalkey = $key; echo $goalkey; } - } if($goalkey) { $array = $this->swap($array, $goal, $goalkey, $direction); From b6e5d72369069e1ca23b2ddd4439b4ebf43495e4 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 03:33:38 +0200 Subject: [PATCH 091/191] Expermineting to drag results --- api/ui/Rearranger.php | 1 + 1 file changed, 1 insertion(+) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index f53a0e4239..8330cfa313 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -35,6 +35,7 @@ class Rearranger { public function seekAndSwap($array, $goal, $direction) { if (gettype($array) == 'array') { + $goalkey = null; foreach ($array as $key => $value) { if($this->searchInside($value, $goal)) { $goalkey = $key; From 1c39f707a6300412bef8d578cbd8bc5a95de509a Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 03:34:15 +0200 Subject: [PATCH 092/191] Expermineting to drag results --- api/ui/Rearranger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 8330cfa313..56b8a15de5 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -42,7 +42,7 @@ public function seekAndSwap($array, $goal, $direction) { echo $goalkey; } } - if($goalkey) { + if($goalkey != null) { $array = $this->swap($array, $goal, $goalkey, $direction); } else { From cbb6587c9017c1cfd1be22f1ed3186efe5c1c8f5 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 03:37:52 +0200 Subject: [PATCH 093/191] Expermineting to drag results --- api/ui/Rearranger.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 56b8a15de5..300e83f240 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -35,14 +35,15 @@ class Rearranger { public function seekAndSwap($array, $goal, $direction) { if (gettype($array) == 'array') { - $goalkey = null; + $goalkey = -1; foreach ($array as $key => $value) { if($this->searchInside($value, $goal)) { $goalkey = $key; - echo $goalkey; + echo "Goal key is " . $goalkey . "\n"; } } - if($goalkey != null) { + if($goalkey >= 0) { + echo "Initiating swap.. \n"; $array = $this->swap($array, $goal, $goalkey, $direction); } else { @@ -63,7 +64,7 @@ public function searchInside ($subarray, $goal) { } } } - return null; + return -1; } public function swap($array, $goal, $goalkey, $direction) { $temp = ''; @@ -88,7 +89,6 @@ public function swap($array, $goal, $goalkey, $direction) { $temp = ''; foreach ($array as $key => $element) { if ($temp != '') { // previous element in temp2 is the goal, $element is the one to be swapped - echo "initiating swap...\n"; echo "Array before swap: \n" . print_r($array, false) . "\n"; $array[$goalkey] = $element; $array[$key] = $temp; @@ -97,7 +97,7 @@ public function swap($array, $goal, $goalkey, $direction) { } // if element is at last position, $temp will be set but nothing is swapped, foreach is over else if ($element == $goal) { - echo "found " . $element . "\n"; + echo "Found " . $element . " at key: " . $key . "\n"; $temp = $element; } } From 62abbcca9188f6e2f1205ad11f0c2fecb66df2a2 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 03:42:42 +0200 Subject: [PATCH 094/191] Expermineting to drag results --- api/ui/Rearranger.php | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 300e83f240..431ab0c503 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -37,24 +37,22 @@ public function seekAndSwap($array, $goal, $direction) { if (gettype($array) == 'array') { $goalkey = -1; foreach ($array as $key => $value) { - if($this->searchInside($value, $goal)) { - $goalkey = $key; - echo "Goal key is " . $goalkey . "\n"; - } - } - if($goalkey >= 0) { - echo "Initiating swap.. \n"; - $array = $this->swap($array, $goal, $goalkey, $direction); - } - else { - foreach ($array as $element) { - if (gettype($element) == 'array') { - $this->seekAndSwap($element, $goal, $direction); + $goalkey->searchInside($value, $goal); + if ($goalkey >= 0) { + echo "Goal key is " . $goalkey . "\n"; + echo "Initiating swap.. \n"; + $array = $this->swap($array, $goal, $goalkey, $direction); + return $array; + } else { + foreach ($array as $element) { + if (gettype($element) == 'array') { + $this->seekAndSwap($element, $goal, $direction); + } } } } + return $array; } - return $array; } public function searchInside ($subarray, $goal) { if (gettype($subarray) == 'array') { From eba7e1399aa1a660fd4fbf17cd0b18c48cd9818e Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 03:43:59 +0200 Subject: [PATCH 095/191] Expermineting to drag results --- api/ui/Rearranger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 431ab0c503..6efb40017d 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -37,7 +37,7 @@ public function seekAndSwap($array, $goal, $direction) { if (gettype($array) == 'array') { $goalkey = -1; foreach ($array as $key => $value) { - $goalkey->searchInside($value, $goal); + $goalkey = $this->searchInside($value, $goal); if ($goalkey >= 0) { echo "Goal key is " . $goalkey . "\n"; echo "Initiating swap.. \n"; From bcc0b9de6dd1f914cdc30cc87e6ad488ad2585a5 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 03:45:25 +0200 Subject: [PATCH 096/191] Expermineting to drag results --- api/ui/Rearranger.php | 1 + 1 file changed, 1 insertion(+) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 6efb40017d..532a1961f3 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -39,6 +39,7 @@ public function seekAndSwap($array, $goal, $direction) { foreach ($array as $key => $value) { $goalkey = $this->searchInside($value, $goal); if ($goalkey >= 0) { + $goalkey = $key; echo "Goal key is " . $goalkey . "\n"; echo "Initiating swap.. \n"; $array = $this->swap($array, $goal, $goalkey, $direction); From 773924906094de26488fbf1607f5e0c74bb5662f Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 03:46:24 +0200 Subject: [PATCH 097/191] Expermineting to drag results --- api/ui/Rearranger.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 532a1961f3..005a9455ae 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -24,18 +24,8 @@ SOFTWARE. */ class Rearranger { - /** - * @var mixed - */ - private $array; - /** - * @var string - */ - private $goalkey; - public function seekAndSwap($array, $goal, $direction) { if (gettype($array) == 'array') { - $goalkey = -1; foreach ($array as $key => $value) { $goalkey = $this->searchInside($value, $goal); if ($goalkey >= 0) { @@ -52,8 +42,8 @@ public function seekAndSwap($array, $goal, $direction) { } } } - return $array; } + return $array; } public function searchInside ($subarray, $goal) { if (gettype($subarray) == 'array') { From 41aa756afab3955506ed40a50d8c0249985c3e70 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 03:47:45 +0200 Subject: [PATCH 098/191] Expermineting to drag results --- api/ui/Rearranger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 005a9455ae..fb0cd9388f 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -32,8 +32,7 @@ public function seekAndSwap($array, $goal, $direction) { $goalkey = $key; echo "Goal key is " . $goalkey . "\n"; echo "Initiating swap.. \n"; - $array = $this->swap($array, $goal, $goalkey, $direction); - return $array; + return $this->swap($array, $goal, $goalkey, $direction); } else { foreach ($array as $element) { if (gettype($element) == 'array') { @@ -57,6 +56,7 @@ public function searchInside ($subarray, $goal) { } public function swap($array, $goal, $goalkey, $direction) { $temp = ''; + $tempkey = 0; $counter = 0; if ($direction == 'up') { foreach ($array as $key => $element) { From 43fb2123daceca7fb89157d40129552a49ac1935 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 03:53:05 +0200 Subject: [PATCH 099/191] Expermineting to drag results --- api/ui/Rearranger.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index fb0cd9388f..f3bd52d99b 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -29,10 +29,11 @@ public function seekAndSwap($array, $goal, $direction) { foreach ($array as $key => $value) { $goalkey = $this->searchInside($value, $goal); if ($goalkey >= 0) { - $goalkey = $key; - echo "Goal key is " . $goalkey . "\n"; + $tempkey = $key; + echo "Goal key is " . $tempkey . "\n"; echo "Initiating swap.. \n"; - return $this->swap($array, $goal, $goalkey, $direction); + $goalkey = -1; + return $this->swap($array, $goal, $tempkey, $direction); } else { foreach ($array as $element) { if (gettype($element) == 'array') { From 21d88c2813bad787291657a254d202e112f0f414 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 03:56:18 +0200 Subject: [PATCH 100/191] Expermineting to drag results --- api/ui/Rearranger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index f3bd52d99b..6508ac8b54 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -32,8 +32,7 @@ public function seekAndSwap($array, $goal, $direction) { $tempkey = $key; echo "Goal key is " . $tempkey . "\n"; echo "Initiating swap.. \n"; - $goalkey = -1; - return $this->swap($array, $goal, $tempkey, $direction); + break; } else { foreach ($array as $element) { if (gettype($element) == 'array') { @@ -42,6 +41,7 @@ public function seekAndSwap($array, $goal, $direction) { } } } + return $this->swap($array, $goal, $tempkey, $direction); } return $array; } From 4533b6896e510737906ebdc0d7a2d326c54bb9a4 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 03:59:58 +0200 Subject: [PATCH 101/191] Expermineting to drag results --- api/ui/Rearranger.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 6508ac8b54..2b2e88fc49 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -29,9 +29,9 @@ public function seekAndSwap($array, $goal, $direction) { foreach ($array as $key => $value) { $goalkey = $this->searchInside($value, $goal); if ($goalkey >= 0) { - $tempkey = $key; - echo "Goal key is " . $tempkey . "\n"; + echo "Goal key is " . $goalkey . "\n"; echo "Initiating swap.. \n"; + $temparray = $array; break; } else { foreach ($array as $element) { @@ -41,7 +41,9 @@ public function seekAndSwap($array, $goal, $direction) { } } } - return $this->swap($array, $goal, $tempkey, $direction); + if(isset($temparray) && $goalkey >= 0) { + return $this->swap($temparray, $goal, $goalkey, $direction); + } } return $array; } From 6985fcda8db71e73b3778a0c7edc127ec443cb14 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 04:00:49 +0200 Subject: [PATCH 102/191] Expermineting to drag results --- api/ui/Rearranger.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 2b2e88fc49..eaf0f63619 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -29,9 +29,10 @@ public function seekAndSwap($array, $goal, $direction) { foreach ($array as $key => $value) { $goalkey = $this->searchInside($value, $goal); if ($goalkey >= 0) { - echo "Goal key is " . $goalkey . "\n"; - echo "Initiating swap.. \n"; $temparray = $array; + $tempkey = $key; + echo "Goal key is " . $tempkey . "\n"; + echo "Initiating swap.. \n"; break; } else { foreach ($array as $element) { From a840e6c8d3b5c75a7e555d1175af770012da6f5f Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 04:03:46 +0200 Subject: [PATCH 103/191] Expermineting to drag results --- api/ui/Rearranger.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index eaf0f63619..30bf3824d1 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -31,6 +31,7 @@ public function seekAndSwap($array, $goal, $direction) { if ($goalkey >= 0) { $temparray = $array; $tempkey = $key; + $goalkey = -1; echo "Goal key is " . $tempkey . "\n"; echo "Initiating swap.. \n"; break; @@ -55,6 +56,7 @@ public function searchInside ($subarray, $goal) { return $key; } } + return -1; } return -1; } From 182fb9190bd78042eeeb191e3bc4a0221621e8c3 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 04:05:54 +0200 Subject: [PATCH 104/191] Expermineting to drag results --- api/ui/Rearranger.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 30bf3824d1..06309c48b3 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -53,9 +53,11 @@ public function searchInside ($subarray, $goal) { if (gettype($subarray) == 'array') { foreach ($subarray as $key => $element) { if (gettype($element) == 'string' && $element == $goal) { + echo "found " . $element . " at key: ". $key . "\n"; return $key; } } + echo "Didnt find element, returning -1\n"; return -1; } return -1; From fd361315fe6dabc6fe56d2b46258306cd94c70b7 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 04:07:51 +0200 Subject: [PATCH 105/191] Expermineting to drag results --- api/ui/Rearranger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 06309c48b3..1cb4b5e0c1 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -53,11 +53,11 @@ public function searchInside ($subarray, $goal) { if (gettype($subarray) == 'array') { foreach ($subarray as $key => $element) { if (gettype($element) == 'string' && $element == $goal) { - echo "found " . $element . " at key: ". $key . "\n"; + echo "Array: \n" . print_r($subarray, false); + echo "Found " . $element . " at key: ". $key . "\n"; return $key; } } - echo "Didnt find element, returning -1\n"; return -1; } return -1; From 6833bc853b46dc8184e9d177755cc87ca35b67b7 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 04:09:09 +0200 Subject: [PATCH 106/191] Expermineting to drag results --- api/ui/Rearranger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 1cb4b5e0c1..9d95207d64 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -53,7 +53,7 @@ public function searchInside ($subarray, $goal) { if (gettype($subarray) == 'array') { foreach ($subarray as $key => $element) { if (gettype($element) == 'string' && $element == $goal) { - echo "Array: \n" . print_r($subarray, false); + echo "Array: " . print_r($subarray, false) . "\n"; echo "Found " . $element . " at key: ". $key . "\n"; return $key; } From ecd88341b3bf43819f6e70f6c0c80ae1536b9118 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 04:11:39 +0200 Subject: [PATCH 107/191] Expermineting to drag results --- api/ui/Rearranger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 9d95207d64..6a308e5c91 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -55,7 +55,7 @@ public function searchInside ($subarray, $goal) { if (gettype($element) == 'string' && $element == $goal) { echo "Array: " . print_r($subarray, false) . "\n"; echo "Found " . $element . " at key: ". $key . "\n"; - return $key; + return $subarray; } } return -1; From dc4227858d9768e6756591f1cfecb187dd843db9 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 04:13:18 +0200 Subject: [PATCH 108/191] Expermineting to drag results --- api/ui/Rearranger.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 6a308e5c91..a74445875c 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -53,7 +53,8 @@ public function searchInside ($subarray, $goal) { if (gettype($subarray) == 'array') { foreach ($subarray as $key => $element) { if (gettype($element) == 'string' && $element == $goal) { - echo "Array: " . print_r($subarray, false) . "\n"; + echo "Array: \n"; + print_r($subarray, false) . "\n"; echo "Found " . $element . " at key: ". $key . "\n"; return $subarray; } From 640181bf940e44757e21067f4d1f2a82db660557 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 04:15:24 +0200 Subject: [PATCH 109/191] Expermineting to drag results --- api/ui/Rearranger.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index a74445875c..a4ace3d16b 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -26,11 +26,11 @@ class Rearranger { public function seekAndSwap($array, $goal, $direction) { if (gettype($array) == 'array') { - foreach ($array as $key => $value) { - $goalkey = $this->searchInside($value, $goal); + foreach ($array as $subarray) { + $goalkey = $this->searchInside($subarray, $goal); if ($goalkey >= 0) { $temparray = $array; - $tempkey = $key; + $tempkey = $goalkey; $goalkey = -1; echo "Goal key is " . $tempkey . "\n"; echo "Initiating swap.. \n"; From ab406c99ce971b729e9c1dbf431391cd48a5828c Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 04:22:22 +0200 Subject: [PATCH 110/191] Expermineting to drag results --- api/ui/Rearranger.php | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index a4ace3d16b..fdbca260e6 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -26,24 +26,23 @@ class Rearranger { public function seekAndSwap($array, $goal, $direction) { if (gettype($array) == 'array') { - foreach ($array as $subarray) { - $goalkey = $this->searchInside($subarray, $goal); - if ($goalkey >= 0) { - $temparray = $array; - $tempkey = $goalkey; - $goalkey = -1; - echo "Goal key is " . $tempkey . "\n"; - echo "Initiating swap.. \n"; + foreach ($array as $element) { + $found = $this->searchInside($$element, $goal); + if ($found) { + $temparray = $element; + $found = false; + echo "Element found inside this array:\n"; + print_r($element, false); + echo "\nInitiating swap.. \n"; break; - } else { - foreach ($array as $element) { - if (gettype($element) == 'array') { - $this->seekAndSwap($element, $goal, $direction); - } + } + else { + if (gettype($element) == 'array') { + $this->seekAndSwap($element, $goal, $direction); } } } - if(isset($temparray) && $goalkey >= 0) { + if(isset($temparray)) { return $this->swap($temparray, $goal, $goalkey, $direction); } } @@ -53,15 +52,13 @@ public function searchInside ($subarray, $goal) { if (gettype($subarray) == 'array') { foreach ($subarray as $key => $element) { if (gettype($element) == 'string' && $element == $goal) { - echo "Array: \n"; - print_r($subarray, false) . "\n"; echo "Found " . $element . " at key: ". $key . "\n"; - return $subarray; + return true; } } - return -1; + return false; } - return -1; + return false; } public function swap($array, $goal, $goalkey, $direction) { $temp = ''; From d3121834845e16b8ca762cde0215f56ca0e53a6e Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 04:24:38 +0200 Subject: [PATCH 111/191] Expermineting to drag results --- api/ui/Rearranger.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index fdbca260e6..1d01bc9758 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -26,14 +26,14 @@ class Rearranger { public function seekAndSwap($array, $goal, $direction) { if (gettype($array) == 'array') { - foreach ($array as $element) { + foreach ($array as $goalkey => $element) { $found = $this->searchInside($$element, $goal); if ($found) { $temparray = $element; - $found = false; + $tempkey = $goalkey; echo "Element found inside this array:\n"; print_r($element, false); - echo "\nInitiating swap.. \n"; + echo "\nInitiating swap.. Key: " . $goalkey . "\n"; break; } else { @@ -42,8 +42,8 @@ public function seekAndSwap($array, $goal, $direction) { } } } - if(isset($temparray)) { - return $this->swap($temparray, $goal, $goalkey, $direction); + if(isset($temparray) && isset($tempkey)) { + return $this->swap($temparray, $goal, $tempkey, $direction); } } return $array; From ebc01554f1c0bdaa9e105aa792515244c16a9ba0 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 04:25:55 +0200 Subject: [PATCH 112/191] Expermineting to drag results --- api/ui/Rearranger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 1d01bc9758..c6234f0c1d 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -27,7 +27,7 @@ class Rearranger { public function seekAndSwap($array, $goal, $direction) { if (gettype($array) == 'array') { foreach ($array as $goalkey => $element) { - $found = $this->searchInside($$element, $goal); + $found = $this->searchInside($element, $goal); if ($found) { $temparray = $element; $tempkey = $goalkey; From c44abe0d528391a95ed942ea0b049469398c9594 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 04:28:09 +0200 Subject: [PATCH 113/191] Expermineting to drag results --- api/ui/Rearranger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index c6234f0c1d..1358debf0c 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -29,7 +29,7 @@ public function seekAndSwap($array, $goal, $direction) { foreach ($array as $goalkey => $element) { $found = $this->searchInside($element, $goal); if ($found) { - $temparray = $element; + $temparray = $array; $tempkey = $goalkey; echo "Element found inside this array:\n"; print_r($element, false); From 2489989304fe2241610136c5efdb894f4edfb71b Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 04:30:10 +0200 Subject: [PATCH 114/191] Expermineting to drag results --- api/ui/Rearranger.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 1358debf0c..ef0044afe6 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -32,8 +32,7 @@ public function seekAndSwap($array, $goal, $direction) { $temparray = $array; $tempkey = $goalkey; echo "Element found inside this array:\n"; - print_r($element, false); - echo "\nInitiating swap.. Key: " . $goalkey . "\n"; + print_r($array, false); break; } else { @@ -43,6 +42,7 @@ public function seekAndSwap($array, $goal, $direction) { } } if(isset($temparray) && isset($tempkey)) { + echo "\nInitiating swap.. Key: " . $goalkey . "\n"; return $this->swap($temparray, $goal, $tempkey, $direction); } } @@ -61,6 +61,8 @@ public function searchInside ($subarray, $goal) { return false; } public function swap($array, $goal, $goalkey, $direction) { + echo "swap received this array: \n"; + print_r($array, false); $temp = ''; $tempkey = 0; $counter = 0; From 577b5c9818ece89858a979ccb8e9e828d8279774 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 04:31:34 +0200 Subject: [PATCH 115/191] Expermineting to drag results --- api/ui/Rearranger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index ef0044afe6..619c75f887 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -61,7 +61,7 @@ public function searchInside ($subarray, $goal) { return false; } public function swap($array, $goal, $goalkey, $direction) { - echo "swap received this array: \n"; + echo "swap received '" . $direction . "' and this array: \n"; print_r($array, false); $temp = ''; $tempkey = 0; From 17042d663ccf3ed21a08991e9520536149f5a50d Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 04:33:07 +0200 Subject: [PATCH 116/191] Expermineting to drag results --- api/ui/Rearranger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 619c75f887..83f82098a8 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -93,7 +93,7 @@ public function swap($array, $goal, $goalkey, $direction) { return $array; } // if element is at last position, $temp will be set but nothing is swapped, foreach is over - else if ($element == $goal) { + else if ($key == $goalkey) { echo "Found " . $element . " at key: " . $key . "\n"; $temp = $element; } From fdf82e2fc5719aa844e3c84cfd8a34f49190b2f0 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 04:36:53 +0200 Subject: [PATCH 117/191] Expermineting to drag results --- api/ui/Rearranger.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 83f82098a8..eea10167ab 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -86,15 +86,17 @@ public function swap($array, $goal, $goalkey, $direction) { $temp = ''; foreach ($array as $key => $element) { if ($temp != '') { // previous element in temp2 is the goal, $element is the one to be swapped - echo "Array before swap: \n" . print_r($array, false) . "\n"; + echo "Array before swap: \n"; + print_r($array, false); $array[$goalkey] = $element; $array[$key] = $temp; - echo "Array after swap: \n" . print_r($array, false) . "\n"; + echo "Array after swap: \n"; + print_r($array, false); return $array; } // if element is at last position, $temp will be set but nothing is swapped, foreach is over else if ($key == $goalkey) { - echo "Found " . $element . " at key: " . $key . "\n"; + echo "Found array containing the value at key: " . $key . "\n"; $temp = $element; } } From f832cfbb36f9a838c2d903d196a36c05882810a5 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 15:13:30 +0200 Subject: [PATCH 118/191] Expermineting to drag results --- api/ui/Rearranger.php | 10 +++++----- api/ui/results.php | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index eea10167ab..db30024b65 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -61,8 +61,8 @@ public function searchInside ($subarray, $goal) { return false; } public function swap($array, $goal, $goalkey, $direction) { - echo "swap received '" . $direction . "' and this array: \n"; - print_r($array, false); + //echo "swap received '" . $direction . "' and this array: \n"; + //print_r($array, false); $temp = ''; $tempkey = 0; $counter = 0; @@ -86,8 +86,8 @@ public function swap($array, $goal, $goalkey, $direction) { $temp = ''; foreach ($array as $key => $element) { if ($temp != '') { // previous element in temp2 is the goal, $element is the one to be swapped - echo "Array before swap: \n"; - print_r($array, false); + //echo "Array before swap: \n"; + //print_r($array, false); $array[$goalkey] = $element; $array[$key] = $temp; echo "Array after swap: \n"; @@ -96,7 +96,7 @@ public function swap($array, $goal, $goalkey, $direction) { } // if element is at last position, $temp will be set but nothing is swapped, foreach is over else if ($key == $goalkey) { - echo "Found array containing the value at key: " . $key . "\n"; + //echo "Found array containing the value at key: " . $key . "\n"; $temp = $element; } } diff --git a/api/ui/results.php b/api/ui/results.php index bb93331ee7..ddb8b00c0a 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -84,8 +84,10 @@ public function get() { $arr = $system->getResultsAll(); $id = $this->get['uid']; $arr = json_decode($arr, true); + print_r($arr, false); $rearranger = new Rearranger(); $swapped_arr = $rearranger->seekAndSwap($arr, $id, 'down'); + print_r($swapped_arr, false); $system->setResultsAll(json_encode($swapped_arr)); break; default: From 8687c73614cd6199dec277668f8b59341576d99f Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 15:23:35 +0200 Subject: [PATCH 119/191] Expermineting to drag results --- api/ui/Rearranger.php | 15 +++++++++------ api/ui/results.php | 2 -- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index db30024b65..5a1df489e0 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -31,8 +31,8 @@ public function seekAndSwap($array, $goal, $direction) { if ($found) { $temparray = $array; $tempkey = $goalkey; - echo "Element found inside this array:\n"; - print_r($array, false); + //echo "Element found inside this array:\n"; + //print_r($array, false); break; } else { @@ -42,8 +42,11 @@ public function seekAndSwap($array, $goal, $direction) { } } if(isset($temparray) && isset($tempkey)) { - echo "\nInitiating swap.. Key: " . $goalkey . "\n"; - return $this->swap($temparray, $goal, $tempkey, $direction); + echo "\nInitiating swap.. Key: " . $tempkey . "\n"; + $temparray = $this->swap($temparray, $goal, $tempkey, $direction); + echo "Returning the array: \n"; + print_r($temparray, false); + return $temparray; } } return $array; @@ -90,8 +93,8 @@ public function swap($array, $goal, $goalkey, $direction) { //print_r($array, false); $array[$goalkey] = $element; $array[$key] = $temp; - echo "Array after swap: \n"; - print_r($array, false); + //echo "Array after swap: \n"; + //print_r($array, false); return $array; } // if element is at last position, $temp will be set but nothing is swapped, foreach is over diff --git a/api/ui/results.php b/api/ui/results.php index ddb8b00c0a..bb93331ee7 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -84,10 +84,8 @@ public function get() { $arr = $system->getResultsAll(); $id = $this->get['uid']; $arr = json_decode($arr, true); - print_r($arr, false); $rearranger = new Rearranger(); $swapped_arr = $rearranger->seekAndSwap($arr, $id, 'down'); - print_r($swapped_arr, false); $system->setResultsAll(json_encode($swapped_arr)); break; default: From 28b76d398ee0f1387a777342c64c4c1e55115580 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 15:23:59 +0200 Subject: [PATCH 120/191] Expermineting to drag results --- api/ui/Rearranger.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 5a1df489e0..deba69ee62 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -51,7 +51,8 @@ public function seekAndSwap($array, $goal, $direction) { } return $array; } - public function searchInside ($subarray, $goal) { + public function searchInside ($subarray, $goal): bool + { if (gettype($subarray) == 'array') { foreach ($subarray as $key => $element) { if (gettype($element) == 'string' && $element == $goal) { From 8281bf2afaf6a1b47ec238ff1bfacc9cc17e7bf7 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 15:28:58 +0200 Subject: [PATCH 121/191] Expermineting to drag results --- api/ui/Rearranger.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index deba69ee62..e4613fef22 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -43,10 +43,10 @@ public function seekAndSwap($array, $goal, $direction) { } if(isset($temparray) && isset($tempkey)) { echo "\nInitiating swap.. Key: " . $tempkey . "\n"; - $temparray = $this->swap($temparray, $goal, $tempkey, $direction); + $array = $this->swap($temparray, $goal, $tempkey, $direction); echo "Returning the array: \n"; - print_r($temparray, false); - return $temparray; + print_r($array, false); + return $array; } } return $array; From e483dcdfaa9622eea2ad9dbe38ad0dd1f39c1b67 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 15:29:57 +0200 Subject: [PATCH 122/191] Expermineting to drag results --- api/ui/Rearranger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index e4613fef22..eb7203682c 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -37,7 +37,7 @@ public function seekAndSwap($array, $goal, $direction) { } else { if (gettype($element) == 'array') { - $this->seekAndSwap($element, $goal, $direction); + $array = $this->seekAndSwap($element, $goal, $direction); } } } From 6e608385f7cb59585c46111906ed78b03076a283 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 15:30:52 +0200 Subject: [PATCH 123/191] Expermineting to drag results --- api/ui/results.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/ui/results.php b/api/ui/results.php index bb93331ee7..61d3d14d28 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -86,6 +86,8 @@ public function get() { $arr = json_decode($arr, true); $rearranger = new Rearranger(); $swapped_arr = $rearranger->seekAndSwap($arr, $id, 'down'); + echo "Swapped? : \n"; + print_r($swapped_arr, false); $system->setResultsAll(json_encode($swapped_arr)); break; default: From cf55c018be4d5548845d9ab9a6e4beaa579b154a Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 15:32:33 +0200 Subject: [PATCH 124/191] Expermineting to drag results --- api/ui/results.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index 61d3d14d28..f8b2ce1244 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -88,7 +88,7 @@ public function get() { $swapped_arr = $rearranger->seekAndSwap($arr, $id, 'down'); echo "Swapped? : \n"; print_r($swapped_arr, false); - $system->setResultsAll(json_encode($swapped_arr)); + //$system->setResultsAll(json_encode($swapped_arr)); break; default: throw new Exception("Unknown action!"); From c0dc46c2a2c03d70c25ecc7d8c6054930c78919b Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 15:34:15 +0200 Subject: [PATCH 125/191] Expermineting to drag results --- api/ui/Rearranger.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index eb7203682c..c3851d3686 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -36,9 +36,7 @@ public function seekAndSwap($array, $goal, $direction) { break; } else { - if (gettype($element) == 'array') { - $array = $this->seekAndSwap($element, $goal, $direction); - } + $array = $this->seekAndSwap($element, $goal, $direction); } } if(isset($temparray) && isset($tempkey)) { From 4b1bb678ba884ee4ca536e3077268ca1a0598eaf Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 15:36:51 +0200 Subject: [PATCH 126/191] Expermineting to drag results --- api/ui/Rearranger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index c3851d3686..91a0e81a55 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -36,7 +36,7 @@ public function seekAndSwap($array, $goal, $direction) { break; } else { - $array = $this->seekAndSwap($element, $goal, $direction); + $this->seekAndSwap($element, $goal, $direction); } } if(isset($temparray) && isset($tempkey)) { From a35d818c05ea336c0f9caf96ddcc4f25f1a0da79 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 15:38:55 +0200 Subject: [PATCH 127/191] Expermineting to drag results --- api/ui/Rearranger.php | 4 ++-- api/ui/results.php | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 91a0e81a55..5f503b0104 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -42,8 +42,8 @@ public function seekAndSwap($array, $goal, $direction) { if(isset($temparray) && isset($tempkey)) { echo "\nInitiating swap.. Key: " . $tempkey . "\n"; $array = $this->swap($temparray, $goal, $tempkey, $direction); - echo "Returning the array: \n"; - print_r($array, false); + //echo "Returning the array: \n"; + //print_r($array, false); return $array; } } diff --git a/api/ui/results.php b/api/ui/results.php index f8b2ce1244..15100a2d32 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -86,6 +86,8 @@ public function get() { $arr = json_decode($arr, true); $rearranger = new Rearranger(); $swapped_arr = $rearranger->seekAndSwap($arr, $id, 'down'); + echo "Preswap : \n"; + print_r($arr, false); echo "Swapped? : \n"; print_r($swapped_arr, false); //$system->setResultsAll(json_encode($swapped_arr)); From 0f3147ad115c9f50c39c8a93db4e44a4640d262e Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 15:51:08 +0200 Subject: [PATCH 128/191] Expermineting to drag results --- api/ui/Rearranger.php | 23 ++++++++++++----------- api/ui/results.php | 6 ++++-- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 5f503b0104..127d10488a 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -24,19 +24,20 @@ SOFTWARE. */ class Rearranger { - public function seekAndSwap($array, $goal, $direction) { + public function seekAndSwap($array, $goal, $direction, $resultId) { if (gettype($array) == 'array') { foreach ($array as $goalkey => $element) { - $found = $this->searchInside($element, $goal); - if ($found) { - $temparray = $array; - $tempkey = $goalkey; - //echo "Element found inside this array:\n"; - //print_r($array, false); - break; - } - else { - $this->seekAndSwap($element, $goal, $direction); + if ($goalkey == $resultId) { // Only change order in the current result config + $found = $this->searchInside($element, $goal); + if ($found) { + $temparray = $array; + $tempkey = $goalkey; + //echo "Element found inside this array:\n"; + //print_r($array, false); + break; + } else { + $this->seekAndSwap($element, $goal, $direction, $resultId); + } } } if(isset($temparray) && isset($tempkey)) { diff --git a/api/ui/results.php b/api/ui/results.php index 15100a2d32..255e17d861 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -73,19 +73,21 @@ public function get() { $system = new System($this->get['systemId']); $arr = $system->getResultsAll(); $id = $this->get['uid']; + $resultId = $this->get['resultId']; echo "UID is " . $id . "\n"; $arr = json_decode($arr, true); $rearranger = new Rearranger(); - $swapped_arr = $rearranger->seekAndSwap($arr, $id, 'up'); + $swapped_arr = $rearranger->seekAndSwap($arr, $id, 'up', $resultId); $system->setResultsAll(json_encode($swapped_arr)); break; case 'down': $system = new System($this->get['systemId']); $arr = $system->getResultsAll(); $id = $this->get['uid']; + $resultId = $this->get['resultId']; $arr = json_decode($arr, true); $rearranger = new Rearranger(); - $swapped_arr = $rearranger->seekAndSwap($arr, $id, 'down'); + $swapped_arr['elements'] = $rearranger->seekAndSwap($arr['elements'], $id, 'down', $resultId); echo "Preswap : \n"; print_r($arr, false); echo "Swapped? : \n"; From 3b518155d7310c97e858138e9f78c329491b9905 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 15:55:51 +0200 Subject: [PATCH 129/191] Expermineting to drag results --- api/ui/Rearranger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 127d10488a..1bd143916a 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -42,10 +42,10 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { } if(isset($temparray) && isset($tempkey)) { echo "\nInitiating swap.. Key: " . $tempkey . "\n"; - $array = $this->swap($temparray, $goal, $tempkey, $direction); + $temparray = $this->swap($temparray, $goal, $tempkey, $direction); //echo "Returning the array: \n"; //print_r($array, false); - return $array; + return $temparray; } } return $array; From 836a4fb0d3435354cbbf13f9bfd718bf251a8f05 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 15:58:00 +0200 Subject: [PATCH 130/191] Expermineting to drag results --- api/ui/results.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index 255e17d861..5564a67178 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -87,9 +87,10 @@ public function get() { $resultId = $this->get['resultId']; $arr = json_decode($arr, true); $rearranger = new Rearranger(); + $swapped_arr = $arr; $swapped_arr['elements'] = $rearranger->seekAndSwap($arr['elements'], $id, 'down', $resultId); - echo "Preswap : \n"; - print_r($arr, false); + //echo "Preswap : \n"; + //print_r($arr, false); echo "Swapped? : \n"; print_r($swapped_arr, false); //$system->setResultsAll(json_encode($swapped_arr)); From 46688bbee5a7e030d63f956f3be4ae27fb403498 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 15:59:14 +0200 Subject: [PATCH 131/191] Expermineting to drag results --- api/ui/Rearranger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 1bd143916a..581201e7c5 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -32,7 +32,7 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { if ($found) { $temparray = $array; $tempkey = $goalkey; - //echo "Element found inside this array:\n"; + echo "Element found\n"; //print_r($array, false); break; } else { From 46677b4082b3f4de064890a831699a1766e8e34c Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:02:27 +0200 Subject: [PATCH 132/191] Expermineting to drag results --- api/ui/Rearranger.php | 24 +++++++++++++----------- api/ui/results.php | 4 ++-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 581201e7c5..c4156b81c3 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -26,17 +26,19 @@ class Rearranger { public function seekAndSwap($array, $goal, $direction, $resultId) { if (gettype($array) == 'array') { - foreach ($array as $goalkey => $element) { - if ($goalkey == $resultId) { // Only change order in the current result config - $found = $this->searchInside($element, $goal); - if ($found) { - $temparray = $array; - $tempkey = $goalkey; - echo "Element found\n"; - //print_r($array, false); - break; - } else { - $this->seekAndSwap($element, $goal, $direction, $resultId); + foreach ($array as $key => $subarray) { + if ($key == $resultId) { // Only change order in the current result config + foreach ($array as $goalkey => $element) { + $found = $this->searchInside($element, $goal); + if ($found) { + $temparray = $array; + $tempkey = $goalkey; + echo "Element found\n"; + //print_r($array, false); + break; + } else { + $this->seekAndSwap($element, $goal, $direction, $resultId); + } } } } diff --git a/api/ui/results.php b/api/ui/results.php index 5564a67178..5295f86443 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -91,8 +91,8 @@ public function get() { $swapped_arr['elements'] = $rearranger->seekAndSwap($arr['elements'], $id, 'down', $resultId); //echo "Preswap : \n"; //print_r($arr, false); - echo "Swapped? : \n"; - print_r($swapped_arr, false); + //echo "Swapped? : \n"; + //print_r($swapped_arr, false); //$system->setResultsAll(json_encode($swapped_arr)); break; default: From 55c12d7eca81c02b69eb4006ce7882c0c54691c3 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:04:18 +0200 Subject: [PATCH 133/191] Expermineting to drag results --- api/ui/Rearranger.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index c4156b81c3..802ca64463 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -28,10 +28,11 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { if (gettype($array) == 'array') { foreach ($array as $key => $subarray) { if ($key == $resultId) { // Only change order in the current result config - foreach ($array as $goalkey => $element) { + echo "Detected resultID"; + foreach ($subarray as $goalkey => $element) { $found = $this->searchInside($element, $goal); if ($found) { - $temparray = $array; + $temparray = $subarray; $tempkey = $goalkey; echo "Element found\n"; //print_r($array, false); From a2f66c6ef65258606707c33b8fd15fcf4f8d64a7 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:05:15 +0200 Subject: [PATCH 134/191] Expermineting to drag results --- api/ui/Rearranger.php | 1 + 1 file changed, 1 insertion(+) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 802ca64463..a6a14e335e 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -27,6 +27,7 @@ class Rearranger { public function seekAndSwap($array, $goal, $direction, $resultId) { if (gettype($array) == 'array') { foreach ($array as $key => $subarray) { + echo "key: " . $key . "resultId: " . $resultId . "\n"; if ($key == $resultId) { // Only change order in the current result config echo "Detected resultID"; foreach ($subarray as $goalkey => $element) { From df615a6c585d55b79e8ce0b1de4ec1fecb7bd01e Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:06:46 +0200 Subject: [PATCH 135/191] Expermineting to drag results --- views/results/build.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/results/build.php b/views/results/build.php index aab60ced50..6eb38da2df 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -70,7 +70,7 @@ function movePlots(direction, id) { console.log(direction); console.log(id); $.ajax({ - url : '/api/ui/results/uid=' + id + '/type=' + plotType +'/systemId=" . $data['system']->getId() . "/action=' + direction + '/resultId=" . $data['resultId'] . "', + url : '/api/ui/results/uid=' + id + '/type=' + plotType +'/systemId=" . $data['system']->getId() . "/action=' + direction + '/resultId=" . $data['resultId'] . "/', type: 'GET', data: { id: id From c4869d7c1c04db4ab00e9395ce2b9a79d39c3233 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:09:26 +0200 Subject: [PATCH 136/191] Expermineting to drag results --- api/ui/Rearranger.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index a6a14e335e..b292901cd2 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -29,7 +29,6 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { foreach ($array as $key => $subarray) { echo "key: " . $key . "resultId: " . $resultId . "\n"; if ($key == $resultId) { // Only change order in the current result config - echo "Detected resultID"; foreach ($subarray as $goalkey => $element) { $found = $this->searchInside($element, $goal); if ($found) { @@ -56,6 +55,8 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { } public function searchInside ($subarray, $goal): bool { + echo "goal: " . $goal . "\n"; + print_r($subarray, false); if (gettype($subarray) == 'array') { foreach ($subarray as $key => $element) { if (gettype($element) == 'string' && $element == $goal) { From de39afb7e0ebc857f8acb43d2e80d4ca1a3dbb18 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:14:58 +0200 Subject: [PATCH 137/191] Expermineting to drag results --- api/ui/Rearranger.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index b292901cd2..e44f895007 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -55,13 +55,15 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { } public function searchInside ($subarray, $goal): bool { - echo "goal: " . $goal . "\n"; + //echo "goal: " . $goal . "\n"; print_r($subarray, false); if (gettype($subarray) == 'array') { foreach ($subarray as $key => $element) { - if (gettype($element) == 'string' && $element == $goal) { - echo "Found " . $element . " at key: ". $key . "\n"; - return true; + foreach ($element as $elementkey => $elementvalue) { + if (gettype($elementvalue) == 'string' && $element == $goal) { + echo "Found " . $element . " at key: " . $key . "\n"; + return true; + } } } return false; From 8790d08fbbf758c6cee171fa3fb4c64b83e15cc7 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:15:13 +0200 Subject: [PATCH 138/191] Expermineting to drag results --- api/ui/Rearranger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index e44f895007..c86feeecb0 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -27,7 +27,7 @@ class Rearranger { public function seekAndSwap($array, $goal, $direction, $resultId) { if (gettype($array) == 'array') { foreach ($array as $key => $subarray) { - echo "key: " . $key . "resultId: " . $resultId . "\n"; + //echo "key: " . $key . "resultId: " . $resultId . "\n"; if ($key == $resultId) { // Only change order in the current result config foreach ($subarray as $goalkey => $element) { $found = $this->searchInside($element, $goal); From 783d08f8c1d07fa1118fcb996454e8268697eefc Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:17:10 +0200 Subject: [PATCH 139/191] Expermineting to drag results --- api/ui/Rearranger.php | 1 + 1 file changed, 1 insertion(+) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index c86feeecb0..edaab972e0 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -60,6 +60,7 @@ public function searchInside ($subarray, $goal): bool if (gettype($subarray) == 'array') { foreach ($subarray as $key => $element) { foreach ($element as $elementkey => $elementvalue) { + echo $elementvalue . "\n"; if (gettype($elementvalue) == 'string' && $element == $goal) { echo "Found " . $element . " at key: " . $key . "\n"; return true; From c4e08dd9ae354cd6fa33520397bf6dd8a23ce1aa Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:18:09 +0200 Subject: [PATCH 140/191] Expermineting to drag results --- api/ui/Rearranger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index edaab972e0..1019f84f59 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -56,12 +56,12 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { public function searchInside ($subarray, $goal): bool { //echo "goal: " . $goal . "\n"; - print_r($subarray, false); + //print_r($subarray, false); if (gettype($subarray) == 'array') { foreach ($subarray as $key => $element) { foreach ($element as $elementkey => $elementvalue) { echo $elementvalue . "\n"; - if (gettype($elementvalue) == 'string' && $element == $goal) { + if (gettype($elementvalue) == 'string' && $elementvalue == $goal) { echo "Found " . $element . " at key: " . $key . "\n"; return true; } From e16deb33f0c27ad35ae231abfc2bf1bd3067b60f Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:20:46 +0200 Subject: [PATCH 141/191] Expermineting to drag results --- api/ui/Rearranger.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 1019f84f59..92d1b0f06e 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -58,13 +58,11 @@ public function searchInside ($subarray, $goal): bool //echo "goal: " . $goal . "\n"; //print_r($subarray, false); if (gettype($subarray) == 'array') { - foreach ($subarray as $key => $element) { - foreach ($element as $elementkey => $elementvalue) { - echo $elementvalue . "\n"; - if (gettype($elementvalue) == 'string' && $elementvalue == $goal) { - echo "Found " . $element . " at key: " . $key . "\n"; - return true; - } + foreach ($subarray as $elementkey => $elementvalue) { + echo $elementvalue . "\n"; + if (gettype($elementvalue) == 'string' && $elementvalue == $goal) { + echo "Found " . $elementvalue . " at key: " . $elementkey . "\n"; + return true; } } return false; From 397f769ab42e2cb036722a4d65c404f7937a702e Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:23:47 +0200 Subject: [PATCH 142/191] Expermineting to drag results --- api/ui/Rearranger.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 92d1b0f06e..5091b03a25 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -58,11 +58,13 @@ public function searchInside ($subarray, $goal): bool //echo "goal: " . $goal . "\n"; //print_r($subarray, false); if (gettype($subarray) == 'array') { - foreach ($subarray as $elementkey => $elementvalue) { - echo $elementvalue . "\n"; - if (gettype($elementvalue) == 'string' && $elementvalue == $goal) { - echo "Found " . $elementvalue . " at key: " . $elementkey . "\n"; - return true; + foreach ($subarray as $key => $element) { + foreach ($element as $elementkey => $elementvalue) { + echo $elementvalue . "\n"; + if (gettype($elementvalue) == 'string' && $elementvalue == $goal) { + echo "Found " . $elementvalue . " at key: " . $elementkey . "\n"; + return true; + } } } return false; From 5f899b760254332ef188393789143b4c3c619c68 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:28:40 +0200 Subject: [PATCH 143/191] Expermineting to drag results --- api/ui/Rearranger.php | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 5091b03a25..5f073c5d62 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -29,16 +29,19 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { foreach ($array as $key => $subarray) { //echo "key: " . $key . "resultId: " . $resultId . "\n"; if ($key == $resultId) { // Only change order in the current result config - foreach ($subarray as $goalkey => $element) { - $found = $this->searchInside($element, $goal); - if ($found) { - $temparray = $subarray; - $tempkey = $goalkey; - echo "Element found\n"; - //print_r($array, false); - break; - } else { - $this->seekAndSwap($element, $goal, $direction, $resultId); + foreach ($subarray as $jobtype => $jobs) { + foreach ($jobs as $number => $job) { + $found = $this->searchInside($job, $goal); + if ($found) { + $temparray = $jobs; + $tempkey = $number; + echo "Element found at key: " . $tempkey . "\n"; + //print_r($array, false); + break; + } else { + echo "else shouldnt happen anymore"; + //$this->seekAndSwap($element, $goal, $direction, $resultId); + } } } } @@ -60,9 +63,9 @@ public function searchInside ($subarray, $goal): bool if (gettype($subarray) == 'array') { foreach ($subarray as $key => $element) { foreach ($element as $elementkey => $elementvalue) { - echo $elementvalue . "\n"; + //echo $elementvalue . "\n"; if (gettype($elementvalue) == 'string' && $elementvalue == $goal) { - echo "Found " . $elementvalue . " at key: " . $elementkey . "\n"; + echo "Found " . $elementvalue . " at key: " . $key . "\n"; return true; } } From 6c7494d37a27a41f4b9977ea374c8f9f70b631a4 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:29:54 +0200 Subject: [PATCH 144/191] Expermineting to drag results --- api/ui/Rearranger.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 5f073c5d62..f3c70f973e 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -62,12 +62,9 @@ public function searchInside ($subarray, $goal): bool //print_r($subarray, false); if (gettype($subarray) == 'array') { foreach ($subarray as $key => $element) { - foreach ($element as $elementkey => $elementvalue) { - //echo $elementvalue . "\n"; - if (gettype($elementvalue) == 'string' && $elementvalue == $goal) { - echo "Found " . $elementvalue . " at key: " . $key . "\n"; - return true; - } + if (gettype($element) == 'string' && $element == $goal) { + echo "Found " . $element . " at key: " . $key . "\n"; + return true; } } return false; From b312271369ad4f6062d4e65b89a317d29bd080b3 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:30:51 +0200 Subject: [PATCH 145/191] Expermineting to drag results --- api/ui/Rearranger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index f3c70f973e..684cb68b58 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -39,7 +39,7 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { //print_r($array, false); break; } else { - echo "else shouldnt happen anymore"; + echo "else shouldnt happen anymore\n"; //$this->seekAndSwap($element, $goal, $direction, $resultId); } } @@ -63,7 +63,7 @@ public function searchInside ($subarray, $goal): bool if (gettype($subarray) == 'array') { foreach ($subarray as $key => $element) { if (gettype($element) == 'string' && $element == $goal) { - echo "Found " . $element . " at key: " . $key . "\n"; + echo "Found " . $element . "\n"; return true; } } From 06549ae0bb92ed27b3a8c25101217ef23b63cce5 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:31:47 +0200 Subject: [PATCH 146/191] Expermineting to drag results --- api/ui/Rearranger.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 684cb68b58..6792b374b0 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -30,17 +30,19 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { //echo "key: " . $key . "resultId: " . $resultId . "\n"; if ($key == $resultId) { // Only change order in the current result config foreach ($subarray as $jobtype => $jobs) { - foreach ($jobs as $number => $job) { - $found = $this->searchInside($job, $goal); - if ($found) { - $temparray = $jobs; - $tempkey = $number; - echo "Element found at key: " . $tempkey . "\n"; - //print_r($array, false); - break; - } else { - echo "else shouldnt happen anymore\n"; - //$this->seekAndSwap($element, $goal, $direction, $resultId); + if(gettype($jobs) == 'array') { + foreach ($jobs as $number => $job) { + $found = $this->searchInside($job, $goal); + if ($found) { + $temparray = $jobs; + $tempkey = $number; + echo "Element found at key: " . $tempkey . "\n"; + //print_r($array, false); + break; + } else { + echo "else shouldnt happen anymore\n"; + //$this->seekAndSwap($element, $goal, $direction, $resultId); + } } } } From 30723c7cce2db5147667afbca30b8b447107ca13 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:32:28 +0200 Subject: [PATCH 147/191] Expermineting to drag results --- api/ui/Rearranger.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 6792b374b0..66e42a86a4 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -39,9 +39,6 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { echo "Element found at key: " . $tempkey . "\n"; //print_r($array, false); break; - } else { - echo "else shouldnt happen anymore\n"; - //$this->seekAndSwap($element, $goal, $direction, $resultId); } } } From c607c4f4eba1b50f171601450e9dda07498e6d42 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:33:01 +0200 Subject: [PATCH 148/191] Expermineting to drag results --- api/ui/Rearranger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 66e42a86a4..22e8b7fcca 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -48,8 +48,8 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { if(isset($temparray) && isset($tempkey)) { echo "\nInitiating swap.. Key: " . $tempkey . "\n"; $temparray = $this->swap($temparray, $goal, $tempkey, $direction); - //echo "Returning the array: \n"; - //print_r($array, false); + echo "Returning the array: \n"; + print_r($array, false); return $temparray; } } From 28ab0aab020c4f562631f7925622e25e78ae6ee7 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:35:10 +0200 Subject: [PATCH 149/191] Expermineting to drag results --- api/ui/Rearranger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 22e8b7fcca..1a26659d25 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -49,7 +49,7 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { echo "\nInitiating swap.. Key: " . $tempkey . "\n"; $temparray = $this->swap($temparray, $goal, $tempkey, $direction); echo "Returning the array: \n"; - print_r($array, false); + print_r($temparray, false); return $temparray; } } From 7bf4720ab42244dc0e100dab2e891f295e48e15e Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:41:26 +0200 Subject: [PATCH 150/191] Expermineting to drag results --- api/ui/Rearranger.php | 19 +++++++------------ api/ui/results.php | 3 ++- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 1a26659d25..3c5c803aa2 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -34,24 +34,19 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { foreach ($jobs as $number => $job) { $found = $this->searchInside($job, $goal); if ($found) { - $temparray = $jobs; - $tempkey = $number; - echo "Element found at key: " . $tempkey . "\n"; - //print_r($array, false); - break; + echo "\nInitiating swap.. Key: " . $number . "\n"; + $temparray = $this->swap($jobs, $goal, $number, $direction); + $jobs = $temparray; + echo "Element found at key: " . $number . "\n"; + //print_r($temparray, false); + print_r($array, false); + return $array; } } } } } } - if(isset($temparray) && isset($tempkey)) { - echo "\nInitiating swap.. Key: " . $tempkey . "\n"; - $temparray = $this->swap($temparray, $goal, $tempkey, $direction); - echo "Returning the array: \n"; - print_r($temparray, false); - return $temparray; - } } return $array; } diff --git a/api/ui/results.php b/api/ui/results.php index 5295f86443..9fdc814dc7 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -77,7 +77,8 @@ public function get() { echo "UID is " . $id . "\n"; $arr = json_decode($arr, true); $rearranger = new Rearranger(); - $swapped_arr = $rearranger->seekAndSwap($arr, $id, 'up', $resultId); + $swapped_arr = $arr; + $swapped_arr['elements'] = $rearranger->seekAndSwap($arr, $id, 'up', $resultId); $system->setResultsAll(json_encode($swapped_arr)); break; case 'down': From af5895689fcdeddc8e4dd9291964ab8f315ee688 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:45:55 +0200 Subject: [PATCH 151/191] Expermineting to drag results --- api/ui/Rearranger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 3c5c803aa2..1b821dcd10 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -36,7 +36,7 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { if ($found) { echo "\nInitiating swap.. Key: " . $number . "\n"; $temparray = $this->swap($jobs, $goal, $number, $direction); - $jobs = $temparray; + $array[$key[$jobtype]] = $temparray; echo "Element found at key: " . $number . "\n"; //print_r($temparray, false); print_r($array, false); From 571227908fcb6776d5580ddc471061c80de71b06 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:47:37 +0200 Subject: [PATCH 152/191] Expermineting to drag results --- api/ui/Rearranger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 1b821dcd10..65ab68e3e3 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -36,9 +36,9 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { if ($found) { echo "\nInitiating swap.. Key: " . $number . "\n"; $temparray = $this->swap($jobs, $goal, $number, $direction); - $array[$key[$jobtype]] = $temparray; + //$array[$key[$jobtype]] = $temparray; echo "Element found at key: " . $number . "\n"; - //print_r($temparray, false); + print_r($temparray, false); print_r($array, false); return $array; } From 4a4aa2fda9733e3b5780d7f82f6431f43e082d3c Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:50:45 +0200 Subject: [PATCH 153/191] Expermineting to drag results --- api/ui/Rearranger.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 65ab68e3e3..48b5aab931 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -35,10 +35,9 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { $found = $this->searchInside($job, $goal); if ($found) { echo "\nInitiating swap.. Key: " . $number . "\n"; - $temparray = $this->swap($jobs, $goal, $number, $direction); - //$array[$key[$jobtype]] = $temparray; + $jobs = $this->swap($jobs, $goal, $number, $direction); echo "Element found at key: " . $number . "\n"; - print_r($temparray, false); + print_r($jobs, false); print_r($array, false); return $array; } From 531ae133aad010508372181be6459099858e73b4 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:52:37 +0200 Subject: [PATCH 154/191] Expermineting to drag results --- api/ui/Rearranger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 48b5aab931..934b7b08af 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -35,9 +35,9 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { $found = $this->searchInside($job, $goal); if ($found) { echo "\nInitiating swap.. Key: " . $number . "\n"; - $jobs = $this->swap($jobs, $goal, $number, $direction); + $array[$key[$jobtype[$jobs]]] = $this->swap($jobs, $goal, $number, $direction); echo "Element found at key: " . $number . "\n"; - print_r($jobs, false); + print_r($array[$key[$jobtype[$jobs]]], false); print_r($array, false); return $array; } From 31d3827fb10ddb2759d3a093fb804a089b4d8d3f Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:55:06 +0200 Subject: [PATCH 155/191] Expermineting to drag results --- api/ui/Rearranger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 934b7b08af..7b79a9ce23 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -35,9 +35,9 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { $found = $this->searchInside($job, $goal); if ($found) { echo "\nInitiating swap.. Key: " . $number . "\n"; - $array[$key[$jobtype[$jobs]]] = $this->swap($jobs, $goal, $number, $direction); + $array[$key][$jobtype][$jobs] = $this->swap($jobs, $goal, $number, $direction); echo "Element found at key: " . $number . "\n"; - print_r($array[$key[$jobtype[$jobs]]], false); + print_r($array[$key][$jobtype][$jobs], false); print_r($array, false); return $array; } From 75679f23123fefd8a8f563a958a8d38fbfa16826 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 16:57:54 +0200 Subject: [PATCH 156/191] Expermineting to drag results --- api/ui/Rearranger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 7b79a9ce23..0d6b271872 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -35,7 +35,7 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { $found = $this->searchInside($job, $goal); if ($found) { echo "\nInitiating swap.. Key: " . $number . "\n"; - $array[$key][$jobtype][$jobs] = $this->swap($jobs, $goal, $number, $direction); + $array[$key][$jobtype][$number] = $this->swap($jobs, $goal, $number, $direction); echo "Element found at key: " . $number . "\n"; print_r($array[$key][$jobtype][$jobs], false); print_r($array, false); From 4743e8bbaff5d1268a1b40477f6769ef30302694 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 17:03:35 +0200 Subject: [PATCH 157/191] Expermineting to drag results --- api/ui/Rearranger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 0d6b271872..4b60b4fccc 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -37,7 +37,7 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { echo "\nInitiating swap.. Key: " . $number . "\n"; $array[$key][$jobtype][$number] = $this->swap($jobs, $goal, $number, $direction); echo "Element found at key: " . $number . "\n"; - print_r($array[$key][$jobtype][$jobs], false); + print_r($array[$key][$jobtype][$number], false); print_r($array, false); return $array; } From 5009d0f00644af62be186e1741c358c53baf2a7f Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 17:10:52 +0200 Subject: [PATCH 158/191] Expermineting to drag results --- api/ui/Rearranger.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 4b60b4fccc..ba25da78e6 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -64,22 +64,22 @@ public function searchInside ($subarray, $goal): bool } return false; } - public function swap($array, $goal, $goalkey, $direction) { + public function swap($jobs, $goal, $goalkey, $direction) { //echo "swap received '" . $direction . "' and this array: \n"; //print_r($array, false); $temp = ''; $tempkey = 0; $counter = 0; if ($direction == 'up') { - foreach ($array as $key => $element) { + foreach ($jobs as $key => $element) { if ($element == $goal && $counter > 0) { - $array[$tempkey] = $element; - $array[$goalkey] = $temp; - return $array; + $jobs[$tempkey] = $element; + $jobs[$goalkey] = $temp; + return $jobs; } else if ($element == $goal && $counter == 0) { echo "found, but already at head"; - return $array; + return $jobs; } $counter++; $temp = $element; @@ -88,23 +88,23 @@ public function swap($array, $goal, $goalkey, $direction) { } else if ($direction == 'down') { $temp = ''; - foreach ($array as $key => $element) { - if ($temp != '') { // previous element in temp2 is the goal, $element is the one to be swapped + foreach ($jobs as $number => $job) { + if ($tempjob != '') { // previous element in temp2 is the goal, $element is the one to be swapped //echo "Array before swap: \n"; //print_r($array, false); - $array[$goalkey] = $element; - $array[$key] = $temp; - //echo "Array after swap: \n"; - //print_r($array, false); - return $array; + $jobs[$goalkey] = $job; + $jobs[$number] = $tempjob; + echo "Array after swap: \n"; + print_r($jobs, false); + return $jobs; } // if element is at last position, $temp will be set but nothing is swapped, foreach is over - else if ($key == $goalkey) { + else if ($number == $goalkey) { //echo "Found array containing the value at key: " . $key . "\n"; - $temp = $element; + $tempjob = $job; } } } - return $array; + return $jobs; } } \ No newline at end of file From 06f829c57dba2a5de7143922ddc419911cf65678 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 17:11:26 +0200 Subject: [PATCH 159/191] Expermineting to drag results --- api/ui/Rearranger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index ba25da78e6..a3ce59194b 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -87,7 +87,7 @@ public function swap($jobs, $goal, $goalkey, $direction) { } } else if ($direction == 'down') { - $temp = ''; + $tempjob = ''; foreach ($jobs as $number => $job) { if ($tempjob != '') { // previous element in temp2 is the goal, $element is the one to be swapped //echo "Array before swap: \n"; From d4e2dac1eea5ea8be244bd0d5714b797aa199ac2 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 17:13:08 +0200 Subject: [PATCH 160/191] Expermineting to drag results --- api/ui/Rearranger.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index a3ce59194b..6efb53c977 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -35,9 +35,8 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { $found = $this->searchInside($job, $goal); if ($found) { echo "\nInitiating swap.. Key: " . $number . "\n"; - $array[$key][$jobtype][$number] = $this->swap($jobs, $goal, $number, $direction); + $array[$key][$jobtype] = $this->swap($jobs, $goal, $number, $direction); echo "Element found at key: " . $number . "\n"; - print_r($array[$key][$jobtype][$number], false); print_r($array, false); return $array; } From 43c88cd3cab9ed3f6190ef98e5770bc69267a7fe Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 17:14:41 +0200 Subject: [PATCH 161/191] Expermineting to drag results --- api/ui/Rearranger.php | 6 +++--- api/ui/results.php | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 6efb53c977..d0f2c14954 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -37,7 +37,7 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { echo "\nInitiating swap.. Key: " . $number . "\n"; $array[$key][$jobtype] = $this->swap($jobs, $goal, $number, $direction); echo "Element found at key: " . $number . "\n"; - print_r($array, false); + //print_r($array, false); return $array; } } @@ -93,8 +93,8 @@ public function swap($jobs, $goal, $goalkey, $direction) { //print_r($array, false); $jobs[$goalkey] = $job; $jobs[$number] = $tempjob; - echo "Array after swap: \n"; - print_r($jobs, false); + //echo "Array after swap: \n"; + //print_r($jobs, false); return $jobs; } // if element is at last position, $temp will be set but nothing is swapped, foreach is over diff --git a/api/ui/results.php b/api/ui/results.php index 9fdc814dc7..6162739dda 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -90,10 +90,8 @@ public function get() { $rearranger = new Rearranger(); $swapped_arr = $arr; $swapped_arr['elements'] = $rearranger->seekAndSwap($arr['elements'], $id, 'down', $resultId); - //echo "Preswap : \n"; - //print_r($arr, false); - //echo "Swapped? : \n"; - //print_r($swapped_arr, false); + echo "Swapped? : \n"; + print_r($swapped_arr, false); //$system->setResultsAll(json_encode($swapped_arr)); break; default: From 90ff2b53deaf323fc8d634e3d2c823fb92e40ef0 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 17:15:48 +0200 Subject: [PATCH 162/191] Expermineting to drag results --- api/ui/results.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index 6162739dda..1d8d86dea2 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -92,7 +92,7 @@ public function get() { $swapped_arr['elements'] = $rearranger->seekAndSwap($arr['elements'], $id, 'down', $resultId); echo "Swapped? : \n"; print_r($swapped_arr, false); - //$system->setResultsAll(json_encode($swapped_arr)); + $system->setResultsAll(json_encode($swapped_arr)); break; default: throw new Exception("Unknown action!"); From e8d5f635263c1fc9d3f5dba59420c3434cede7d7 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 17:17:28 +0200 Subject: [PATCH 163/191] Expermineting to drag results --- views/results/build.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/results/build.php b/views/results/build.php index 6eb38da2df..a30dd62829 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -76,7 +76,7 @@ function movePlots(direction, id) { id: id }, success: function(response) { - alert(response); + location.reload(); }, }); } From a729d111a68de18283622b6c2874df51bc793624 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 17:20:54 +0200 Subject: [PATCH 164/191] Expermineting to drag results --- api/ui/Rearranger.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index d0f2c14954..facd014c45 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -70,19 +70,19 @@ public function swap($jobs, $goal, $goalkey, $direction) { $tempkey = 0; $counter = 0; if ($direction == 'up') { - foreach ($jobs as $key => $element) { - if ($element == $goal && $counter > 0) { - $jobs[$tempkey] = $element; + foreach ($jobs as $number => $job) { + if ($number == $goalkey && $counter > 0) { + $jobs[$tempkey] = $job; $jobs[$goalkey] = $temp; return $jobs; } - else if ($element == $goal && $counter == 0) { + else if ($number == $goalkey && $counter == 0) { echo "found, but already at head"; return $jobs; } $counter++; - $temp = $element; - $tempkey = $key; + $temp = $job; + $tempkey = $number; } } else if ($direction == 'down') { From a9063bccb8dab6df86856b811cc4e180a5781b54 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 17:22:57 +0200 Subject: [PATCH 165/191] Expermineting to drag results --- api/ui/results.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index 1d8d86dea2..5f9c39ba6d 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -74,11 +74,10 @@ public function get() { $arr = $system->getResultsAll(); $id = $this->get['uid']; $resultId = $this->get['resultId']; - echo "UID is " . $id . "\n"; $arr = json_decode($arr, true); $rearranger = new Rearranger(); $swapped_arr = $arr; - $swapped_arr['elements'] = $rearranger->seekAndSwap($arr, $id, 'up', $resultId); + $swapped_arr['elements'] = $rearranger->seekAndSwap($arr['elements'], $id, 'up', $resultId); $system->setResultsAll(json_encode($swapped_arr)); break; case 'down': From e8773ffae904c8f0a3bccd0f50418d72750a9f5e Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 17:26:25 +0200 Subject: [PATCH 166/191] Expermineting to drag results --- libraries/graphs/bar-plot/build.template.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/graphs/bar-plot/build.template.html b/libraries/graphs/bar-plot/build.template.html index 0b586d3651..fda0c6a73e 100644 --- a/libraries/graphs/bar-plot/build.template.html +++ b/libraries/graphs/bar-plot/build.template.html @@ -2,8 +2,8 @@

    Bar Plot

    - - + +
    From b96e7711b63bbf238e445cd4a16b82ca5aece830 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 17:27:46 +0200 Subject: [PATCH 167/191] Expermineting to drag results --- libraries/graphs/boxplot/build.template.html | 4 ++++ libraries/graphs/line-plot-multi/build.template.html | 4 ++++ libraries/graphs/line-plot/build.template.html | 4 ++++ libraries/graphs/pie-plot/build.template.html | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/libraries/graphs/boxplot/build.template.html b/libraries/graphs/boxplot/build.template.html index c324b807a7..f51d221b69 100644 --- a/libraries/graphs/boxplot/build.template.html +++ b/libraries/graphs/boxplot/build.template.html @@ -1,6 +1,10 @@

    Box Plot

    +
    + + +
    diff --git a/libraries/graphs/line-plot-multi/build.template.html b/libraries/graphs/line-plot-multi/build.template.html index 99917bfb54..ebfc80626f 100644 --- a/libraries/graphs/line-plot-multi/build.template.html +++ b/libraries/graphs/line-plot-multi/build.template.html @@ -1,6 +1,10 @@

    Line Plot (multiple parameters)

    +
    + + +
    diff --git a/libraries/graphs/line-plot/build.template.html b/libraries/graphs/line-plot/build.template.html index 6bcca0afd4..465c0042a1 100644 --- a/libraries/graphs/line-plot/build.template.html +++ b/libraries/graphs/line-plot/build.template.html @@ -1,6 +1,10 @@

    Line Plot

    +
    + + +
    diff --git a/libraries/graphs/pie-plot/build.template.html b/libraries/graphs/pie-plot/build.template.html index 73a9c289d5..fd914667d7 100644 --- a/libraries/graphs/pie-plot/build.template.html +++ b/libraries/graphs/pie-plot/build.template.html @@ -1,6 +1,10 @@

    Pie Plot

    +
    + + +
    From ce1c5f590ffd27d4e090488c370d956f101fdbd3 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 17:32:06 +0200 Subject: [PATCH 168/191] Expermineting to drag results --- libraries/graphs/bar-plot/build.template.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/graphs/bar-plot/build.template.html b/libraries/graphs/bar-plot/build.template.html index fda0c6a73e..1916234d28 100644 --- a/libraries/graphs/bar-plot/build.template.html +++ b/libraries/graphs/bar-plot/build.template.html @@ -2,8 +2,8 @@

    Bar Plot

    - - + +
    From 8694bbab08853ba6bded1fa332eda14e5a866bf6 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 24 Jun 2024 17:33:35 +0200 Subject: [PATCH 169/191] Expermineting to drag results --- libraries/graphs/bar-plot/build.template.html | 4 ++-- libraries/graphs/boxplot/build.template.html | 4 ++-- libraries/graphs/line-plot-multi/build.template.html | 4 ++-- libraries/graphs/line-plot/build.template.html | 4 ++-- libraries/graphs/pie-plot/build.template.html | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libraries/graphs/bar-plot/build.template.html b/libraries/graphs/bar-plot/build.template.html index 1916234d28..66cdd9d9b5 100644 --- a/libraries/graphs/bar-plot/build.template.html +++ b/libraries/graphs/bar-plot/build.template.html @@ -2,8 +2,8 @@

    Bar Plot

    - - + +
    diff --git a/libraries/graphs/boxplot/build.template.html b/libraries/graphs/boxplot/build.template.html index f51d221b69..c43d926313 100644 --- a/libraries/graphs/boxplot/build.template.html +++ b/libraries/graphs/boxplot/build.template.html @@ -2,8 +2,8 @@

    Box Plot

    - - + +
    diff --git a/libraries/graphs/line-plot-multi/build.template.html b/libraries/graphs/line-plot-multi/build.template.html index ebfc80626f..c90bd1f616 100644 --- a/libraries/graphs/line-plot-multi/build.template.html +++ b/libraries/graphs/line-plot-multi/build.template.html @@ -2,8 +2,8 @@

    Line Plot (multiple parameters)

    - - + +
    diff --git a/libraries/graphs/line-plot/build.template.html b/libraries/graphs/line-plot/build.template.html index 465c0042a1..5e2be5ce99 100644 --- a/libraries/graphs/line-plot/build.template.html +++ b/libraries/graphs/line-plot/build.template.html @@ -2,8 +2,8 @@

    Line Plot

    - - + +
    diff --git a/libraries/graphs/pie-plot/build.template.html b/libraries/graphs/pie-plot/build.template.html index fd914667d7..e1bf831c0c 100644 --- a/libraries/graphs/pie-plot/build.template.html +++ b/libraries/graphs/pie-plot/build.template.html @@ -2,8 +2,8 @@

    Pie Plot

    - - + +
    From 87fa6494615654f3c749aaccec28265d7d4deb2b Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 25 Jun 2024 03:14:53 +0200 Subject: [PATCH 170/191] Expermineting to drag results --- api/ui/Rearranger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index facd014c45..5512f986a7 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -27,11 +27,11 @@ class Rearranger { public function seekAndSwap($array, $goal, $direction, $resultId) { if (gettype($array) == 'array') { foreach ($array as $key => $subarray) { - //echo "key: " . $key . "resultId: " . $resultId . "\n"; - if ($key == $resultId) { // Only change order in the current result config + if ($key == $resultId) { // Check if we're in the right result config foreach ($subarray as $jobtype => $jobs) { if(gettype($jobs) == 'array') { foreach ($jobs as $number => $job) { + // Check if this is the job we want to move $found = $this->searchInside($job, $goal); if ($found) { echo "\nInitiating swap.. Key: " . $number . "\n"; From f5150c1a5e094f15e8d583f8fd3d6339677f04a7 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 25 Jun 2024 14:28:29 +0200 Subject: [PATCH 171/191] Expermineting to drag results --- api/ui/Rearranger.php | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 5512f986a7..5a6f90e01a 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -32,12 +32,9 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { if(gettype($jobs) == 'array') { foreach ($jobs as $number => $job) { // Check if this is the job we want to move - $found = $this->searchInside($job, $goal); + $found = $this->isInside($job, $goal); if ($found) { - echo "\nInitiating swap.. Key: " . $number . "\n"; $array[$key][$jobtype] = $this->swap($jobs, $goal, $number, $direction); - echo "Element found at key: " . $number . "\n"; - //print_r($array, false); return $array; } } @@ -48,10 +45,7 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { } return $array; } - public function searchInside ($subarray, $goal): bool - { - //echo "goal: " . $goal . "\n"; - //print_r($subarray, false); + public function isInside ($subarray, $goal) { if (gettype($subarray) == 'array') { foreach ($subarray as $key => $element) { if (gettype($element) == 'string' && $element == $goal) { @@ -63,9 +57,7 @@ public function searchInside ($subarray, $goal): bool } return false; } - public function swap($jobs, $goal, $goalkey, $direction) { - //echo "swap received '" . $direction . "' and this array: \n"; - //print_r($array, false); + public function swap($jobs, $goalkey, $direction) { $temp = ''; $tempkey = 0; $counter = 0; @@ -77,7 +69,7 @@ public function swap($jobs, $goal, $goalkey, $direction) { return $jobs; } else if ($number == $goalkey && $counter == 0) { - echo "found, but already at head"; + //found, but already at head return $jobs; } $counter++; @@ -88,18 +80,13 @@ public function swap($jobs, $goal, $goalkey, $direction) { else if ($direction == 'down') { $tempjob = ''; foreach ($jobs as $number => $job) { - if ($tempjob != '') { // previous element in temp2 is the goal, $element is the one to be swapped - //echo "Array before swap: \n"; - //print_r($array, false); + if ($tempjob != '') { $jobs[$goalkey] = $job; $jobs[$number] = $tempjob; - //echo "Array after swap: \n"; - //print_r($jobs, false); return $jobs; } // if element is at last position, $temp will be set but nothing is swapped, foreach is over else if ($number == $goalkey) { - //echo "Found array containing the value at key: " . $key . "\n"; $tempjob = $job; } } From f19215ac3a9a6a0d6285501ebfa6ad93e566d9d5 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 25 Jun 2024 14:29:51 +0200 Subject: [PATCH 172/191] Remove debugging comments & code --- api/ui/Rearranger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/Rearranger.php b/api/ui/Rearranger.php index 5a6f90e01a..935b2972f7 100644 --- a/api/ui/Rearranger.php +++ b/api/ui/Rearranger.php @@ -34,7 +34,7 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { // Check if this is the job we want to move $found = $this->isInside($job, $goal); if ($found) { - $array[$key][$jobtype] = $this->swap($jobs, $goal, $number, $direction); + $array[$key][$jobtype] = $this->swap($jobs, $number, $direction); return $array; } } From 49e3ee4cb850244be97bc84cfe96271607bbfcae Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 25 Jun 2024 14:54:47 +0200 Subject: [PATCH 173/191] Relocated Rearranger.php, changed include path --- api/ui/results.php | 4 +++- {api/ui => core}/Rearranger.php | 27 ++++++++++++++++----------- 2 files changed, 19 insertions(+), 12 deletions(-) rename {api/ui => core}/Rearranger.php (88%) diff --git a/api/ui/results.php b/api/ui/results.php index 5f9c39ba6d..4385cd2885 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -25,7 +25,9 @@ SOFTWARE. */ -include ("Rearranger.php"); +use core\Rearranger; + +include ("../../core/Rearranger.php"); class Results_API extends API { public $patch_access = Auth_Library::A_LOGGEDIN; diff --git a/api/ui/Rearranger.php b/core/Rearranger.php similarity index 88% rename from api/ui/Rearranger.php rename to core/Rearranger.php index 935b2972f7..c6a1d2c199 100644 --- a/api/ui/Rearranger.php +++ b/core/Rearranger.php @@ -23,13 +23,17 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -class Rearranger { - public function seekAndSwap($array, $goal, $direction, $resultId) { + +namespace core; +class Rearranger +{ + public function seekAndSwap($array, $goal, $direction, $resultId) + { if (gettype($array) == 'array') { foreach ($array as $key => $subarray) { if ($key == $resultId) { // Check if we're in the right result config foreach ($subarray as $jobtype => $jobs) { - if(gettype($jobs) == 'array') { + if (gettype($jobs) == 'array') { foreach ($jobs as $number => $job) { // Check if this is the job we want to move $found = $this->isInside($job, $goal); @@ -45,7 +49,9 @@ public function seekAndSwap($array, $goal, $direction, $resultId) { } return $array; } - public function isInside ($subarray, $goal) { + + public function isInside($subarray, $goal) + { if (gettype($subarray) == 'array') { foreach ($subarray as $key => $element) { if (gettype($element) == 'string' && $element == $goal) { @@ -57,7 +63,9 @@ public function isInside ($subarray, $goal) { } return false; } - public function swap($jobs, $goalkey, $direction) { + + public function swap($jobs, $goalkey, $direction) + { $temp = ''; $tempkey = 0; $counter = 0; @@ -67,8 +75,7 @@ public function swap($jobs, $goalkey, $direction) { $jobs[$tempkey] = $job; $jobs[$goalkey] = $temp; return $jobs; - } - else if ($number == $goalkey && $counter == 0) { + } else if ($number == $goalkey && $counter == 0) { //found, but already at head return $jobs; } @@ -76,16 +83,14 @@ public function swap($jobs, $goalkey, $direction) { $temp = $job; $tempkey = $number; } - } - else if ($direction == 'down') { + } else if ($direction == 'down') { $tempjob = ''; foreach ($jobs as $number => $job) { if ($tempjob != '') { $jobs[$goalkey] = $job; $jobs[$number] = $tempjob; return $jobs; - } - // if element is at last position, $temp will be set but nothing is swapped, foreach is over + } // if element is at last position, $temp will be set but nothing is swapped, foreach is over else if ($number == $goalkey) { $tempjob = $job; } From 9fad8d3597a47a9833b6e89eed0f2da0af99bfbd Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 25 Jun 2024 14:56:51 +0200 Subject: [PATCH 174/191] Relocated Rearranger.php, changed include path --- core/Rearranger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/Rearranger.php b/core/Rearranger.php index c6a1d2c199..23c62d60f5 100644 --- a/core/Rearranger.php +++ b/core/Rearranger.php @@ -24,7 +24,7 @@ SOFTWARE. */ -namespace core; +//namespace core; class Rearranger { public function seekAndSwap($array, $goal, $direction, $resultId) From e204595023b40ebcf5f6f30985f00dbb7b152f87 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 25 Jun 2024 14:57:35 +0200 Subject: [PATCH 175/191] Relocated Rearranger.php, changed include path --- api/ui/results.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index 4385cd2885..d6a4bfbcb2 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -25,7 +25,7 @@ SOFTWARE. */ -use core\Rearranger; +//use core\Rearranger; include ("../../core/Rearranger.php"); class Results_API extends API { From cea5d067608dd1f3e2628ad71aa1316b8b3dfdd0 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 25 Jun 2024 14:58:08 +0200 Subject: [PATCH 176/191] Relocated Rearranger.php, changed include path --- api/ui/results.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index d6a4bfbcb2..2a0f00f362 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -91,8 +91,6 @@ public function get() { $rearranger = new Rearranger(); $swapped_arr = $arr; $swapped_arr['elements'] = $rearranger->seekAndSwap($arr['elements'], $id, 'down', $resultId); - echo "Swapped? : \n"; - print_r($swapped_arr, false); $system->setResultsAll(json_encode($swapped_arr)); break; default: From ce748f3a909b6a6fedfc275ee4d37bfc752d136b Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 25 Jun 2024 14:59:34 +0200 Subject: [PATCH 177/191] Relocated Rearranger.php, changed include path --- views/results/build.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/results/build.php b/views/results/build.php index a30dd62829..87d2dc4267 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -76,7 +76,7 @@ function movePlots(direction, id) { id: id }, success: function(response) { - location.reload(); + }, }); } From 0b39e05c8bcf53656313e4cb0c7c85f1cb74b3a3 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 25 Jun 2024 15:03:52 +0200 Subject: [PATCH 178/191] Relocated Rearranger.php, changed include path --- api/ui/results.php | 2 +- core/Rearranger.php | 2 +- views/results/build.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index 2a0f00f362..1cf20ab636 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -25,7 +25,7 @@ SOFTWARE. */ -//use core\Rearranger; +use core\Rearranger; include ("../../core/Rearranger.php"); class Results_API extends API { diff --git a/core/Rearranger.php b/core/Rearranger.php index 23c62d60f5..c6a1d2c199 100644 --- a/core/Rearranger.php +++ b/core/Rearranger.php @@ -24,7 +24,7 @@ SOFTWARE. */ -//namespace core; +namespace core; class Rearranger { public function seekAndSwap($array, $goal, $direction, $resultId) diff --git a/views/results/build.php b/views/results/build.php index 87d2dc4267..a30dd62829 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -76,7 +76,7 @@ function movePlots(direction, id) { id: id }, success: function(response) { - + location.reload(); }, }); } From d09c1c94c310e626724bdd3e00d2808f0e8b504f Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 25 Jun 2024 15:04:54 +0200 Subject: [PATCH 179/191] Relocated Rearranger.php, changed include path --- {core => api/ui}/Rearranger.php | 1 - api/ui/results.php | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) rename {core => api/ui}/Rearranger.php (99%) diff --git a/core/Rearranger.php b/api/ui/Rearranger.php similarity index 99% rename from core/Rearranger.php rename to api/ui/Rearranger.php index c6a1d2c199..f96720feb2 100644 --- a/core/Rearranger.php +++ b/api/ui/Rearranger.php @@ -24,7 +24,6 @@ SOFTWARE. */ -namespace core; class Rearranger { public function seekAndSwap($array, $goal, $direction, $resultId) diff --git a/api/ui/results.php b/api/ui/results.php index 1cf20ab636..31047c907e 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -25,9 +25,7 @@ SOFTWARE. */ -use core\Rearranger; - -include ("../../core/Rearranger.php"); +include ("Rearranger.php"); class Results_API extends API { public $patch_access = Auth_Library::A_LOGGEDIN; From 5afa1944fd11a19dce7535833b78754c22a67e2a Mon Sep 17 00:00:00 2001 From: PatrikB Date: Fri, 28 Jun 2024 13:51:02 +0200 Subject: [PATCH 180/191] Relocated Rearranger.php, changed include path --- api/ui/results.php | 4 +++- {api/ui => core}/Rearranger.php | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) rename {api/ui => core}/Rearranger.php (99%) diff --git a/api/ui/results.php b/api/ui/results.php index 31047c907e..0d95968336 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -25,7 +25,9 @@ SOFTWARE. */ -include ("Rearranger.php"); +use core\Rearranger; + +//include ("Rearranger.php"); class Results_API extends API { public $patch_access = Auth_Library::A_LOGGEDIN; diff --git a/api/ui/Rearranger.php b/core/Rearranger.php similarity index 99% rename from api/ui/Rearranger.php rename to core/Rearranger.php index f96720feb2..c6a1d2c199 100644 --- a/api/ui/Rearranger.php +++ b/core/Rearranger.php @@ -24,6 +24,7 @@ SOFTWARE. */ +namespace core; class Rearranger { public function seekAndSwap($array, $goal, $direction, $resultId) From 5202d3751ba66c1de3c0fb3396e678552a68b462 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Fri, 28 Jun 2024 13:51:58 +0200 Subject: [PATCH 181/191] Relocated Rearranger.php, changed include path --- api/ui/results.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index 0d95968336..b5f3e7b5a6 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -78,9 +78,8 @@ public function get() { $resultId = $this->get['resultId']; $arr = json_decode($arr, true); $rearranger = new Rearranger(); - $swapped_arr = $arr; - $swapped_arr['elements'] = $rearranger->seekAndSwap($arr['elements'], $id, 'up', $resultId); - $system->setResultsAll(json_encode($swapped_arr)); + $arr['elements'] = $rearranger->seekAndSwap($arr['elements'], $id, 'up', $resultId); + $system->setResultsAll(json_encode($arr)); break; case 'down': $system = new System($this->get['systemId']); @@ -89,9 +88,8 @@ public function get() { $resultId = $this->get['resultId']; $arr = json_decode($arr, true); $rearranger = new Rearranger(); - $swapped_arr = $arr; - $swapped_arr['elements'] = $rearranger->seekAndSwap($arr['elements'], $id, 'down', $resultId); - $system->setResultsAll(json_encode($swapped_arr)); + $arr['elements'] = $rearranger->seekAndSwap($arr['elements'], $id, 'down', $resultId); + $system->setResultsAll(json_encode($arr)); break; default: throw new Exception("Unknown action!"); From 35bfc53a82ce939146c30dfdf7de7385b341f80e Mon Sep 17 00:00:00 2001 From: PatrikB Date: Fri, 28 Jun 2024 13:53:16 +0200 Subject: [PATCH 182/191] Relocated Rearranger.php, changed include path --- api/ui/results.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index b5f3e7b5a6..9d41750453 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -27,7 +27,7 @@ use core\Rearranger; -//include ("Rearranger.php"); +include ("../../core/Rearranger.php"); class Results_API extends API { public $patch_access = Auth_Library::A_LOGGEDIN; From 988ea0618bc003cb2eb13fd8826ba1f1f91d7a16 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Fri, 28 Jun 2024 13:55:33 +0200 Subject: [PATCH 183/191] Relocated Rearranger.php, changed include path --- api/ui/results.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index 9d41750453..7b2f76c1b7 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -27,7 +27,7 @@ use core\Rearranger; -include ("../../core/Rearranger.php"); +include ("./core/Rearranger.php"); class Results_API extends API { public $patch_access = Auth_Library::A_LOGGEDIN; From 363424f2be8a942c5ca273d7ec16309ab5b67f18 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Fri, 28 Jun 2024 13:58:53 +0200 Subject: [PATCH 184/191] Relocated Rearranger.php, changed include path --- api/ui/results.php | 2 +- core/Rearranger.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/ui/results.php b/api/ui/results.php index 7b2f76c1b7..f01a280a98 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -25,7 +25,7 @@ SOFTWARE. */ -use core\Rearranger; +//use core\Rearranger; include ("./core/Rearranger.php"); class Results_API extends API { diff --git a/core/Rearranger.php b/core/Rearranger.php index c6a1d2c199..23c62d60f5 100644 --- a/core/Rearranger.php +++ b/core/Rearranger.php @@ -24,7 +24,7 @@ SOFTWARE. */ -namespace core; +//namespace core; class Rearranger { public function seekAndSwap($array, $goal, $direction, $resultId) From 2de68d140c5623aa334b2f9b17f4963d4c7ca7fc Mon Sep 17 00:00:00 2001 From: PatrikB Date: Fri, 28 Jun 2024 14:00:13 +0200 Subject: [PATCH 185/191] Relocated Rearranger.php, changed include path --- views/results/build.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/results/build.php b/views/results/build.php index a30dd62829..87d2dc4267 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -76,7 +76,7 @@ function movePlots(direction, id) { id: id }, success: function(response) { - location.reload(); + }, }); } From 2a0515537a316760b88f221f0e3dac2e7860c072 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Fri, 28 Jun 2024 14:02:24 +0200 Subject: [PATCH 186/191] Relocated Rearranger.php, changed include path --- {core => api/ui}/Rearranger.php | 1 - api/ui/results.php | 3 +-- views/results/build.php | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) rename {core => api/ui}/Rearranger.php (99%) diff --git a/core/Rearranger.php b/api/ui/Rearranger.php similarity index 99% rename from core/Rearranger.php rename to api/ui/Rearranger.php index 23c62d60f5..f96720feb2 100644 --- a/core/Rearranger.php +++ b/api/ui/Rearranger.php @@ -24,7 +24,6 @@ SOFTWARE. */ -//namespace core; class Rearranger { public function seekAndSwap($array, $goal, $direction, $resultId) diff --git a/api/ui/results.php b/api/ui/results.php index f01a280a98..353d13f5d7 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -25,9 +25,8 @@ SOFTWARE. */ -//use core\Rearranger; +include ("Rearranger.php"); -include ("./core/Rearranger.php"); class Results_API extends API { public $patch_access = Auth_Library::A_LOGGEDIN; diff --git a/views/results/build.php b/views/results/build.php index 87d2dc4267..a30dd62829 100644 --- a/views/results/build.php +++ b/views/results/build.php @@ -76,7 +76,7 @@ function movePlots(direction, id) { id: id }, success: function(response) { - + location.reload(); }, }); } From 0978cbccecee2181358e80bfb486218cc0c3fd0a Mon Sep 17 00:00:00 2001 From: PatrikB Date: Fri, 28 Jun 2024 14:09:20 +0200 Subject: [PATCH 187/191] Relocated Rearranger.php, changed include path --- api/ui/results.php | 4 +++- {api/ui => core}/Rearranger.php | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) rename {api/ui => core}/Rearranger.php (99%) diff --git a/api/ui/results.php b/api/ui/results.php index 353d13f5d7..ba3fc9233a 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -25,7 +25,9 @@ SOFTWARE. */ -include ("Rearranger.php"); +include "../../core/Rearranger.php"; + +use core\Rearranger; class Results_API extends API { diff --git a/api/ui/Rearranger.php b/core/Rearranger.php similarity index 99% rename from api/ui/Rearranger.php rename to core/Rearranger.php index f96720feb2..c6a1d2c199 100644 --- a/api/ui/Rearranger.php +++ b/core/Rearranger.php @@ -24,6 +24,7 @@ SOFTWARE. */ +namespace core; class Rearranger { public function seekAndSwap($array, $goal, $direction, $resultId) From b58e7471613a6dc943cc367b1dccf9e080e960c3 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Fri, 28 Jun 2024 14:10:03 +0200 Subject: [PATCH 188/191] Relocated Rearranger.php, changed include path --- api/ui/results.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/ui/results.php b/api/ui/results.php index ba3fc9233a..c585b70875 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -25,7 +25,7 @@ SOFTWARE. */ -include "../../core/Rearranger.php"; +include "./core/Rearranger.php"; use core\Rearranger; From 3def3c18387eb866a200ceec1a670579e366d64a Mon Sep 17 00:00:00 2001 From: PatrikB Date: Fri, 28 Jun 2024 14:10:31 +0200 Subject: [PATCH 189/191] Relocated Rearranger.php, changed include path --- {core => api/ui}/Rearranger.php | 1 - api/ui/results.php | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) rename {core => api/ui}/Rearranger.php (99%) diff --git a/core/Rearranger.php b/api/ui/Rearranger.php similarity index 99% rename from core/Rearranger.php rename to api/ui/Rearranger.php index c6a1d2c199..f96720feb2 100644 --- a/core/Rearranger.php +++ b/api/ui/Rearranger.php @@ -24,7 +24,6 @@ SOFTWARE. */ -namespace core; class Rearranger { public function seekAndSwap($array, $goal, $direction, $resultId) diff --git a/api/ui/results.php b/api/ui/results.php index c585b70875..caf6cba93b 100644 --- a/api/ui/results.php +++ b/api/ui/results.php @@ -25,9 +25,7 @@ SOFTWARE. */ -include "./core/Rearranger.php"; - -use core\Rearranger; +include "Rearranger.php"; class Results_API extends API { From bc0df549a6944b6bb8611081618072e4e91edaf6 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 8 Jul 2024 13:36:40 +0200 Subject: [PATCH 190/191] Relocated Rearranger.php, changed include path --- controllers/job.php | 2 ++ views/job/detail.php | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/controllers/job.php b/controllers/job.php index 4dd7d74921..aee8288b29 100644 --- a/controllers/job.php +++ b/controllers/job.php @@ -145,6 +145,8 @@ public function detail() { $events = Util::eventFilter(['job' => $job]); $this->view->assign('events', $events); + $this->view->assign('logErrors', 5); + } else { throw new Exception("No job with id: " . $this->get['id']); } diff --git a/views/job/detail.php b/views/job/detail.php index 40e23cb5aa..221d8334b8 100644 --- a/views/job/detail.php +++ b/views/job/detail.php @@ -224,6 +224,18 @@ function updateProgress() {
    +
    + + Errors: + + +
    +
    + + Warnings: + + +
    From a0690b51590994920f1f8fcba1213d1d267ee0fe Mon Sep 17 00:00:00 2001 From: PatrikB Date: Mon, 8 Jul 2024 13:38:58 +0200 Subject: [PATCH 191/191] Reverted last commit" --- controllers/job.php | 2 -- views/job/detail.php | 12 ------------ 2 files changed, 14 deletions(-) diff --git a/controllers/job.php b/controllers/job.php index aee8288b29..4dd7d74921 100644 --- a/controllers/job.php +++ b/controllers/job.php @@ -145,8 +145,6 @@ public function detail() { $events = Util::eventFilter(['job' => $job]); $this->view->assign('events', $events); - $this->view->assign('logErrors', 5); - } else { throw new Exception("No job with id: " . $this->get['id']); } diff --git a/views/job/detail.php b/views/job/detail.php index 221d8334b8..40e23cb5aa 100644 --- a/views/job/detail.php +++ b/views/job/detail.php @@ -224,18 +224,6 @@ function updateProgress() {
    -
    - - Errors: - - -
    -
    - - Warnings: - - -