ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\Test\Presentation\TestScreenGUI Class Reference

Class TestScreenGUI. More...

+ Collaboration diagram for ILIAS\Test\Presentation\TestScreenGUI:

Public Member Functions

 __construct (private readonly \ilObjTest $object, private readonly \ilObjUser $user, private readonly UIFactory $ui_factory, private readonly UIRenderer $ui_renderer, private readonly \ilLanguage $lng, private readonly Refinery $refinery, private readonly \ilCtrlInterface $ctrl, private readonly \ilGlobalTemplateInterface $tpl, private readonly ContentStyle $content_style, private readonly HTTPServices $http, private readonly TabsManager $tabs_manager, private readonly \ilAccessHandler $access, private readonly \ilTestAccess $test_access, private readonly \ilDBInterface $database, private readonly \ilRbacSystem $rbac_system)
 
 executeCommand ()
 
 testScreen ()
 

Data Fields

const DEFAULT_CMD = 'testScreen'
 

Private Member Functions

 addOfflineMessageBoxIfNecessary (array $elements)
 
 handleRenderMessageBox (array $elements)
 
 handleRenderIntroduction (array $elements)
 
 handleRenderLauncher (array $elements)
 
 getLauncher ()
 
 getResumeLauncherLink ()
 
 buildModalLauncher ()
 
 getModalLauncherLink ()
 
 getModalLauncherInputs ()
 
 getModalLauncherMessageBox ()
 
 getStartLauncherLink ()
 
 buildLauncherLinkUrl (string $cmd)
 
 evaluateLauncherModalForm (Result $result)
 
 checkPassword (Result $result)
 
 testCanBeStarted ()
 
 isUserOutOfProcessingTime ()
 
 blockUserAfterHavingPassed ()
 
 hasAvailablePasses ()
 
 lastPassSuspended ()
 
 isModalLauncherNeeded ()
 
 getSkillLevelThresholdsMissingInfo ()
 
 areSkillLevelThresholdsMissing ()
 

Private Attributes

readonly ilTestPassesSelector $test_passes_selector
 
readonly int $ref_id
 
readonly MainSettings $main_settings
 
readonly ilTestSession $test_session
 
readonly DataFactory $data_factory
 
ilTestPasswordChecker $password_checker
 

Detailed Description

Class TestScreenGUI.

Author
Matheus Zych mzych.nosp@m.@dat.nosp@m.abay..nosp@m.de

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

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Test\Presentation\TestScreenGUI::__construct ( private readonly \ilObjTest  $object,
private readonly \ilObjUser  $user,
private readonly UIFactory  $ui_factory,
private readonly UIRenderer  $ui_renderer,
private readonly \ilLanguage  $lng,
private readonly Refinery  $refinery,
private readonly \ilCtrlInterface  $ctrl,
private readonly \ilGlobalTemplateInterface  $tpl,
private readonly ContentStyle  $content_style,
private readonly HTTPServices  $http,
private readonly TabsManager  $tabs_manager,
private readonly \ilAccessHandler  $access,
private readonly \ilTestAccess  $test_access,
private readonly \ilDBInterface  $database,
private readonly \ilRbacSystem  $rbac_system 
)

Definition at line 55 of file class.TestScreenGUI.php.

71 {
72 $this->ref_id = $this->object->getRefId();
73 $this->main_settings = $this->object->getMainSettings();
74 $this->data_factory = new DataFactory();
75
76 $this->test_session = (new \ilTestSessionFactory($this->object, $this->database, $this->user))->getSession();
77
78 $this->test_passes_selector = new \ilTestPassesSelector($this->database, $this->object);
79 $this->test_passes_selector->setActiveId($this->test_session->getActiveId());
80 $this->test_passes_selector->setLastFinishedPass($this->test_session->getLastFinishedPass());
81 $this->password_checker = new \ilTestPasswordChecker($this->rbac_system, $this->user, $this->object, $this->lng);
82 }

References ILIAS\Repository\database(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ addOfflineMessageBoxIfNecessary()

ILIAS\Test\Presentation\TestScreenGUI::addOfflineMessageBoxIfNecessary ( array  $elements)
private

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

138 : array
139 {
140 if (!$this->object->getOfflineStatus()) {
141 return $elements;
142 }
143
144 $offline_message_box = $this->ui_factory->messageBox()->info($this->lng->txt('test_is_offline'));
145
146 if (!$this->access->checkAccess('write', '', $this->object->getRefId())) {
147 $elements[] = $offline_message_box;
148 return $elements;
149 }
150
151 $elements[] = $offline_message_box->withLinks([
152 $this->ui_factory->link()->standard(
153 $this->lng->txt('test_edit_settings'),
154 $this->ctrl->getLinkTargetByClass(SettingsMainGUI::class)
155 )
156 ]);
157 return $elements;
158 }

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

+ Here is the call graph for this function:

◆ areSkillLevelThresholdsMissing()

ILIAS\Test\Presentation\TestScreenGUI::areSkillLevelThresholdsMissing ( )
private

Definition at line 606 of file class.TestScreenGUI.php.

606 : bool
607 {
608 if (!$this->object->isSkillServiceEnabled()) {
609 return false;
610 }
611
612 $questionContainerId = $this->object->getId();
613
614 $assignmentList = new \ilAssQuestionSkillAssignmentList($this->database);
615 $assignmentList->setParentObjId($questionContainerId);
616 $assignmentList->loadFromDb();
617
618 foreach ($assignmentList->getUniqueAssignedSkills() as $data) {
619 foreach ($data['skill']->getLevelData() as $level) {
620 $threshold = new \ilTestSkillLevelThreshold($this->database);
621 $threshold->setTestId($this->object->getTestId());
622 $threshold->setSkillBaseId($data['skill_base_id']);
623 $threshold->setSkillTrefId($data['skill_tref_id']);
624 $threshold->setSkillLevelId($level['id']);
625
626 if (!$threshold->dbRecordExists()) {
627 return true;
628 }
629 }
630 }
631
632 return false;
633 }
$data
Definition: storeScorm.php:45

References $data, ILIAS\Repository\database(), and ILIAS\Repository\object().

Referenced by ILIAS\Test\Presentation\TestScreenGUI\testScreen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ blockUserAfterHavingPassed()

ILIAS\Test\Presentation\TestScreenGUI::blockUserAfterHavingPassed ( )
private

Definition at line 553 of file class.TestScreenGUI.php.

553 : bool
554 {
555 if ($this->main_settings->getTestBehaviourSettings()->getBlockAfterPassedEnabled()) {
556 return $this->test_passes_selector->getLastFinishedPass() >= 0
557 && $this->test_passes_selector->hasTestPassedOnce($this->test_session->getActiveId());
558 }
559
560 return false;
561 }

Referenced by ILIAS\Test\Presentation\TestScreenGUI\getLauncher().

+ Here is the caller graph for this function:

◆ buildLauncherLinkUrl()

ILIAS\Test\Presentation\TestScreenGUI::buildLauncherLinkUrl ( string  $cmd)
private

Definition at line 459 of file class.TestScreenGUI.php.

462 return $this->data_factory->uri(
463 ILIAS_HTTP_PATH . '/' . $this->ctrl->getLinkTargetByClass(
464 [
465 \ilRepositoryGUI::class,
466 \ilObjTestGUI::class,
467 $this->object->isFixedTest()
468 ? \ilTestPlayerFixedQuestionSetGUI::class
469 : \ilTestPlayerRandomQuestionSetGUI::class
470 ],
471 $cmd
472 )
473 );
474 }
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35

◆ buildModalLauncher()

ILIAS\Test\Presentation\TestScreenGUI::buildModalLauncher ( )
private

Definition at line 339 of file class.TestScreenGUI.php.

339 : Launcher
340 {
341 $launcher = $this->ui_factory->launcher()->inline($this->getModalLauncherLink())
342 ->withInputs(
343 $this->ui_factory->input()->field()->group($this->getModalLauncherInputs()),
344 function (Result $result) {
345 $this->evaluateLauncherModalForm($result);
346 },
348 )->withModalSubmitLabel($this->lng->txt('continue'));
349
350 $request = $this->http->request();
351 $key = 'launcher_id';
352 if (array_key_exists($key, $request->getQueryParams())
353 && $request->getQueryParams()[$key] === 'exam_modal') {
354 $launcher = $launcher->withRequest($request);
355 }
356
357 return $launcher;
358 }
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Result.php:29
$request
@ilCtrl_Calls ilObjLearningSequenceContentGUI: ilObjLearningSequenceConditionsGUI
Definition: ltiauth.php:39
static http()
Fetches the global http state from ILIAS.

References $request, ILIAS\Test\Presentation\TestScreenGUI\evaluateLauncherModalForm(), ILIAS\Test\Presentation\TestScreenGUI\getModalLauncherLink(), ILIAS\Test\Presentation\TestScreenGUI\getModalLauncherMessageBox(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\UI\Component\Launcher\Launcher\withInputs().

Referenced by ILIAS\Test\Presentation\TestScreenGUI\getLauncher().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkPassword()

ILIAS\Test\Presentation\TestScreenGUI::checkPassword ( Result  $result)
private

Definition at line 513 of file class.TestScreenGUI.php.

515 : void {
516 $password = $result->value()['exam_password']?->toString();
517 if ($password === $this->main_settings->getAccessSettings()->getPassword()) {
518 \ilSession::set('tst_password_' . $this->object->getTestId(), $password);
519 return;
520 }
521
522 \ilSession::set('tst_password_' . $this->object->getTestId(), '');
523 $this->test_session->setPasswordChecked(false);
524 }
static set(string $a_var, $a_val)
Set a value.
value()
Get the encapsulated value.

References ILIAS\Repository\object(), and ilSession\set().

+ Here is the call graph for this function:

◆ evaluateLauncherModalForm()

ILIAS\Test\Presentation\TestScreenGUI::evaluateLauncherModalForm ( Result  $result)
private

Definition at line 476 of file class.TestScreenGUI.php.

476 : void
477 {
478 if ($result->isError()) {
479 return;
480 }
481
482 $anonymous = $this->user->isAnonymous();
483 if (array_key_exists('exam_access_code', $result->value())) {
484 $value = $result->value()['exam_access_code'];
485 if ($anonymous && !empty($value)) {
486 $this->test_session->setAccessCodeToSession($value);
487 } else {
488 $this->test_session->unsetAccessCodeInSession();
489 }
490 }
491
492 if (
493 !$anonymous &&
494 $this->main_settings->getParticipantFunctionalitySettings()->getUsePreviousAnswerAllowed()
495 ) {
496 $this->user->setPref(
497 'tst_use_previous_answers',
498 $result->value()['exam_use_previous_answers'] ?? '0'
499 );
500 $this->user->update();
501 }
502
503 if ($this->main_settings->getAccessSettings()->getPasswordEnabled()) {
504 $this->checkPassword($result);
505 }
506
507 $this->ctrl->redirectByClass(
508 (new \ilTestPlayerFactory($this->object))->getPlayerGUI()::class,
510 );
511 }
isError()
Get to know if the result is an error.

References ILIAS\Repository\ctrl(), ilTestPlayerCommands\INIT_TEST, ILIAS\Data\Result\isError(), ILIAS\Repository\user(), and ILIAS\Data\Result\value().

Referenced by ILIAS\Test\Presentation\TestScreenGUI\buildModalLauncher().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ILIAS\Test\Presentation\TestScreenGUI::executeCommand ( )

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

84 : void
85 {
86 if ($this->access->checkAccess('read', '', $this->ref_id)) {
87 $this->{$this->ctrl->getCmd(self::DEFAULT_CMD)}();
88 return;
89 }
90
91 $this->tabs_manager->activateTab(TabsManager::TAB_ID_TEST);
92
93 if (!$this->object->getMainSettings()->getAdditionalSettings()->getHideInfoTab()) {
94 $this->ctrl->redirectByClass([\ilRepositoryGUI::class, \ilObjTestGUI::class, \ilInfoScreenGUI::class]);
95 }
96
97 $this->tpl->setOnScreenMessage('failure', sprintf(
98 $this->lng->txt('msg_no_perm_read_item'),
99 $this->object->getTitle()
100 ), true);
101 $this->ctrl->setParameterByClass(\ilRepositoryGUI::class, 'ref_id', ROOT_FOLDER_ID);
102 $this->ctrl->redirectByClass(\ilRepositoryGUI::class);
103 }
const ROOT_FOLDER_ID
Definition: constants.php:32

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ROOT_FOLDER_ID, and ILIAS\Test\Presentation\TabsManager\TAB_ID_TEST.

+ Here is the call graph for this function:

◆ getLauncher()

ILIAS\Test\Presentation\TestScreenGUI::getLauncher ( )
private

Definition at line 244 of file class.TestScreenGUI.php.

244 : Launcher
245 {
246 $launcher_factory = $this->ui_factory->launcher();
247
248 if ($this->object->isStartingTimeEnabled() && !$this->object->startingTimeReached()) {
249 return $launcher_factory
250 ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
251 ->withButtonLabel(sprintf(
252 $this->lng->txt('detail_starting_time_not_reached'),
253 \ilDatePresentation::formatDate(new \ilDateTime($this->object->getStartingTime(), IL_CAL_UNIX))
254 ), false)
255 ;
256 }
257
258 if ($this->object->isEndingTimeEnabled() && $this->object->endingTimeReached()) {
259 return $launcher_factory
260 ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
261 ->withButtonLabel(sprintf(
262 $this->lng->txt('detail_ending_time_reached'),
263 \ilDatePresentation::formatDate(new \ilDateTime($this->object->getEndingTime(), IL_CAL_UNIX))
264 ), false)
265 ;
266 }
267
268 if ($this->isUserOutOfProcessingTime()) {
269 return $launcher_factory
270 ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
271 ->withButtonLabel($this->lng->txt('tst_out_of_time_message'), false)
272 ;
273 }
274
275 $participant_access = $this->test_access->isParticipantAllowed(
276 $this->object->getId(),
277 $this->user->getId()
278 );
279
280 if ($participant_access === ParticipantAccess::NOT_INVITED) {
281 return $launcher_factory
282 ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
283 ->withButtonLabel($this->lng->txt('tst_exam_not_assigned_participant_disclaimer'), false)
284 ;
285 }
286
287 if ($participant_access !== ParticipantAccess::ALLOWED) {
288 return $launcher_factory
289 ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
290 ->withButtonLabel($participant_access->getAccessForbiddenMessage($this->lng), false)
291 ;
292 }
293
294 if (!$this->hasAvailablePasses()) {
295 return $launcher_factory
296 ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
297 ->withButtonLabel($this->lng->txt('tst_launcher_button_label_passes_limit_reached'), false);
298 }
299
300 if ($this->blockUserAfterHavingPassed()) {
301 return $launcher_factory
302 ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
303 ->withButtonLabel($this->lng->txt('tst_already_passed_cannot_retake'), false)
304 ;
305 }
306
307 $next_pass_allowed_timestamp = 0;
308 if (!$this->object->isNextPassAllowed($this->test_passes_selector, $next_pass_allowed_timestamp)) {
309 return $launcher_factory
310 ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
311 ->withButtonLabel(
312 sprintf(
313 $this->lng->txt('wait_for_next_pass_hint_msg'),
314 \ilDatePresentation::formatDate(new \ilDateTime($next_pass_allowed_timestamp, IL_CAL_UNIX)),
315 ),
316 false
317 )
318 ;
319 }
320
321 if ($this->lastPassSuspended()) {
322 return $launcher_factory->inline($this->getResumeLauncherLink());
323 }
324
325 if ($this->isModalLauncherNeeded()) {
326 return $this->buildModalLauncher();
327 }
328 return $launcher_factory->inline($this->getStartLauncherLink());
329 }
const IL_CAL_UNIX
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling

References ILIAS\Test\Presentation\TestScreenGUI\blockUserAfterHavingPassed(), ILIAS\Test\Presentation\TestScreenGUI\buildModalLauncher(), ilDatePresentation\formatDate(), ILIAS\Test\Presentation\TestScreenGUI\getResumeLauncherLink(), ILIAS\Test\Presentation\TestScreenGUI\getStartLauncherLink(), ILIAS\Test\Presentation\TestScreenGUI\hasAvailablePasses(), IL_CAL_UNIX, ILIAS\Test\Presentation\TestScreenGUI\isModalLauncherNeeded(), ILIAS\Test\Presentation\TestScreenGUI\isUserOutOfProcessingTime(), ILIAS\Test\Presentation\TestScreenGUI\lastPassSuspended(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ILIAS\UI\Component\Launcher\Launcher\withButtonLabel().

Referenced by ILIAS\Test\Presentation\TestScreenGUI\handleRenderLauncher().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getModalLauncherInputs()

ILIAS\Test\Presentation\TestScreenGUI::getModalLauncherInputs ( )
private

Definition at line 370 of file class.TestScreenGUI.php.

370 : array
371 {
372 if ($this->main_settings->getIntroductionSettings()->getExamConditionsCheckboxEnabled()) {
373 $modal_inputs['exam_conditions'] = $this->ui_factory->input()->field()->checkbox(
374 $this->lng->txt('tst_exam_conditions'),
375 $this->lng->txt('tst_exam_conditions_label')
376 )->withRequired(true)
377 ->withAdditionalTransformation(
378 $this->refinery->custom()->constraint(
379 static fn(bool $value): bool => $value,
380 $this->lng->txt('tst_exam_conditions_not_checked_message'),
381 )
382 );
383 }
384
385 if ($this->main_settings->getAccessSettings()->getPasswordEnabled()) {
386 $modal_inputs['exam_password'] = $this->ui_factory->input()->field()->password(
387 $this->lng->txt('tst_exam_password'),
388 $this->lng->txt('tst_exam_password_label')
389 )->withRevelation(true)
390 ->withRequired(true)
391 ->withAdditionalTransformation(
392 $this->refinery->custom()->constraint(
393 fn(Password $value): bool => $value->toString() === $this->main_settings->getAccessSettings()->getPassword(),
394 $this->lng->txt('tst_exam_password_invalid_message'),
395 )
396 );
397 }
398
399 if ($this->user->isAnonymous()) {
400 $access_code_input = $this->ui_factory->input()->field()->text(
401 $this->lng->txt('tst_exam_access_code'),
402 $this->lng->txt('tst_exam_access_code_label')
403 )->withAdditionalTransformation(
404 $this->refinery->custom()->constraint(
405 fn(string $value): bool => $value === '' || $this->test_session->isAccessCodeUsed($value),
406 $this->lng->txt('tst_exam_access_code_invalid_message'),
407 )
408 );
409
410 $access_code_from_session = $this->test_session->getAccessCodeFromSession();
411 if ($access_code_from_session) {
412 $access_code_input = $access_code_input->withValue($access_code_from_session);
413 }
414
415 $modal_inputs['exam_access_code'] = $access_code_input;
416 }
417
418 if (
419 $this->test_passes_selector->getLastFinishedPass() >= 0
420 && $this->main_settings->getParticipantFunctionalitySettings()->getUsePreviousAnswerAllowed()
421 ) {
422 $modal_inputs['exam_use_previous_answers'] = $this->ui_factory->input()->field()->checkbox(
423 $this->lng->txt('tst_exam_use_previous_answers'),
424 $this->lng->txt('tst_exam_use_previous_answers_label')
425 )->withAdditionalTransformation(
426 $this->refinery->custom()->transformation(
427 static fn(bool $value): string => $value ? '1' : '0'
428 )
429 );
430 }
431
432 return $modal_inputs ?? [];
433 }

References ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\Data\Password\toString(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ getModalLauncherLink()

ILIAS\Test\Presentation\TestScreenGUI::getModalLauncherLink ( )
private

Definition at line 360 of file class.TestScreenGUI.php.

360 : Link
361 {
362 return $this->data_factory->link(
363 $this->lng->txt('tst_exam_start'),
364 $this->data_factory->uri(
365 $this->http->request()->getUri()->__toString()
366 )->withParameter('launcher_id', 'exam_modal')
367 );
368 }

References ILIAS\Repository\lng().

Referenced by ILIAS\Test\Presentation\TestScreenGUI\buildModalLauncher().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getModalLauncherMessageBox()

ILIAS\Test\Presentation\TestScreenGUI::getModalLauncherMessageBox ( )
private

Definition at line 435 of file class.TestScreenGUI.php.

435 : ?MessageBox
436 {
437 $exam_conditions_enabled = $this->main_settings->getIntroductionSettings()->getExamConditionsCheckboxEnabled();
438 $password_enabled = $this->main_settings->getAccessSettings()->getPasswordEnabled();
439
440 if ($exam_conditions_enabled && $password_enabled) {
441 $modal_message_box_message = $this->lng->txt('tst_exam_modal_message_conditions_and_password');
442 } elseif ($exam_conditions_enabled) {
443 $modal_message_box_message = $this->lng->txt('tst_exam_modal_message_conditions');
444 } elseif ($password_enabled) {
445 $modal_message_box_message = $this->lng->txt('tst_exam_modal_message_password');
446 }
447
448 return isset($modal_message_box_message) ? $this->ui_factory->messageBox()->info($modal_message_box_message) : null;
449 }

References ILIAS\Repository\lng().

Referenced by ILIAS\Test\Presentation\TestScreenGUI\buildModalLauncher().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getResumeLauncherLink()

ILIAS\Test\Presentation\TestScreenGUI::getResumeLauncherLink ( )
private

Definition at line 331 of file class.TestScreenGUI.php.

331 : Link
332 {
333 return $this->data_factory->link(
334 $this->lng->txt('tst_resume_test'),
335 $this->buildLauncherLinkUrl(\ilTestPlayerCommands::RESUME_PLAYER)
336 );
337 }

References ILIAS\Repository\lng(), and ilTestPlayerCommands\RESUME_PLAYER.

Referenced by ILIAS\Test\Presentation\TestScreenGUI\getLauncher().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSkillLevelThresholdsMissingInfo()

ILIAS\Test\Presentation\TestScreenGUI::getSkillLevelThresholdsMissingInfo ( )
private

Definition at line 586 of file class.TestScreenGUI.php.

586 : MessageBox
587 {
588 return $this->ui_factory->messageBox()->failure(
589 $this->lng->txt('tst_skl_level_thresholds_missing')
590 )->withLinks([
591 $this->ui_factory->link()->standard(
592 $this->lng->txt('tst_skl_level_thresholds_link'),
593 $this->ctrl->getLinkTargetByClass(
594 [
595 \ilRepositoryGUI::class,
596 \ilObjTestGUI::class,
597 \ilTestSkillAdministrationGUI::class,
598 \ilTestSkillLevelThresholdsGUI::class
599 ],
601 )
602 )
603 ]);
604 }

References ilTestSkillLevelThresholdsGUI\CMD_SHOW_SKILL_THRESHOLDS, ILIAS\Repository\lng(), and ILIAS\UI\Component\MessageBox\MessageBox\withLinks().

Referenced by ILIAS\Test\Presentation\TestScreenGUI\testScreen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStartLauncherLink()

ILIAS\Test\Presentation\TestScreenGUI::getStartLauncherLink ( )
private

Definition at line 451 of file class.TestScreenGUI.php.

451 : Link
452 {
453 return $this->data_factory->link(
454 $this->lng->txt('tst_exam_start'),
455 $this->buildLauncherLinkUrl(\ilTestPlayerCommands::INIT_TEST)
456 );
457 }

References ilTestPlayerCommands\INIT_TEST, and ILIAS\Repository\lng().

Referenced by ILIAS\Test\Presentation\TestScreenGUI\getLauncher().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleRenderIntroduction()

ILIAS\Test\Presentation\TestScreenGUI::handleRenderIntroduction ( array  $elements)
private

Definition at line 220 of file class.TestScreenGUI.php.

220 : array
221 {
222 $introduction = $this->object->getIntroduction();
223
224 if (
225 $this->main_settings->getIntroductionSettings()->getIntroductionEnabled() &&
226 !empty($introduction)
227 ) {
228 $this->content_style->gui()->addCss($this->tpl, $this->ref_id);
229 $elements[] = $this->ui_factory->panel()->standard(
230 $this->lng->txt('tst_introduction'),
231 $this->ui_factory->legacy()->content($introduction),
232 );
233 }
234
235 return $elements;
236 }

References ILIAS\Repository\lng().

Referenced by ILIAS\Test\Presentation\TestScreenGUI\testScreen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleRenderLauncher()

ILIAS\Test\Presentation\TestScreenGUI::handleRenderLauncher ( array  $elements)
private

Definition at line 238 of file class.TestScreenGUI.php.

238 : array
239 {
240 $elements[] = $this->getLauncher();
241 return $elements;
242 }

References ILIAS\Test\Presentation\TestScreenGUI\getLauncher().

+ Here is the call graph for this function:

◆ handleRenderMessageBox()

ILIAS\Test\Presentation\TestScreenGUI::handleRenderMessageBox ( array  $elements)
private

Definition at line 160 of file class.TestScreenGUI.php.

160 : array
161 {
162 $message_box_message = '';
163 $message_box_message_elements = [];
164
165 $exam_conditions_enabled = $this->main_settings->getIntroductionSettings()->getExamConditionsCheckboxEnabled();
166 $password_enabled = $this->main_settings->getAccessSettings()->getPasswordEnabled();
167 $test_behaviour_settings = $this->main_settings->getTestBehaviourSettings();
168
169 if ($exam_conditions_enabled && $password_enabled) {
170 $message_box_message_elements[] = $this->lng->txt('tst_launcher_status_message_conditions_and_password');
171 } elseif ($exam_conditions_enabled) {
172 $message_box_message_elements[] = $this->lng->txt('tst_launcher_status_message_conditions');
173 } elseif ($password_enabled) {
174 $message_box_message_elements[] = $this->lng->txt('tst_launcher_status_message_password');
175 }
176
177 if ($test_behaviour_settings->getProcessingTimeEnabled()
178 && !$this->isUserOutOfProcessingTime()
179 && $this->hasAvailablePasses()) {
180 $active_id = $this->test_session->getActiveId();
181 $starting_time = $this->object->getStartingTimeOfUser($active_id);
182 $message_box_message_elements[] = (new WorkingTime(
183 $this->lng,
184 $starting_time === false ? null : $starting_time,
185 $this->object->getProcessingTimeInSeconds($active_id)
186 ))->getMessage(false);
187 }
188
189 $nr_of_tries = $this->object->getNrOfTries();
190
191 if ($nr_of_tries !== 0) {
192 $message_box_message_elements[] = sprintf($this->lng->txt('tst_attempt_limit_message'), $nr_of_tries);
193 }
194
195 if ($this->object->isStartingTimeEnabled() && !$this->object->startingTimeReached()) {
196 $message_box_message_elements[] = sprintf(
197 $this->lng->txt('detail_starting_time_not_reached'),
198 \ilDatePresentation::formatDate(new \ilDateTime($this->object->getStartingTime(), IL_CAL_UNIX))
199 );
200 }
201
202 if ($this->object->isEndingTimeEnabled() && !$this->object->endingTimeReached()) {
203 $message_box_message_elements[] = sprintf(
204 $this->lng->txt('tst_exam_ending_time_message'),
205 \ilDatePresentation::formatDate(new \ilDateTime($this->object->getEndingTime(), IL_CAL_UNIX))
206 );
207 }
208
209 foreach ($message_box_message_elements as $message_box_message_element) {
210 $message_box_message .= ' ' . $message_box_message_element;
211 }
212
213 if (!empty($message_box_message)) {
214 $elements[] = $this->ui_factory->messageBox()->info($message_box_message);
215 }
216
217 return $elements;
218 }

References ilDatePresentation\formatDate(), IL_CAL_UNIX, ILIAS\Repository\lng(), and ILIAS\Repository\object().

Referenced by ILIAS\Test\Presentation\TestScreenGUI\testScreen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasAvailablePasses()

ILIAS\Test\Presentation\TestScreenGUI::hasAvailablePasses ( )
private

Definition at line 563 of file class.TestScreenGUI.php.

563 : bool
564 {
565 $nr_of_tries = $this->object->getNrOfTries();
566
567 return $nr_of_tries === 0 || (count($this->test_passes_selector->getExistingPasses()) <= $nr_of_tries && count($this->test_passes_selector->getClosedPasses()) < $nr_of_tries);
568 }

Referenced by ILIAS\Test\Presentation\TestScreenGUI\getLauncher().

+ Here is the caller graph for this function:

◆ isModalLauncherNeeded()

ILIAS\Test\Presentation\TestScreenGUI::isModalLauncherNeeded ( )
private

Definition at line 575 of file class.TestScreenGUI.php.

575 : bool
576 {
577 return (
578 $this->main_settings->getIntroductionSettings()->getExamConditionsCheckboxEnabled()
579 || $this->main_settings->getAccessSettings()->getPasswordEnabled()
580 || $this->main_settings->getParticipantFunctionalitySettings()->getUsePreviousAnswerAllowed()
581 && $this->test_passes_selector->getLastFinishedPass() >= 0
582 || $this->user->isAnonymous()
583 );
584 }

Referenced by ILIAS\Test\Presentation\TestScreenGUI\getLauncher().

+ Here is the caller graph for this function:

◆ isUserOutOfProcessingTime()

ILIAS\Test\Presentation\TestScreenGUI::isUserOutOfProcessingTime ( )
private

Definition at line 536 of file class.TestScreenGUI.php.

536 : bool
537 {
538 $test_behaviour_settings = $this->object->getMainSettings()->getTestBehaviourSettings();
539 if (!$test_behaviour_settings->getProcessingTimeEnabled()
540 || $test_behaviour_settings->getResetProcessingTime()) {
541 return false;
542 }
543
544 $active_id = $this->test_passes_selector->getActiveId();
545 $last_started_pass = $this->test_session->getLastStartedPass();
546 return $last_started_pass !== null
547 && $this->object->isMaxProcessingTimeReached(
548 $this->object->getStartingTimeOfUser($active_id, $last_started_pass),
549 $active_id
550 );
551 }

References ILIAS\Repository\object().

Referenced by ILIAS\Test\Presentation\TestScreenGUI\getLauncher().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lastPassSuspended()

ILIAS\Test\Presentation\TestScreenGUI::lastPassSuspended ( )
private

Definition at line 570 of file class.TestScreenGUI.php.

570 : bool
571 {
572 return (count($this->test_passes_selector->getExistingPasses()) - count($this->test_passes_selector->getClosedPasses())) === 1;
573 }

Referenced by ILIAS\Test\Presentation\TestScreenGUI\getLauncher().

+ Here is the caller graph for this function:

◆ testCanBeStarted()

ILIAS\Test\Presentation\TestScreenGUI::testCanBeStarted ( )
private

Definition at line 526 of file class.TestScreenGUI.php.

526 : bool
527 {
528 if ($this->object->getOfflineStatus()
529 || !$this->object->isComplete($this->object->getQuestionSetConfig())) {
530 return false;
531 }
532
533 return true;
534 }

References ILIAS\Repository\object().

Referenced by ILIAS\Test\Presentation\TestScreenGUI\testScreen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testScreen()

ILIAS\Test\Presentation\TestScreenGUI::testScreen ( )

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

105 : void
106 {
107 $this->tabs_manager->activateTab(TabsManager::TAB_ID_TEST);
108 $this->tpl->setPermanentLink($this->object->getType(), $this->ref_id);
109
110 $elements = [];
111
112 if ($this->areSkillLevelThresholdsMissing()) {
113 $elements = [$this->getSkillLevelThresholdsMissingInfo()];
114 }
115 $elements = $this->handleRenderMessageBox($elements);
116 $elements = $this->handleRenderIntroduction($elements);
117
118 if ($this->testCanBeStarted()) {
119 $this->tpl->setContent(
120 $this->ui_renderer->render(
121 $this->handleRenderLauncher(
122 $elements
123 )
124 )
125 );
126 return;
127 }
128
129 $this->tpl->setContent(
130 $this->ui_renderer->render(
131 $this->addOfflineMessageBoxIfNecessary(
132 $elements
133 )
134 )
135 );
136 }

References ILIAS\Test\Presentation\TestScreenGUI\areSkillLevelThresholdsMissing(), ILIAS\Test\Presentation\TestScreenGUI\getSkillLevelThresholdsMissingInfo(), ILIAS\Test\Presentation\TestScreenGUI\handleRenderIntroduction(), ILIAS\Test\Presentation\TestScreenGUI\handleRenderMessageBox(), ILIAS\Repository\object(), ILIAS\Test\Presentation\TabsManager\TAB_ID_TEST, and ILIAS\Test\Presentation\TestScreenGUI\testCanBeStarted().

+ Here is the call graph for this function:

Field Documentation

◆ $data_factory

readonly DataFactory ILIAS\Test\Presentation\TestScreenGUI::$data_factory
private

Definition at line 52 of file class.TestScreenGUI.php.

◆ $main_settings

readonly MainSettings ILIAS\Test\Presentation\TestScreenGUI::$main_settings
private

Definition at line 50 of file class.TestScreenGUI.php.

◆ $password_checker

ilTestPasswordChecker ILIAS\Test\Presentation\TestScreenGUI::$password_checker
private

Definition at line 53 of file class.TestScreenGUI.php.

◆ $ref_id

readonly int ILIAS\Test\Presentation\TestScreenGUI::$ref_id
private

Definition at line 49 of file class.TestScreenGUI.php.

◆ $test_passes_selector

readonly ilTestPassesSelector ILIAS\Test\Presentation\TestScreenGUI::$test_passes_selector
private

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

◆ $test_session

readonly ilTestSession ILIAS\Test\Presentation\TestScreenGUI::$test_session
private

Definition at line 51 of file class.TestScreenGUI.php.

◆ DEFAULT_CMD

const ILIAS\Test\Presentation\TestScreenGUI::DEFAULT_CMD = 'testScreen'

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