ILIAS  release_8 Revision v8.24
class.ilTestPlayerConfirmationModal.php
Go to the documentation of this file.
1<?php
2
28{
32 protected $modalId = '';
33
37 protected $headerText = '';
38
42 protected $confirmationText = '';
43
48
53
57 protected $buttons = array();
58
62 protected $parameters = array();
63
67 public function getModalId(): string
68 {
69 return $this->modalId;
70 }
71
75 public function setModalId($modalId)
76 {
77 $this->modalId = $modalId;
78 }
79
83 public function getHeaderText(): string
84 {
85 return $this->headerText;
86 }
87
91 public function setHeaderText($headerText)
92 {
93 $this->headerText = $headerText;
94 }
95
99 public function getConfirmationText(): string
100 {
102 }
103
108 {
109 $this->confirmationText = $confirmationText;
110 }
111
115 public function getConfirmationCheckboxName(): string
116 {
118 }
119
124 {
125 $this->confirmationCheckboxName = $confirmationCheckboxName;
126 }
127
131 public function getConfirmationCheckboxLabel(): string
132 {
134 }
135
140 {
141 $this->confirmationCheckboxLabel = $confirmationCheckboxLabel;
142 }
143
147 public function getButtons(): array
148 {
149 return $this->buttons;
150 }
151
155 public function addButton(ilLinkButton $button)
156 {
157 $this->buttons[] = $button;
158 }
159
163 public function getParameters(): array
164 {
165 return $this->parameters;
166 }
167
171 public function addParameter(ilHiddenInputGUI $hiddenInputGUI)
172 {
173 $this->parameters[] = $hiddenInputGUI;
174 }
175
179 public function isConfirmationCheckboxRequired(): bool
180 {
181 return strlen($this->getConfirmationCheckboxName()) && strlen($this->getConfirmationCheckboxLabel());
182 }
183
187 public function buildBody(): string
188 {
189 $tpl = new ilTemplate('tpl.tst_player_confirmation_modal.html', true, true, 'Modules/Test');
190
191 if ($this->isConfirmationCheckboxRequired()) {
192 $tpl->setCurrentBlock('checkbox');
193 $tpl->setVariable('CONFIRMATION_CHECKBOX_NAME', $this->getConfirmationCheckboxName());
194 $tpl->setVariable('CONFIRMATION_CHECKBOX_LABEL', $this->getConfirmationCheckboxLabel());
195 $tpl->parseCurrentBlock();
196 }
197
198 foreach ($this->getParameters() as $parameter) {
199 $tpl->setCurrentBlock('hidden_inputs');
200 $tpl->setVariable('HIDDEN_INPUT', $parameter->getToolbarHTML());
201 $tpl->parseCurrentBlock();
202 }
203
204 foreach ($this->getButtons() as $button) {
205 $tpl->setCurrentBlock('buttons');
206 $tpl->setVariable('BUTTON', $button->render());
207 $tpl->parseCurrentBlock();
208 }
209
210 $tpl->setVariable('CONFIRMATION_TEXT', $this->getConfirmationText());
211
212 return $tpl->get();
213 }
214
218 public function getHTML(): string
219 {
220 $modal = ilModalGUI::getInstance();
221 $modal->setId($this->getModalId());
222 $modal->setHeading($this->getHeaderText());
223 $modal->setBody($this->buildBody());
224 return $modal->getHTML();
225 }
226
231 public function buildModalButtonInstance($buttonId): ilLinkButton
232 {
233 $button = ilLinkButton::getInstance();
234
235 $button->setUrl('#');
236 $button->setId($buttonId);
237
238 return $button;
239 }
240}
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()
special template class to simplify handling of ITX/PEAR
setConfirmationCheckboxLabel($confirmationCheckboxLabel)
addParameter(ilHiddenInputGUI $hiddenInputGUI)
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41