ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
class.ilAssLongmenuCorrectionsInputGUI.php
Go to the documentation of this file.
1<?php
2
20
30{
31 private \ILIAS\DI\UIServices $ui;
32
34
35 public function __construct($a_title = "", $a_postvar = "")
36 {
37 global $DIC;
38 $this->ui = $DIC->ui();
39
40 parent::__construct($a_title, $a_postvar);
41 }
42
43 public function checkInput(): bool
44 {
45 return true;
46 }
47
48 public function insert(ilTemplate $a_tpl): void
49 {
50 // Get input
51 $inp = new ilTextWizardInputGUI('', '');
52 $inp->setValues(current($this->values['answers_all']));
53 $inp->setDisabled(true);
54
55 $this->answer_options_modal = $this->ui->factory()->modal()->lightbox(
56 $this->ui->factory()->modal()->lightboxTextPage(
57 $inp->render(),
58 $this->lng->txt('answer_options')
59 )
60 );
61
62 $tpl = new ilTemplate('tpl.prop_longmenu_corrections_input.html', true, true, 'components/ILIAS/TestQuestionPool');
63
64 $tpl->setVariable('TAG_INPUT', $this->buildTagInput()->render());
65 $tpl->setVariable('NUM_ANSWERS', $this->values['answers_all_count']);
66 $tpl->setVariable(
67 'BTN_SHOW',
68 $this->ui->renderer()->render(
69 $this->ui->factory()->button()->standard(
70 $this->lng->txt('show'),
71 $this->answer_options_modal->getShowSignal()
72 )
73 )
74 );
75 $tpl->setVariable('TXT_ANSWERS', $this->lng->txt('answer_options'));
76 $tpl->setVariable('TXT_CORRECT_ANSWERS', $this->lng->txt('correct_answers') . ':');
77
78 $tpl->setVariable('POSTVAR', $this->getPostVar());
79
80 $a_tpl->setCurrentBlock("prop_generic");
81 $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
82 $a_tpl->parseCurrentBlock();
83 }
84
85 public function getContentOutsideFormTag(): string
86 {
87 return $this->answer_options_modal === null
88 ? ''
89 : $this->ui->renderer()->render($this->answer_options_modal);
90 }
91
92 protected function buildTagInput(): ilTagInputGUI
93 {
94 $tagInput = new ilTagInputGUI('', $this->getPostVar() . '_tags');
95 $tagInput->setTypeAheadMinLength(1);
96
97 $tagInput->setOptions($this->values['answers_correct']);
98 $tagInput->setTypeAheadList($this->values['answers_all'][0]);
99
100 return $tagInput;
101 }
102}
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
This class represents a single choice wizard property in a property form.
__construct($a_title="", $a_postvar="")
Constructor.
getContentOutsideFormTag()
Get content that has to reside outside of the parent form tag, e.g.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
render(string $a_mode="")
This class represents a text wizard property in a property form.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26