19 declare(strict_types=1);
38 private \ILIAS\DI\UIServices
$ui;
130 $this->anything_rendered =
true;
135 $this->show_discard_modal_signal = $signal;
148 if ($this->question_mark_link_target) {
153 'ilTestMarkQuestionIcon' 156 $actions[] = $this->ui_factory->button()->shy(
159 )->withAdditionalOnLoadCode(
160 static function (
string $id) use ($target):
string {
161 return "document.getElementById('$id').addEventListener('click', " 163 .
" il.TestPlayerQuestionEditControl.checkNavigation('{$target}', 'show', e);" 169 if ($this->skip_question_link_target) {
170 $actions[] = $this->ui_factory->button()->shy(
171 $this->
lng->txt(
'postpone_question'),
176 if ($actions !== []) {
177 $actions[] = $this->ui_factory->divider()->horizontal();
180 $actions[] = $this->ui_factory->button()->shy(
181 $this->
lng->txt(
'tst_revert_changes'),
183 )->withUnavailableAction(!$this->revert_changes_link_target);
185 if ($this->question_worked_through) {
186 $actions[] = $this->ui_factory->button()->shy(
187 $this->
lng->txt(
'discard_answer'),
189 )->withUnavailableAction(!$this->discard_solution_button_enabled)
193 $list = $this->ui_factory->dropdown()->standard($actions)->withLabel($this->
lng->txt(
'actions'));
194 $tpl->setVariable(
'ACTION_MENU', $this->ui_renderer->render($list));
202 if ($this->edit_solution_command) {
205 $this->edit_solution_command,
213 $this->instant_feedback_command,
215 $this->force_instant_response_enabled
219 if ($this->request_hint_command) {
222 $this->request_hint_command,
227 if ($this->show_hints_command) {
230 $this->show_hints_command,
231 $this->
lng->txt(
'show_requested_question_hints')
235 if ($this->anything_rendered) {
244 if ($this->question_worked_through) {
245 return $this->
lng->txt(
'edit_answer');
248 return $this->
lng->txt(
'answer_question');
253 if ($this->answer_freezing_enabled) {
254 return $this->
lng->txt(
'submit_and_check');
257 return $this->
lng->txt(
'check');
262 if ($this->hint_requests_exist) {
263 return $this->
lng->txt(
'button_request_next_question_hint');
266 return $this->
lng->txt(
'button_request_question_hint');
271 if ($this->question_marked) {
272 return $this->
lng->txt(
'tst_remove_mark');
275 return $this->
lng->txt(
'tst_question_mark');
281 if ($this->question_marked) {
282 return $this->
lng->txt(
'tst_question_marked');
285 return$this->
lng->txt(
'tst_question_not_marked');
290 if ($this->question_marked) {
299 switch ($a_purpose) {
302 'tpl.tst_question_navigation.html',
305 'components/ILIAS/Test' 310 'tpl.tst_question_actions.html',
313 'components/ILIAS/Test' 333 $tpl->
setVariable(
'BUTTON_INSTANCE', $this->ui_renderer->render($button));
348 $this->ui_factory->button()->standard($label,
'')->withAdditionalOnLoadCode($on_load_code)
362 $this->ui_factory->button()->primary($label,
'')->withAdditionalOnLoadCode($on_load_code)
369 $this->ui_factory->button()->standard($label,
'')->withAdditionalOnLoadCode($on_load_code)
375 return static function (
$id) use ($command):
string {
376 return "document.getElementById('$id').addEventListener('click', " 378 .
" e.target.setAttribute('name', 'cmd[$command]');" 379 .
' e.target.form.requestSubmit(e.target);' parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
bool $force_instant_response_enabled
setRevertChangesLinkTarget(string $revert_changes_link_target)
setQuestionMarked(bool $question_marked)
getEditSolutionButtonLabel()
setSkipQuestionLinkTarget(string $skip_question_link_target)
setDiscardSolutionButtonEnabled(bool $discard_solution_button_enabled)
setEditSolutionCommand(string $edit_solution_command)
renderActionsIcon(ilTemplate $tpl, string $icon_src, string $label, string $css_class)
renderButtonInstance(ilTemplate $tpl, Button $button)
string $revert_changes_link_target
string $show_hints_command
setShowDiscardModalSignal(Signal $signal)
setShowHintsCommand(string $show_hints_command)
getRequestHintButtonLabel()
const CSS_CLASS_SUBMIT_BUTTONS
parseButtonsBlock(ilTemplate $tpl)
setForceInstantResponseEnabled(bool $force_instant_response_enabled)
getOnLoadCode(string $command)
getQuestionMarkIconSource()
setHintRequestsExist(bool $hint_requests_exist)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
string $question_mark_link_target
setAnswerFreezingEnabled(bool $answer_freezing_enabled)
setRequestHintCommand(string $request_hint_command)
setVariable($variable, $value='')
Sets a variable value.
renderSubmitButton(ilTemplate $tpl, string $command, string $label)
__construct(protected ilLanguage $lng, protected UIFactory $ui_factory, protected UIRenderer $ui_renderer)
getShowDiscardModalSignal()
bool $hint_requests_exist
const SHOW_DISABLED_COMMANDS
bool $discard_solution_button_enabled
Signal $show_discard_modal_signal
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
const SHOW_INSTANT_RESPONSE
string $request_hint_command
string $skip_question_link_target
renderInstantFeedbackButton(ilTemplate $tpl, string $command, string $label, bool $is_primary)
string $edit_solution_command
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setInstantFeedbackCommand(string $instant_feedback_command)
setQuestionWorkedThrough(bool $question_worked_through)
bool $question_worked_through
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
bool $answer_freezing_enabled
getQuestionMarkIconLabel()
getTemplate($a_purpose='toolbar')
string $instant_feedback_command
setQuestionMarkLinkTarget(string $question_mark_link_target)
getQuestionMarkActionLabel()
parseNavigation(ilTemplate $tpl)