ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilAssLongmenuCorrectionsInputGUI.php
Go to the documentation of this file.
1 <?php
2 
28 {
29  private \ILIAS\DI\UIServices $ui;
30 
31  public function __construct($a_title = "", $a_postvar = "")
32  {
33  global $DIC;
34  $this->ui = $DIC->ui();
35 
36  parent::__construct($a_title, $a_postvar);
37  }
38 
39  public function checkInput(): bool
40  {
41  return true;
42  }
43 
44  public function insert(ilTemplate $a_tpl): void
45  {
46  // Get input
47  $inp = new ilTextWizardInputGUI('', '');
48  $inp->setValues(current($this->values['answers_all']));
49  $inp->setDisabled(true);
50  $message = $inp->render();
51 
52  $page = $this->ui->factory()->modal()->lightboxTextPage($message, $this->lng->txt('answer_options'));
53  $modal = $this->ui->factory()->modal()->lightbox($page);
54  $button = $this->ui->factory()->button()->standard($this->lng->txt('show'), $modal->getShowSignal());
55 
56  $tpl = new ilTemplate('tst.longmenu_corrections_input.html', true, true, 'components/ILIAS/TestQuestionPool');
57 
58  $tpl->setVariable('ANSWERS_MODAL', $this->ui->renderer()->render($modal));
59  $tpl->setVariable('TAG_INPUT', $this->buildTagInput()->render());
60  $tpl->setVariable('NUM_ANSWERS', $this->values['answers_all_count']);
61  $tpl->setVariable('BTN_SHOW', $this->ui->renderer()->render($button));
62  $tpl->setVariable('TXT_ANSWERS', $this->lng->txt('answer_options'));
63  $tpl->setVariable('TXT_CORRECT_ANSWERS', $this->lng->txt('correct_answers') . ':');
64 
65  $tpl->setVariable('POSTVAR', $this->getPostVar());
66 
67  $a_tpl->setCurrentBlock("prop_generic");
68  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
69  $a_tpl->parseCurrentBlock();
70  }
71 
72  protected function buildTagInput(): ilTagInputGUI
73  {
74  $tagInput = new ilTagInputGUI('', $this->getPostVar() . '_tags');
75  $tagInput->setTypeAheadMinLength(1);
76 
77  $tagInput->setOptions($this->values['answers_correct']);
78  $tagInput->setTypeAheadList($this->values['answers_all'][0]);
79 
80  return $tagInput;
81  }
82 }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a single choice wizard property in a property form.
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
global $DIC
Definition: shib_login.php:26
render(string $a_mode="")
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
__construct(Container $dic, ilPlugin $plugin)
$message
Definition: xapiexit.php:31
This class represents a text wizard property in a property form.