ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilTestScreenGUI Class Reference

Class ilTestScreenGUI. More...

+ Collaboration diagram for ilTestScreenGUI:

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 ilCtrl $ctrl, private readonly ilGlobalTemplateInterface $tpl, private readonly ContentStyle $content_style, private readonly HTTPServices $http, private readonly ilTabsGUI $tabs, private readonly ilAccessHandler $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 ilObjTestMainSettings $main_settings
 
readonly ilTestSession $test_session
 
readonly DataFactory $data_factory
 
ilTestPasswordChecker $password_checker
 

Detailed Description

Class ilTestScreenGUI.

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

Definition at line 39 of file class.ilTestScreenGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestScreenGUI::__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 ilCtrl  $ctrl,
private readonly ilGlobalTemplateInterface  $tpl,
private readonly ContentStyle  $content_style,
private readonly HTTPServices  $http,
private readonly ilTabsGUI  $tabs,
private readonly ilAccessHandler  $access,
private readonly ilDBInterface  $database,
private readonly ilRbacSystem  $rbac_system 
)

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

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

65  {
66  $this->ref_id = $this->object->getRefId();
67  $this->main_settings = $this->object->getMainSettings();
68  $this->data_factory = new DataFactory();
69 
70  $this->test_session = (new ilTestSessionFactory($this->object, $this->database, $this->user))->getSession();
71 
72  $this->test_passes_selector = new ilTestPassesSelector($this->database, $this->object);
73  $this->test_passes_selector->setActiveId($this->test_session->getActiveId());
74  $this->test_passes_selector->setLastFinishedPass($this->test_session->getLastFinishedPass());
75  $this->password_checker = new ilTestPasswordChecker($this->rbac_system, $this->user, $this->object, $this->lng);
76  }
+ Here is the call graph for this function:

Member Function Documentation

◆ areSkillLevelThresholdsMissing()

ilTestScreenGUI::areSkillLevelThresholdsMissing ( )
private

Definition at line 525 of file class.ilTestScreenGUI.php.

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

Referenced by testScreen().

525  : bool
526  {
527  if (!$this->object->isSkillServiceEnabled()) {
528  return false;
529  }
530 
531  $questionContainerId = $this->object->getId();
532 
533  $assignmentList = new ilAssQuestionSkillAssignmentList($this->database);
534  $assignmentList->setParentObjId($questionContainerId);
535  $assignmentList->loadFromDb();
536 
537  foreach ($assignmentList->getUniqueAssignedSkills() as $data) {
538  foreach ($data['skill']->getLevelData() as $level) {
539  $threshold = new ilTestSkillLevelThreshold($this->database);
540  $threshold->setTestId($this->object->getTestId());
541  $threshold->setSkillBaseId($data['skill_base_id']);
542  $threshold->setSkillTrefId($data['skill_tref_id']);
543  $threshold->setSkillLevelId($level['id']);
544 
545  if (!$threshold->dbRecordExists()) {
546  return true;
547  }
548  }
549  }
550 
551  return false;
552  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ blockUserAfterHavingPassed()

ilTestScreenGUI::blockUserAfterHavingPassed ( )
private

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

Referenced by getLauncher().

476  : bool
477  {
478  if ($this->main_settings->getTestBehaviourSettings()->getBlockAfterPassedEnabled()) {
479  return $this->test_passes_selector->getLastFinishedPass() >= 0
480  && $this->test_passes_selector->hasTestPassedOnce($this->test_session->getActiveId());
481  }
482 
483  return false;
484  }
+ Here is the caller graph for this function:

◆ buildLinkTarget()

ilTestScreenGUI::buildLinkTarget ( string  $cmd = null)
private

Definition at line 554 of file class.ilTestScreenGUI.php.

References ILIAS\Repository\ctrl().

Referenced by getSkillLevelThresholdsMissingInfo().

554  : string
555  {
556  $target = array_merge(['ilRepositoryGUI', 'ilObjTestGUI'], ['ilTestSkillAdministrationGUI', 'ilTestSkillLevelThresholdsGUI']);
557  return $this->ctrl->getLinkTargetByClass($target, $cmd);
558  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildModalLauncher()

ilTestScreenGUI::buildModalLauncher ( )
private

Definition at line 284 of file class.ilTestScreenGUI.php.

References ILIAS\LTI\ToolProvider\$key, evaluateLauncherModalForm(), getModalLauncherInputs(), getModalLauncherLink(), getModalLauncherMessageBox(), ILIAS\FileDelivery\http(), and ILIAS\Repository\lng().

Referenced by getLauncher().

284  : Launcher
285  {
286  $launcher = $this->ui_factory->launcher()->inline($this->getModalLauncherLink())
287  ->withInputs(
288  $this->ui_factory->input()->field()->group($this->getModalLauncherInputs()),
289  function (Result $result) {
290  $this->evaluateLauncherModalForm($result);
291  },
293  )->withModalSubmitLabel($this->lng->txt('continue'));
294 
295  $request = $this->http->request();
296  $key = 'launcher_id';
297  if (array_key_exists($key, $request->getQueryParams())
298  && $request->getQueryParams()[$key] === 'exam_modal') {
299  $launcher = $launcher->withRequest($request);
300  }
301  return $launcher;
302  }
evaluateLauncherModalForm(Result $result)
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Result.php:14
static http()
Fetches the global http state from ILIAS.
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ evaluateLauncherModalForm()

ilTestScreenGUI::evaluateLauncherModalForm ( Result  $result)
private

Definition at line 381 of file class.ilTestScreenGUI.php.

References ILIAS\LTI\ToolProvider\$key, $message, ILIAS\Repository\ctrl(), ilTestPlayerCommands\INIT_TEST, ILIAS\Data\Result\isOK(), ILIAS\Repository\lng(), ilGlobalTemplateInterface\MESSAGE_TYPE_FAILURE, ILIAS\Repository\object(), ilSession\set(), ILIAS\Repository\user(), and ILIAS\Data\Result\value().

Referenced by buildModalLauncher().

381  : void
382  {
383  if ($result->isOK()) {
384  $conditions_met = true;
385  $message = '';
386  $access_settings_password = $this->main_settings->getAccessSettings()->getPassword();
387  $anonymous = $this->user->isAnonymous();
388  foreach ($result->value() as $key => $value) {
389 
390  switch ($key) {
391  case 'exam_conditions':
392  $exam_conditions_value = (bool) $value;
393  if (!$exam_conditions_value) {
394  $conditions_met = false;
395  $message .= $this->lng->txt('tst_exam_conditions_not_checked_message') . '<br>';
396  }
397  break;
398  case 'exam_password':
399  $password = $value;
400  $exam_password_valid = ($password === $access_settings_password);
401  if (!$exam_password_valid) {
402  $conditions_met = false;
403  $message .= $this->lng->txt('tst_exam_password_invalid_message') . '<br>';
404  }
405  $this->password_checker->setUserEnteredPassword($password);
406  break;
407  case 'exam_access_code':
408  if ($anonymous && !empty($value)) {
409  $this->test_session->setAccessCodeToSession($value);
410  } else {
411  $this->test_session->unsetAccessCodeInSession();
412  }
413  break;
414  case 'exam_use_previous_answers':
415  $exam_use_previous_answers_value = (string) (int) $value;
416  break;
417  }
418  }
419 
420  if ($message !== '') {
421  $this->tpl->setOnScreenMessage(ilGlobalTemplateInterface::MESSAGE_TYPE_FAILURE, $message, true);
422  }
423 
424  if (empty($result->value())) {
425  $this->tpl->setOnScreenMessage(ilGlobalTemplateInterface::MESSAGE_TYPE_FAILURE, $this->lng->txt('tst_exam_required_fields_not_filled_message'), true);
426  } elseif ($conditions_met) {
427  if (
428  !$anonymous &&
429  $this->main_settings->getParticipantFunctionalitySettings()->getUsePreviousAnswerAllowed()
430  ) {
431  $this->user->setPref('tst_use_previous_answers', $exam_use_previous_answers_value ?? '0');
432  $this->user->update();
433  }
434 
435  if (isset($password) && $password === $access_settings_password) {
436  ilSession::set('tst_password_' . $this->object->getTestId(), $password);
437  } else {
438  ilSession::set('tst_password_' . $this->object->getTestId(), '');
439  $this->test_session->setPasswordChecked(false);
440  }
441 
442  $this->ctrl->redirectByClass((new ilTestPlayerFactory($this->object))->getPlayerGUI()::class, ilTestPlayerCommands::INIT_TEST);
443  }
444  } else {
445  $this->tpl->setOnScreenMessage(ilGlobalTemplateInterface::MESSAGE_TYPE_FAILURE, $this->lng->txt('tst_exam_required_fields_not_filled_message'), true);
446  }
447  }
isOK()
Get to know if the result is ok.
value()
Get the encapsulated value.
string $key
Consumer key/client ID value.
Definition: System.php:193
$message
Definition: xapiexit.php:32
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilTestScreenGUI::executeCommand ( )

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

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

78  : void
79  {
80  if ($this->access->checkAccess('read', '', $this->ref_id)) {
81  $this->{$this->ctrl->getCmd(self::DEFAULT_CMD)}();
82  return;
83  }
84 
85  if (!$this->object->getMainSettings()->getAdditionalSettings()->getHideInfoTab()) {
86  $this->ctrl->redirectByClass(ilObjTestGUI::class, 'infoScreen');
87  }
88 
89  $this->tpl->setOnScreenMessage('failure', sprintf(
90  $this->lng->txt('msg_no_perm_read_item'),
91  $this->object->getTitle()
92  ), true);
93  $this->ctrl->setParameterByClass('ilrepositorygui', 'ref_id', ROOT_FOLDER_ID);
94  $this->ctrl->redirectByClass('ilrepositorygui');
95  }
const ROOT_FOLDER_ID
Definition: constants.php:32
+ Here is the call graph for this function:

◆ getLauncher()

ilTestScreenGUI::getLauncher ( )
private

Definition at line 196 of file class.ilTestScreenGUI.php.

References ilObjTestAccess\_lookupOnlineTestAccess(), blockUserAfterHavingPassed(), buildModalLauncher(), ilDatePresentation\formatDate(), getResumeLauncherLink(), getStartLauncherLink(), hasAvailablePasses(), IL_CAL_UNIX, isModalLauncherNeeded(), isUserOutOfProcessingTime(), lastPassSuspended(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ILIAS\Repository\user().

Referenced by handleRenderLauncher().

196  : Launcher
197  {
198  $launcher_factory = $this->ui_factory->launcher();
199 
200  if ($this->object->isStartingTimeEnabled() && !$this->object->startingTimeReached()) {
201  return $launcher_factory
202  ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
203  ->withButtonLabel(sprintf(
204  $this->lng->txt('detail_starting_time_not_reached'),
205  ilDatePresentation::formatDate(new ilDateTime($this->object->getStartingTime(), IL_CAL_UNIX))
206  ), false)
207  ;
208  }
209 
210  if ($this->object->isEndingTimeEnabled() && $this->object->endingTimeReached()) {
211  return $launcher_factory
212  ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
213  ->withButtonLabel(sprintf(
214  $this->lng->txt('detail_ending_time_reached'),
215  ilDatePresentation::formatDate(new ilDateTime($this->object->getEndingTime(), IL_CAL_UNIX))
216  ), false)
217  ;
218  }
219 
220  if ($this->isUserOutOfProcessingTime()) {
221  return $launcher_factory
222  ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
223  ->withButtonLabel($this->lng->txt('tst_out_of_time_message'), false)
224  ;
225  }
226 
227  if ($this->object->getFixedParticipants() && $this->object->getInvitedUsers($this->user->getId()) === []) {
228  return $launcher_factory
229  ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
230  ->withButtonLabel($this->lng->txt('tst_exam_not_assigned_participant_disclaimer'), false)
231  ;
232  }
233 
234  if (ilObjTestAccess::_lookupOnlineTestAccess($this->object->getId(), $this->user->getId()) !== true) {
235  return $launcher_factory
236  ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
237  ->withButtonLabel($this->lng->txt('user_wrong_clientip'), false)
238  ;
239  }
240 
241  if (!$this->hasAvailablePasses()) {
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_launcher_button_label_passes_limit_reached'), false);
245  }
246 
247  if ($this->blockUserAfterHavingPassed()) {
248  return $launcher_factory
249  ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
250  ->withButtonLabel($this->lng->txt('tst_already_passed_cannot_retake'), false)
251  ;
252  }
253 
254  $next_pass_allowed_timestamp = 0;
255  if (!$this->object->isNextPassAllowed($this->test_passes_selector, $next_pass_allowed_timestamp)) {
256  return $launcher_factory
257  ->inline($this->data_factory->link('', $this->data_factory->uri($this->http->request()->getUri()->__toString())))
258  ->withButtonLabel(
259  sprintf(
260  $this->lng->txt('wait_for_next_pass_hint_msg'),
261  ilDatePresentation::formatDate(new ilDateTime($next_pass_allowed_timestamp, IL_CAL_UNIX)),
262  ),
263  false
264  )
265  ;
266  }
267 
268  if ($this->lastPassSuspended()) {
269  return $launcher_factory->inline($this->getResumeLauncherLink());
270  }
271 
272  if ($this->isModalLauncherNeeded()) {
273  return $this->buildModalLauncher();
274  }
275  return $launcher_factory->inline($this->getStartLauncherLink());
276  }
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
const IL_CAL_UNIX
static _lookupOnlineTestAccess($a_test_id, $a_user_id)
Checks if a user is allowd to run an online exam.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getModalLauncherInputs()

ilTestScreenGUI::getModalLauncherInputs ( )
private

Definition at line 310 of file class.ilTestScreenGUI.php.

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

Referenced by buildModalLauncher().

310  : array
311  {
312  if ($this->main_settings->getIntroductionSettings()->getExamConditionsCheckboxEnabled()) {
313  $modal_inputs['exam_conditions'] = $this->ui_factory->input()->field()->checkbox(
314  $this->lng->txt('tst_exam_conditions'),
315  $this->lng->txt('tst_exam_conditions_label')
316  )->withRequired(true);
317  }
318 
319  if ($this->main_settings->getAccessSettings()->getPasswordEnabled()) {
320  $modal_inputs['exam_password'] = $this->ui_factory->input()->field()->password(
321  $this->lng->txt('tst_exam_password'),
322  $this->lng->txt('tst_exam_password_label')
323  )->withRevelation(true)
324  ->withRequired(true)
325  ->withAdditionalTransformation(
326  $this->refinery->custom()->transformation(
327  static function (ILIAS\Data\Password $value): string {
328  return $value->toString();
329  }
330  )
331  );
332  }
333 
334  if ($this->user->isAnonymous()) {
335  $access_code_input = $this->ui_factory->input()->field()->text(
336  $this->lng->txt('tst_exam_access_code'),
337  $this->lng->txt('tst_exam_access_code_label')
338  );
339 
340  $access_code_from_session = $this->test_session->getAccessCodeFromSession();
341  if ($access_code_from_session) {
342  $access_code_input = $access_code_input->withValue($access_code_from_session);
343  }
344 
345  $modal_inputs['exam_access_code'] = $access_code_input;
346  }
347 
348  if ($this->main_settings->getParticipantFunctionalitySettings()->getUsePreviousAnswerAllowed()
349  && $this->test_passes_selector->getLastFinishedPass() >= 0) {
350  $modal_inputs['exam_use_previous_answers'] = $this->ui_factory->input()->field()->checkbox(
351  $this->lng->txt('tst_exam_use_previous_answers'),
352  $this->lng->txt('tst_exam_use_previous_answers_label')
353  );
354  }
355 
356  return $modal_inputs ?? [];
357  }
Class ChatMainBarProvider .
A password is used as part of credentials for authentication.
Definition: Password.php:16
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getModalLauncherLink()

ilTestScreenGUI::getModalLauncherLink ( )
private

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

References ILIAS\FileDelivery\http(), and ILIAS\Repository\lng().

Referenced by buildModalLauncher().

304  : Link
305  {
306  $uri = $this->data_factory->uri($this->http->request()->getUri()->__toString())->withParameter('launcher_id', 'exam_modal');
307  return $this->data_factory->link($this->lng->txt('tst_exam_start'), $uri);
308  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getModalLauncherMessageBox()

ilTestScreenGUI::getModalLauncherMessageBox ( )
private

Definition at line 359 of file class.ilTestScreenGUI.php.

References ILIAS\Repository\lng().

Referenced by buildModalLauncher().

359  : ?MessageBox
360  {
361  $exam_conditions_enabled = $this->main_settings->getIntroductionSettings()->getExamConditionsCheckboxEnabled();
362  $password_enabled = $this->main_settings->getAccessSettings()->getPasswordEnabled();
363 
364  if ($exam_conditions_enabled && $password_enabled) {
365  $modal_message_box_message = $this->lng->txt('tst_exam_modal_message_conditions_and_password');
366  } elseif ($exam_conditions_enabled) {
367  $modal_message_box_message = $this->lng->txt('tst_exam_modal_message_conditions');
368  } elseif ($password_enabled) {
369  $modal_message_box_message = $this->lng->txt('tst_exam_modal_message_password');
370  }
371 
372  return isset($modal_message_box_message) ? $this->ui_factory->messageBox()->info($modal_message_box_message) : null;
373  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getResumeLauncherLink()

ilTestScreenGUI::getResumeLauncherLink ( )
private

Definition at line 278 of file class.ilTestScreenGUI.php.

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

Referenced by getLauncher().

278  : Link
279  {
280  $url = $this->ctrl->getLinkTarget((new ilTestPlayerFactory($this->object))->getPlayerGUI(), ilTestPlayerCommands::RESUME_PLAYER);
281  return $this->data_factory->link($this->lng->txt('tst_resume_test'), $this->data_factory->uri(ILIAS_HTTP_PATH . '/' . $url));
282  }
$url
Definition: ltiregstart.php:35
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSkillLevelThresholdsMissingInfo()

ilTestScreenGUI::getSkillLevelThresholdsMissingInfo ( )
private

Definition at line 509 of file class.ilTestScreenGUI.php.

References $message, buildLinkTarget(), ilTestSkillLevelThresholdsGUI\CMD_SHOW_SKILL_THRESHOLDS, and ILIAS\Repository\lng().

Referenced by testScreen().

509  : Component
510  {
511  $message = $this->lng->txt('tst_skl_level_thresholds_missing');
512 
513  $link_target = $this->buildLinkTarget(
515  );
516 
517  $link = $this->ui_factory->link()->standard(
518  $this->lng->txt('tst_skl_level_thresholds_link'),
519  $link_target
520  );
521 
522  return $this->ui_factory->messageBox()->failure($message)->withLinks([$link]);
523  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
buildLinkTarget(string $cmd=null)
$message
Definition: xapiexit.php:32
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStartLauncherLink()

ilTestScreenGUI::getStartLauncherLink ( )
private

Definition at line 375 of file class.ilTestScreenGUI.php.

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

Referenced by getLauncher().

375  : Link
376  {
377  $url = $this->ctrl->getLinkTarget((new ilTestPlayerFactory($this->object))->getPlayerGUI(), ilTestPlayerCommands::INIT_TEST);
378  return $this->data_factory->link($this->lng->txt('tst_exam_start'), $this->data_factory->uri(ILIAS_HTTP_PATH . '/' . $url));
379  }
$url
Definition: ltiregstart.php:35
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleRenderIntroduction()

ilTestScreenGUI::handleRenderIntroduction ( array  $elements)
private

Definition at line 172 of file class.ilTestScreenGUI.php.

References ILIAS\Repository\lng().

Referenced by testScreen().

172  : array
173  {
174  $introduction = $this->object->getIntroduction();
175 
176  if (
177  $this->main_settings->getIntroductionSettings()->getIntroductionEnabled() &&
178  !empty($introduction)
179  ) {
180  $this->content_style->gui()->addCss($this->tpl, $this->ref_id);
181  $elements[] = $this->ui_factory->panel()->standard(
182  $this->lng->txt('tst_introduction'),
183  $this->ui_factory->legacy($introduction),
184  );
185  }
186 
187  return $elements;
188  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleRenderLauncher()

ilTestScreenGUI::handleRenderLauncher ( array  $elements)
private

Definition at line 190 of file class.ilTestScreenGUI.php.

References getLauncher().

Referenced by testScreen().

190  : array
191  {
192  $elements[] = $this->getLauncher();
193  return $elements;
194  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleRenderMessageBox()

ilTestScreenGUI::handleRenderMessageBox ( array  $elements)
private

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

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

Referenced by testScreen().

117  : array
118  {
119  $message_box_message = '';
120  $message_box_message_elements = [];
121 
122  $exam_conditions_enabled = $this->main_settings->getIntroductionSettings()->getExamConditionsCheckboxEnabled();
123  $password_enabled = $this->main_settings->getAccessSettings()->getPasswordEnabled();
124  $test_behaviour_settings = $this->main_settings->getTestBehaviourSettings();
125 
126  if ($exam_conditions_enabled && $password_enabled) {
127  $message_box_message_elements[] = $this->lng->txt('tst_launcher_status_message_conditions_and_password');
128  } elseif ($exam_conditions_enabled) {
129  $message_box_message_elements[] = $this->lng->txt('tst_launcher_status_message_conditions');
130  } elseif ($password_enabled) {
131  $message_box_message_elements[] = $this->lng->txt('tst_launcher_status_message_password');
132  }
133 
134  if ($test_behaviour_settings->getProcessingTimeEnabled() && !$this->isUserOutOfProcessingTime()) {
135  $message_box_message_elements[] = sprintf(
136  $this->lng->txt('tst_time_limit_message'),
137  $test_behaviour_settings->getProcessingTimeAsMinutes()
138  );
139  }
140 
141  $nr_of_tries = $this->object->getNrOfTries();
142 
143  if ($nr_of_tries !== 0) {
144  $message_box_message_elements[] = sprintf($this->lng->txt('tst_attempt_limit_message'), $nr_of_tries);
145  }
146 
147  if ($this->object->isStartingTimeEnabled() && !$this->object->startingTimeReached()) {
148  $message_box_message_elements[] = sprintf(
149  $this->lng->txt('detail_starting_time_not_reached'),
150  ilDatePresentation::formatDate(new ilDateTime($this->object->getStartingTime(), IL_CAL_UNIX))
151  );
152  }
153 
154  if ($this->object->isEndingTimeEnabled() && !$this->object->endingTimeReached()) {
155  $message_box_message_elements[] = sprintf(
156  $this->lng->txt('tst_exam_ending_time_message'),
157  ilDatePresentation::formatDate(new ilDateTime($this->object->getEndingTime(), IL_CAL_UNIX))
158  );
159  }
160 
161  foreach ($message_box_message_elements as $message_box_message_element) {
162  $message_box_message .= ' ' . $message_box_message_element;
163  }
164 
165  if (!empty($message_box_message)) {
166  $elements[] = $this->ui_factory->messageBox()->info($message_box_message);
167  }
168 
169  return $elements;
170  }
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
const IL_CAL_UNIX
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasAvailablePasses()

ilTestScreenGUI::hasAvailablePasses ( )
private

Definition at line 486 of file class.ilTestScreenGUI.php.

Referenced by getLauncher().

486  : bool
487  {
488  $nr_of_tries = $this->object->getNrOfTries();
489 
490  return $nr_of_tries === 0 || (count($this->test_passes_selector->getExistingPasses()) <= $nr_of_tries && count($this->test_passes_selector->getClosedPasses()) < $nr_of_tries);
491  }
+ Here is the caller graph for this function:

◆ isModalLauncherNeeded()

ilTestScreenGUI::isModalLauncherNeeded ( )
private

Definition at line 498 of file class.ilTestScreenGUI.php.

References ILIAS\Repository\user().

Referenced by getLauncher().

498  : bool
499  {
500  return (
501  $this->main_settings->getIntroductionSettings()->getExamConditionsCheckboxEnabled()
502  || $this->main_settings->getAccessSettings()->getPasswordEnabled()
503  || $this->main_settings->getParticipantFunctionalitySettings()->getUsePreviousAnswerAllowed()
504  && $this->test_passes_selector->getLastFinishedPass() >= 0
505  || $this->user->isAnonymous()
506  );
507  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isUserOutOfProcessingTime()

ilTestScreenGUI::isUserOutOfProcessingTime ( )
private

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

References ILIAS\Repository\object().

Referenced by getLauncher(), and handleRenderMessageBox().

459  : bool
460  {
461  $test_behaviour_settings = $this->object->getMainSettings()->getTestBehaviourSettings();
462  if (!$test_behaviour_settings->getProcessingTimeEnabled()
463  || $test_behaviour_settings->getResetProcessingTime()) {
464  return false;
465  }
466 
467  $active_id = $this->test_passes_selector->getActiveId();
468  $last_started_pass = $this->test_session->getLastStartedPass();
469  return $last_started_pass !== null
470  && $this->object->isMaxProcessingTimeReached(
471  $this->object->getStartingTimeOfUser($active_id, $last_started_pass),
472  $active_id
473  );
474  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lastPassSuspended()

ilTestScreenGUI::lastPassSuspended ( )
private

Definition at line 493 of file class.ilTestScreenGUI.php.

Referenced by getLauncher().

493  : bool
494  {
495  return (count($this->test_passes_selector->getExistingPasses()) - count($this->test_passes_selector->getClosedPasses())) === 1;
496  }
+ Here is the caller graph for this function:

◆ testCanBeStarted()

ilTestScreenGUI::testCanBeStarted ( )
private

Definition at line 449 of file class.ilTestScreenGUI.php.

References ILIAS\Repository\object().

449  : bool
450  {
451  if ($this->object->getOfflineStatus()
452  || !$this->object->isComplete($this->object->getQuestionSetConfig())) {
453  return false;
454  }
455 
456  return true;
457  }
+ Here is the call graph for this function:

◆ testScreen()

ilTestScreenGUI::testScreen ( )

Definition at line 97 of file class.ilTestScreenGUI.php.

References $ref_id, areSkillLevelThresholdsMissing(), getSkillLevelThresholdsMissingInfo(), handleRenderIntroduction(), handleRenderLauncher(), handleRenderMessageBox(), ILIAS\Repository\object(), ilTestTabsManager\TAB_ID_TEST, and ILIAS\Repository\tabs().

97  : void
98  {
99  $this->tabs->activateTab(ilTestTabsManager::TAB_ID_TEST);
100  $this->tpl->setPermanentLink($this->object->getType(), $this->ref_id);
101 
102  $elements = [];
103 
104  if ($this->areSkillLevelThresholdsMissing()) {
105  $elements = [$this->getSkillLevelThresholdsMissingInfo()];
106  }
107  $elements = $this->handleRenderMessageBox($elements);
108  $elements = $this->handleRenderIntroduction($elements);
109 
110  $this->tpl->setContent(
111  $this->ui_renderer->render(
112  $this->testCanBeStarted() ? $this->handleRenderLauncher($elements) : $elements
113  )
114  );
115  }
handleRenderLauncher(array $elements)
handleRenderMessageBox(array $elements)
handleRenderIntroduction(array $elements)
+ Here is the call graph for this function:

Field Documentation

◆ $data_factory

readonly DataFactory ilTestScreenGUI::$data_factory
private

Definition at line 47 of file class.ilTestScreenGUI.php.

◆ $main_settings

readonly ilObjTestMainSettings ilTestScreenGUI::$main_settings
private

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

◆ $password_checker

ilTestPasswordChecker ilTestScreenGUI::$password_checker
private

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

◆ $ref_id

readonly int ilTestScreenGUI::$ref_id
private

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

Referenced by testScreen().

◆ $test_passes_selector

readonly ilTestPassesSelector ilTestScreenGUI::$test_passes_selector
private

Definition at line 43 of file class.ilTestScreenGUI.php.

◆ $test_session

readonly ilTestSession ilTestScreenGUI::$test_session
private

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

◆ DEFAULT_CMD


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