ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 570 of file class.TestScreenGUI.php.

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

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

521 : bool
522 {
523 if ($this->main_settings->getTestBehaviourSettings()->getBlockAfterPassedEnabled()) {
524 return $this->test_passes_selector->getLastFinishedPass() >= 0
525 && $this->test_passes_selector->hasTestPassedOnce($this->test_session->getActiveId());
526 }
527
528 return false;
529 }

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

599 : string
600 {
601 $target = array_merge(['ilRepositoryGUI', 'ilObjTestGUI'], ['ilTestSkillAdministrationGUI', 'ilTestSkillLevelThresholdsGUI']);
602 return $this->ctrl->getLinkTargetByClass($target, $cmd);
603 }

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

301 : Launcher
302 {
303 $launcher = $this->ui_factory->launcher()->inline($this->getModalLauncherLink())
304 ->withInputs(
305 $this->ui_factory->input()->field()->group($this->getModalLauncherInputs()),
306 function (Result $result) {
307 $this->evaluateLauncherModalForm($result);
308 },
310 )->withModalSubmitLabel($this->lng->txt('continue'));
311
312 $request = $this->http->request();
313 $key = 'launcher_id';
314 if (array_key_exists($key, $request->getQueryParams())
315 && $request->getQueryParams()[$key] === 'exam_modal') {
316 $launcher = $launcher->withRequest($request);
317 }
318 return $launcher;
319 }
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 401 of file class.TestScreenGUI.php.

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

References $_SERVER, $message, 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 327 of file class.TestScreenGUI.php.

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

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

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

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

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

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 $url = $this->ctrl->getLinkTarget(
295 (new \ilTestPlayerFactory($this->object))->getPlayerGUI(),
297 );
298 return $this->data_factory->link($this->lng->txt('tst_resume_test'), $this->data_factory->uri(ILIAS_HTTP_PATH . '/' . $url));
299 }
$url
Definition: shib_logout.php:68

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

554 : MessageBox
555 {
556 $message = $this->lng->txt('tst_skl_level_thresholds_missing');
557
558 $link_target = $this->buildLinkTarget(
560 );
561
562 $link = $this->ui_factory->link()->standard(
563 $this->lng->txt('tst_skl_level_thresholds_link'),
564 $link_target
565 );
566
567 return $this->ui_factory->messageBox()->failure($message)->withLinks([$link]);
568 }

References $message, 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 392 of file class.TestScreenGUI.php.

392 : Link
393 {
394 $url = $this->ctrl->getLinkTarget(
395 (new \ilTestPlayerFactory($this->object))->getPlayerGUI(),
397 );
398 return $this->data_factory->link($this->lng->txt('tst_exam_start'), $this->data_factory->uri(ILIAS_HTTP_PATH . '/' . $url));
399 }

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

531 : bool
532 {
533 $nr_of_tries = $this->object->getNrOfTries();
534
535 return $nr_of_tries === 0 || (count($this->test_passes_selector->getExistingPasses()) <= $nr_of_tries && count($this->test_passes_selector->getClosedPasses()) < $nr_of_tries);
536 }

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

543 : bool
544 {
545 return (
546 $this->main_settings->getIntroductionSettings()->getExamConditionsCheckboxEnabled()
547 || $this->main_settings->getAccessSettings()->getPasswordEnabled()
548 || $this->main_settings->getParticipantFunctionalitySettings()->getUsePreviousAnswerAllowed()
549 && $this->test_passes_selector->getLastFinishedPass() >= 0
550 || $this->user->isAnonymous()
551 );
552 }

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

504 : bool
505 {
506 $test_behaviour_settings = $this->object->getMainSettings()->getTestBehaviourSettings();
507 if (!$test_behaviour_settings->getProcessingTimeEnabled()
508 || $test_behaviour_settings->getResetProcessingTime()) {
509 return false;
510 }
511
512 $active_id = $this->test_passes_selector->getActiveId();
513 $last_started_pass = $this->test_session->getLastStartedPass();
514 return $last_started_pass !== null
515 && $this->object->isMaxProcessingTimeReached(
516 $this->object->getStartingTimeOfUser($active_id, $last_started_pass),
517 $active_id
518 );
519 }

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

538 : bool
539 {
540 return (count($this->test_passes_selector->getExistingPasses()) - count($this->test_passes_selector->getClosedPasses())) === 1;
541 }

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

494 : bool
495 {
496 if ($this->object->getOfflineStatus()
497 || !$this->object->isComplete($this->object->getQuestionSetConfig())) {
498 return false;
499 }
500
501 return true;
502 }

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: