ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilTestNavigationToolbarGUI.php
Go to the documentation of this file.
1 <?php
2 
19 require_once 'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
20 require_once 'Modules/Test/classes/class.ilTestPlayerNavButton.php';
21 
29 {
33  protected $ctrl;
34 
38  protected $playerGUI;
39 
43  private $suspendTestButtonEnabled = false;
44 
48  private $questionListButtonEnabled = false;
49 
53  private $questionTreeButtonEnabled = false;
54 
55  private bool $questionTreeVisible = false;
56 
61 
65  private $finishTestButtonEnabled = false;
66 
70  private $finishTestCommand = '';
71 
75  private $finishTestButtonPrimary = false;
76 
80  private $disabledStateEnabled = false;
81 
88  {
89  $this->ctrl = $ctrl;
90  $this->lng = $lng;
91  $this->playerGUI = $playerGUI;
92 
94  }
95 
99  public function isSuspendTestButtonEnabled(): bool
100  {
102  }
103 
108  {
109  $this->suspendTestButtonEnabled = $suspendTestButtonEnabled;
110  }
111 
115  public function isQuestionListButtonEnabled(): bool
116  {
118  }
119 
124  {
125  $this->questionListButtonEnabled = $questionListButtonEnabled;
126  }
127 
131  public function isQuestionTreeButtonEnabled(): bool
132  {
134  }
135 
140  {
141  $this->questionTreeButtonEnabled = $questionTreeButtonEnabled;
142  }
143 
147  public function isQuestionTreeVisible(): bool
148  {
150  }
151 
152  public function setQuestionTreeVisible(bool $questionTreeVisible): void
153  {
154  $this->questionTreeVisible = $questionTreeVisible;
155  }
156 
160  public function isQuestionSelectionButtonEnabled(): bool
161  {
163  }
164 
169  {
170  $this->questionSelectionButtonEnabled = $questionSelectionButtonEnabled;
171  }
172 
176  public function isFinishTestButtonEnabled(): bool
177  {
179  }
180 
185  {
186  $this->finishTestButtonEnabled = $finishTestButtonEnabled;
187  }
188 
192  public function getFinishTestCommand(): string
193  {
195  }
196 
201  {
202  $this->finishTestCommand = $finishTestCommand;
203  }
204 
208  public function isFinishTestButtonPrimary(): bool
209  {
211  }
212 
217  {
218  $this->finishTestButtonPrimary = $finishTestButtonPrimary;
219  }
220 
224  public function isDisabledStateEnabled(): bool
225  {
227  }
228 
233  {
234  $this->disabledStateEnabled = $disabledStateEnabled;
235  }
236 
237  public function build()
238  {
239  if ($this->isQuestionTreeButtonEnabled()) {
240  $this->addQuestionTreeButton();
241  }
242 
243  if ($this->isQuestionListButtonEnabled()) {
244  $this->addQuestionListButton();
245  }
246 
247  if ($this->isQuestionSelectionButtonEnabled()) {
249  }
250 
251  if ($this->isSuspendTestButtonEnabled()) {
252  $this->addSuspendTestButton();
253  }
254 
255  if ($this->isFinishTestButtonEnabled()) {
256  $this->addFinishTestButton();
257  }
258  }
259 
260  private function addSuspendTestButton()
261  {
263  $btn->setNextCommand(ilTestPlayerCommands::SUSPEND_TEST);
264  $btn->setUrl($this->ctrl->getLinkTarget(
265  $this->playerGUI,
267  ));
268  $btn->setCaption('cancel_test');
269  //$btn->setDisabled($this->isDisabledStateEnabled());
270  $btn->addCSSClass('ilTstNavElem');
271  $this->addButtonInstance($btn);
272  }
273 
274  private function addQuestionListButton()
275  {
277  $btn->setNextCommand(ilTestPlayerCommands::QUESTION_SUMMARY);
278  $btn->setUrl($this->ctrl->getLinkTarget(
279  $this->playerGUI,
281  ));
282  $btn->setCaption('question_summary_btn');
283  //$btn->setDisabled($this->isDisabledStateEnabled());
284  $btn->addCSSClass('ilTstNavElem');
285  $this->addButtonInstance($btn);
286  }
287 
288  private function addQuestionSelectionButton()
289  {
291  $btn->setNextCommand(ilTestPlayerCommands::SHOW_QUESTION_SELECTION);
292  $btn->setUrl($this->ctrl->getLinkTarget(
293  $this->playerGUI,
295  ));
296  $btn->setCaption('tst_change_dyn_test_question_selection');
297  //$btn->setDisabled($this->isDisabledStateEnabled());
298  $btn->addCSSClass('ilTstNavElem');
299  $this->addButtonInstance($btn);
300  }
301 
302  private function addQuestionTreeButton()
303  {
305  $btn->setNextCommand(ilTestPlayerCommands::TOGGLE_SIDE_LIST);
306  $btn->setUrl($this->ctrl->getLinkTarget(
307  $this->playerGUI,
309  ));
310  if ($this->isQuestionTreeVisible()) {
311  $btn->setCaption('tst_hide_side_list');
312  } else {
313  $btn->setCaption('tst_show_side_list');
314  }
315  //$btn->setDisabled($this->isDisabledStateEnabled());
316  $btn->addCSSClass('ilTstNavElem');
317  $this->addButtonInstance($btn);
318  }
319 
320  private function addFinishTestButton()
321  {
323  $btn->setNextCommand($this->getFinishTestCommand());
324  $btn->setUrl($this->ctrl->getLinkTarget(
325  $this->playerGUI,
326  $this->getFinishTestCommand()
327  ));
328  $btn->setCaption('finish_test');
329  //$btn->setDisabled($this->isDisabledStateEnabled());
330  $btn->setPrimary($this->isFinishTestButtonPrimary());
331  $btn->addCSSClass('ilTstNavElem');
332  $this->addButtonInstance($btn);
333  }
334 }
setFinishTestButtonEnabled($finishTestButtonEnabled)
setQuestionTreeButtonEnabled($questionTreeButtonEnabled)
setSuspendTestButtonEnabled($suspendTestButtonEnabled)
addButtonInstance(ilButtonBase $a_button)
Add button instance.
setQuestionSelectionButtonEnabled($questionSelectionButtonEnabled)
setQuestionTreeVisible(bool $questionTreeVisible)
__construct(ilCtrl $ctrl, ilLanguage $lng, ilTestPlayerAbstractGUI $playerGUI)
setFinishTestButtonPrimary($finishTestButtonPrimary)
__construct(Container $dic, ilPlugin $plugin)
setQuestionListButtonEnabled($questionListButtonEnabled)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...