ILIAS  release_8 Revision v8.24
class.ilAssLongmenuCorrectionsInputGUI.php
Go to the documentation of this file.
1<?php
2
28{
29 public function checkInput(): bool
30 {
31 return true;
32 }
33
34 public function insert(ilTemplate $a_tpl): void
35 {
36 $tpl = new ilTemplate('tst.longmenu_corrections_input.html', true, true, 'Modules/TestQuestionPool');
37
38 $tpl->setVariable('ANSWERS_MODAL', $this->buildAnswersModal()->getHTML());
39
40 $tpl->setVariable('TAG_INPUT', $this->buildTagInput()->render());
41
42 $tpl->setVariable('NUM_ANSWERS', $this->values['answers_all_count']);
43
44 $tpl->setVariable('TXT_ANSWERS', $this->lng->txt('answer_options'));
45 $tpl->setVariable('TXT_SHOW', $this->lng->txt('show'));
46 $tpl->setVariable('TXT_CORRECT_ANSWERS', $this->lng->txt('correct_answers'));
47
48 $tpl->setVariable('POSTVAR', $this->getPostVar());
49
50 $a_tpl->setCurrentBlock("prop_generic");
51 $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
52 $a_tpl->parseCurrentBlock();
53 }
54
55 protected function buildAnswersModal(): ilModalGUI
56 {
57 $closeButton = ilJsLinkButton::getInstance();
58 $closeButton->setCaption('close');
59 $closeButton->setTarget('');
60 $closeButton->setOnClick("$('#modal_{$this->getPostVar()}').modal('hide');");
61
62 $modal = ilModalGUI::getInstance();
63 $modal->setId('modal_' . $this->getPostVar());
64 $modal->setHeading($this->lng->txt('answer_options'));
65 $modal->addButton($closeButton);
66
67 $inp = new ilTextWizardInputGUI('', '');
68 $inp->setValues(current($this->values['answers_all']));
69 $inp->setDisabled(true);
70
71 $modal->setBody($inp->render());
72
73 return $modal;
74 }
75
76 protected function buildTagInput(): ilTagInputGUI
77 {
78 $tagInput = new ilTagInputGUI('', $this->getPostVar() . '_tags');
79 $tagInput->setTypeAheadMinLength(1);
80
81 $tagInput->setOptions($this->values['answers_correct']);
82 $tagInput->setTypeAheadList($this->values['answers_all'][0]);
83
84 return $tagInput;
85 }
86}
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance()
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 file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41