ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
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="")
 Set form action (if form action is set, toolbar is wrapped into form tags) More...
 
 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)
 
 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)
 
 getStickyItems ()
 
 setStickyItems (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 ()
 

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 31 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 47 of file class.ilTestInfoScreenToolbarGUI.php.

60 {
61 }

Member Function Documentation

◆ addFailureMessage()

ilTestInfoScreenToolbarGUI::addFailureMessage ( string  $failureMessage)

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

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

◆ addFormInput()

ilTestInfoScreenToolbarGUI::addFormInput (   $formInput)

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

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

◆ addInfoMessage()

ilTestInfoScreenToolbarGUI::addInfoMessage (   $infoMessage)

@ param string $infoMessage Could be.

Doesn't have to.

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

101 : void
102 {
103 $this->infoMessages[] = $infoMessage;
104 }

◆ addInputItem()

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

Reimplemented from ilToolbarGUI.

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

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

◆ build()

ilTestInfoScreenToolbarGUI::build ( )

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

214 : void
215 {
217
218 $this->setParameter($this->getTestPlayerGUI(), 'lock', $this->getSessionLockString());
219 $this->setParameter($this->getTestPlayerGUI(), 'sequence', $this->getTestSession()->getLastSequence());
220 $this->setParameter('ilObjTestGUI', 'ref_id', $this->getTestOBJ()->getRefId());
221 $this->setFormAction($this->buildFormAction($this->getTestPlayerGUI()));
222
223 if ($this->getTestOBJ()->getOfflineStatus()) {
224 $message = $this->lng->txt('test_is_offline');
225
226 $links = [];
227
228 if ($this->access->checkAccess("write", "", $this->getTestOBJ()->getRefId())) {
229 $links[] = $this->ui_factory->link()->standard(
230 $this->lng->txt('test_edit_settings'),
231 $this->buildLinkTarget(SettingsMainGUI::class)
232 );
233 }
234
235 $msgBox = $this->ui_factory->messageBox()->info($message)->withLinks($links);
236
237 $this->populateMessage($this->ui_renderer->render($msgBox));
238 }
239
240 if ($this->access->checkAccess("write", "", $this->getTestOBJ()->getRefId())) {
241 $qsaImportFails = new ilAssQuestionSkillAssignmentImportFails($this->test_obj->getId());
242 $sltImportFails = new ilTestSkillLevelThresholdImportFails($this->test_obj->getId());
243
244 if ($qsaImportFails->failedImportsRegistered() || $sltImportFails->failedImportsRegistered()) {
245 $importFailsMsg = [];
246
247 if ($qsaImportFails->failedImportsRegistered()) {
248 $importFailsMsg[] = $qsaImportFails->getFailedImportsMessage($this->lng);
249 }
250
251 if ($sltImportFails->failedImportsRegistered()) {
252 $importFailsMsg[] = $sltImportFails->getFailedImportsMessage($this->lng);
253 }
254
255 $message = implode('<br />', $importFailsMsg);
256
257 $button = $this->ui_factory->button()->standard(
258 $this->lng->txt('ass_skl_import_fails_remove_btn'),
259 $this->ctrl->getLinkTargetByClass('ilObjTestGUI', 'removeImportFails')
260 );
261
262 $msgBox = $this->ui_factory->messageBox()->failure($message)->withButtons([$button]);
263
264 $this->populateMessage($this->ui_renderer->render($msgBox));
265 }
266 }
267 }
setParameter($target, $parameter, $value)
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)

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

+ Here is the call graph for this function:

◆ buildFormAction()

ilTestInfoScreenToolbarGUI::buildFormAction (   $target)
private

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

197 : string
198 {
199 return $this->ctrl->getFormActionByClass($this->getClassPath($target));
200 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ buildLinkTarget()

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

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

192 : string
193 {
194 return $this->ctrl->getLinkTargetByClass($this->getClassPath($target), $cmd);
195 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ buildSessionLockString()

ilTestInfoScreenToolbarGUI::buildSessionLockString ( )
private

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

209 : string
210 {
211 return md5($_COOKIE[session_name()] . time());
212 }
$_COOKIE[session_name()]
Definition: xapitoken.php:52

References $_COOKIE.

◆ clearItems()

ilTestInfoScreenToolbarGUI::clearItems ( )

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

155 : void
156 {
157 if ($this->global_toolbar instanceof parent) {
158 $this->global_toolbar->setItems([]);
159 } else {
160 $this->setItems([]);
161 }
162 }
setItems(array $items)

◆ ensureInitialisedSessionLockString()

ilTestInfoScreenToolbarGUI::ensureInitialisedSessionLockString ( )
private

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

202 : void
203 {
204 if ($this->getSessionLockString() === '') {
206 }
207 }

◆ getClassName()

ilTestInfoScreenToolbarGUI::getClassName (   $target)
private

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

165 {
166 if (is_object($target)) {
167 $target = get_class($target);
168 }
169
170 return $target;
171 }

◆ getClassNameArray()

ilTestInfoScreenToolbarGUI::getClassNameArray (   $target)
private

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

173 : array
174 {
175 if (is_array($target)) {
176 return $target;
177 }
178
179 return [$this->getClassName($target)];
180 }

◆ getClassPath()

ilTestInfoScreenToolbarGUI::getClassPath (   $target)
private

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

182 : array
183 {
184 return array_merge(self::$TARGET_CLASS_PATH_BASE, $this->getClassNameArray($target));
185 }

◆ getFailureMessages()

ilTestInfoScreenToolbarGUI::getFailureMessages ( )

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

106 : array
107 {
109 }

References $failureMessages.

◆ getInfoMessages()

ilTestInfoScreenToolbarGUI::getInfoMessages ( )

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

93 : array
94 {
96 }

References $infoMessages.

◆ getSessionLockString()

ilTestInfoScreenToolbarGUI::getSessionLockString ( )

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

83 : ?string
84 {
86 }

References $sessionLockString.

◆ getTestOBJ()

ilTestInfoScreenToolbarGUI::getTestOBJ ( )
private

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

68 : ilObjTest
69 {
70 return $this->test_obj;
71 }

◆ getTestPlayerGUI()

ilTestInfoScreenToolbarGUI::getTestPlayerGUI ( )
private

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

74 {
75 return $this->test_player_gui;
76 }

◆ getTestQuestionSetConfig()

ilTestInfoScreenToolbarGUI::getTestQuestionSetConfig ( )
private

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

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

◆ getTestSession()

ilTestInfoScreenToolbarGUI::getTestSession ( )
private

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

79 {
80 return $this->test_session;
81 }
Test session handler.

◆ populateMessage()

ilTestInfoScreenToolbarGUI::populateMessage (   $message)
protected

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

269 : void
270 {
271 $this->main_tpl->setCurrentBlock('mess');
272 $this->main_tpl->setVariable('MESSAGE', $message);
273 $this->main_tpl->parseCurrentBlock();
274 }

◆ sendMessages()

ilTestInfoScreenToolbarGUI::sendMessages ( )

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

276 : void
277 {
278 $info_messages = $this->getInfoMessages();
279 if ($info_messages !== []) {
280 $this->main_tpl->setOnScreenMessage('info', array_pop($info_messages));
281 }
282
283 $failure_messages = $this->getFailureMessages();
284 if ($failure_messages !== []) {
285 $this->main_tpl->setOnScreenMessage('failure', array_pop($failure_messages));
286 }
287 }

◆ setCloseFormTag()

ilTestInfoScreenToolbarGUI::setCloseFormTag ( bool  $a_val)

Reimplemented from ilToolbarGUI.

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

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

◆ setFormAction()

ilTestInfoScreenToolbarGUI::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)

Reimplemented from ilToolbarGUI.

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

120 : void {
121 if ($this->global_toolbar instanceof parent) {
122 $this->global_toolbar->setFormAction($a_val, $a_multipart, $a_target);
123 } else {
124 parent::setFormAction($a_val, $a_multipart, $a_target);
125 }
126 }

◆ setParameter()

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

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

187 : void
188 {
189 $this->ctrl->setParameterByClass($this->getClassName($target), $parameter, $value);
190 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ setSessionLockString()

ilTestInfoScreenToolbarGUI::setSessionLockString (   $sessionLockString)

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

88 : void
89 {
90 $this->sessionLockString = $sessionLockString;
91 }

References $sessionLockString.

Field Documentation

◆ $failureMessages

array ilTestInfoScreenToolbarGUI::$failureMessages = []
private

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

Referenced by getFailureMessages().

◆ $infoMessages

array ilTestInfoScreenToolbarGUI::$infoMessages = []
private

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

◆ $testQuestionSetConfig

ilTestQuestionSetConfig ilTestInfoScreenToolbarGUI::$testQuestionSetConfig = null
protected

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

◆ $testSequence

ilTestInfoScreenToolbarGUI::$testSequence
protected

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

◆ $testSession

ilTestSession ilTestInfoScreenToolbarGUI::$testSession = null
protected

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


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