Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/trunk' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
mjansenDatabay committed Jan 29, 2025
2 parents e9964ea + 231590b commit 8ecc665
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
23 changes: 15 additions & 8 deletions components/ILIAS/TestQuestionPool/classes/class.assLongMenuGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ class assLongMenuGUI extends assQuestionGUI implements ilGuiQuestionScoringAdjus
private readonly UIFactory $ui_factory;
private readonly UIRenderer $ui_renderer;

private ?ilPropertyFormGUI $edit_form = null;

public function __construct($id = -1)
{
parent::__construct();
Expand All @@ -59,17 +57,17 @@ public function getCommand($cmd)
*/
protected function writePostData(bool $always = false): int
{
$this->edit_form = $this->buildEditForm();
$this->edit_form->setValuesByPost();
$check = $this->edit_form->checkInput() && $this->verifyAnswerOptions();
$this->editForm = $this->buildEditForm();
$this->editForm->setValuesByPost();
$check = $this->editForm->checkInput() && $this->verifyAnswerOptions();

if (!$check) {
$this->editQuestion();
return 1;
}
$this->writeQuestionGenericPostData();
$this->writeQuestionSpecificPostData($this->edit_form);
$custom_check = $this->object->checkQuestionCustomPart($this->edit_form);
$this->writeQuestionSpecificPostData($this->editForm);
$custom_check = $this->object->checkQuestionCustomPart($this->editForm);
if (!$custom_check) {
$this->tpl->setOnScreenMessage('failure', $this->lng->txt('form_input_not_valid'));
$this->editQuestion();
Expand Down Expand Up @@ -151,11 +149,20 @@ public function editQuestion(
bool $checkonly = false,
?bool $is_save_cmd = null
): bool {
$form = $this->edit_form;
$form = $this->editForm;
if ($form === null) {
$form = $this->buildEditForm();
}

/*
* sk 29.01.2025: This is a god aw-ful hack and one more sign,
* that the flow here needs to change, but we need this to set the
* question id on question creation (see: https://mantis.ilias.de/view.php?id=43705)
*/
if ($this->object->getId() > 0) {
$this->ctrl->setParameterByClass(self::class, 'q_id', $this->object->getId());
}
$form->setFormAction($this->ctrl->getFormActionByClass(self::class));
$this->renderEditForm($form);
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ abstract class assQuestionGUI
protected GeneralQuestionPropertiesRepository $questionrepository;
protected GUIService $notes_gui;
protected ilCtrl $ctrl;
private array $new_id_listeners = [];
private int $new_id_listener_cnt = 0;
private ?ilAssQuestionPreviewSession $preview_session = null;
protected assQuestion $object;
protected ilGlobalPageTemplate $tpl;
Expand Down Expand Up @@ -150,7 +148,7 @@ abstract class assQuestionGUI

private bool $previousSolutionPrefilled = false;

protected ilPropertyFormGUI $editForm;
protected ?ilPropertyFormGUI $editForm = null;
protected readonly ilTestLegacyFormsHelper $forms_helper;
protected readonly RequestDataCollector $request_data_collector;
protected bool $parent_type_is_lm = false;
Expand Down

0 comments on commit 8ecc665

Please sign in to comment.