19declare(strict_types=1);
38 private \ILIAS\DI\UIServices
$ui;
56 protected UIFactory $ui_factory,
57 protected UIRenderer $ui_renderer
113 $this->anything_rendered =
true;
118 $this->show_discard_modal_signal = $signal;
123 return $this->show_discard_modal_signal ??
new SignalImplementation(
'');
141 if ($this->question_mark_link_target) {
146 'ilTestMarkQuestionIcon'
149 $actions[] = $this->ui_factory->button()->shy(
152 )->withAdditionalOnLoadCode(
153 static function (
string $id) use ($target):
string {
154 return "document.getElementById('$id').addEventListener('click', "
156 .
" il.TestPlayerQuestionEditControl.checkNavigation('{$target}', 'show', e);"
162 if ($this->skip_question_link_target) {
163 $actions[] = $this->ui_factory->button()->shy(
164 $this->
lng->txt(
'postpone_question'),
165 $this->skip_question_link_target
169 if ($actions !== []) {
170 $actions[] = $this->ui_factory->divider()->horizontal();
173 $actions[] = $this->ui_factory->button()->shy(
174 $this->
lng->txt(
'tst_revert_changes'),
175 $this->revert_changes_link_target
177 ->withUnavailableAction(!$this->revert_changes_link_target)
178 ->withAdditionalOnLoadCode(
179 static fn(
string $id):
string =>
"document.getElementById('{$id}').classList.add('ilTestRevertChangesAction')"
182 $actions[] = $this->ui_factory->button()->shy($this->
lng->txt(
'discard_answer'),
'#')
183 ->withUnavailableAction(!$this->discard_solution_button_enabled)
186 $list = $this->ui_factory->dropdown()->standard($actions)->withLabel($this->
lng->txt(
'actions'));
187 $tpl->setVariable(
'ACTION_MENU', $this->ui_renderer->render($list));
195 if ($this->edit_solution_command) {
198 $this->edit_solution_command,
206 $this->instant_feedback_command,
208 $this->force_instant_response_enabled
212 if ($this->anything_rendered) {
221 if ($this->question_worked_through) {
222 return $this->
lng->txt(
'edit_answer');
225 return $this->
lng->txt(
'answer_question');
230 if ($this->answer_freezing_enabled) {
231 return $this->
lng->txt(
'submit_and_check');
234 return $this->
lng->txt(
'check');
239 if ($this->question_marked) {
240 return $this->
lng->txt(
'tst_remove_mark');
243 return $this->
lng->txt(
'tst_question_mark');
249 if ($this->question_marked) {
250 return $this->
lng->txt(
'tst_question_marked');
253 return$this->lng->txt(
'tst_question_not_marked');
258 if ($this->question_marked) {
267 switch ($a_purpose) {
270 'tpl.tst_question_navigation.html',
273 'components/ILIAS/Test'
278 'tpl.tst_question_actions.html',
281 'components/ILIAS/Test'
301 $tpl->
setVariable(
'BUTTON_INSTANCE', $this->ui_renderer->render($button));
316 $this->ui_factory->button()->standard($label,
'')->withAdditionalOnLoadCode($on_load_code)
328 $this->renderButtonInstance(
330 $this->ui_factory->button()->primary($label,
'')->withAdditionalOnLoadCode($on_load_code)
335 $this->renderButtonInstance(
337 $this->ui_factory->button()->standard($label,
'')->withAdditionalOnLoadCode($on_load_code)
343 return static function (
$id) use ($command):
string {
344 return "document.getElementById('$id').addEventListener('click', "
346 .
" e.target.setAttribute('name', 'cmd[$command]');"
347 .
' e.target.form.requestSubmit(e.target);'
358 $tpl->setCurrentBlock(
'actions_icon');
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
setVariable($variable, $value='')
Sets a variable value.
Builds a Color from either hex- or rgb values.
special template class to simplify handling of ITX/PEAR
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
getEditSolutionButtonLabel()
setShowDiscardModalSignal(Signal $signal)
const CSS_CLASS_SUBMIT_BUTTONS
bool $discard_solution_button_enabled
setForceInstantResponseEnabled(bool $force_instant_response_enabled)
setInstantFeedbackCommand(string $instant_feedback_command)
setFeedbackButtonEnabled(bool $feedback_button_enabled)
getShowDiscardModalSignal()
bool $feedback_button_enabled
renderButtonInstance(ilTemplate $tpl, Button $button)
renderSubmitButton(ilTemplate $tpl, string $command, string $label)
string $revert_changes_link_target
Signal $show_discard_modal_signal
setRevertChangesLinkTarget(string $revert_changes_link_target)
getQuestionMarkActionLabel()
bool $answer_freezing_enabled
__construct(protected ilLanguage $lng, protected UIFactory $ui_factory, protected UIRenderer $ui_renderer)
string $instant_feedback_command
setQuestionWorkedThrough(bool $question_worked_through)
getTemplate($a_purpose='toolbar')
bool $force_instant_response_enabled
setQuestionMarkLinkTarget(string $question_mark_link_target)
isFeedbackButtonEnabled()
getQuestionMarkIconLabel()
setAnswerFreezingEnabled(bool $answer_freezing_enabled)
bool $question_worked_through
setEditSolutionCommand(string $edit_solution_command)
getOnLoadCode(string $command)
setQuestionMarked(bool $question_marked)
string $skip_question_link_target
renderActionsIcon(ilTemplate $tpl, string $icon_src, string $label, string $css_class)
const SHOW_DISABLED_COMMANDS
renderInstantFeedbackButton(ilTemplate $tpl, string $command, string $label, bool $is_primary)
parseButtonsBlock(ilTemplate $tpl)
string $question_mark_link_target
getQuestionMarkIconSource()
setDiscardSolutionButtonEnabled(bool $discard_solution_button_enabled)
string $edit_solution_command
parseNavigation(ilTemplate $tpl)
setSkipQuestionLinkTarget(string $skip_question_link_target)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
An entity that renders components to a string output.