42 private string $parent_cmd,
44 private $question_hint_tracking,
57 $cmd = $this->
ctrl->getCmd(self::CMD_SHOW_LIST);
58 $next_class = $this->
ctrl->getNextClass($this);
60 switch ($next_class) {
61 case 'ilasshintpagegui':
69 $forwarder->forward();
80 if ($this->global_screen->tool()->context()->current()->getAdditionalData()
82 $this->global_screen->tool()->context()->current()->getAdditionalData()->replace(
84 $this->parent_gui->getObject()->getTitle() .
' - ' . $this->
lng->txt(
'show_requested_question_hints')
88 $question_hint_list = $this->question_hint_tracking->getRequestedHintsList();
102 if (!$this->request->isset(
'hintId') || $this->request->int(
'hintId') === 0) {
106 $is_requested = $this->question_hint_tracking->isRequested($this->request->int(
'hintId'));
108 if (!$is_requested) {
109 throw new ilTestException(
'hint with given id is not yet requested for given testactive and testpass');
114 if ($this->global_screen->tool()->context()->current()->getAdditionalData()
116 $this->global_screen->tool()->context()->current()->getAdditionalData()->replace(
118 $this->parent_gui->getObject()->getTitle() .
' - ' . sprintf(
119 $this->
lng->txt(
'tst_question_hints_form_header_edit'),
120 $question_hint->getIndex(),
121 $this->request->int(
'sequence') ?? 0
127 $form->setFormAction($this->
ctrl->getFormAction($this));
128 $form->setTableWidth(
'100%');
129 $form->setTitle(sprintf(
130 $this->
lng->txt(
'tst_question_hints_form_header_edit'),
131 $question_hint->getIndex(),
132 $this->questionOBJ->getTitleForHTMLOutput()
134 $form->addCommandButton(self::CMD_BACK_TO_QUESTION, $this->
lng->txt(
'tst_question_hints_back_to_question'));
136 $num_existing_requests = $this->question_hint_tracking->getNumExistingRequests();
138 if ($num_existing_requests > 1) {
139 $form->addCommandButton(self::CMD_SHOW_LIST, $this->
lng->txt(
'show_requested_question_hints'));
144 $non_editable_hint_text =
new ilNonEditableValueGUI($this->
lng->txt(
'tst_question_hints_form_label_hint_text'),
'hint_text',
true);
146 $form->addItem($non_editable_hint_text);
150 $non_editable_hint_point =
new ilNonEditableValueGUI($this->
lng->txt(
'tst_question_hints_form_label_hint_points'),
'hint_points');
151 $non_editable_hint_point->setValue($question_hint->getPoints());
152 $form->addItem($non_editable_hint_point);
159 if ($this->global_screen->tool()->context()->current()->getAdditionalData()
161 $this->global_screen->tool()->context()->current()->getAdditionalData()->replace(
163 $this->parent_gui->getObject()->getTitle() .
' - ' . $this->
lng->txt(
'tst_question_hints_confirm_request')
168 $next_requestable_hint = $this->question_hint_tracking->getNextRequestableHint();
170 $this->
ctrl->redirect($this, self::CMD_BACK_TO_QUESTION);
176 $this->
ctrl->getFormAction($this),
177 "hintId={$next_requestable_hint->getId()}" 180 $confirmation->setFormAction($form_action);
182 $confirmation->setConfirm($this->
lng->txt(
'tst_question_hints_confirm_request'), self::CMD_PERFORM_REQUEST);
183 $confirmation->setCancel($this->
lng->txt(
'tst_question_hints_cancel_request'), self::CMD_BACK_TO_QUESTION);
185 if ($next_requestable_hint->getPoints() == 0.0) {
186 $confirmation->setHeaderText($this->
lng->txt(
'tst_question_hints_request_confirmation_no_deduction'));
188 $confirmation->setHeaderText(sprintf(
189 $this->
lng->txt(
'tst_question_hints_request_confirmation'),
190 $next_requestable_hint->getIndex(),
191 $next_requestable_hint->getPoints()
200 if (!$this->request->isset(
'hintId') || !(
int) $this->request->raw(
'hintId')) {
205 $next_requestable_hint = $this->question_hint_tracking->getNextRequestableHint();
207 $this->
ctrl->redirect($this, self::CMD_BACK_TO_QUESTION);
210 if ($next_requestable_hint->getId() != (
int) $this->request->raw(
'hintId')) {
211 throw new ilTestException(
'given hint id does not relate to the next requestable hint');
214 $this->question_hint_tracking->storeRequest($next_requestable_hint);
223 $this->
ctrl->redirect($this->parent_gui, $this->parent_cmd);
228 $tpl->setContent($content);
234 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
235 $this->
ctrl->setParameterByClass(
'ilasshintpagegui',
'hint_id', $hint_id);
236 return $this->
ctrl->getLinkTargetByClass(
'ilAssHintPageGUI',
'',
'',
false, $xml_style);
239 $this->
ctrl->setParameter($this,
'hintId', $hint_id);
240 return $this->
ctrl->getLinkTarget($this, self::CMD_SHOW_HINT,
'',
false, $xml_style);
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
const CMD_CONFIRM_REQUEST
static getInstanceById($hintId)
creates a hint object instance, loads the persisted hint dataset identified by passed hint id from da...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
populateContent($content, $tpl)
Output class for assessment test execution.
Base Exception for all Exceptions relating to Modules/Test.
__construct(private ilTestOutputGUI|ilAssQuestionPreviewGUI $parent_gui, private string $parent_cmd, assQuestionGUI $question_gui, private $question_hint_tracking, private ilCtrl $ctrl, private ilLanguage $lng, private ilGlobalTemplateInterface $tpl, protected ilTabsGUI $tabs, private GlobalScreen $global_screen)
const CMD_PERFORM_REQUEST
Basic GUI class for assessment questions.
const PRESENTATION_MODE_REQUEST
presentation mode for requesting
static redirect(string $a_script)
const TEST_PLAYER_VIEW_TITLE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getHintPresentationLinkTarget($hint_id, $xml_style=true)
const CMD_BACK_TO_QUESTION