From 0f95b8ab1926aa1b99a0ac9700f9648133433fd2 Mon Sep 17 00:00:00 2001 From: Niels Theen Date: Tue, 12 Jun 2018 10:23:18 +0200 Subject: [PATCH 1/5] Use incremental steps from the test instead of question pool --- classes/controllers/abstract.ilXTSFControllerGUI.php | 4 +++- classes/controllers/class.ilFormATestOutputGUI.php | 9 +++++++-- .../controllers/class.ilFormATestPlayerControllerGUI.php | 7 ++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/classes/controllers/abstract.ilXTSFControllerGUI.php b/classes/controllers/abstract.ilXTSFControllerGUI.php index b7d82c9..1630040 100644 --- a/classes/controllers/abstract.ilXTSFControllerGUI.php +++ b/classes/controllers/abstract.ilXTSFControllerGUI.php @@ -269,9 +269,11 @@ abstract class ilXTSFControllerGUI { * * @return string */ - protected function generateJumpToNodeLink($finish_set, $node, $params = array()) + protected function generateJumpToNodeLink($finish_set, $node, $params = array(), $step = 0) { $this->ctrl->setParameter($this->controller, "node_id", $node["id"]); + $this->ctrl->setParameter($this->controller, "node_step", $step); + if ($finish_set) { $this->ctrl->setParameter($this->controller, "finished", 1); diff --git a/classes/controllers/class.ilFormATestOutputGUI.php b/classes/controllers/class.ilFormATestOutputGUI.php index f428153..daa9d80 100644 --- a/classes/controllers/class.ilFormATestOutputGUI.php +++ b/classes/controllers/class.ilFormATestOutputGUI.php @@ -400,7 +400,13 @@ class ilFormATestOutputGUI extends ilXTSFControllerGUI else { $left_template->setCurrentBlock("linked_line"); - $left_template->setVariable("LINK", $this->generateJumpToNodeLink($finish_set, $node, array("xtsf_token" => $this->session->getToken()))); + $left_template->setVariable("LINK", $this->generateJumpToNodeLink( + $finish_set, + $node, + array("xtsf_token" => $this->session->getToken()), + $step + )); + //$template->setVariable("QUESTION_INDEX", $node["question_index"]); $left_template->setVariable("QUESTION_TITLE", $title); $left_template->parseCurrentBlock(); @@ -482,4 +488,3 @@ class ilFormATestOutputGUI extends ilXTSFControllerGUI return $show_question_inline_score; } } - \ No newline at end of file diff --git a/classes/controllers/class.ilFormATestPlayerControllerGUI.php b/classes/controllers/class.ilFormATestPlayerControllerGUI.php index f8992f0..f66112f 100644 --- a/classes/controllers/class.ilFormATestPlayerControllerGUI.php +++ b/classes/controllers/class.ilFormATestPlayerControllerGUI.php @@ -414,14 +414,19 @@ class ilFormATestPlayerControllerGUI extends ilXTSFControllerGUI } else { + $inTestStep = 0; + if (isset($_GET["node_step"])) { + $inTestStep = $_GET["node_step"]; + } $steps = $this->session->getStepsToDelete($node); $items = array(); foreach($steps as $step) { + $inTestStep++; $items[] = array( "name" => "n_id[]", "id" => $step["id"], - "text" => $this->plugin->txt("header_step"). ": ". $step["step"] + "text" => $this->plugin->txt("header_step"). ": ". $inTestStep ); } $cancel = "ilFormATestPlayerControllerGUI.back"; -- GitLab From 48b4cddc7f894e239035fa5cfd3575008d0beb2f Mon Sep 17 00:00:00 2001 From: Niels Theen Date: Tue, 12 Jun 2018 10:51:28 +0200 Subject: [PATCH 2/5] Default values if GET parameter is not set --- .../controllers/class.ilFormATestPlayerControllerGUI.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/classes/controllers/class.ilFormATestPlayerControllerGUI.php b/classes/controllers/class.ilFormATestPlayerControllerGUI.php index f66112f..30c5069 100644 --- a/classes/controllers/class.ilFormATestPlayerControllerGUI.php +++ b/classes/controllers/class.ilFormATestPlayerControllerGUI.php @@ -415,13 +415,18 @@ class ilFormATestPlayerControllerGUI extends ilXTSFControllerGUI else { $inTestStep = 0; - if (isset($_GET["node_step"])) { + if (true === isset($_GET["node_step"])) { $inTestStep = $_GET["node_step"]; } + $steps = $this->session->getStepsToDelete($node); $items = array(); foreach($steps as $step) { + if (false === isset($_GET["node_step"])) { + $inTestStep = $step["step"]; + } + $inTestStep++; $items[] = array( "name" => "n_id[]", -- GitLab From a3aeffef3a7ec63492a114a9ec1be76eba14c1d4 Mon Sep 17 00:00:00 2001 From: Niels Theen Date: Thu, 28 Jun 2018 11:25:13 +0200 Subject: [PATCH 3/5] Remove unneeded default value in loop --- .../controllers/class.ilFormATestPlayerControllerGUI.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/classes/controllers/class.ilFormATestPlayerControllerGUI.php b/classes/controllers/class.ilFormATestPlayerControllerGUI.php index 30c5069..0704b85 100644 --- a/classes/controllers/class.ilFormATestPlayerControllerGUI.php +++ b/classes/controllers/class.ilFormATestPlayerControllerGUI.php @@ -417,16 +417,16 @@ class ilFormATestPlayerControllerGUI extends ilXTSFControllerGUI $inTestStep = 0; if (true === isset($_GET["node_step"])) { $inTestStep = $_GET["node_step"]; + $int = (int) $inTestStep; + if ((string) $int !== (string) $inTestStep) { + throw new ilException('"node_step" MUST be an integer value', 403); + } } $steps = $this->session->getStepsToDelete($node); $items = array(); foreach($steps as $step) { - if (false === isset($_GET["node_step"])) { - $inTestStep = $step["step"]; - } - $inTestStep++; $items[] = array( "name" => "n_id[]", -- GitLab From ae1ff51293cdf70cd977d06079fa8da603e10598 Mon Sep 17 00:00:00 2001 From: Niels Theen Date: Thu, 28 Jun 2018 11:57:57 +0200 Subject: [PATCH 4/5] Incremental steps in history --- classes/controllers/class.ilFormATestResultOuputGUI.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/classes/controllers/class.ilFormATestResultOuputGUI.php b/classes/controllers/class.ilFormATestResultOuputGUI.php index 5aa2913..7404904 100644 --- a/classes/controllers/class.ilFormATestResultOuputGUI.php +++ b/classes/controllers/class.ilFormATestResultOuputGUI.php @@ -154,8 +154,8 @@ class ilFormATestResultOuputGUI extends ilXTSFControllerGUI $this->template->setCurrentBlock('path_overview_question'); $this->template->parseCurrentBlock(); } - // - + + $step = 1; foreach($data as $item) { if($current_node_id == null || $current_node_id != $item["id"]) @@ -177,7 +177,8 @@ class ilFormATestResultOuputGUI extends ilXTSFControllerGUI $question_title = "(Q ". $item["question_index"]. ") ". $item["question_title"]; if($this->modus == self::MODUS_PARTICIPANTS) { - $question_title = $set["title"] . " - " . $this->plugin->txt("header_step"). ": ". $item["step"]; + $question_title = $set["title"] . " - " . $this->plugin->txt("header_step"). ": ". $step; + $step++; } $gui = assQuestion::instantiateQuestionGUI($item["question_fi"]); @@ -317,4 +318,3 @@ class ilFormATestResultOuputGUI extends ilXTSFControllerGUI } } } - \ No newline at end of file -- GitLab From b8da7a25336e6e4df6b0e8ca62620ffd33e12b5d Mon Sep 17 00:00:00 2001 From: Niels Theen Date: Thu, 28 Jun 2018 12:04:22 +0200 Subject: [PATCH 5/5] Correct steps for backbutton --- .../class.ilFormATestPlayerControllerGUI.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/classes/controllers/class.ilFormATestPlayerControllerGUI.php b/classes/controllers/class.ilFormATestPlayerControllerGUI.php index 0704b85..176fa25 100644 --- a/classes/controllers/class.ilFormATestPlayerControllerGUI.php +++ b/classes/controllers/class.ilFormATestPlayerControllerGUI.php @@ -198,6 +198,17 @@ class ilFormATestPlayerControllerGUI extends ilXTSFControllerGUI } else { + $inTestStep = 1; + if (true === isset($_GET["node_step"])) { + $inTestStep = $_GET["node_step"]; + $int = (int) $inTestStep; + if ((string) $int !== (string) $inTestStep) { + throw new ilException('"node_step" MUST be an integer value', 403); + } + + $inTestStep = $inTestStep + 1; + } + $this->renderConfirmationScreen( "ilFormATestPlayerControllerGUI.resumeTest", "ilFormATestPlayerControllerGUI.prev", @@ -205,7 +216,7 @@ class ilFormATestPlayerControllerGUI extends ilXTSFControllerGUI array( "name" => "n_id[]", "id" => $this->session->getNodeId(), - "text" => $this->plugin->txt("header_step"). ": ". $this->session->getStep() + "text" => $this->plugin->txt("header_step"). ": ". $inTestStep ) ), $this->plugin->txt("confirm_walk_back"), -- GitLab