ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilTestInfoScreenToolbarGUI Class Reference
+ Inheritance diagram for ilTestInfoScreenToolbarGUI:
+ Collaboration diagram for ilTestInfoScreenToolbarGUI:

Public Member Functions

 __construct (private ilObjTest $test_obj, private ilTestPlayerAbstractGUI $test_player_gui, private ilTestQuestionSetConfig $test_question_set_config, private ilTestSession $test_session, private ilDBInterface $db, private ilAccessHandler $access, private ilCtrl $ctrl, protected ilLanguage $lng, private UIFactory $ui_factory, private UIRenderer $ui_renderer, private ilGlobalTemplateInterface $main_tpl, private ilToolbarGUI $global_toolbar)
 
 getSessionLockString ()
 
 setSessionLockString ($sessionLockString)
 
 getInfoMessages ()
 
 addInfoMessage ($infoMessage)
 @ param string $infoMessage Could be. More...
 
 getFailureMessages ()
 
 addFailureMessage (string $failureMessage)
 
 setFormAction (string $a_val, bool $a_multipart=false, string $a_target="")
 
 setCloseFormTag (bool $a_val)
 
 addInputItem (ilToolbarItem $a_item, bool $a_output_label=false)
 
 addFormInput ($formInput)
 
 clearItems ()
 
 build ()
 
 sendMessages ()
 
- Public Member Functions inherited from ilToolbarGUI
 setFormAction (string $a_val, bool $a_multipart=false, string $a_target="")
 Set form action (if form action is set, toolbar is wrapped into form tags) More...
 
 getFormAction ()
 
 setLeadingImage (string $a_img, string $a_alt)
 
 setHidden (bool $a_val)
 
 getHidden ()
 
 setId (string $a_val)
 
 getId ()
 
 setPreventDoubleSubmission (bool $a_val)
 
 getPreventDoubleSubmission ()
 
 addButton (string $a_txt, string $a_cmd, string $a_target="", ?int $a_acc_key=null, string $a_additional_attrs='', string $a_id="", string $a_class='submit')
 
 addFormButton (string $a_txt, string $a_cmd, ?int $a_acc_key=null, bool $a_primary=false, ?string $a_class=null)
 
 addInputItem (ilToolbarItem $a_item, bool $a_output_label=false)
 
 addStickyItem ( $a_item, bool $a_output_label=false)
 Add a sticky item. More...
 
 addButtonInstance (ilButtonBase $a_button)
 Add button instance. More...
 
 addDropDown (string $a_txt, string $a_dd_html)
 
 addAdvancedSelectionList (ilAdvancedSelectionListGUI $adv)
 
 addSeparator ()
 
 addText (string $a_text)
 
 addSpacer (string $a_width=null)
 
 addComponent (\ILIAS\UI\Component\Component $a_comp)
 
 addLink (string $a_caption, string $a_url, bool $a_disabled=false)
 
 setOpenFormTag (bool $a_val)
 
 getOpenFormTag ()
 
 setCloseFormTag (bool $a_val)
 
 getCloseFormTag ()
 
 setFormName (string $a_val)
 
 getFormName ()
 
 getGroupedItems ()
 Get all groups (items separated by a separator) More...
 
 getItems ()
 
 setItems (array $items)
 

Protected Member Functions

 populateMessage ($message)
 
- Protected Member Functions inherited from ilToolbarGUI
 applyAutoStickyToSingleElement ()
 If the toolbar consists of only one button, make it sticky Note: Atm this is only possible for buttons. More...
 

Protected Attributes

ilTestQuestionSetConfig $testQuestionSetConfig = null
 
ilTestSession $testSession = null
 
 $testSequence
 
- Protected Attributes inherited from ilToolbarGUI
ilLanguage $lng
 
string $id = ''
 
string $form_action = ''
 
bool $hidden = false
 
array $lead_img
 
bool $open_form_tag = true
 
bool $close_form_tag = true
 
string $form_target = ""
 
string $form_name = ""
 
bool $prevent_double_submission = false
 
array $sticky_items = array()
 
bool $has_separator = false
 
ILIAS DI UIServices $ui
 
bool $multipart = false
 

Private Member Functions

 getTestQuestionSetConfig ()
 
 getTestOBJ ()
 
 getTestPlayerGUI ()
 
 getTestSession ()
 
 getClassName ($target)
 
 getClassNameArray ($target)
 
 getClassPath ($target)
 
 setParameter ($target, $parameter, $value)
 
 buildLinkTarget ($target, $cmd=null)
 
 buildFormAction ($target)
 
 ensureInitialisedSessionLockString ()
 
 buildSessionLockString ()
 
 hasFixedQuestionSetSkillAssignsLowerThanBarrier ()
 
 getSkillAssignBarrierInfo ()
 

Private Attributes

string $sessionLockString = ''
 
array $infoMessages = []
 
array $failureMessages = []
 

Static Private Attributes

static array $TARGET_CLASS_PATH_BASE = ['ilRepositoryGUI', 'ilObjTestGUI']
 

Additional Inherited Members

- Data Fields inherited from ilToolbarGUI
array $items = array()
 
- Static Protected Attributes inherited from ilToolbarGUI
static int $instances = 0
 

Detailed Description

Definition at line 30 of file class.ilTestInfoScreenToolbarGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestInfoScreenToolbarGUI::__construct ( private ilObjTest  $test_obj,
private ilTestPlayerAbstractGUI  $test_player_gui,
private ilTestQuestionSetConfig  $test_question_set_config,
private ilTestSession  $test_session,
private ilDBInterface  $db,
private ilAccessHandler  $access,
private ilCtrl  $ctrl,
protected ilLanguage  $lng,
private UIFactory  $ui_factory,
private UIRenderer  $ui_renderer,
private ilGlobalTemplateInterface  $main_tpl,
private ilToolbarGUI  $global_toolbar 
)

Definition at line 46 of file class.ilTestInfoScreenToolbarGUI.php.

59  {
60  }

Member Function Documentation

◆ addFailureMessage()

ilTestInfoScreenToolbarGUI::addFailureMessage ( string  $failureMessage)

Definition at line 110 of file class.ilTestInfoScreenToolbarGUI.php.

Referenced by build().

110  : void
111  {
112  $this->failureMessages[] = $failureMessage;
113  }
+ Here is the caller graph for this function:

◆ addFormInput()

ilTestInfoScreenToolbarGUI::addFormInput (   $formInput)

Definition at line 147 of file class.ilTestInfoScreenToolbarGUI.php.

147  : void
148  {
149  if ($this->global_toolbar instanceof parent) {
150  $this->global_toolbar->addFormInput($formInput);
151  }
152  }

◆ addInfoMessage()

ilTestInfoScreenToolbarGUI::addInfoMessage (   $infoMessage)

@ param string $infoMessage Could be.

Doesn't have to.

Definition at line 100 of file class.ilTestInfoScreenToolbarGUI.php.

Referenced by build().

100  : void
101  {
102  $this->infoMessages[] = $infoMessage;
103  }
+ Here is the caller graph for this function:

◆ addInputItem()

ilTestInfoScreenToolbarGUI::addInputItem ( ilToolbarItem  $a_item,
bool  $a_output_label = false 
)

Definition at line 136 of file class.ilTestInfoScreenToolbarGUI.php.

139  : void {
140  if ($this->global_toolbar instanceof parent) {
141  $this->global_toolbar->addInputItem($a_item, $a_output_label);
142  } else {
143  parent::addInputItem($a_item, $a_output_label);
144  }
145  }

◆ build()

ilTestInfoScreenToolbarGUI::build ( )

Definition at line 234 of file class.ilTestInfoScreenToolbarGUI.php.

References $message, ILIAS\Repository\access(), addFailureMessage(), addInfoMessage(), buildFormAction(), buildLinkTarget(), clearItems(), ILIAS\Repository\ctrl(), ensureInitialisedSessionLockString(), ilAssQuestionSkillAssignmentImportFails\failedImportsRegistered(), ilAssQuestionSkillAssignmentImportFails\getFailedImportsMessage(), ilTestSkillLevelThresholdImportFails\getFailedImportsMessage(), getSessionLockString(), getSkillAssignBarrierInfo(), getTestOBJ(), getTestPlayerGUI(), getTestQuestionSetConfig(), getTestSession(), hasFixedQuestionSetSkillAssignsLowerThanBarrier(), ILIAS\Repository\lng(), populateMessage(), setFormAction(), and setParameter().

234  : void
235  {
237 
238  $this->setParameter($this->getTestPlayerGUI(), 'lock', $this->getSessionLockString());
239  $this->setParameter($this->getTestPlayerGUI(), 'sequence', $this->getTestSession()->getLastSequence());
240  $this->setParameter('ilObjTestGUI', 'ref_id', $this->getTestOBJ()->getRefId());
241 
242  $this->setFormAction($this->buildFormAction($this->getTestPlayerGUI()));
243 
244  if (!$this->getTestOBJ()->getOfflineStatus() && $this->getTestOBJ()->isComplete($this->getTestQuestionSetConfig())) {
245  if ($this->access->checkAccess("read", "", $this->getTestOBJ()->getRefId())) {
246  $executable = $this->getTestOBJ()->isExecutable(
247  $this->getTestSession(),
248  $this->getTestSession()->getUserId(),
249  true
250  );
251 
252  if ($executable['executable'] && $this->getTestOBJ()->areObligationsEnabled() && $this->getTestOBJ()->hasObligations()) {
253  $this->addInfoMessage($this->lng->txt('tst_test_contains_obligatory_questions'));
254  }
255  }
256  }
257  if ($this->getTestOBJ()->getOfflineStatus() && !$this->getTestQuestionSetConfig()->areDepenciesBroken()) {
258  $message = $this->lng->txt("test_is_offline");
259 
260  $links = [];
261 
262  if ($this->access->checkAccess("write", "", $this->getTestOBJ()->getRefId())) {
263  $links[] = $this->ui_factory->link()->standard(
264  $this->lng->txt('test_edit_settings'),
265  $this->buildLinkTarget('ilobjtestsettingsmaingui')
266  );
267  }
268 
269  $msgBox = $this->ui_factory->messageBox()->info($message)->withLinks($links);
270 
271  $this->populateMessage($this->ui_renderer->render($msgBox));
272  }
273 
274  if ($this->access->checkAccess("write", "", $this->getTestOBJ()->getRefId())) {
275  $qsaImportFails = new ilAssQuestionSkillAssignmentImportFails($this->test_obj->getId());
276  $sltImportFails = new ilTestSkillLevelThresholdImportFails($this->test_obj->getId());
277 
278  if ($qsaImportFails->failedImportsRegistered() || $sltImportFails->failedImportsRegistered()) {
279  $importFailsMsg = [];
280 
281  if ($qsaImportFails->failedImportsRegistered()) {
282  $importFailsMsg[] = $qsaImportFails->getFailedImportsMessage($this->lng);
283  }
284 
285  if ($sltImportFails->failedImportsRegistered()) {
286  $importFailsMsg[] = $sltImportFails->getFailedImportsMessage($this->lng);
287  }
288 
289  $message = implode('<br />', $importFailsMsg);
290 
291  $button = $this->ui_factory->button()->standard(
292  $this->lng->txt('ass_skl_import_fails_remove_btn'),
293  $this->ctrl->getLinkTargetByClass('ilObjTestGUI', 'removeImportFails')
294  );
295 
296  $msgBox = $this->ui_factory->messageBox()->failure($message)->withButtons([$button]);
297 
298  $this->populateMessage($this->ui_renderer->render($msgBox));
299  } elseif ($this->getTestOBJ()->isSkillServiceToBeConsidered()) {
301  $this->addInfoMessage($this->getSkillAssignBarrierInfo());
302  }
303  }
304 
305  if ($this->getTestQuestionSetConfig()->areDepenciesBroken()) {
306  $this->addFailureMessage($this->getTestQuestionSetConfig()->getDepenciesBrokenMessage($this->lng));
307 
308  $this->clearItems();
309  } elseif ($this->getTestQuestionSetConfig()->areDepenciesInVulnerableState()) {
310  $this->addInfoMessage($this->getTestQuestionSetConfig()->getDepenciesInVulnerableStateMessage($this->lng));
311  }
312  }
313  }
setParameter($target, $parameter, $value)
setFormAction(string $a_val, bool $a_multipart=false, string $a_target="")
addInfoMessage($infoMessage)
@ param string $infoMessage Could be.
$message
Definition: xapiexit.php:32
+ Here is the call graph for this function:

◆ buildFormAction()

ilTestInfoScreenToolbarGUI::buildFormAction (   $target)
private

Definition at line 196 of file class.ilTestInfoScreenToolbarGUI.php.

References ILIAS\Repository\ctrl(), and getClassPath().

Referenced by build().

196  : string
197  {
198  return $this->ctrl->getFormActionByClass($this->getClassPath($target));
199  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildLinkTarget()

ilTestInfoScreenToolbarGUI::buildLinkTarget (   $target,
  $cmd = null 
)
private

Definition at line 191 of file class.ilTestInfoScreenToolbarGUI.php.

References ILIAS\Repository\ctrl(), and getClassPath().

Referenced by build().

191  : string
192  {
193  return $this->ctrl->getLinkTargetByClass($this->getClassPath($target), $cmd);
194  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildSessionLockString()

ilTestInfoScreenToolbarGUI::buildSessionLockString ( )
private

Definition at line 208 of file class.ilTestInfoScreenToolbarGUI.php.

References $_COOKIE.

Referenced by ensureInitialisedSessionLockString().

208  : string
209  {
210  return md5($_COOKIE[session_name()] . time());
211  }
$_COOKIE[session_name()]
Definition: xapitoken.php:54
+ Here is the caller graph for this function:

◆ clearItems()

ilTestInfoScreenToolbarGUI::clearItems ( )

Definition at line 154 of file class.ilTestInfoScreenToolbarGUI.php.

References ilToolbarGUI\setItems().

Referenced by build().

154  : void
155  {
156  if ($this->global_toolbar instanceof parent) {
157  $this->global_toolbar->setItems([]);
158  } else {
159  $this->setItems([]);
160  }
161  }
setItems(array $items)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ensureInitialisedSessionLockString()

ilTestInfoScreenToolbarGUI::ensureInitialisedSessionLockString ( )
private

Definition at line 201 of file class.ilTestInfoScreenToolbarGUI.php.

References buildSessionLockString(), getSessionLockString(), and setSessionLockString().

Referenced by build().

201  : void
202  {
203  if ($this->getSessionLockString() === '') {
205  }
206  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getClassName()

ilTestInfoScreenToolbarGUI::getClassName (   $target)
private

Definition at line 163 of file class.ilTestInfoScreenToolbarGUI.php.

Referenced by getClassNameArray(), and setParameter().

164  {
165  if (is_object($target)) {
166  $target = get_class($target);
167  }
168 
169  return $target;
170  }
+ Here is the caller graph for this function:

◆ getClassNameArray()

ilTestInfoScreenToolbarGUI::getClassNameArray (   $target)
private

Definition at line 172 of file class.ilTestInfoScreenToolbarGUI.php.

References getClassName().

Referenced by getClassPath().

172  : array
173  {
174  if (is_array($target)) {
175  return $target;
176  }
177 
178  return [$this->getClassName($target)];
179  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getClassPath()

ilTestInfoScreenToolbarGUI::getClassPath (   $target)
private

Definition at line 181 of file class.ilTestInfoScreenToolbarGUI.php.

References getClassNameArray().

Referenced by buildFormAction(), and buildLinkTarget().

181  : array
182  {
183  return array_merge(self::$TARGET_CLASS_PATH_BASE, $this->getClassNameArray($target));
184  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFailureMessages()

ilTestInfoScreenToolbarGUI::getFailureMessages ( )

Definition at line 105 of file class.ilTestInfoScreenToolbarGUI.php.

References $failureMessages.

Referenced by sendMessages().

105  : array
106  {
107  return $this->failureMessages;
108  }
+ Here is the caller graph for this function:

◆ getInfoMessages()

ilTestInfoScreenToolbarGUI::getInfoMessages ( )

Definition at line 92 of file class.ilTestInfoScreenToolbarGUI.php.

References $infoMessages.

Referenced by sendMessages().

92  : array
93  {
94  return $this->infoMessages;
95  }
+ Here is the caller graph for this function:

◆ getSessionLockString()

ilTestInfoScreenToolbarGUI::getSessionLockString ( )

Definition at line 82 of file class.ilTestInfoScreenToolbarGUI.php.

References $sessionLockString.

Referenced by build(), and ensureInitialisedSessionLockString().

82  : ?string
83  {
85  }
+ Here is the caller graph for this function:

◆ getSkillAssignBarrierInfo()

ilTestInfoScreenToolbarGUI::getSkillAssignBarrierInfo ( )
private

Definition at line 226 of file class.ilTestInfoScreenToolbarGUI.php.

References ilObjAssessmentFolder\getSkillTriggerAnswerNumberBarrier(), and ILIAS\Repository\lng().

Referenced by build().

226  : string
227  {
228  return sprintf(
229  $this->lng->txt('tst_skill_triggerings_num_req_answers_not_reached_warn'),
231  );
232  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTestOBJ()

ilTestInfoScreenToolbarGUI::getTestOBJ ( )
private

Definition at line 67 of file class.ilTestInfoScreenToolbarGUI.php.

Referenced by build().

67  : ilObjTest
68  {
69  return $this->test_obj;
70  }
+ Here is the caller graph for this function:

◆ getTestPlayerGUI()

ilTestInfoScreenToolbarGUI::getTestPlayerGUI ( )
private

Definition at line 72 of file class.ilTestInfoScreenToolbarGUI.php.

Referenced by build().

73  {
74  return $this->test_player_gui;
75  }
Output class for assessment test execution.
+ Here is the caller graph for this function:

◆ getTestQuestionSetConfig()

ilTestInfoScreenToolbarGUI::getTestQuestionSetConfig ( )
private

Definition at line 62 of file class.ilTestInfoScreenToolbarGUI.php.

Referenced by build().

63  {
64  return $this->test_question_set_config;
65  }
+ Here is the caller graph for this function:

◆ getTestSession()

ilTestInfoScreenToolbarGUI::getTestSession ( )
private

Definition at line 77 of file class.ilTestInfoScreenToolbarGUI.php.

Referenced by build().

77  : ?ilTestSession
78  {
79  return $this->test_session;
80  }
+ Here is the caller graph for this function:

◆ hasFixedQuestionSetSkillAssignsLowerThanBarrier()

ilTestInfoScreenToolbarGUI::hasFixedQuestionSetSkillAssignsLowerThanBarrier ( )
private

Definition at line 213 of file class.ilTestInfoScreenToolbarGUI.php.

Referenced by build().

213  : bool
214  {
215  if (!$this->test_obj->isFixedTest()) {
216  return false;
217  }
218 
219  $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
220  $assignmentList->setParentObjId($this->test_obj->getId());
221  $assignmentList->loadFromDb();
222 
223  return $assignmentList->hasSkillsAssignedLowerThanBarrier();
224  }
+ Here is the caller graph for this function:

◆ populateMessage()

ilTestInfoScreenToolbarGUI::populateMessage (   $message)
protected

Definition at line 315 of file class.ilTestInfoScreenToolbarGUI.php.

References $message.

Referenced by build().

315  : void
316  {
317  $this->main_tpl->setCurrentBlock('mess');
318  $this->main_tpl->setVariable('MESSAGE', $message);
319  $this->main_tpl->parseCurrentBlock();
320  }
$message
Definition: xapiexit.php:32
+ Here is the caller graph for this function:

◆ sendMessages()

ilTestInfoScreenToolbarGUI::sendMessages ( )

Definition at line 322 of file class.ilTestInfoScreenToolbarGUI.php.

References getFailureMessages(), and getInfoMessages().

322  : void
323  {
324  $info_messages = $this->getInfoMessages();
325  if ($info_messages !== []) {
326  $this->main_tpl->setOnScreenMessage('info', array_pop($info_messages));
327  }
328 
329  $failure_messages = $this->getFailureMessages();
330  if ($failure_messages !== []) {
331  $this->main_tpl->setOnScreenMessage('failure', array_pop($failure_messages));
332  }
333  }
+ Here is the call graph for this function:

◆ setCloseFormTag()

ilTestInfoScreenToolbarGUI::setCloseFormTag ( bool  $a_val)

Definition at line 127 of file class.ilTestInfoScreenToolbarGUI.php.

127  : void
128  {
129  if ($this->global_toolbar instanceof parent) {
130  $this->global_toolbar->setCloseFormTag($a_val);
131  } else {
132  parent::setCloseFormTag($a_val);
133  }
134  }

◆ setFormAction()

ilTestInfoScreenToolbarGUI::setFormAction ( string  $a_val,
bool  $a_multipart = false,
string  $a_target = "" 
)

Definition at line 115 of file class.ilTestInfoScreenToolbarGUI.php.

Referenced by build().

119  : void {
120  if ($this->global_toolbar instanceof parent) {
121  $this->global_toolbar->setFormAction($a_val, $a_multipart, $a_target);
122  } else {
123  parent::setFormAction($a_val, $a_multipart, $a_target);
124  }
125  }
+ Here is the caller graph for this function:

◆ setParameter()

ilTestInfoScreenToolbarGUI::setParameter (   $target,
  $parameter,
  $value 
)
private

Definition at line 186 of file class.ilTestInfoScreenToolbarGUI.php.

References ILIAS\Repository\ctrl(), and getClassName().

Referenced by build().

186  : void
187  {
188  $this->ctrl->setParameterByClass($this->getClassName($target), $parameter, $value);
189  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSessionLockString()

ilTestInfoScreenToolbarGUI::setSessionLockString (   $sessionLockString)

Definition at line 87 of file class.ilTestInfoScreenToolbarGUI.php.

References $sessionLockString.

Referenced by ensureInitialisedSessionLockString().

87  : void
88  {
89  $this->sessionLockString = $sessionLockString;
90  }
+ Here is the caller graph for this function:

Field Documentation

◆ $failureMessages

array ilTestInfoScreenToolbarGUI::$failureMessages = []
private

Definition at line 44 of file class.ilTestInfoScreenToolbarGUI.php.

Referenced by getFailureMessages().

◆ $infoMessages

array ilTestInfoScreenToolbarGUI::$infoMessages = []
private

Definition at line 43 of file class.ilTestInfoScreenToolbarGUI.php.

Referenced by getInfoMessages().

◆ $sessionLockString

string ilTestInfoScreenToolbarGUI::$sessionLockString = ''
private

◆ $TARGET_CLASS_PATH_BASE

array ilTestInfoScreenToolbarGUI::$TARGET_CLASS_PATH_BASE = ['ilRepositoryGUI', 'ilObjTestGUI']
staticprivate

Definition at line 32 of file class.ilTestInfoScreenToolbarGUI.php.

◆ $testQuestionSetConfig

ilTestQuestionSetConfig ilTestInfoScreenToolbarGUI::$testQuestionSetConfig = null
protected

Definition at line 34 of file class.ilTestInfoScreenToolbarGUI.php.

◆ $testSequence

ilTestInfoScreenToolbarGUI::$testSequence
protected

Definition at line 40 of file class.ilTestInfoScreenToolbarGUI.php.

◆ $testSession

ilTestSession ilTestInfoScreenToolbarGUI::$testSession = null
protected

Definition at line 35 of file class.ilTestInfoScreenToolbarGUI.php.


The documentation for this class was generated from the following file: