ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilTestEvaluationGUI Class Reference

Output class for assessment test evaluation. More...

+ Inheritance diagram for ilTestEvaluationGUI:
+ Collaboration diagram for ilTestEvaluationGUI:

Public Member Functions

 __construct (ilObjTest $object)
 
 getTestAccess ()
 
 setTestAccess ($testAccess)
 
 executeCommand ()
 execute command More...
 
 getEvaluationQuestionId ($question_id, $original_id='')
 Returns the ID of a question for evaluation purposes. More...
 
 printResults ()
 
 showResults ()
 
 outUserPassDetails ()
 
 outUserResultsOverview ()
 
 outUserListOfAnswerPasses ()
 
 outCertificate ()
 
 confirmDeletePass ()
 
 cancelDeletePass ()
 
 performDeletePass ()
 
- Public Member Functions inherited from ilTestServiceGUI
 isContextResultPresentation ()
 
 setContextResultPresentation (bool $contextResultPresentation)
 
 setParticipantData (ilTestParticipantData $participantData)
 
 getParticipantData ()
 
 getPassOverviewTableData (ilTestSession $test_session, array $passes, bool $with_results)
 
 setObjectiveOrientedContainer (ilTestObjectiveOrientedContainer $objective_oriented_container)
 
 getObjectiveOrientedContainer ()
 
 executeCommand ()
 execute command More...
 
 buildPassOverviewTableGUI (ilTestEvaluationGUI $target_gui)
 
 getPassListOfAnswers (&$result_array, $active_id, $pass, $show_solutions=false, $only_answered_questions=false, $show_question_only=false, $show_reached_points=false, $anchorNav=false, ?ilTestQuestionRelatedObjectivesList $objectives_list=null, ?ResultsTitlesBuilder $testResultHeaderLabelBuilder=null)
 Returns the list of answers of a users test pass. More...
 
 getResultsSignature ()
 Returns HTML code for a signature field. More...
 
 getAdditionalUsrDataHtmlAndPopulateWindowTitle (int $active_id, bool $overwrite_anonymity=false)
 Returns the user data for a test results output. More...
 
 getCorrectSolutionOutput ($question_id, $active_id, $pass, ?ilTestQuestionRelatedObjectivesList $objectives_list=null)
 Returns an output of the solution to an answer compared to the correct solution. More...
 
 getObject ()
 

Protected Member Functions

 setCss ()
 
 redirectBackToParticipantsScreen ()
 
 sendPage (string $page)
 
- Protected Member Functions inherited from ilTestServiceGUI
 getPassDetailsOverviewTableGUI (array $result_array, int $active_id, int $pass, ilTestServiceGUI $target_gui, string $target_cmd, ?ilTestQuestionRelatedObjectivesList $objectives_list=null, bool $multiple_objectives_involved=true)
 
 buildPassDetailsOverviewTableGUI (ilTestServiceGUI $target_gui, string $target_cmd)
 
 isGradingMessageRequired ()
 
 getGradingMessageBuilder (int $active_id)
 
 buildQuestionRelatedObjectivesList (ilLOTestQuestionAdapter $objectives_adapter, ilTestQuestionSequence $test_sequence)
 
 populateContent (string $content)
 
 outCorrectSolutionCmd ()
 
 outCorrectSolution ()
 
 populatePassFinishDate (ilTemplate $tpl, ?int $pass_finish_date)
 
 populateExamId (ilTemplate $tpl, int $active_id, int $pass)
 

Protected Attributes

ilTestAccess $testAccess
 
ilTestProcessLockerFactory $processLockerFactory
 
- Protected Attributes inherited from ilTestServiceGUI
readonly RequestDataCollector $testrequest
 
readonly GeneralQuestionPropertiesRepository $questionrepository
 
readonly TestQuestionsRepository $testquestionsrepository
 
ilTestService $service = null
 
readonly ilDBInterface $db
 
readonly ilLanguage $lng
 
readonly TestLogger $logger
 
readonly ilHelpGUI $help
 
readonly ilRbacSystem $rbac_system
 
ilGlobalTemplateInterface ilTemplate $tpl
 sk 2023-08-01: We need this union type, even if it is wrong! To change this More...
 
readonly ContentStyle $content_style
 
readonly ilErrorHandling $error
 
ilAccess $access
 
readonly HTTPServices $http
 
readonly ilCtrlInterface $ctrl
 
readonly ilToolbarGUI $toolbar
 
readonly ilTabsGUI $tabs
 
readonly ilObjectDataCache $obj_cache
 
readonly ilComponentRepository $component_repository
 
readonly ilComponentFactory $component_factory
 
readonly ilObjUser $user
 
readonly ArrayBasedRequestWrapper $post_wrapper
 
readonly ilNavigationHistory $navigation_history
 
readonly Refinery $refinery
 
readonly UIFactory $ui_factory
 
readonly UIRenderer $ui_renderer
 
readonly SkillService $skills_service
 
readonly ilTestShuffler $shuffler
 
readonly ResultsDataFactory $results_data_factory
 
readonly ResultsPresentationFactory $results_presentation_factory
 
readonly ILIAS $ilias
 
readonly ilSetting $settings
 
readonly GlobalScreenServices $global_screen
 
readonly ilTree $tree
 
int $ref_id
 
ilTestSessionFactory $test_session_factory = null
 
ilTestSequenceFactory $test_sequence_factory = null
 
ilTestParticipantData $participantData = null
 
TestResultRepository $test_result_repository
 
ilTestParticipantAccessFilterFactory $participant_access_filter
 

Private Member Functions

 redirectToPassDeletionContext (string $context)
 
 buildResultsTitle (string $participant_name, int $pass)
 
 buildAttemptComponents (int $active_id, int $attempt_id, bool $with_test_results_overview, bool $for_print)
 
 addPrintResultsButtonToToolbar ()
 
 addPrintButtonToToolbar ()
 
 addCertificateDownloadButtonToToolbar ()
 
 addToggleBestSolutionButtonToToolbar ()
 
 addParticipantSelectorToToolbar (array $selected_participants, int $current_active_id)
 
 buildParticipantSelectorArray (array $selected_participants, int $current_active_id)
 
 addAttemptSwitchingViewControlToToolbar (array $available_attempts, int $selected_attempt)
 
 buildAttemptSwitchingViewControl (array $available_attempts, int $selected_attempt)
 
 retrieveSelectedParticipants ()
 
 filterSelectedActiveIdsByAccess (array $selected_active_ids)
 

Private Attributes

const DEFAULT_CMD = 'outUserListOfAnswerPasses'
 
readonly ParticipantRepository $participant_repository
 

Detailed Description

Output class for assessment test evaluation.

The ilTestEvaluationGUI class creates the output for the ilObjTestGUI class when authors evaluate a test. This saves some heap space because the ilObjTestGUI class will be much smaller then

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

\

@ilCtrl_Calls ilTestEvaluationGUI: ilTestPassDetailsOverviewTableGUI @ilCtrl_Calls ilTestEvaluationGUI: ilTestPassDeletionConfirmationGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilTestEvaluationGUI::__construct ( ilObjTest  $object)

Definition at line 56 of file class.ilTestEvaluationGUI.php.

57 {
58 parent::__construct($object);
59 $this->participant_access_filter = new ilTestParticipantAccessFilterFactory($this->access);
60 $this->participant_repository = TestDIC::dic()['participant.repository'];
61
62 $this->processLockerFactory = new ilTestProcessLockerFactory(
63 new ilSetting('assessment'),
64 $this->db,
65 $this->object->getTestLogger()
66 );
67 }
ILIAS Setting Class.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\access(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

Member Function Documentation

◆ addAttemptSwitchingViewControlToToolbar()

ilTestEvaluationGUI::addAttemptSwitchingViewControlToToolbar ( array  $available_attempts,
int  $selected_attempt 
)
private

Definition at line 1003 of file class.ilTestEvaluationGUI.php.

1006 : void {
1007 $selected_attempt++;
1008 $this->toolbar->addComponent(
1010 $available_attempts,
1011 $selected_attempt
1012 )
1013 );
1014 $this->ctrl->clearParameterByClass(self::class, 'attempt');
1015 }
buildAttemptSwitchingViewControl(array $available_attempts, int $selected_attempt)

Referenced by outUserListOfAnswerPasses().

+ Here is the caller graph for this function:

◆ addCertificateDownloadButtonToToolbar()

ilTestEvaluationGUI::addCertificateDownloadButtonToToolbar ( )
private

Definition at line 931 of file class.ilTestEvaluationGUI.php.

931 : void
932 {
933 $this->toolbar->addComponent(
934 $this->ui_factory->button()->standard(
935 $this->lng->txt('certificate'),
936 $this->ctrl->getLinkTargetByClass(self::class, 'outCertificate')
937 )
938 );
939 }

References ILIAS\Repository\toolbar().

Referenced by outUserPassDetails(), and outUserResultsOverview().

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

◆ addParticipantSelectorToToolbar()

ilTestEvaluationGUI::addParticipantSelectorToToolbar ( array  $selected_participants,
int  $current_active_id 
)
private

Definition at line 968 of file class.ilTestEvaluationGUI.php.

971 : void {
972 $this->toolbar->addSeparator();
973 $this->toolbar->addComponent(
974 $this->ui_factory->dropdown()
975 ->standard(
976 $this->buildParticipantSelectorArray($selected_participants, $current_active_id)
977 )->withLabel($this->lng->txt('tst_res_jump_to_participant_hint_opt'))
978 );
979 }

Referenced by showResults().

+ Here is the caller graph for this function:

◆ addPrintButtonToToolbar()

ilTestEvaluationGUI::addPrintButtonToToolbar ( )
private

Definition at line 917 of file class.ilTestEvaluationGUI.php.

917 : void
918 {
919 $this->toolbar->addComponent(
920 $this->ui_factory->button()->standard(
921 $this->lng->txt('print'),
922 ''
923 )->withOnLoadCode(
924 fn($id): string => "document.getElementById('{$id}').addEventListener('click', "
925 . "()=>{window.print();}"
926 . ');'
927 )
928 );
929 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id, and ILIAS\Repository\toolbar().

Referenced by outUserListOfAnswerPasses(), outUserPassDetails(), and outUserResultsOverview().

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

◆ addPrintResultsButtonToToolbar()

ilTestEvaluationGUI::addPrintResultsButtonToToolbar ( )
private

Definition at line 902 of file class.ilTestEvaluationGUI.php.

902 : void
903 {
904 $link = $this->ctrl->getLinkTargetByClass(self::class, 'printResults');
905 $this->toolbar->addComponent(
906 $this->ui_factory->button()->standard(
907 $this->lng->txt('print'),
908 ''
909 )->withOnLoadCode(
910 fn($id): string => "document.getElementById('{$id}').addEventListener('click', "
911 . "(e) => {window.open('{$link}');}"
912 . ');'
913 )
914 );
915 }

References $id, ILIAS\Repository\ctrl(), and ILIAS\Repository\toolbar().

Referenced by showResults().

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

◆ addToggleBestSolutionButtonToToolbar()

ilTestEvaluationGUI::addToggleBestSolutionButtonToToolbar ( )
private

Definition at line 941 of file class.ilTestEvaluationGUI.php.

941 : void
942 {
943 if ($this->testrequest->isset('show_best_solutions')) {
945 'tst_results_show_best_solutions',
946 $this->testrequest->int('show_best_solutions') === 1
947 );
948 }
949
950 if (ilSession::get('tst_results_show_best_solutions')) {
951 $this->ctrl->setParameter($this, 'show_best_solutions', '0');
952 $label = $this->lng->txt('tst_btn_hide_best_solutions');
953 } else {
954 $this->ctrl->setParameter($this, 'show_best_solutions', '1');
955 $label = $this->lng->txt('tst_btn_show_best_solutions');
956 }
957
958 $this->toolbar->addSeparator();
959 $this->toolbar->addComponent(
960 $this->ui_factory->button()->standard(
961 $label,
962 $this->ctrl->getLinkTargetByClass(self::class, $this->ctrl->getCmd(self::DEFAULT_CMD))
963 )
964 );
965 $this->ctrl->clearParameters($this, 'show_best_solutions');
966 }
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.

References ILIAS\Repository\ctrl(), ilSession\get(), ILIAS\Repository\lng(), ilSession\set(), and ILIAS\Repository\toolbar().

Referenced by showResults().

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

◆ buildAttemptComponents()

ilTestEvaluationGUI::buildAttemptComponents ( int  $active_id,
int  $attempt_id,
bool  $with_test_results_overview,
bool  $for_print 
)
private

Definition at line 829 of file class.ilTestEvaluationGUI.php.

834 : array {
835 $settings = $this->results_presentation_factory->getAttemptResultsSettings(
836 $this->object,
837 false
838 );
839 $attempt_overview = $this->ui_factory->panel()->sub(
840 $this->lng->txt('question_summary'),
841 $this->results_data_factory->getAttemptOverviewFor(
842 $settings,
843 $this->object,
844 $active_id,
845 $attempt_id
846 )->getAsDescriptiveListing(
847 $this->lng,
848 $this->ui_factory,
849 [
850 'timezone' => new DateTimeZone($this->user->getTimeZone()),
851 'datetimeformat' => $this->user->getDateTimeFormat()->toString()
852 ]
853 )
854 );
855
856 if ($with_test_results_overview) {
857 $attempt_overview = $attempt_overview->withFurtherInformation(
858 $this->ui_factory->card()->standard($this->lng->txt('overview'))->withSections([
859 $this->results_data_factory->getOverviewDataForTest($this->object)
860 ->getAsDescriptiveListing(
861 $this->lng,
862 $this->ui_factory
863 )
864 ])
865 );
866 }
867
868 $results_presentation_table = $this->results_presentation_factory->getAttemptResultsPresentationTable(
869 $this->results_data_factory->getAttemptResultsFor(
870 $settings,
871 $this->object,
872 $active_id,
873 $attempt_id,
874 false
875 ),
876 $settings,
877 '',
878 $for_print
879 )->getTableComponent();
880
881 if ($for_print) {
882 $signal = $results_presentation_table->getExpandAllSignal();
883 $signal_options = json_encode(['options' => $signal->getOptions()]);
884 $results_presentation_table = [
885 $results_presentation_table,
886 $this->ui_factory->legacy()->content('')->withAdditionalOnLoadCode(
887 static fn(string $id): string => "$(document).trigger('{$signal->getId()}', $signal_options);"
888 )
889 ];
890 }
891
892
893
894 $attempt_details = $this->ui_factory->panel()->sub(
895 $this->lng->txt('details'),
896 $results_presentation_table
897 );
898
899 return [$attempt_overview, $attempt_details];
900 }
readonly ilSetting $settings

Referenced by printResults(), and showResults().

+ Here is the caller graph for this function:

◆ buildAttemptSwitchingViewControl()

ilTestEvaluationGUI::buildAttemptSwitchingViewControl ( array  $available_attempts,
int  $selected_attempt 
)
private

Definition at line 1017 of file class.ilTestEvaluationGUI.php.

1020 : ViewControlMode {
1021 return $this->ui_factory->viewControl()->mode(
1022 array_reduce(
1023 $available_attempts,
1024 function (array $c, int $v): array {
1025 $this->ctrl->setParameterByClass(self::class, 'attempt', $v);
1026 $attempt = $v + 1;
1027 $c["{$this->lng->txt('tst_attempt')} {$attempt}"] = $this
1028 ->ctrl->getLinkTargetByClass(self::class, $this->ctrl->getCmd(self::DEFAULT_CMD));
1029 return $c;
1030 },
1031 []
1032 ),
1033 $this->lng->txt('select_attempt')
1034 )->withActive("{$this->lng->txt('tst_attempt')} {$selected_attempt}");
1035 }

Referenced by showResults().

+ Here is the caller graph for this function:

◆ buildParticipantSelectorArray()

ilTestEvaluationGUI::buildParticipantSelectorArray ( array  $selected_participants,
int  $current_active_id 
)
private

Definition at line 981 of file class.ilTestEvaluationGUI.php.

984 : array {
985 $selected_active_ids = array_keys($selected_participants);
986 $this->ctrl->setParameterByClass(self::class, 'active_ids', implode(',', $selected_active_ids));
987 unset($selected_active_ids[array_search($current_active_id, $selected_active_ids)]);
988 $available_user_links = array_map(
989 function (int $v) use ($selected_participants): StandardLink {
990 $this->ctrl->setParameterByClass(self::class, 'active_id', $v);
991 return $this->ui_factory->link()->standard(
992 $selected_participants[$v],
993 $this->ctrl->getLinkTargetByClass(self::class, 'showResults')
994 );
995 },
996 $selected_active_ids
997 );
998 $this->ctrl->clearParameterByClass(self::class, 'active_id');
999 $this->ctrl->clearParameterByClass(self::class, 'active_ids');
1000 return $available_user_links;
1001 }

◆ buildResultsTitle()

ilTestEvaluationGUI::buildResultsTitle ( string  $participant_name,
int  $pass 
)
private

Definition at line 814 of file class.ilTestEvaluationGUI.php.

814 : string
815 {
816 if ($this->object->getAnonymity()) {
817 return sprintf(
818 $this->lng->txt('tst_eval_results_by_pass_lo'),
819 $pass + 1
820 );
821 }
822 return sprintf(
823 $this->lng->txt('tst_result_user_name_pass'),
824 $pass + 1,
825 $participant_name
826 );
827 }

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

Referenced by printResults(), and showResults().

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

◆ cancelDeletePass()

ilTestEvaluationGUI::cancelDeletePass ( )

Definition at line 590 of file class.ilTestEvaluationGUI.php.

590 : void
591 {
592 $this->redirectToPassDeletionContext($this->testrequest->strVal('context'));
593 }
redirectToPassDeletionContext(string $context)

References redirectToPassDeletionContext().

+ Here is the call graph for this function:

◆ confirmDeletePass()

ilTestEvaluationGUI::confirmDeletePass ( )

Definition at line 572 of file class.ilTestEvaluationGUI.php.

573 {
574 if ($this->testrequest->isset('context') && strlen($this->testrequest->raw('context'))) {
575 $context = $this->testrequest->raw('context');
576 } else {
578 }
579
580 if (!$this->object->isPassDeletionAllowed()) {
581 $this->redirectToPassDeletionContext($context);
582 }
583
584 $confirm = new ilTestPassDeletionConfirmationGUI($this->ctrl, $this->lng, $this);
585 $confirm->build($this->testrequest->getActiveId('active_id'), $this->testrequest->int('pass'), $context);
586
587 $this->tpl->setContent($this->ctrl->getHTML($confirm));
588 }

References ilTestPassDeletionConfirmationGUI\CONTEXT_PASS_OVERVIEW, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and redirectToPassDeletionContext().

+ Here is the call graph for this function:

◆ executeCommand()

ilTestEvaluationGUI::executeCommand ( )

execute command

Reimplemented from ilTestServiceGUI.

Definition at line 79 of file class.ilTestEvaluationGUI.php.

80 {
81 $cmd = $this->ctrl->getCmd(self::DEFAULT_CMD);
82 $next_class = $this->ctrl->getNextClass($this);
83 $this->ctrl->saveParameter($this, 'sequence');
84 $this->ctrl->saveParameter($this, 'active_id');
85
86 switch ($next_class) {
87 case 'iltestpassdetailsoverviewtablegui':
88 $tableGUI = new ilTestPassDetailsOverviewTableGUI($this->ctrl, $this, 'outUserPassDetails');
89 $this->ctrl->forwardCommand($tableGUI);
90 break;
91
92 default:
93 if (in_array($cmd, ['excel_scored_test_run', 'excel_all_test_runs'])) {
94 $ret = $this->exportEvaluation($cmd);
95 } elseif (in_array($cmd, ['excel_all_test_runs_a'])) {
96 $ret = $this->exportAggregatedResults($cmd);
97 } else {
98 $ret = $this->$cmd();
99 }
100 break;
101 }
102 return $ret;
103 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ filterSelectedActiveIdsByAccess()

ilTestEvaluationGUI::filterSelectedActiveIdsByAccess ( array  $selected_active_ids)
private

Definition at line 1061 of file class.ilTestEvaluationGUI.php.

1063 : array {
1064 return array_filter(
1065 $selected_active_ids,
1066 fn(int $v): bool => $this->testAccess->checkResultsAccessForActiveId(
1067 $v,
1068 $this->object->getTestId()
1069 )
1070 );
1071 }

◆ getEvaluationQuestionId()

ilTestEvaluationGUI::getEvaluationQuestionId (   $question_id,
  $original_id = '' 
)

Returns the ID of a question for evaluation purposes.

If a question id and the id of the original question are given, this function returns the original id, otherwise the question id

Returns
int question or original id

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

112 {
113 if ($original_id > 0) {
114 return $original_id;
115 } else {
116 return $question_id;
117 }
118 }

◆ getTestAccess()

ilTestEvaluationGUI::getTestAccess ( )

Definition at line 69 of file class.ilTestEvaluationGUI.php.

References $testAccess.

◆ outCertificate()

ilTestEvaluationGUI::outCertificate ( )

Definition at line 558 of file class.ilTestEvaluationGUI.php.

559 {
560 $ilUserCertificateRepository = new ilUserCertificateRepository($this->db, $this->logger->getComponentLogger());
561 $pdfGenerator = new ilPdfGenerator($ilUserCertificateRepository);
562
563 $pdfAction = new ilCertificatePdfAction(
564 $pdfGenerator,
566 $this->lng->txt('error_creating_certificate_pdf')
567 );
568
569 $pdfAction->downloadPdf($this->user->getId(), $this->object->getId());
570 }
Just a wrapper class to create Unit Test for other classes.

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

+ Here is the call graph for this function:

◆ outUserListOfAnswerPasses()

ilTestEvaluationGUI::outUserListOfAnswerPasses ( )

Definition at line 453 of file class.ilTestEvaluationGUI.php.

454 {
455 if (!$this->object->getShowSolutionPrintview()) {
456 $this->tpl->setOnScreenMessage('info', $this->lng->txt('no_permission'), true);
457 $this->ctrl->redirectByClass([ilRepositoryGUI::class, ilObjTestGUI::class, ilInfoScreenGUI::class]);
458 }
459
460 $template = new ilTemplate('tpl.il_as_tst_info_list_of_answers.html', true, true, 'components/ILIAS/Test');
461
462 $user_id = $this->user->getId();
463
464 $test_session = $this->test_session_factory->getSession();
465 $active_id = $test_session->getActiveId();
466
467 if ($this->testrequest->isset('attempt')) {
468 $attempt = $this->testrequest->int('attempt');
469 } else {
470 $attempt = \ilObjTest::_getResultPass($test_session->getActiveId());
471 }
472
473 $test_passes_selector = new ilTestPassesSelector($this->db, $this->object);
474 $test_passes_selector->setActiveId($test_session->getActiveId());
475 $test_passes_selector->setLastFinishedPass($test_session->getLastFinishedPass());
476
477 if (count($test_passes_selector->getClosedPasses()) > 1) {
478 $this->addAttemptSwitchingViewControlToToolbar($test_passes_selector->getClosedPasses(), $attempt);
479 }
480
482
483 $test_result_header_label_builder = new ResultsTitlesBuilder($this->lng, $this->obj_cache);
484 $test_result_header_label_builder->setAttemptLastAccessDate(
485 (new \DateTimeImmutable(
486 '@' . ilObjTest::lookupLastTestPassAccess($test_session->getActiveId(), $attempt)
487 ))->setTimezone(new \DateTimeZone($this->user->getTimeZone()))
488 ->format($this->user->getDateTimeFormat()->toString())
489 );
490
491 $objectives_list = null;
492 if ($this->getObjectiveOrientedContainer()?->isObjectiveOrientedPresentationRequired()) {
493 $test_sequence = $this->test_sequence_factory->getSequenceByActiveIdAndPass($active_id, $attempt);
494 $test_sequence->loadFromDb();
495 $test_sequence->loadQuestions();
496
497 $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($test_session);
498
499 $objectives_list = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $test_sequence);
500 $objectives_list->loadObjectivesTitles();
501
502 $test_result_header_label_builder->setObjectiveOrientedContainerId($test_session->getObjectiveOrientedContainerId());
503 $test_result_header_label_builder->setUserId($test_session->getUserId());
504 $test_result_header_label_builder->setTestObjId($this->object->getId());
505 $test_result_header_label_builder->setTestRefId($this->object->getRefId());
506 $test_result_header_label_builder->initObjectiveOrientedMode();
507 }
508
509 $result_array = $this->object->getTestResult(
510 $active_id,
511 $attempt,
512 false,
513 !$this->getObjectiveOrientedContainer()?->isObjectiveOrientedPresentationRequired()
514 );
515
516 $signature = $this->getResultsSignature();
517 $show_all_answers = true;
518 if ($this->object->isExecutable($test_session, $user_id)) {
519 $show_all_answers = false;
520 }
521 $this->setContextResultPresentation(false);
522 $answers = $this->getPassListOfAnswers(
523 $result_array,
524 $active_id,
525 $attempt,
526 false,
527 $show_all_answers,
528 false,
529 false,
530 false,
531 $objectives_list,
532 $test_result_header_label_builder
533 );
534 $template->setVariable('PASS_DETAILS', $answers);
535
537 $active_id,
538 $test_session->getUserId() === $user_id
539 );
540 $template->setVariable('USER_DATA', $user_data);
541 if (strlen($signature)) {
542 $template->setVariable('SIGNATURE', $signature);
543 }
544 if (!is_null($attempt) && $this->object->isShowExamIdInTestResultsEnabled()) {
545 $template->setCurrentBlock('exam_id_footer');
546 $template->setVariable('EXAM_ID_VAL', ilObjTest::lookupExamId(
547 $test_session->getActiveId(),
548 $attempt
549 ));
550 $template->setVariable('EXAM_ID_TXT', $this->lng->txt('exam_id'));
551 $template->parseCurrentBlock();
552 }
553
554 $this->setCss();
555 $this->tpl->setVariable('ADM_CONTENT', $template->get());
556 }
static getInstance(ilTestSession $a_test_session)
static _getResultPass($active_id)
Retrieves the pass number that should be counted for a given user.
static lookupExamId($active_id, $pass)
special template class to simplify handling of ITX/PEAR
addAttemptSwitchingViewControlToToolbar(array $available_attempts, int $selected_attempt)
setContextResultPresentation(bool $contextResultPresentation)
getAdditionalUsrDataHtmlAndPopulateWindowTitle(int $active_id, bool $overwrite_anonymity=false)
Returns the user data for a test results output.
buildQuestionRelatedObjectivesList(ilLOTestQuestionAdapter $objectives_adapter, ilTestQuestionSequence $test_sequence)
getResultsSignature()
Returns HTML code for a signature field.
getPassListOfAnswers(&$result_array, $active_id, $pass, $show_solutions=false, $only_answered_questions=false, $show_question_only=false, $show_reached_points=false, $anchorNav=false, ?ilTestQuestionRelatedObjectivesList $objectives_list=null, ?ResultsTitlesBuilder $testResultHeaderLabelBuilder=null)
Returns the list of answers of a users test pass.

References $user_id, ilObjTest\_getResultPass(), addAttemptSwitchingViewControlToToolbar(), addPrintButtonToToolbar(), ilTestServiceGUI\buildQuestionRelatedObjectivesList(), ILIAS\Repository\ctrl(), ilTestServiceGUI\getAdditionalUsrDataHtmlAndPopulateWindowTitle(), ilLOTestQuestionAdapter\getInstance(), ilTestServiceGUI\getObjectiveOrientedContainer(), ilTestServiceGUI\getPassListOfAnswers(), ilTestServiceGUI\getResultsSignature(), ILIAS\Repository\lng(), ilObjTest\lookupExamId(), ILIAS\Repository\object(), ilTestServiceGUI\setContextResultPresentation(), setCss(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ outUserPassDetails()

ilTestEvaluationGUI::outUserPassDetails ( )

Definition at line 234 of file class.ilTestEvaluationGUI.php.

234 : void
235 {
236 $this->tabs->clearSubTabs();
237 $this->tabs->setBackTarget($this->lng->txt('tst_results_back_overview'), $this->ctrl->getLinkTarget($this));
238
239 $test_session = $this->test_session_factory->getSession();
240
241 if (!$this->object->getShowPassDetails()) {
242 $this->ctrl->redirectByClass([ilRepositoryGUI::class, ilObjTestGUI::class, ilInfoScreenGUI::class]);
243 }
244
245 $active_id = $test_session->getActiveId();
246 $user_id = $test_session->getUserId();
247
248 $this->ctrl->saveParameter($this, 'pass');
249 $pass = $this->testrequest->int('pass');
250
251 $test_result_header_label_builder = new ResultsTitlesBuilder($this->lng, $this->obj_cache);
252
253 $objectives_list = null;
254
255 $consider_hidden_questions = true;
256 $consider_optional_questions = true;
257
258 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
259 $consider_hidden_questions = false;
260 $consider_optional_questions = true;
261
262 $test_sequence = $this->test_sequence_factory->getSequenceByActiveIdAndPass($active_id, $pass);
263 $test_sequence->loadFromDb();
264 $test_sequence->loadQuestions();
265
266 if ($this->object->isRandomTest() && !$test_sequence->isAnsweringOptionalQuestionsConfirmed()) {
267 $consider_optional_questions = false;
268 }
269
270 $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($test_session);
271
272 $objectives_list = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $test_sequence);
273 $objectives_list->loadObjectivesTitles();
274
275 $test_result_header_label_builder->setObjectiveOrientedContainerId($test_session->getObjectiveOrientedContainerId());
276 $test_result_header_label_builder->setUserId($test_session->getUserId());
277 $test_result_header_label_builder->setTestObjId($this->object->getId());
278 $test_result_header_label_builder->setTestRefId($this->object->getRefId());
279 $test_result_header_label_builder->initObjectiveOrientedMode();
280 }
281
282 $tpl = new ilTemplate('tpl.il_as_tst_pass_details_overview_participants.html', true, true, 'components/ILIAS/Test');
283
285
286 if ((new ilCertificateDownloadValidator())->isCertificateDownloadable($user_id, $this->object->getId())) {
288 }
289
290 $tpl->setCurrentBlock('signature');
291 $tpl->setVariable('SIGNATURE', $this->getResultsSignature());
293
294 if ($this->object->isShowExamIdInTestResultsEnabled()) {
295 if ($this->object->isShowExamIdInTestResultsEnabled()) {
297 $test_session->getActiveId(),
298 $pass
299 ));
300 $tpl->setVariable('EXAM_ID_TXT', $this->lng->txt('exam_id'));
301 }
302 }
303
304 if (!$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired() &&
305 $this->isGradingMessageRequired() && $this->object->getNrOfTries() == 1) {
306 $grading_message_builder = $this->getGradingMessageBuilder($active_id);
307 $grading_message_builder->buildMessage();
308 $grading_message_builder->sendMessage();
309 }
310
311 $data = $this->object->getCompleteEvaluationData();
312 $reached = $data->getParticipant($active_id)->getPass($pass)->getReachedPoints();
313 $max = $data->getParticipant($active_id)->getPass($pass)->getMaxPoints();
314 $percent = $max ? $reached / $max * 100.0 : 0;
315 $result = $data->getParticipant($active_id)->getPass($pass)->getReachedPoints() . ' ' . strtolower($this->lng->txt('of')) . ' ' . $data->getParticipant($active_id)->getPass($pass)->getMaxPoints() . ' (' . sprintf('%2.2f', $percent) . ' %' . ')';
316 $tpl->setCurrentBlock('total_score');
317 $tpl->setVariable('TOTAL_RESULT_TEXT', $this->lng->txt('tst_stat_result_resultspoints'));
318 $tpl->setVariable('TOTAL_RESULT', $result);
320
321 $tpl->setVariable('TEXT_RESULTS', $test_result_header_label_builder->getPassDetailsHeaderLabel($pass + 1));
322 $tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this));
323
324 $this->populateExamId($tpl, $active_id, (int) $pass);
325 $this->populatePassFinishDate($tpl, ilObjTest::lookupLastTestPassAccess($active_id, $pass));
326
327 $this->setCss();
328
329 $settings = $this->results_presentation_factory->getAttemptResultsSettings(
330 $this->object,
331 true
332 );
333 $table = $this->results_presentation_factory->getAttemptResultsPresentationTable(
334 $this->results_data_factory->getAttemptResultsFor(
335 $settings,
336 $this->object,
337 $active_id,
338 $pass,
339 true
340 ),
341 $settings,
342 $this->buildResultsTitle(
343 $this->participant_repository->getParticipantByActiveId(
344 $this->object->getTestId(),
345 $active_id
346 )->getDisplayName($this->lng),
347 $pass
348 ),
349 false
350 );
351
352 $tpl->setVariable('LIST_OF_ANSWERS', $table->render());
353
354 $this->tpl->addCss(ilObjStyleSheet::getContentStylePath(0));
355
356 $this->tpl->setContent(
357 $tpl->get()
358 );
359 }
Validates if an active certificate is stored in the database and can be downloaded by the user.
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
populatePassFinishDate(ilTemplate $tpl, ?int $pass_finish_date)
populateExamId(ilTemplate $tpl, int $active_id, int $pass)
ilGlobalTemplateInterface ilTemplate $tpl
sk 2023-08-01: We need this union type, even if it is wrong! To change this
getGradingMessageBuilder(int $active_id)
setVariable(string $variable, $value='')
Sets the given variable to the given value.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
$data
Definition: storeScorm.php:45

References $data, ilTestServiceGUI\$settings, ilTestServiceGUI\$tpl, $user_id, addCertificateDownloadButtonToToolbar(), addPrintButtonToToolbar(), ilTestServiceGUI\buildQuestionRelatedObjectivesList(), ILIAS\Repository\ctrl(), ILIAS\UICore\GlobalTemplate\get(), ilObjStyleSheet\getContentStylePath(), ilTestServiceGUI\getGradingMessageBuilder(), ilLOTestQuestionAdapter\getInstance(), ilTestServiceGUI\getObjectiveOrientedContainer(), ilTestServiceGUI\getResultsSignature(), ilTestServiceGUI\isGradingMessageRequired(), ILIAS\Repository\lng(), ilObjTest\lookupExamId(), ILIAS\Repository\object(), ILIAS\UICore\GlobalTemplate\parseCurrentBlock(), ilTestServiceGUI\populateExamId(), ilTestServiceGUI\populatePassFinishDate(), setCss(), ILIAS\UICore\GlobalTemplate\setCurrentBlock(), ILIAS\UICore\GlobalTemplate\setVariable(), and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

◆ outUserResultsOverview()

ilTestEvaluationGUI::outUserResultsOverview ( )

Definition at line 361 of file class.ilTestEvaluationGUI.php.

362 {
363 $test_session = $this->test_session_factory->getSession();
364 $active_id = $test_session->getActiveId();
365 $user_id = $this->user->getId();
366
367 if (!$this->object->canShowTestResults($test_session)) {
368 $this->ctrl->redirectByClass([ilRepositoryGUI::class, ilObjTestGUI::class, ilInfoScreenGUI::class]);
369 }
370
371 $templatehead = new ilTemplate('tpl.il_as_tst_results_participants.html', true, true, 'components/ILIAS/Test');
372 $template = new ilTemplate('tpl.il_as_tst_results_participant.html', true, true, 'components/ILIAS/Test');
373
375
376 if ((new ilCertificateDownloadValidator())->isCertificateDownloadable($user_id, $this->object->getId())) {
378 }
379
380 $test_result_header_label_builder = new ResultsTitlesBuilder($this->lng, $this->obj_cache);
381 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
382 $test_result_header_label_builder->setObjectiveOrientedContainerId($test_session->getObjectiveOrientedContainerId());
383 $test_result_header_label_builder->setUserId($test_session->getUserId());
384 $test_result_header_label_builder->setTestObjId($this->object->getId());
385 $test_result_header_label_builder->setTestRefId($this->object->getRefId());
386 $test_result_header_label_builder->initObjectiveOrientedMode();
387 }
388
389 $template->setCurrentBlock('pass_overview');
390
391 $test_passes_selector = new ilTestPassesSelector($this->db, $this->object);
392 $test_passes_selector->setActiveId($test_session->getActiveId());
393 $test_passes_selector->setLastFinishedPass($test_session->getLastFinishedPass());
394
395 $pass_overview_table_gui = $this->buildPassOverviewTableGUI($this);
396 $pass_overview_table_gui->setActiveId($test_session->getActiveId());
397 $pass_overview_table_gui->setResultPresentationEnabled(true);
398 if ($this->object->getShowPassDetails()) {
399 $pass_overview_table_gui->setPassDetailsCommand('outUserPassDetails');
400 }
401 if ($this->object->isPassDeletionAllowed()) {
402 $pass_overview_table_gui->setPassDeletionCommand('confirmDeletePass');
403 }
404 $pass_overview_table_gui->init();
405 $pass_overview_table_gui->setData($this->getPassOverviewTableData($test_session, $test_passes_selector->getReportablePasses(), true));
406 $pass_overview_table_gui->setTitle($test_result_header_label_builder->getPassOverviewHeaderLabel());
407 $overview = $pass_overview_table_gui->getHTML();
408 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
409 $lo_status = new ilTestLearningObjectivesStatusGUI(
410 $this->lng,
411 $this->ctrl,
412 $this->ui_factory,
413 $this->ui_renderer,
414 $this->testrequest
415 );
416 $lo_status->setCrsObjId($this->getObjectiveOrientedContainer()->getObjId());
417 $lo_status->setUsrId($test_session->getUserId());
418 $overview .= '<br />' . $lo_status->getHTML();
419 }
420 $template->setVariable('PASS_OVERVIEW', $overview);
421 $template->parseCurrentBlock();
422
423 if ($this->isGradingMessageRequired()) {
424 $grading_message_builder = $this->getGradingMessageBuilder($active_id);
425 $grading_message_builder->buildMessage();
426 $grading_message_builder->sendMessage();
427 }
428
429 if (!$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
430 $overwrite_anonymity = $test_session->getUserId() === $user_id;
431 if (!$overwrite_anonymity && $this->object->getAnonymity()) {
432 $template->setVariable('TEXT_HEADING', $this->lng->txt('tst_result'));
433 } else {
434 $template->setVariable(
435 'TEXT_HEADING',
436 sprintf(
437 $this->lng->txt('tst_result_user_name'),
438 $this->object->userLookupFullName($user_id, $overwrite_anonymity)
439 )
440 );
441 $template->setVariable(
442 'USER_DATA',
443 $this->getAdditionalUsrDataHtmlAndPopulateWindowTitle($active_id, $overwrite_anonymity)
444 );
445 }
446 }
447
448 $this->setCss();
449 $templatehead->setVariable('RESULTS_PARTICIPANT', $template->get());
450 $this->tpl->setContent($templatehead->get());
451 }
buildPassOverviewTableGUI(ilTestEvaluationGUI $target_gui)
getPassOverviewTableData(ilTestSession $test_session, array $passes, bool $with_results)

References $user_id, addCertificateDownloadButtonToToolbar(), addPrintButtonToToolbar(), ilTestServiceGUI\buildPassOverviewTableGUI(), ILIAS\Repository\ctrl(), ilTestServiceGUI\getAdditionalUsrDataHtmlAndPopulateWindowTitle(), ilTestServiceGUI\getGradingMessageBuilder(), ilTestServiceGUI\getObjectiveOrientedContainer(), ilTestServiceGUI\getPassOverviewTableData(), ilTestServiceGUI\isGradingMessageRequired(), ILIAS\Repository\lng(), ILIAS\Repository\object(), setCss(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ performDeletePass()

ilTestEvaluationGUI::performDeletePass ( )

Definition at line 608 of file class.ilTestEvaluationGUI.php.

608 : void
609 {
610 $context = $this->testrequest->strVal('context') ?? ilTestPassDeletionConfirmationGUI::CONTEXT_PASS_OVERVIEW;
611 $active_fi = $this->testrequest->int('active_id');
612 $pass = $this->testrequest->int('pass');
613
614 if (!$this->object->isPassDeletionAllowed()) {
615 $this->redirectToPassDeletionContext($context);
616 }
617
619
620 if ($active_fi === 0 || !$this->testrequest->isset('pass')) {
621 $this->ctrl->redirect($this, 'outUserResultsOverview');
622 }
623
624 if ($pass === ilObjTest::_getResultPass($active_fi)) {
625 $this->ctrl->redirect($this, 'outUserResultsOverview');
626 }
627
628 // Get information
629 $result = $ilDB->query("
630 SELECT tst_active.tries, tst_active.last_finished_pass, tst_sequence.pass
631 FROM tst_active
632 LEFT JOIN tst_sequence
633 ON tst_sequence.active_fi = tst_active.active_id
634 AND tst_sequence.pass = tst_active.tries
635 WHERE tst_active.active_id = {$ilDB->quote($active_fi, 'integer')}
636 ");
637
638 $row = $ilDB->fetchAssoc($result);
639
640 $tries = $row['tries'];
641 $lastFinishedPass = is_numeric($row['last_finished_pass']) ? $row['last_finished_pass'] : -1;
642
643 if ($pass < $lastFinishedPass) {
644 $isActivePass = false;
645 $must_renumber = true;
646 } elseif ($pass == $lastFinishedPass) {
647 $isActivePass = false;
648
649 if ($tries == $row['pass']) {
650 $must_renumber = true;
651 } else {
652 $must_renumber = false;
653 }
654 } elseif ($pass == $row['pass']) {
655 $isActivePass = true;
656 $must_renumber = false;
657 } else {
658 throw new ilTestException('This should not happen, please contact Bjoern Heyser to clean up this pass salad!');
659 }
660
661 if ($isActivePass) {
662 $this->ctrl->redirect($this, 'outUserResultsOverview');
663 }
664
665 if ($pass == 0 && (
666 ($lastFinishedPass == 0 && $tries == 1 && $tries != $row['pass'])
667 || ($isActivePass == true) // should be equal to || ($lastFinishedPass == -1 && $tries == 0)
668 )) {
669 $last_pass = true;
670 } else {
671 $last_pass = false;
672 }
673
674 // Work on tables:
675 // tst_active
676 if ($last_pass) {
677 $ilDB->manipulate(
678 'DELETE
679 FROM tst_active
680 WHERE active_id = ' . $ilDB->quote($active_fi, 'integer')
681 );
682 } elseif (!$isActivePass) {
683 $ilDB->manipulate(
684 'UPDATE tst_active
685 SET tries = ' . $ilDB->quote($tries - 1, 'integer') . ',
686 last_finished_pass = ' . $ilDB->quote($lastFinishedPass - 1, 'integer') . '
687 WHERE active_id = ' . $ilDB->quote($active_fi, 'integer')
688 );
689 }
690 // tst_manual_fb
691 $ilDB->manipulate(
692 'DELETE
693 FROM tst_manual_fb
694 WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
695 AND pass = ' . $ilDB->quote($pass, 'integer')
696 );
697
698 if ($must_renumber) {
699 $ilDB->manipulate(
700 'UPDATE tst_manual_fb
701 SET pass = pass - 1
702 WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
703 AND pass > ' . $ilDB->quote($pass, 'integer')
704 );
705 }
706
707 // tst_mark -> nothing to do
708 //
709 // tst_pass_result
710 $ilDB->manipulate(
711 'DELETE
712 FROM tst_pass_result
713 WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
714 AND pass = ' . $ilDB->quote($pass, 'integer')
715 );
716
717 if ($must_renumber) {
718 $ilDB->manipulate(
719 'UPDATE tst_pass_result
720 SET pass = pass - 1
721 WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
722 AND pass > ' . $ilDB->quote($pass, 'integer')
723 );
724 }
725
726 $ilDB->manipulate(
727 'DELETE
728 FROM tst_sequence
729 WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
730 AND pass = ' . $ilDB->quote($pass, 'integer')
731 );
732
733 if ($must_renumber) {
734 $ilDB->manipulate(
735 'UPDATE tst_sequence
736 SET pass = pass - 1
737 WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
738 AND pass > ' . $ilDB->quote($pass, 'integer')
739 );
740 }
741
742 // tst_solutions
743 $ilDB->manipulate(
744 'DELETE
745 FROM tst_solutions
746 WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
747 AND pass = ' . $ilDB->quote($pass, 'integer')
748 );
749
750 if ($must_renumber) {
751 $ilDB->manipulate(
752 'UPDATE tst_solutions
753 SET pass = pass - 1
754 WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
755 AND pass > ' . $ilDB->quote($pass, 'integer')
756 );
757 }
758
759 // tst_test_result
760 $ilDB->manipulate(
761 'DELETE
762 FROM tst_test_result
763 WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
764 AND pass = ' . $ilDB->quote($pass, 'integer')
765 );
766
767 if ($must_renumber) {
768 $ilDB->manipulate(
769 'UPDATE tst_test_result
770 SET pass = pass - 1
771 WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
772 AND pass > ' . $ilDB->quote($pass, 'integer')
773 );
774 }
775
776 // tst_test_rnd_qst -> nothing to do
777
778 // tst_times
779 $ilDB->manipulate(
780 'DELETE
781 FROM tst_times
782 WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
783 AND pass = ' . $ilDB->quote($pass, 'integer')
784 );
785
786 if ($must_renumber) {
787 $ilDB->manipulate(
788 'UPDATE tst_times
789 SET pass = pass - 1
790 WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
791 AND pass > ' . $ilDB->quote($pass, 'integer')
792 );
793 }
794
795 $this->test_result_repository->updateTestResultCache((int) $active_fi);
796
797 $this->redirectToPassDeletionContext($context);
798 }
Base Exception for all Exceptions relating to Modules/Test.
readonly ilDBInterface $db

References ilTestServiceGUI\$db, $ilDB, ilObjTest\_getResultPass(), ilTestPassDeletionConfirmationGUI\CONTEXT_PASS_OVERVIEW, ILIAS\Repository\ctrl(), ILIAS\Repository\object(), and redirectToPassDeletionContext().

+ Here is the call graph for this function:

◆ printResults()

ilTestEvaluationGUI::printResults ( )

Definition at line 129 of file class.ilTestEvaluationGUI.php.

129 : void
130 {
131 if (!$this->testAccess->checkManageParticipantsAccess()
132 && !$this->testAccess->checkParticipantsResultsAccess()) {
133 ilObjTestGUI::accessViolationRedirect();
134 }
135
136 $this->ctrl->saveParameterByClass(self::class, 'active_ids');
137 $this->global_screen->tool()->context()->current()->addAdditionalData(
138 PrintLayoutProvider::TEST_CONTEXT_PRINT,
139 true
140 );
141
142 $selected_participants = $this->retrieveSelectedParticipants();
143 $results_panel = $this->ui_factory->panel()->report(
144 $this->lng->txt('tst_results'),
145 array_map(
146 function (int $v) use ($selected_participants): SubPanel {
147 $attempt_id = ilObjTest::_getResultPass($v);
148 $components = $this->buildAttemptComponents($v, $attempt_id, false, true);
149 return $this->ui_factory->panel()->sub(
150 $this->buildResultsTitle($selected_participants[$v], $attempt_id),
152 );
153 },
154 array_keys($selected_participants)
155 )
156 );
157
158 $this->tpl->setVariable(
159 'ADM_CONTENT',
160 $this->ui_renderer->render([
161 $results_panel,
162 $this->ui_factory->legacy()->content('')->withAdditionalOnLoadCode(
163 fn(string $id): string => 'setTimeout(() => {window.print();}, 50)'
164 )
165 ])
166 );
167 }
$components
buildResultsTitle(string $participant_name, int $pass)
buildAttemptComponents(int $active_id, int $attempt_id, bool $with_test_results_overview, bool $for_print)

References $components, $id, ilObjTest\_getResultPass(), buildAttemptComponents(), buildResultsTitle(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and retrieveSelectedParticipants().

+ Here is the call graph for this function:

◆ redirectBackToParticipantsScreen()

ilTestEvaluationGUI::redirectBackToParticipantsScreen ( )
protected

Definition at line 800 of file class.ilTestEvaluationGUI.php.

801 {
802 $this->ctrl->redirectByClass(ilTestParticipantsGUI::class);
803 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ redirectToPassDeletionContext()

ilTestEvaluationGUI::redirectToPassDeletionContext ( string  $context)
private

Definition at line 595 of file class.ilTestEvaluationGUI.php.

595 : void
596 {
597 switch ($context) {
599
600 $this->ctrl->redirect($this);
601
602 // no break
604 $this->ctrl->redirectByClass([ilRepositoryGUI::class, ilObjTestGUI::class, ilInfoScreenGUI::class]);
605 }
606 }

References ilTestPassDeletionConfirmationGUI\CONTEXT_INFO_SCREEN, ilTestPassDeletionConfirmationGUI\CONTEXT_PASS_OVERVIEW, and ILIAS\Repository\ctrl().

Referenced by cancelDeletePass(), confirmDeletePass(), and performDeletePass().

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

◆ retrieveSelectedParticipants()

ilTestEvaluationGUI::retrieveSelectedParticipants ( )
private
Returns
array<int, string> Array with the active_id as key and the display name as value

Definition at line 1041 of file class.ilTestEvaluationGUI.php.

1041 : array
1042 {
1043 $int_trafo = $this->refinery->kindlyTo()->int();
1044 $selected_participants = [];
1045 foreach ($this->participant_repository->getParticipants(
1046 $this->object->getTestId(),
1047 [
1048 'active_ids' => $this->filterSelectedActiveIdsByAccess(
1049 array_map(
1050 fn(string $v): int => $int_trafo->transform($v),
1051 explode(',', $this->testrequest->strVal('active_ids'))
1052 )
1053 )
1054 ]
1055 ) as $participant) {
1056 $selected_participants[$participant->getActiveId()] = $participant->getDisplayName($this->lng);
1057 }
1058 return $selected_participants;
1059 }

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

Referenced by printResults(), and showResults().

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

◆ sendPage()

ilTestEvaluationGUI::sendPage ( string  $page)
protected

Definition at line 805 of file class.ilTestEvaluationGUI.php.

806 {
807 $this->http->saveResponse($this->http->response()->withBody(
808 Streams::ofString($page)
809 ));
810 $this->http->sendResponse();
811 $this->http->close();
812 }
static http()
Fetches the global http state from ILIAS.

References $page, and ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ setCss()

ilTestEvaluationGUI::setCss ( )
protected

Definition at line 120 of file class.ilTestEvaluationGUI.php.

120 : void
121 {
122 $this->tpl->addCss(ilUtil::getStyleSheetLocation('output', 'test_print.css'), 'print');
123 if ($this->object->getShowSolutionAnswersOnly()) {
124 $this->tpl->addCss(ilUtil::getStyleSheetLocation('output', 'test_print_hide_content.css'), 'print');
125 }
126 $this->tpl->addCss(ilObjStyleSheet::getContentStylePath(0));
127 }
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user

References ilObjStyleSheet\getContentStylePath(), ilUtil\getStyleSheetLocation(), and ILIAS\Repository\object().

Referenced by outUserListOfAnswerPasses(), outUserPassDetails(), outUserResultsOverview(), and showResults().

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

◆ setTestAccess()

ilTestEvaluationGUI::setTestAccess (   $testAccess)

Definition at line 74 of file class.ilTestEvaluationGUI.php.

74 : void
75 {
76 $this->testAccess = $testAccess;
77 }

References $testAccess.

◆ showResults()

ilTestEvaluationGUI::showResults ( )

Definition at line 169 of file class.ilTestEvaluationGUI.php.

169 : void
170 {
171 if (!$this->testAccess->checkManageParticipantsAccess()
172 && !$this->testAccess->checkParticipantsResultsAccess()) {
173 ilObjTestGUI::accessViolationRedirect();
174 }
175
176 $this->setCss();
177 $this->ctrl->saveParameterByClass(self::class, 'active_ids');
178
179 $selected_participants = $this->retrieveSelectedParticipants();
180
183
184 $current_active_id = array_key_first($selected_participants);
185 if (count($selected_participants) > 1
186 && ($selected_active_id = $this->testrequest->getActiveId()) > 0
187 && array_key_exists($selected_active_id, $selected_participants) !== false) {
188 $current_active_id = $selected_active_id;
189 }
190
191 if ($this->testrequest->isset('attempt')) {
192 $attempt_id = min($this->testrequest->int('attempt'), ilObjTest::_getMaxPass($current_active_id));
193 } else {
194 $attempt_id = ilObjTest::_getResultPass($current_active_id);
195 }
196
197 $results_panel = $this->ui_factory->panel()->report(
198 $this->buildResultsTitle(
199 $selected_participants[$current_active_id],
200 $attempt_id
201 ),
202 $this->buildAttemptComponents($current_active_id, $attempt_id, true, false)
203 );
204
205 $attempts_ids_array = $this->results_data_factory->getAttemptIdsArrayFor(
206 $this->object,
207 $current_active_id
208 );
209
210 if (count($attempts_ids_array) > 1) {
211 $results_panel = $results_panel->withViewControls([
213 $attempts_ids_array,
214 ++$attempt_id
215 )
216 ]);
217 }
218
219 if (count($selected_participants) > 1) {
220 $this->addParticipantSelectorToToolbar($selected_participants, $current_active_id);
221 }
222
223 $this->tpl->setVariable(
224 'ADM_CONTENT',
225 $this->ui_renderer->render($results_panel)
226 );
227
228 $this->tabs->setBackTarget(
229 $this->lng->txt('back'),
230 $this->ctrl->getLinkTargetByClass(['ilTestParticipantsGUI'])
231 );
232 }
static _getMaxPass($active_id)
Retrieves the maximum pass of a given user for a given test in which the user answered at least one q...
addParticipantSelectorToToolbar(array $selected_participants, int $current_active_id)

References ilObjTest\_getMaxPass(), ilObjTest\_getResultPass(), addParticipantSelectorToToolbar(), addPrintResultsButtonToToolbar(), addToggleBestSolutionButtonToToolbar(), buildAttemptComponents(), buildAttemptSwitchingViewControl(), buildResultsTitle(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), retrieveSelectedParticipants(), setCss(), and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

Field Documentation

◆ $participant_repository

readonly ParticipantRepository ilTestEvaluationGUI::$participant_repository
private

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

◆ $processLockerFactory

ilTestProcessLockerFactory ilTestEvaluationGUI::$processLockerFactory
protected

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

◆ $testAccess

ilTestAccess ilTestEvaluationGUI::$testAccess
protected

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

Referenced by getTestAccess(), and setTestAccess().

◆ DEFAULT_CMD

const ilTestEvaluationGUI::DEFAULT_CMD = 'outUserListOfAnswerPasses'
private

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


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