ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilTestPlayerConfirmationModal.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
14 {
18  protected $modalId = '';
19 
23  protected $headerText = '';
24 
28  protected $confirmationText = '';
29 
33  protected $confirmationCheckboxName = '';
34 
39 
43  protected $buttons = array();
44 
48  protected $parameters = array();
49 
53  public function getModalId()
54  {
55  return $this->modalId;
56  }
57 
61  public function setModalId($modalId)
62  {
63  $this->modalId = $modalId;
64  }
65 
69  public function getHeaderText()
70  {
71  return $this->headerText;
72  }
73 
77  public function setHeaderText($headerText)
78  {
79  $this->headerText = $headerText;
80  }
81 
85  public function getConfirmationText()
86  {
88  }
89 
94  {
95  $this->confirmationText = $confirmationText;
96  }
97 
101  public function getConfirmationCheckboxName()
102  {
104  }
105 
110  {
111  $this->confirmationCheckboxName = $confirmationCheckboxName;
112  }
113 
118  {
120  }
121 
126  {
127  $this->confirmationCheckboxLabel = $confirmationCheckboxLabel;
128  }
129 
133  public function getButtons()
134  {
135  return $this->buttons;
136  }
137 
141  public function addButton(ilLinkButton $button)
142  {
143  $this->buttons[] = $button;
144  }
145 
149  public function getParameters()
150  {
151  return $this->parameters;
152  }
153 
157  public function addParameter(ilHiddenInputGUI $hiddenInputGUI)
158  {
159  $this->parameters[] = $hiddenInputGUI;
160  }
161 
166  {
167  return strlen($this->getConfirmationCheckboxName()) && strlen($this->getConfirmationCheckboxLabel());
168  }
169 
173  public function buildBody()
174  {
175  $tpl = new ilTemplate('tpl.tst_player_confirmation_modal.html', true, true, 'Modules/Test');
176 
177  if ($this->isConfirmationCheckboxRequired()) {
178  $tpl->setCurrentBlock('checkbox');
179  $tpl->setVariable('CONFIRMATION_CHECKBOX_NAME', $this->getConfirmationCheckboxName());
180  $tpl->setVariable('CONFIRMATION_CHECKBOX_LABEL', $this->getConfirmationCheckboxLabel());
181  $tpl->parseCurrentBlock();
182  }
183 
184  foreach ($this->getParameters() as $parameter) {
185  $tpl->setCurrentBlock('hidden_inputs');
186  $tpl->setVariable('HIDDEN_INPUT', $parameter->getToolbarHTML());
187  $tpl->parseCurrentBlock();
188  }
189 
190  foreach ($this->getButtons() as $button) {
191  $tpl->setCurrentBlock('buttons');
192  $tpl->setVariable('BUTTON', $button->render());
193  $tpl->parseCurrentBlock();
194  }
195 
196  $tpl->setVariable('CONFIRMATION_TEXT', $this->getConfirmationText());
197 
198  return $tpl->get();
199  }
200 
204  public function getHTML()
205  {
206  $modal = ilModalGUI::getInstance();
207  $modal->setId($this->getModalId());
208  $modal->setHeading($this->getHeaderText());
209  $modal->setBody($this->buildBody());
210  return $modal->getHTML();
211  }
212 
217  public function buildModalButtonInstance($buttonId)
218  {
219  $button = ilLinkButton::getInstance();
220 
221  $button->setUrl('#');
222  $button->setId($buttonId);
223 
224  return $button;
225  }
226 }
$tpl
Definition: ilias.php:10
This class represents a hidden form property in a property form.
special template class to simplify handling of ITX/PEAR
static getInstance()
Get instance.
addParameter(ilHiddenInputGUI $hiddenInputGUI)
setConfirmationCheckboxLabel($confirmationCheckboxLabel)