ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
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

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

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 45 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 56 of file class.TestScreenGUI.php.

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

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

+ Here is the call graph for this function:

Member Function Documentation

◆ areSkillLevelThresholdsMissing()

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

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

576 : bool
577 {
578 if (!$this->object->isSkillServiceEnabled()) {
579 return false;
580 }
581
582 $questionContainerId = $this->object->getId();
583
584 $assignmentList = new \ilAssQuestionSkillAssignmentList($this->database);
585 $assignmentList->setParentObjId($questionContainerId);
586 $assignmentList->loadFromDb();
587
588 foreach ($assignmentList->getUniqueAssignedSkills() as $data) {
589 foreach ($data['skill']->getLevelData() as $level) {
590 $threshold = new \ilTestSkillLevelThreshold($this->database);
591 $threshold->setTestId($this->object->getTestId());
592 $threshold->setSkillBaseId($data['skill_base_id']);
593 $threshold->setSkillTrefId($data['skill_tref_id']);
594 $threshold->setSkillLevelId($level['id']);
595
596 if (!$threshold->dbRecordExists()) {
597 return true;
598 }
599 }
600 }
601
602 return false;
603 }

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 527 of file class.TestScreenGUI.php.

527 : bool
528 {
529 if ($this->main_settings->getTestBehaviourSettings()->getBlockAfterPassedEnabled()) {
530 return $this->test_passes_selector->getLastFinishedPass() >= 0
531 && $this->test_passes_selector->hasTestPassedOnce($this->test_session->getActiveId());
532 }
533
534 return false;
535 }

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

+ Here is the caller graph for this function:

◆ buildLinkTarget()

ILIAS\Test\Presentation\TestScreenGUI::buildLinkTarget ( ?string  $cmd = null)
private

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

605 : string
606 {
607 $target = array_merge(['ilRepositoryGUI', 'ilObjTestGUI'], ['ilTestSkillAdministrationGUI', 'ilTestSkillLevelThresholdsGUI']);
608 return $this->ctrl->getLinkTargetByClass($target, $cmd);
609 }

References ILIAS\Repository\ctrl().

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

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

◆ buildModalLauncher()

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

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

304 : Launcher
305 {
306 $launcher = $this->ui_factory->launcher()->inline($this->getModalLauncherLink())
307 ->withInputs(
308 $this->ui_factory->input()->field()->group($this->getModalLauncherInputs()),
309 function (Result $result) {
310 $this->evaluateLauncherModalForm($result);
311 },
313 )->withModalSubmitLabel($this->lng->txt('continue'));
314
315 $request = $this->http->request();
316 $key = 'launcher_id';
317 if (array_key_exists($key, $request->getQueryParams())
318 && $request->getQueryParams()[$key] === 'exam_modal') {
319 $launcher = $launcher->withRequest($request);
320 }
321 return $launcher;
322 }
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Result.php:29
static http()
Fetches the global http state from ILIAS.

References 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:

◆ evaluateLauncherModalForm()

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

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

407 : void
408 {
409 if ($result->isOK()) {
410 $conditions_met = true;
411 $message = '';
412 $access_settings_password = $this->main_settings->getAccessSettings()->getPassword();
413 $anonymous = $this->user->isAnonymous();
414 foreach ($result->value() as $key => $value) {
415
416 switch ($key) {
417 case 'exam_conditions':
418 $exam_conditions_value = (bool) $value;
419 if (!$exam_conditions_value) {
420 $conditions_met = false;
421 $message .= $this->lng->txt('tst_exam_conditions_not_checked_message') . '<br>';
422 }
423 break;
424 case 'exam_password':
425 $password = $value;
426 $exam_password_valid = ($password === $access_settings_password);
427 if (!$exam_password_valid) {
428 $conditions_met = false;
429 $message .= $this->lng->txt('tst_exam_password_invalid_message') . '<br>';
430 if ($this->object->getTestLogger()->isLoggingEnabled()
431 && !$this->object->getAnonymity()) {
432 $logger = $this->object->getTestLogger();
433 $logger->logParticipantInteraction(
434 $logger->getInteractionFactory()->buildParticipantInteraction(
435 $this->ref_id,
436 null,
437 $this->user->getId(),
438 $_SERVER['REMOTE_ADDR'],
439 TestParticipantInteractionTypes::WRONG_TEST_PASSWORD_PROVIDED,
440 []
441 )
442 );
443 }
444 }
445 $this->password_checker->setUserEnteredPassword($password);
446 break;
447 case 'exam_access_code':
448 if ($anonymous && !empty($value)) {
449 $this->test_session->setAccessCodeToSession($value);
450 } else {
451 $this->test_session->unsetAccessCodeInSession();
452 }
453 break;
454 case 'exam_use_previous_answers':
455 $exam_use_previous_answers_value = (string) (int) $value;
456 break;
457 }
458 }
459
460 if ($message !== '') {
461 $this->tpl->setOnScreenMessage(\ilGlobalTemplateInterface::MESSAGE_TYPE_FAILURE, $message, true);
462 }
463
464 if (empty($result->value())) {
465 $this->tpl->setOnScreenMessage(
467 $this->lng->txt('tst_exam_required_fields_not_filled_message'),
468 true
469 );
470 } elseif ($conditions_met) {
471 if (
472 !$anonymous &&
473 $this->main_settings->getParticipantFunctionalitySettings()->getUsePreviousAnswerAllowed()
474 ) {
475 $this->user->setPref('tst_use_previous_answers', $exam_use_previous_answers_value ?? '0');
476 $this->user->update();
477 }
478
479 if (isset($password) && $password === $access_settings_password) {
480 \ilSession::set('tst_password_' . $this->object->getTestId(), $password);
481 } else {
482 \ilSession::set('tst_password_' . $this->object->getTestId(), '');
483 $this->test_session->setPasswordChecked(false);
484 }
485
486 $this->ctrl->redirectByClass(
487 (new \ilTestPlayerFactory($this->object))->getPlayerGUI()::class,
489 );
490 }
491 } else {
492 $this->tpl->setOnScreenMessage(
494 $this->lng->txt('tst_exam_required_fields_not_filled_message'),
495 true
496 );
497 }
498 }
return true
static set(string $a_var, $a_val)
Set a value.
isOK()
Get to know if the result is ok.
value()
Get the encapsulated value.
$_SERVER['HTTP_HOST']
Definition: raiseError.php:26

References $_SERVER, ILIAS\Repository\ctrl(), ilTestPlayerCommands\INIT_TEST, ILIAS\Data\Result\isOK(), ILIAS\Repository\lng(), ILIAS\UICore\GlobalTemplate\MESSAGE_TYPE_FAILURE, ILIAS\Repository\object(), ilSession\set(), true, 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 85 of file class.TestScreenGUI.php.

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

205 : Launcher
206 {
207 $launcher_factory = $this->ui_factory->launcher();
208
209 if ($this->object->isStartingTimeEnabled() && !$this->object->startingTimeReached()) {
210 return $launcher_factory
211 ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
212 ->withButtonLabel(sprintf(
213 $this->lng->txt('detail_starting_time_not_reached'),
214 \ilDatePresentation::formatDate(new \ilDateTime($this->object->getStartingTime(), IL_CAL_UNIX))
215 ), false)
216 ;
217 }
218
219 if ($this->object->isEndingTimeEnabled() && $this->object->endingTimeReached()) {
220 return $launcher_factory
221 ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
222 ->withButtonLabel(sprintf(
223 $this->lng->txt('detail_ending_time_reached'),
224 \ilDatePresentation::formatDate(new \ilDateTime($this->object->getEndingTime(), IL_CAL_UNIX))
225 ), false)
226 ;
227 }
228
229 if ($this->isUserOutOfProcessingTime()) {
230 return $launcher_factory
231 ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
232 ->withButtonLabel($this->lng->txt('tst_out_of_time_message'), false)
233 ;
234 }
235
236 $participant_access = $this->test_access->isParticipantAllowed(
237 $this->object->getId(),
238 $this->user->getId()
239 );
240
241 if ($participant_access === ParticipantAccess::NOT_INVITED) {
242 return $launcher_factory
243 ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
244 ->withButtonLabel($this->lng->txt('tst_exam_not_assigned_participant_disclaimer'), false)
245 ;
246 }
247
248 if ($participant_access !== ParticipantAccess::ALLOWED) {
249 return $launcher_factory
250 ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
251 ->withButtonLabel($participant_access->getAccessForbiddenMessage($this->lng), false)
252 ;
253 }
254
255 if (!$this->hasAvailablePasses()) {
256 return $launcher_factory
257 ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
258 ->withButtonLabel($this->lng->txt('tst_launcher_button_label_passes_limit_reached'), false);
259 }
260
261 if ($this->blockUserAfterHavingPassed()) {
262 return $launcher_factory
263 ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
264 ->withButtonLabel($this->lng->txt('tst_already_passed_cannot_retake'), false)
265 ;
266 }
267
268 $next_pass_allowed_timestamp = 0;
269 if (!$this->object->isNextPassAllowed($this->test_passes_selector, $next_pass_allowed_timestamp)) {
270 return $launcher_factory
271 ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
272 ->withButtonLabel(
273 sprintf(
274 $this->lng->txt('wait_for_next_pass_hint_msg'),
275 \ilDatePresentation::formatDate(new \ilDateTime($next_pass_allowed_timestamp, IL_CAL_UNIX)),
276 ),
277 false
278 )
279 ;
280 }
281
282 if ($this->lastPassSuspended()) {
283 return $launcher_factory->inline($this->getResumeLauncherLink());
284 }
285
286 if ($this->isModalLauncherNeeded()) {
287 return $this->buildModalLauncher();
288 }
289 return $launcher_factory->inline($this->getStartLauncherLink());
290 }
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 330 of file class.TestScreenGUI.php.

330 : array
331 {
332 if ($this->main_settings->getIntroductionSettings()->getExamConditionsCheckboxEnabled()) {
333 $modal_inputs['exam_conditions'] = $this->ui_factory->input()->field()->checkbox(
334 $this->lng->txt('tst_exam_conditions'),
335 $this->lng->txt('tst_exam_conditions_label')
336 )->withRequired(true);
337 }
338
339 if ($this->main_settings->getAccessSettings()->getPasswordEnabled()) {
340 $modal_inputs['exam_password'] = $this->ui_factory->input()->field()->password(
341 $this->lng->txt('tst_exam_password'),
342 $this->lng->txt('tst_exam_password_label')
343 )->withRevelation(true)
344 ->withRequired(true)
345 ->withAdditionalTransformation(
346 $this->refinery->custom()->transformation(
347 static function (Password $value): string {
348 return $value->toString();
349 }
350 )
351 );
352 }
353
354 if ($this->user->isAnonymous()) {
355 $access_code_input = $this->ui_factory->input()->field()->text(
356 $this->lng->txt('tst_exam_access_code'),
357 $this->lng->txt('tst_exam_access_code_label')
358 );
359
360 $access_code_from_session = $this->test_session->getAccessCodeFromSession();
361 if ($access_code_from_session) {
362 $access_code_input = $access_code_input->withValue($access_code_from_session);
363 }
364
365 $modal_inputs['exam_access_code'] = $access_code_input;
366 }
367
368 if ($this->main_settings->getParticipantFunctionalitySettings()->getUsePreviousAnswerAllowed()
369 && $this->test_passes_selector->getLastFinishedPass() >= 0) {
370 $modal_inputs['exam_use_previous_answers'] = $this->ui_factory->input()->field()->checkbox(
371 $this->lng->txt('tst_exam_use_previous_answers'),
372 $this->lng->txt('tst_exam_use_previous_answers_label')
373 );
374 }
375
376 return $modal_inputs ?? [];
377 }

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 324 of file class.TestScreenGUI.php.

324 : Link
325 {
326 $uri = $this->data_factory->uri($this->http->request()->getUri()->__toString())->withParameter('launcher_id', 'exam_modal');
327 return $this->data_factory->link($this->lng->txt('tst_exam_start'), $uri);
328 }

References ILIAS\FileDelivery\http(), and 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 379 of file class.TestScreenGUI.php.

379 : ?MessageBox
380 {
381 $exam_conditions_enabled = $this->main_settings->getIntroductionSettings()->getExamConditionsCheckboxEnabled();
382 $password_enabled = $this->main_settings->getAccessSettings()->getPasswordEnabled();
383
384 if ($exam_conditions_enabled && $password_enabled) {
385 $modal_message_box_message = $this->lng->txt('tst_exam_modal_message_conditions_and_password');
386 } elseif ($exam_conditions_enabled) {
387 $modal_message_box_message = $this->lng->txt('tst_exam_modal_message_conditions');
388 } elseif ($password_enabled) {
389 $modal_message_box_message = $this->lng->txt('tst_exam_modal_message_password');
390 }
391
392 return isset($modal_message_box_message) ? $this->ui_factory->messageBox()->info($modal_message_box_message) : null;
393 }

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 292 of file class.TestScreenGUI.php.

292 : Link
293 {
294 $class = $this->object->isFixedTest()
295 ? \ilTestPlayerFixedQuestionSetGUI::class
296 : \ilTestPlayerRandomQuestionSetGUI::class;
297 $url = $this->ctrl->getLinkTargetByClass(
298 [\ilRepositoryGUI::class, \ilObjTestGUI::class, $class],
300 );
301 return $this->data_factory->link($this->lng->txt('tst_resume_test'), $this->data_factory->uri(ILIAS_HTTP_PATH . '/' . $url));
302 }
$url
Definition: shib_logout.php:70

References $url, ILIAS\Repository\ctrl(), 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 560 of file class.TestScreenGUI.php.

560 : MessageBox
561 {
562 $message = $this->lng->txt('tst_skl_level_thresholds_missing');
563
564 $link_target = $this->buildLinkTarget(
566 );
567
568 $link = $this->ui_factory->link()->standard(
569 $this->lng->txt('tst_skl_level_thresholds_link'),
570 $link_target
571 );
572
573 return $this->ui_factory->messageBox()->failure($message)->withLinks([$link]);
574 }

References ILIAS\Test\Presentation\TestScreenGUI\buildLinkTarget(), ilTestSkillLevelThresholdsGUI\CMD_SHOW_SKILL_THRESHOLDS, and 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:

◆ getStartLauncherLink()

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

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

395 : Link
396 {
397 $class = $this->object->isFixedTest()
398 ? \ilTestPlayerFixedQuestionSetGUI::class
399 : \ilTestPlayerRandomQuestionSetGUI::class;
400 $url = $this->ctrl->getLinkTargetByClass(
401 [\ilRepositoryGUI::class, \ilObjTestGUI::class, $class],
403 );
404 return $this->data_factory->link($this->lng->txt('tst_exam_start'), $this->data_factory->uri(ILIAS_HTTP_PATH . '/' . $url));
405 }

References $url, ILIAS\Repository\ctrl(), 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 181 of file class.TestScreenGUI.php.

181 : array
182 {
183 $introduction = $this->object->getIntroduction();
184
185 if (
186 $this->main_settings->getIntroductionSettings()->getIntroductionEnabled() &&
187 !empty($introduction)
188 ) {
189 $this->content_style->gui()->addCss($this->tpl, $this->ref_id);
190 $elements[] = $this->ui_factory->panel()->standard(
191 $this->lng->txt('tst_introduction'),
192 $this->ui_factory->legacy()->content($introduction),
193 );
194 }
195
196 return $elements;
197 }

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 199 of file class.TestScreenGUI.php.

199 : array
200 {
201 $elements[] = $this->getLauncher();
202 return $elements;
203 }

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 126 of file class.TestScreenGUI.php.

126 : array
127 {
128 $message_box_message = '';
129 $message_box_message_elements = [];
130
131 $exam_conditions_enabled = $this->main_settings->getIntroductionSettings()->getExamConditionsCheckboxEnabled();
132 $password_enabled = $this->main_settings->getAccessSettings()->getPasswordEnabled();
133 $test_behaviour_settings = $this->main_settings->getTestBehaviourSettings();
134
135 if ($exam_conditions_enabled && $password_enabled) {
136 $message_box_message_elements[] = $this->lng->txt('tst_launcher_status_message_conditions_and_password');
137 } elseif ($exam_conditions_enabled) {
138 $message_box_message_elements[] = $this->lng->txt('tst_launcher_status_message_conditions');
139 } elseif ($password_enabled) {
140 $message_box_message_elements[] = $this->lng->txt('tst_launcher_status_message_password');
141 }
142
143 if ($test_behaviour_settings->getProcessingTimeEnabled() && !$this->isUserOutOfProcessingTime()) {
144 $message_box_message_elements[] = sprintf(
145 $this->lng->txt('tst_time_limit_message'),
146 $test_behaviour_settings->getProcessingTimeAsMinutes()
147 );
148 }
149
150 $nr_of_tries = $this->object->getNrOfTries();
151
152 if ($nr_of_tries !== 0) {
153 $message_box_message_elements[] = sprintf($this->lng->txt('tst_attempt_limit_message'), $nr_of_tries);
154 }
155
156 if ($this->object->isStartingTimeEnabled() && !$this->object->startingTimeReached()) {
157 $message_box_message_elements[] = sprintf(
158 $this->lng->txt('detail_starting_time_not_reached'),
159 \ilDatePresentation::formatDate(new \ilDateTime($this->object->getStartingTime(), IL_CAL_UNIX))
160 );
161 }
162
163 if ($this->object->isEndingTimeEnabled() && !$this->object->endingTimeReached()) {
164 $message_box_message_elements[] = sprintf(
165 $this->lng->txt('tst_exam_ending_time_message'),
166 \ilDatePresentation::formatDate(new \ilDateTime($this->object->getEndingTime(), IL_CAL_UNIX))
167 );
168 }
169
170 foreach ($message_box_message_elements as $message_box_message_element) {
171 $message_box_message .= ' ' . $message_box_message_element;
172 }
173
174 if (!empty($message_box_message)) {
175 $elements[] = $this->ui_factory->messageBox()->info($message_box_message);
176 }
177
178 return $elements;
179 }

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 537 of file class.TestScreenGUI.php.

537 : bool
538 {
539 $nr_of_tries = $this->object->getNrOfTries();
540
541 return $nr_of_tries === 0 || (count($this->test_passes_selector->getExistingPasses()) <= $nr_of_tries && count($this->test_passes_selector->getClosedPasses()) < $nr_of_tries);
542 }

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 549 of file class.TestScreenGUI.php.

549 : bool
550 {
551 return (
552 $this->main_settings->getIntroductionSettings()->getExamConditionsCheckboxEnabled()
553 || $this->main_settings->getAccessSettings()->getPasswordEnabled()
554 || $this->main_settings->getParticipantFunctionalitySettings()->getUsePreviousAnswerAllowed()
555 && $this->test_passes_selector->getLastFinishedPass() >= 0
556 || $this->user->isAnonymous()
557 );
558 }

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 510 of file class.TestScreenGUI.php.

510 : bool
511 {
512 $test_behaviour_settings = $this->object->getMainSettings()->getTestBehaviourSettings();
513 if (!$test_behaviour_settings->getProcessingTimeEnabled()
514 || $test_behaviour_settings->getResetProcessingTime()) {
515 return false;
516 }
517
518 $active_id = $this->test_passes_selector->getActiveId();
519 $last_started_pass = $this->test_session->getLastStartedPass();
520 return $last_started_pass !== null
521 && $this->object->isMaxProcessingTimeReached(
522 $this->object->getStartingTimeOfUser($active_id, $last_started_pass),
523 $active_id
524 );
525 }

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 544 of file class.TestScreenGUI.php.

544 : bool
545 {
546 return (count($this->test_passes_selector->getExistingPasses()) - count($this->test_passes_selector->getClosedPasses())) === 1;
547 }

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 500 of file class.TestScreenGUI.php.

500 : bool
501 {
502 if ($this->object->getOfflineStatus()
503 || !$this->object->isComplete($this->object->getQuestionSetConfig())) {
504 return false;
505 }
506
507 return true;
508 }

References ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ testScreen()

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

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

106 : void
107 {
108 $this->tabs_manager->activateTab(TabsManager::TAB_ID_TEST);
109 $this->tpl->setPermanentLink($this->object->getType(), $this->ref_id);
110
111 $elements = [];
112
113 if ($this->areSkillLevelThresholdsMissing()) {
114 $elements = [$this->getSkillLevelThresholdsMissingInfo()];
115 }
116 $elements = $this->handleRenderMessageBox($elements);
117 $elements = $this->handleRenderIntroduction($elements);
118
119 $this->tpl->setContent(
120 $this->ui_renderer->render(
121 $this->testCanBeStarted() ? $this->handleRenderLauncher($elements) : $elements
122 )
123 );
124 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $data_factory

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

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

◆ $main_settings

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

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

◆ $password_checker

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

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

◆ $ref_id

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

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

◆ $test_passes_selector

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

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

◆ $test_session

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

Definition at line 52 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: