ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 ilCtrlInterface $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 32 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 ilCtrlInterface  $ctrl,
protected ilLanguage  $lng,
private UIFactory  $ui_factory,
private UIRenderer  $ui_renderer,
private ilGlobalTemplateInterface  $main_tpl,
private ilToolbarGUI  $global_toolbar 
)

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

61  {
62  }

Member Function Documentation

◆ addFailureMessage()

ilTestInfoScreenToolbarGUI::addFailureMessage ( string  $failureMessage)

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

112  : void
113  {
114  $this->failureMessages[] = $failureMessage;
115  }

◆ addFormInput()

ilTestInfoScreenToolbarGUI::addFormInput (   $formInput)

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

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

◆ addInfoMessage()

ilTestInfoScreenToolbarGUI::addInfoMessage (   $infoMessage)

@ param string $infoMessage Could be.

Doesn't have to.

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

Referenced by build().

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

◆ addInputItem()

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

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

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

◆ build()

ilTestInfoScreenToolbarGUI::build ( )

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

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

236  : void
237  {
239 
240  $this->setParameter($this->getTestPlayerGUI(), 'lock', $this->getSessionLockString());
241  $this->setParameter($this->getTestPlayerGUI(), 'sequence', $this->getTestSession()->getLastSequence());
242  $this->setParameter('ilObjTestGUI', 'ref_id', $this->getTestOBJ()->getRefId());
243  $this->setFormAction($this->buildFormAction($this->getTestPlayerGUI()));
244 
245  if ($this->getTestOBJ()->getOfflineStatus()) {
246  $message = $this->lng->txt('test_is_offline');
247 
248  $links = [];
249 
250  if ($this->access->checkAccess("write", "", $this->getTestOBJ()->getRefId())) {
251  $links[] = $this->ui_factory->link()->standard(
252  $this->lng->txt('test_edit_settings'),
253  $this->buildLinkTarget(SettingsMainGUI::class)
254  );
255  }
256 
257  $msgBox = $this->ui_factory->messageBox()->info($message)->withLinks($links);
258 
259  $this->populateMessage($this->ui_renderer->render($msgBox));
260  }
261 
262  if ($this->access->checkAccess("write", "", $this->getTestOBJ()->getRefId())) {
263  $qsaImportFails = new ilAssQuestionSkillAssignmentImportFails($this->test_obj->getId());
264  $sltImportFails = new ilTestSkillLevelThresholdImportFails($this->test_obj->getId());
265 
266  if ($qsaImportFails->failedImportsRegistered() || $sltImportFails->failedImportsRegistered()) {
267  $importFailsMsg = [];
268 
269  if ($qsaImportFails->failedImportsRegistered()) {
270  $importFailsMsg[] = $qsaImportFails->getFailedImportsMessage($this->lng);
271  }
272 
273  if ($sltImportFails->failedImportsRegistered()) {
274  $importFailsMsg[] = $sltImportFails->getFailedImportsMessage($this->lng);
275  }
276 
277  $message = implode('<br />', $importFailsMsg);
278 
279  $button = $this->ui_factory->button()->standard(
280  $this->lng->txt('ass_skl_import_fails_remove_btn'),
281  $this->ctrl->getLinkTargetByClass('ilObjTestGUI', 'removeImportFails')
282  );
283 
284  $msgBox = $this->ui_factory->messageBox()->failure($message)->withButtons([$button]);
285 
286  $this->populateMessage($this->ui_renderer->render($msgBox));
287  } elseif ($this->getTestOBJ()->isSkillServiceToBeConsidered()) {
289  $this->addInfoMessage($this->getSkillAssignBarrierInfo());
290  }
291  }
292  }
293  }
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:31
+ Here is the call graph for this function:

◆ buildFormAction()

ilTestInfoScreenToolbarGUI::buildFormAction (   $target)
private

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

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

Referenced by build().

198  : string
199  {
200  return $this->ctrl->getFormActionByClass($this->getClassPath($target));
201  }
+ 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 193 of file class.ilTestInfoScreenToolbarGUI.php.

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

Referenced by build().

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

◆ buildSessionLockString()

ilTestInfoScreenToolbarGUI::buildSessionLockString ( )
private

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

References $_COOKIE.

Referenced by ensureInitialisedSessionLockString().

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

◆ clearItems()

ilTestInfoScreenToolbarGUI::clearItems ( )

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

References ilToolbarGUI\setItems().

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

◆ ensureInitialisedSessionLockString()

ilTestInfoScreenToolbarGUI::ensureInitialisedSessionLockString ( )
private

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

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

Referenced by build().

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

◆ getClassName()

ilTestInfoScreenToolbarGUI::getClassName (   $target)
private

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

Referenced by getClassNameArray(), and setParameter().

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

◆ getClassNameArray()

ilTestInfoScreenToolbarGUI::getClassNameArray (   $target)
private

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

References getClassName().

Referenced by getClassPath().

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

◆ getClassPath()

ilTestInfoScreenToolbarGUI::getClassPath (   $target)
private

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

References getClassNameArray().

Referenced by buildFormAction(), and buildLinkTarget().

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

◆ getFailureMessages()

ilTestInfoScreenToolbarGUI::getFailureMessages ( )

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

References $failureMessages.

Referenced by sendMessages().

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

◆ getInfoMessages()

ilTestInfoScreenToolbarGUI::getInfoMessages ( )

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

References $infoMessages.

Referenced by sendMessages().

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

◆ getSessionLockString()

ilTestInfoScreenToolbarGUI::getSessionLockString ( )

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

References $sessionLockString.

Referenced by build(), and ensureInitialisedSessionLockString().

84  : ?string
85  {
87  }
+ Here is the caller graph for this function:

◆ getSkillAssignBarrierInfo()

ilTestInfoScreenToolbarGUI::getSkillAssignBarrierInfo ( )
private

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

References getTestOBJ(), and ILIAS\Repository\lng().

Referenced by build().

228  : string
229  {
230  return sprintf(
231  $this->lng->txt('tst_skill_triggerings_num_req_answers_not_reached_warn'),
232  $this->getTestOBJ()->getGlobalSettings()->getSkillTriggeringNumberOfAnswers()
233  );
234  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTestOBJ()

ilTestInfoScreenToolbarGUI::getTestOBJ ( )
private

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

Referenced by build(), and getSkillAssignBarrierInfo().

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

◆ getTestPlayerGUI()

ilTestInfoScreenToolbarGUI::getTestPlayerGUI ( )
private

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

Referenced by build().

75  {
76  return $this->test_player_gui;
77  }
+ Here is the caller graph for this function:

◆ getTestQuestionSetConfig()

ilTestInfoScreenToolbarGUI::getTestQuestionSetConfig ( )
private

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

65  {
66  return $this->test_question_set_config;
67  }

◆ getTestSession()

ilTestInfoScreenToolbarGUI::getTestSession ( )
private

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

Referenced by build().

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

◆ hasFixedQuestionSetSkillAssignsLowerThanBarrier()

ilTestInfoScreenToolbarGUI::hasFixedQuestionSetSkillAssignsLowerThanBarrier ( )
private

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

Referenced by build().

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

◆ populateMessage()

ilTestInfoScreenToolbarGUI::populateMessage (   $message)
protected

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

References $message.

Referenced by build().

295  : void
296  {
297  $this->main_tpl->setCurrentBlock('mess');
298  $this->main_tpl->setVariable('MESSAGE', $message);
299  $this->main_tpl->parseCurrentBlock();
300  }
$message
Definition: xapiexit.php:31
+ Here is the caller graph for this function:

◆ sendMessages()

ilTestInfoScreenToolbarGUI::sendMessages ( )

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

References getFailureMessages(), and getInfoMessages().

302  : void
303  {
304  $info_messages = $this->getInfoMessages();
305  if ($info_messages !== []) {
306  $this->main_tpl->setOnScreenMessage('info', array_pop($info_messages));
307  }
308 
309  $failure_messages = $this->getFailureMessages();
310  if ($failure_messages !== []) {
311  $this->main_tpl->setOnScreenMessage('failure', array_pop($failure_messages));
312  }
313  }
+ Here is the call graph for this function:

◆ setCloseFormTag()

ilTestInfoScreenToolbarGUI::setCloseFormTag ( bool  $a_val)

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

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

◆ setFormAction()

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

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

Referenced by build().

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

◆ setParameter()

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

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

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

Referenced by build().

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

◆ setSessionLockString()

ilTestInfoScreenToolbarGUI::setSessionLockString (   $sessionLockString)

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

References $sessionLockString.

Referenced by ensureInitialisedSessionLockString().

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

Field Documentation

◆ $failureMessages

array ilTestInfoScreenToolbarGUI::$failureMessages = []
private

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

Referenced by getFailureMessages().

◆ $infoMessages

array ilTestInfoScreenToolbarGUI::$infoMessages = []
private

Definition at line 45 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 34 of file class.ilTestInfoScreenToolbarGUI.php.

◆ $testQuestionSetConfig

ilTestQuestionSetConfig ilTestInfoScreenToolbarGUI::$testQuestionSetConfig = null
protected

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

◆ $testSequence

ilTestInfoScreenToolbarGUI::$testSequence
protected

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

◆ $testSession

ilTestSession ilTestInfoScreenToolbarGUI::$testSession = null
protected

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


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