Skip to content

Commit

Permalink
TA: Ordering Table for Questionlist in Test, merge ilObjTestGUI
Browse files Browse the repository at this point in the history
  • Loading branch information
nhaagen authored and kergomard committed Jul 1, 2024
1 parent 8672444 commit f511be1
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions components/ILIAS/Test/classes/class.ilObjTestGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public function __construct($refId = null)
parent::__construct("", $ref_id, true, false);

$this->ctrl->saveParameter($this, ['ref_id', 'test_ref_id', 'calling_test', 'test_express_mode', 'q_id']);

$this->lng->loadLanguageModule('assessment');

if ($this->object instanceof ilObjTest) {
Expand Down Expand Up @@ -798,7 +799,6 @@ public function executeCommand(): void
if ($cmd === 'edit' && !$this->access->checkAccess('write', '', $this->testrequest->getRefId())) {
$this->redirectAfterMissingWrite();
}

$this->prepareOutput();
$forwarder = new ilAssQuestionPageCommandForwarder();
$forwarder->setTestObj($this->getTestObject());
Expand Down Expand Up @@ -934,17 +934,15 @@ public function executeCommand(): void
}
$this->prepareOutput();
$this->addHeaderAction();
if ($cmd && (strcmp($cmd, "properties") == 0) && ($this->testrequest->raw("browse"))) {
if ((strcmp($cmd, "properties") == 0) && ($this->testrequest->raw("browse"))) {
$this->questionsObject();
return;
}
if ($cmd && (strcmp($cmd, "properties") == 0) && ($this->testrequest->raw("up") || $this->testrequest->raw("down"))) {
if ((strcmp($cmd, "properties") == 0) && ($this->testrequest->raw("up") || $this->testrequest->raw("down"))) {
$this->questionsObject();
return;
}
if ($cmd) {
$ret = $cmd === 'testScreen' ? $this->ctrl->forwardCommand($this->getTestScreenGUIInstance()) : $this->{$cmd . "Object"}();
}
$ret = $cmd === 'testScreen' ? $this->ctrl->forwardCommand($this->getTestScreenGUIInstance()) : $this->{$cmd . "Object"}();
break;
default:
if ((!$this->access->checkAccess("read", "", $this->testrequest->getRefId()))) {
Expand All @@ -965,6 +963,7 @@ public function executeCommand(): void
$this->prepareOutput();

$this->ctrl->setReturn($this, "questions");

try {
$qid = $this->fetchAuthoringQuestionIdParameter();

Expand Down Expand Up @@ -2085,7 +2084,6 @@ public function questionsObject()
$this->tpl->parseCurrentBlock();
}


private function populateQuestionBrowserToolbarButtons(ilToolbarGUI $toolbar, string $context): void
{
$this->ctrl->setParameterByClass(
Expand Down Expand Up @@ -2966,6 +2964,7 @@ public function copyAndLinkQuestionsToPoolObject(
}
assQuestion::saveOriginalId($questionInstance->getId(), $newId);
}

$this->tpl->setOnScreenMessage('success', $this->lng->txt('tst_qst_added_to_pool_' . (count($result->ids) > 1 ? 'p' : 's')), true);
$this->ctrl->redirect($this, 'questions');
}
Expand Down Expand Up @@ -3026,6 +3025,7 @@ protected function copyAndLinkToQuestionpool(array $question_ids): void
return;
}
}

$this->createQuestionpoolTargetObject('copyAndLinkQuestionsToPool');
}

Expand Down Expand Up @@ -3066,6 +3066,7 @@ public function createQuestionpoolTargetObject($cmd)
false,
"write"
);

if (count($questionpools) == 0) {
$form = $this->getTargetQuestionpoolForm($questionpools, 'createQuestionPoolAndCopy');
} else {
Expand All @@ -3082,6 +3083,7 @@ public function createQuestionpoolTargetObject($cmd)
break;
}
}

$this->tpl->setContent($form->getHTML());
$this->tpl->printToStdout();
exit();
Expand All @@ -3091,7 +3093,6 @@ protected function getTargetQuestionpoolForm($questionpools, string $cmd): ilPro
{
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));

$form->addCommandButton($cmd, $this->lng->txt('submit'));
$form->addCommandButton('cancelCreateQuestion', $this->lng->txt('cancel'));

Expand Down Expand Up @@ -3274,7 +3275,7 @@ protected function copyQuestions(array $question_ids): void

$questionTitles = $this->object->getQuestionTitles();

foreach ($question_ids as $id) {
foreach ($ids as $id) {
$question = assQuestion::instantiateQuestionGUI($id);
if ($question) {
$title = $question->object->getTitle();
Expand All @@ -3300,6 +3301,7 @@ protected function copyQuestions(array $question_ids): void
}

$this->tpl->setOnScreenMessage('success', $this->lng->txt('copy_questions_success'), true);

$this->ctrl->redirect($this, 'questions');
}

Expand Down

0 comments on commit f511be1

Please sign in to comment.