ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilTestServiceGUI Class Reference

Service GUI class for tests. More...

+ Inheritance diagram for ilTestServiceGUI:
+ Collaboration diagram for ilTestServiceGUI:

Public Member Functions

 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 ($testSession, $active_id, $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

 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

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 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 Attributes

ilTestObjectiveOrientedContainer $objective_oriented_container
 
bool $contextResultPresentation = true
 

Detailed Description

Service GUI class for tests.

This class is the parent class for all service classes which are called from ilObjTestGUI. This is mainly done to reduce the size of ilObjTestGUI to put command service functions into classes that could be called by ilCtrl.

@ilCtrl_IsCalledBy ilTestServiceGUI: ilObjTestGUI

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
Version
$Id$

\

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

Member Function Documentation

◆ buildPassDetailsOverviewTableGUI()

ilTestServiceGUI::buildPassDetailsOverviewTableGUI ( ilTestServiceGUI  $target_gui,
string  $target_cmd 
)
protected

◆ buildPassOverviewTableGUI()

ilTestServiceGUI::buildPassOverviewTableGUI ( ilTestEvaluationGUI  $target_gui)

Definition at line 296 of file class.ilTestServiceGUI.php.

297 {
298 $table = new ilTestPassOverviewTableGUI($target_gui, '');
299
300 $table->setPdfPresentationEnabled(
301 $this->testrequest->isset('pdf') && $this->testrequest->raw('pdf') == 1
302 );
303
304 $table->setObjectiveOrientedPresentationEnabled(
305 $this->getObjectiveOrientedContainer()?->isObjectiveOrientedPresentationRequired() ?? false
306 );
307
308 return $table;
309 }
Class ilTestPassOverviewTableGUI.

Referenced by ilTestEvaluationGUI\outUserResultsOverview().

+ Here is the caller graph for this function:

◆ buildQuestionRelatedObjectivesList()

ilTestServiceGUI::buildQuestionRelatedObjectivesList ( ilLOTestQuestionAdapter  $objectives_adapter,
ilTestQuestionSequence  $test_sequence 
)
protected

Definition at line 666 of file class.ilTestServiceGUI.php.

670 $questionRelatedObjectivesList = new ilTestQuestionRelatedObjectivesList();
671
672 $objectives_adapter->buildQuestionRelatedObjectiveList($test_sequence, $questionRelatedObjectivesList);
673
674 return $questionRelatedObjectivesList;
675 }
buildQuestionRelatedObjectiveList(ilTestQuestionSequence $a_test_sequence, ilTestQuestionRelatedObjectivesList $a_objectives_list)

Referenced by ilTestSubmissionReviewGUI\buildUserReviewOutput(), ilTestEvaluationGUI\outUserListOfAnswerPasses(), ilTestEvaluationGUI\outUserPassDetails(), and ilTestEvalObjectiveOrientedGUI\showVirtualPassCmd().

+ Here is the caller graph for this function:

◆ executeCommand()

ilTestServiceGUI::executeCommand ( )

execute command

Reimplemented in ilTestEvalObjectiveOrientedGUI, ilTestEvaluationGUI, ilTestPlayerAbstractGUI, ilTestSubmissionReviewGUI, and ILIAS\Test\Scoring\Manual\TestScoringByParticipantGUI.

Definition at line 283 of file class.ilTestServiceGUI.php.

284 {
285 $cmd = $this->ctrl->getCmd();
286 $next_class = $this->ctrl->getNextClass($this);
287
288 switch ($next_class) {
289 default:
290 $ret = &$this->$cmd();
291 break;
292 }
293 return $ret;
294 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getAdditionalUsrDataHtmlAndPopulateWindowTitle()

ilTestServiceGUI::getAdditionalUsrDataHtmlAndPopulateWindowTitle (   $testSession,
  $active_id,
  $overwrite_anonymity = false 
)

Returns the user data for a test results output.

Parameters
ilTestSession
integer$user_idThe user ID of the user
boolean$overwrite_anonymityTRUE if the anonymity status should be overwritten, FALSE otherwise
Returns
string HTML code of the user data for the test results @access public

Definition at line 532 of file class.ilTestServiceGUI.php.

532 : string
533 {
534 if (!is_object($testSession)) {
535 throw new InvalidArgumentException('Not an object, expected ilTestSession');
536 }
537 $template = new ilTemplate("tpl.il_as_tst_results_userdata.html", true, true, "components/ILIAS/Test");
538 $user_id = $this->object->_getUserIdFromActiveId($active_id);
539 if (strlen(ilObjUser::_lookupLogin($user_id)) > 0) {
540 $user = new ilObjUser($user_id);
541 } else {
542 $user = new ilObjUser();
543 $user->setLastname($this->lng->txt('deleted_user'));
544 }
545 $t = $testSession->getSubmittedTimestamp();
546 if (!$t) {
547 $t = $this->object->_getLastAccess($testSession->getActiveId());
548 }
549
550 if ($this->getObjectiveOrientedContainer()?->isObjectiveOrientedPresentationRequired()) {
551 $uname = $this->object->userLookupFullName($user_id, $overwrite_anonymity);
552 $template->setCurrentBlock('name');
553 $template->setVariable('TXT_USR_NAME', $this->lng->txt("name"));
554 $template->setVariable('VALUE_USR_NAME', $uname);
555 $template->parseCurrentBlock();
556 }
557
558 $title_matric = "";
559 if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == false) || ($overwrite_anonymity))) {
560 $template->setCurrentBlock("matriculation");
561 $template->setVariable("TXT_USR_MATRIC", $this->lng->txt("matriculation"));
562 $template->setVariable("VALUE_USR_MATRIC", $user->getMatriculation());
563 $template->parseCurrentBlock();
564 $title_matric = " - " . $this->lng->txt("matriculation") . ": " . $user->getMatriculation();
565 }
566
567 $invited_user = array_pop($this->object->getInvitedUsers($user_id));
568 $title_client = '';
569 $template->setVariable("TXT_TEST_TITLE", $this->lng->txt("title"));
570 $template->setVariable("VALUE_TEST_TITLE", $this->object->getTitle());
571
572 // change the pagetitle (tab title or title in title bar of window)
573 $pagetitle = $this->object->getTitle() . $title_matric . $title_client;
574 $this->tpl->setHeaderPageTitle($pagetitle);
575
576 return $template->get();
577 }
User class.
setLastname(string $lastname)
static _lookupLogin(int $a_user_id)
special template class to simplify handling of ITX/PEAR
readonly ilObjUser $user

References $user_id, ilObjUser\_lookupLogin(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

Referenced by ilTestEvaluationGUI\outUserListOfAnswerPasses(), and ilTestEvaluationGUI\outUserResultsOverview().

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

◆ getCorrectSolutionOutput()

ilTestServiceGUI::getCorrectSolutionOutput (   $question_id,
  $active_id,
  $pass,
?ilTestQuestionRelatedObjectivesList  $objectives_list = null 
)

Returns an output of the solution to an answer compared to the correct solution.

Parameters
integer$question_idDatabase ID of the question
integer$active_idActive ID of the active user
integer$passTest pass
Returns
string HTML code of the correct solution comparison @access public

Definition at line 588 of file class.ilTestServiceGUI.php.

588 : string
589 {
590 $ilUser = $this->user;
591
592 $test_id = $this->object->getTestId();
593 $question_gui = $this->object->createQuestionGUI("", $question_id);
594
595 $template = new ilTemplate("tpl.il_as_tst_correct_solution_output.html", true, true, "components/ILIAS/Test");
596 $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? true : false;
597 $result_output = $question_gui->getSolutionOutput($active_id, $pass, true, false, $show_question_only, $this->object->getShowSolutionFeedback(), false, false, true);
598 $best_output = $question_gui->getSolutionOutput($active_id, $pass, false, false, $show_question_only, false, true, false, false);
599 if ($this->object->getShowSolutionFeedback() && $this->testrequest->raw('cmd') != 'outCorrectSolution') {
600 $specificAnswerFeedback = $question_gui->getSpecificFeedbackOutput(
601 $question_gui->getObject()->fetchIndexedValuesFromValuePairs(
602 $question_gui->getObject()->getSolutionValues($active_id, $pass)
603 )
604 );
605 if (strlen($specificAnswerFeedback)) {
606 $template->setCurrentBlock("outline_specific_feedback");
607 $template->setVariable("OUTLINE_SPECIFIC_FEEDBACK", $specificAnswerFeedback);
608 $template->parseCurrentBlock();
609 }
610 }
611 $template->setVariable("TEXT_YOUR_SOLUTION", $this->lng->txt("tst_your_answer_was"));
612 $template->setVariable("TEXT_SOLUTION_OUTPUT", $this->lng->txt("tst_your_answer_was")); // Mantis 28646. I don't really know why Ingmar renamed the placeholder, so
613 // I set both old and new since the old one is set as well in several places.
614 $maxpoints = $question_gui->getObject()->getMaximumPoints();
615 if ($maxpoints == 1) {
616 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->getObject()->getTitleForHTMLOutput()) . " (" . $maxpoints . " " . $this->lng->txt("point") . ")");
617 } else {
618 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->getObject()->getTitleForHTMLOutput()) . " (" . $maxpoints . " " . $this->lng->txt("points") . ")");
619 }
620 if ($objectives_list !== null) {
621 $objectives = $this->lng->txt('tst_res_lo_objectives_header') . ': ';
622 $objectives .= $objectives_list->getQuestionRelatedObjectiveTitles($question_gui->getObject()->getId());
623 $template->setVariable('OBJECTIVES', $objectives);
624 }
625 $template->setVariable("SOLUTION_OUTPUT", $result_output);
626 $template->setVariable("RECEIVED_POINTS", sprintf($this->lng->txt("you_received_a_of_b_points"), $question_gui->getObject()->getReachedPoints($active_id, $pass), $maxpoints));
627 $template->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
628 $template->setVariable("BACKLINK_TEXT", "<< " . $this->lng->txt("back"));
629 return $template->get();
630 }
$objectives

References $objectives, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ getGradingMessageBuilder()

ilTestServiceGUI::getGradingMessageBuilder ( int  $active_id)
protected

Definition at line 656 of file class.ilTestServiceGUI.php.

657 {
659 $this->lng,
660 $this->tpl,
661 $this->object,
662 $this->test_result_repository->getTestResult($active_id)
663 );
664 }

References ILIAS\Repository\lng().

Referenced by ilTestEvaluationGUI\outUserPassDetails(), and ilTestEvaluationGUI\outUserResultsOverview().

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

◆ getObject()

ilTestServiceGUI::getObject ( )

Definition at line 783 of file class.ilTestServiceGUI.php.

783 : ilObjTest
784 {
785 return $this->object;
786 }

Referenced by ilTestPassOverviewTableGUI\__construct(), ILIAS\Test\Scoring\Manual\TestScoringByParticipantGUI\saveManScoringParticipantScreen(), and ilTestSubmissionReviewGUI\show().

+ Here is the caller graph for this function:

◆ getObjectiveOrientedContainer()

◆ getParticipantData()

ilTestServiceGUI::getParticipantData ( )

Definition at line 179 of file class.ilTestServiceGUI.php.

References $participantData.

◆ getPassDetailsOverviewTableGUI()

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 
)
protected

Definition at line 448 of file class.ilTestServiceGUI.php.

457 $this->ctrl->setParameter($target_gui, 'active_id', $active_id);
458 $this->ctrl->setParameter($target_gui, 'pass', $pass);
459
460 $table_gui = $this->buildPassDetailsOverviewTableGUI($target_gui, $target_cmd);
461
462 if ($objectives_list !== null) {
463 $table_gui->setQuestionRelatedObjectivesList($objectives_list);
464 $table_gui->setObjectiveOrientedPresentationEnabled(true);
465 }
466
467 $table_gui->setMultipleObjectivesInvolved($multiple_objectives_involved);
468
469 $table_gui->setActiveId($active_id);
470 $table_gui->setShowSuggestedSolution(false);
471
472 $users_question_solutions = [];
473
474 foreach ($result_array as $key => $val) {
475 if ($key === 'test' || $key === 'pass') {
476 continue;
477 }
478
479 if ($this->object->getShowSolutionSuggested() && strlen($val['solution'])) {
480 $table_gui->setShowSuggestedSolution(true);
481 }
482
483 if (isset($val['pass'])) {
484 $table_gui->setPassColumnEnabled(true);
485 }
486
487 $users_question_solutions[$key] = $val;
488 }
489
490 $table_gui->initColumns();
491
492 $table_gui->setFilterCommand($target_cmd . 'SetTableFilter');
493 $table_gui->setResetCommand($target_cmd . 'ResetTableFilter');
494
495 $table_gui->setData($users_question_solutions);
496
497 return $table_gui;
498 }
buildPassDetailsOverviewTableGUI(ilTestServiceGUI $target_gui, string $target_cmd)

Referenced by ilTestEvalObjectiveOrientedGUI\showVirtualPassCmd().

+ Here is the caller graph for this function:

◆ getPassListOfAnswers()

ilTestServiceGUI::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.

Parameters
array$result_arrayAn array containing the results of the users test pass (generated by ilObjTest::getTestResult)
integer$active_idActive ID of the active user
integer$passTest pass
boolean$show_solutionsTRUE, if the solution output should be shown in the answers, FALSE otherwise
Returns
string HTML code of the list of answers @access public

Definition at line 321 of file class.ilTestServiceGUI.php.

332 : string {
333 $maintemplate = new ilTemplate('tpl.il_as_tst_list_of_answers.html', true, true, 'components/ILIAS/Test');
334
335 $counter = 1;
336 // output of questions with solutions
337 foreach ($result_array as $question_data) {
338 if (!array_key_exists('workedthrough', $question_data)) {
339 $question_data['workedthrough'] = 0;
340 }
341 if (!array_key_exists('qid', $question_data)) {
342 $question_data['qid'] = -1;
343 }
344
345 if (($question_data['workedthrough'] == 1) || ($only_answered_questions == false)) {
346 $template = new ilTemplate('tpl.il_as_qpl_question_printview.html', true, true, 'components/ILIAS/TestQuestionPool');
347 $question_id = $question_data["qid"] ?? null;
348 if ($question_id !== null
349 && $question_id !== -1
350 && is_numeric($question_id)) {
351 $maintemplate->setCurrentBlock('printview_question');
352 $question_gui = $this->object->createQuestionGUI("", $question_id);
353
354 $question_gui->getObject()->setShuffler($this->shuffler->getAnswerShuffleFor(
355 (int) $question_id,
356 (int) $active_id,
357 (int) $pass
358 ));
359 if (is_object($question_gui)) {
360 if ($anchorNav) {
361 $template->setCurrentBlock('block_id');
362 $template->setVariable('BLOCK_ID', "detailed_answer_block_act_{$active_id}_qst_{$question_id}");
363 $template->parseCurrentBlock();
364
365 $template->setCurrentBlock('back_anchor');
366 $template->setVariable('HREF_BACK_ANCHOR', "#pass_details_tbl_row_act_{$active_id}_qst_{$question_id}");
367 $template->setVariable('TXT_BACK_ANCHOR', $this->lng->txt('tst_back_to_question_list'));
368 $template->parseCurrentBlock();
369 }
370
371 if ($show_reached_points) {
372 $template->setCurrentBlock("result_points");
373 $template->setVariable("RESULT_POINTS", $this->lng->txt("tst_reached_points") . ": " . $question_gui->getObject()->getReachedPoints($active_id, $pass) . " " . $this->lng->txt("of") . " " . $question_gui->getObject()->getMaximumPoints());
374 $template->parseCurrentBlock();
375 }
376 $template->setVariable("COUNTER_QUESTION", $counter . ". ");
377 $template->setVariable("TXT_QUESTION_ID", $this->lng->txt('question_id_short'));
378 $template->setVariable("QUESTION_ID", $question_gui->getObject()->getId());
379 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->getObject()->getTitleForHTMLOutput()));
380
381 if ($objectives_list !== null) {
382 $objectives = $this->lng->txt('tst_res_lo_objectives_header') . ': ';
383 $objectives .= $objectives_list->getQuestionRelatedObjectiveTitles($question_gui->getObject()->getId());
384 $template->setVariable("OBJECTIVES", $objectives);
385 }
386
387 $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? true : false;
388
389 $show_feedback = $this->isContextResultPresentation() && $this->object->getShowSolutionFeedback();
390 $show_best_solution = $this->isContextResultPresentation() && $show_solutions;
391 $show_graphical_output = $this->isContextResultPresentation();
392
393 if ($show_best_solution) {
394 $compare_template = new ilTemplate('tpl.il_as_tst_answers_compare.html', true, true, 'components/ILIAS/Test');
395 $test_session = $this->test_session_factory->getSession($active_id);
396 if ($pass <= $test_session->getLastFinishedPass()) {
397 $compare_template->setVariable("HEADER_PARTICIPANT", $this->lng->txt('tst_header_participant'));
398 } else {
399 $compare_template->setVariable("HEADER_PARTICIPANT", $this->lng->txt('tst_header_participant_no_answer'));
400 }
401
402 $compare_template->setVariable("HEADER_SOLUTION", $this->lng->txt('tst_header_solution'));
403 $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_graphical_output, false, $show_question_only, $show_feedback);
404 $best_output = $question_gui->getSolutionOutput($active_id, $pass, false, false, $show_question_only, false, true);
405
406 $compare_template->setVariable('PARTICIPANT', $result_output);
407 $compare_template->setVariable('SOLUTION', $best_output);
408 $template->setVariable('SOLUTION_OUTPUT', $compare_template->get());
409 } else {
410 $result_output = $question_gui->getSolutionOutput(
411 $active_id,
412 $pass,
413 $show_graphical_output,
414 false,
415 $show_question_only,
416 $show_feedback,
417 false,
418 false,
419 true,
420 $show_feedback
421 );
422 $template->setVariable('SOLUTION_OUTPUT', $result_output);
423 }
424
425 $maintemplate->setCurrentBlock('printview_question');
426 $maintemplate->setVariable("QUESTION_PRINTVIEW", $template->get());
427 $maintemplate->parseCurrentBlock();
428 $counter++;
429 }
430 }
431 }
432 }
433
434 if ($testResultHeaderLabelBuilder !== null) {
435 if ($pass !== null) {
436 $headerText = $testResultHeaderLabelBuilder->getListOfAnswersHeaderLabel($pass + 1);
437 } else {
438 $headerText = $testResultHeaderLabelBuilder->getVirtualListOfAnswersHeaderLabel();
439 }
440 } else {
441 $headerText = '';
442 }
443
444 $maintemplate->setVariable('RESULTS_OVERVIEW', $headerText);
445 return $maintemplate->get();
446 }
$counter

References $counter, $objectives, ILIAS\Repository\lng(), and ILIAS\Repository\object().

Referenced by ilTestEvaluationGUI\outUserListOfAnswerPasses().

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

◆ getPassOverviewTableData()

ilTestServiceGUI::getPassOverviewTableData ( ilTestSession  $test_session,
array  $passes,
bool  $with_results 
)
Parameters
array<int>$passes An integer array of test runs
Returns
array<mixed>

Definition at line 188 of file class.ilTestServiceGUI.php.

192 : array {
193 $data = [];
194
195 $objective_oriented_presentation = $this->getObjectiveOrientedContainer()
196 ?->isObjectiveOrientedPresentationRequired() ?? false;
197
198 if ($objective_oriented_presentation) {
199 $consider_hidden_questions = false;
200
201 $objectives_adapter = ilLOTestQuestionAdapter::getInstance($test_session);
202 } else {
203 $consider_hidden_questions = true;
204 }
205
206 $scored_pass = \ilObjTest::_getResultPass($test_session->getActiveId());
207
208 foreach ($passes as $pass) {
209 $row = [
210 'scored' => false,
211 'pass' => $pass,
212 'date' => ilObjTest::lookupLastTestPassAccess($test_session->getActiveId(), $pass)
213 ];
214 $considerOptionalQuestions = true;
215
216 if ($objective_oriented_presentation) {
217 $test_sequence = $this->test_sequence_factory->getSequenceByActiveIdAndPass($test_session->getActiveId(), $pass);
218 $test_sequence->loadFromDb();
219 $test_sequence->loadQuestions();
220
221 if ($this->object->isRandomTest() && !$test_sequence->isAnsweringOptionalQuestionsConfirmed()) {
222 $considerOptionalQuestions = false;
223 }
224
225 $test_sequence->setConsiderHiddenQuestionsEnabled($consider_hidden_questions);
226 $test_sequence->setConsiderOptionalQuestionsEnabled($considerOptionalQuestions);
227
228 $objectives_list = $this->buildQuestionRelatedObjectivesList($objectives_adapter, $test_sequence);
229 $objectives_list->loadObjectivesTitles();
230
231 $row['objectives'] = $objectives_list->getUniqueObjectivesStringForQuestions($test_sequence->getUserSequenceQuestions());
232 }
233
234 if (!$with_results) {
235 $data[] = $row;
236 continue;
237 }
238
239 $result_array = $this->object->getTestResult(
240 $test_session->getActiveId(),
241 $pass,
242 false,
243 $consider_hidden_questions,
244 $considerOptionalQuestions
245 );
246
247 if (!$result_array['pass']['total_max_points']) {
248 $row['percentage'] = 0;
249 } else {
250 $row['percentage'] = ($result_array['pass']['total_reached_points'] / $result_array['pass']['total_max_points']) * 100;
251 }
252
253 $row['max_points'] = $result_array['pass']['total_max_points'];
254 $row['reached_points'] = $result_array['pass']['total_reached_points'];
255 $row['scored'] = ($pass == $scored_pass);
256 $row['num_workedthrough_questions'] = $result_array['pass']['num_workedthrough'];
257 $row['num_questions_total'] = $result_array['pass']['num_questions_total'];
258 $data[] = $row;
259 }
260
261 return $data;
262 }
static getInstance(ilTestSession $a_test_session)
static _getResultPass($active_id)
Retrieves the pass number that should be counted for a given user.
buildQuestionRelatedObjectivesList(ilLOTestQuestionAdapter $objectives_adapter, ilTestQuestionSequence $test_sequence)

References ilLOTestQuestionAdapter\getInstance().

Referenced by ilTestEvaluationGUI\outUserResultsOverview().

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

◆ getResultsSignature()

ilTestServiceGUI::getResultsSignature ( )

Returns HTML code for a signature field.

Returns
string HTML code of the date and signature field for the test results @access public

Definition at line 506 of file class.ilTestServiceGUI.php.

506 : string
507 {
508 if ($this->object->getShowSolutionSignature() && !$this->object->getAnonymity()) {
509 $template = new ilTemplate("tpl.il_as_tst_results_userdata_signature.html", true, true, "components/ILIAS/Test");
510 $template->setVariable("TXT_DATE", $this->lng->txt("date"));
513 $template->setVariable("VALUE_DATE", ilDatePresentation::formatDate(new ilDate(time(), IL_CAL_UNIX)));
515 $template->setVariable("TXT_SIGNATURE", $this->lng->txt("tst_signature"));
516 $template->setVariable("IMG_SPACER", ilUtil::getImagePath("media/spacer.png"));
517 return $template->get();
518 } else {
519 return "";
520 }
521 }
const IL_CAL_UNIX
static setUseRelativeDates(bool $a_status)
set use relative dates
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
Class for single dates.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)

References ilDatePresentation\formatDate(), ilUtil\getImagePath(), IL_CAL_UNIX, ILIAS\Repository\lng(), ILIAS\Repository\object(), ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().

Referenced by ilTestEvaluationGUI\outUserListOfAnswerPasses(), and ilTestEvaluationGUI\outUserPassDetails().

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

◆ isContextResultPresentation()

ilTestServiceGUI::isContextResultPresentation ( )

Definition at line 107 of file class.ilTestServiceGUI.php.

107 : bool
108 {
110 }

References $contextResultPresentation.

◆ isGradingMessageRequired()

ilTestServiceGUI::isGradingMessageRequired ( )
protected

Definition at line 639 of file class.ilTestServiceGUI.php.

639 : bool
640 {
641 $session = $this->test_session_factory->getSession();
642 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()
643 || $this->object->getScoreSettings()->getScoringSettings()->getPassScoring() === ilObjTest::SCORE_LAST_PASS
644 && $session->getLastFinishedPass() < $session->getLastStartedPass()) {
645 return false;
646 }
647
648 if ($this->object->isShowGradingStatusEnabled()
649 || $this->object->isShowGradingMarkEnabled()) {
650 return true;
651 }
652
653 return false;
654 }
const SCORE_LAST_PASS

References ILIAS\Repository\object(), and ilObjTest\SCORE_LAST_PASS.

Referenced by ilTestEvaluationGUI\outUserPassDetails(), and ilTestEvaluationGUI\outUserResultsOverview().

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

◆ outCorrectSolution()

ilTestServiceGUI::outCorrectSolution ( )
protected

Reimplemented in ilTestPlayerAbstractGUI.

Definition at line 687 of file class.ilTestServiceGUI.php.

687 : void
688 {
689 if (!$this->object->getShowSolutionDetails()) {
690 $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_permission"), true);
691 $this->ctrl->redirectByClass([ilRepositoryGUI::class, ilObjTestGUI::class, ilInfoScreenGUI::class]);
692 }
693
694 $testSession = $this->test_session_factory->getSession();
695 $active_id = $testSession->getActiveId();
696
697 if (!($active_id > 0)) {
698 $this->ctrl->redirectByClass([ilRepositoryGUI::class, ilObjTestGUI::class, ilInfoScreenGUI::class]);
699 }
700
701 $this->ctrl->saveParameter($this, "pass");
702 $pass = (int) $this->testrequest->raw("pass");
703
704 $active_id = (int) $this->testrequest->raw('evaluation');
705
706 $test_sequence = $this->test_sequence_factory->getSequenceByActiveIdAndPass($active_id, $pass);
707 $test_sequence->loadFromDb();
708 $test_sequence->loadQuestions();
709
710 if (!$test_sequence->questionExists($active_id)) {
711 ilObjTestGUI::accessViolationRedirect();
712 }
713
714 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
715 $test_sequence = $this->test_sequence_factory->getSequenceByActiveIdAndPass($active_id, $pass);
716 $test_sequence->loadFromDb();
717 $test_sequence->loadQuestions();
718
719 $objectives_adapter = ilLOTestQuestionAdapter::getInstance($testSession);
720 $objectives_list = $this->buildQuestionRelatedObjectivesList($objectives_adapter, $test_sequence);
721 $objectives_list->loadObjectivesTitles();
722 } else {
723 $objectives_list = null;
724 }
725
726 $ilTabs = $this->tabs;
727
728 if ($this instanceof ilTestEvalObjectiveOrientedGUI) {
729 $ilTabs->setBackTarget(
730 $this->lng->txt("tst_back_to_virtual_pass"),
731 $this->ctrl->getLinkTarget($this, 'showVirtualPass')
732 );
733 } else {
734 $ilTabs->setBackTarget(
735 $this->lng->txt("tst_back_to_pass_details"),
736 $this->ctrl->getLinkTarget($this, 'outUserPassDetails')
737 );
738 }
739 $ilTabs->clearSubTabs();
740
741 $this->tpl->setCurrentBlock("ContentStyle");
742 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
743 $this->tpl->parseCurrentBlock();
744
745 $this->tpl->setCurrentBlock("SyntaxStyle");
746 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
747 $this->tpl->parseCurrentBlock();
748
749 $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css"), "print");
750 if ($this->object->getShowSolutionAnswersOnly()) {
751 $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css"), "print");
752 }
753
754 $solution = $this->getCorrectSolutionOutput($active_id, $active_id, $pass, $objectives_list);
755
756 $this->tpl->setContent($solution);
757 }
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
setBackTarget(string $a_title, string $a_target, string $a_frame="")
getCorrectSolutionOutput($question_id, $active_id, $pass, ?ilTestQuestionRelatedObjectivesList $objectives_list=null)
Returns an output of the solution to an answer compared to the correct solution.
readonly ilTabsGUI $tabs
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user

References ILIAS\Repository\ctrl(), ilObjStyleSheet\getContentStylePath(), ilLOTestQuestionAdapter\getInstance(), ilUtil\getStyleSheetLocation(), ilObjStyleSheet\getSyntaxStylePath(), ILIAS\Repository\int(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ outCorrectSolutionCmd()

ilTestServiceGUI::outCorrectSolutionCmd ( )
protected

Definition at line 682 of file class.ilTestServiceGUI.php.

682 : void
683 {
684 $this->outCorrectSolution(); // cannot be named xxxCmd, because it's also called from context without Cmd in names
685 }

◆ populateContent()

ilTestServiceGUI::populateContent ( string  $content)
protected

Definition at line 677 of file class.ilTestServiceGUI.php.

677 : void
678 {
679 $this->tpl->setContent($content);
680 }

Referenced by ilTestEvalObjectiveOrientedGUI\showVirtualPassCmd().

+ Here is the caller graph for this function:

◆ populateExamId()

ilTestServiceGUI::populateExamId ( ilTemplate  $tpl,
int  $active_id,
int  $pass 
)
protected

Definition at line 772 of file class.ilTestServiceGUI.php.

772 : void
773 {
774 if ($this->object->isShowExamIdInTestResultsEnabled()) {
775 $tpl->setVariable('EXAM_ID_TXT', $this->lng->txt('exam_id'));
776 $tpl->setVariable('EXAM_ID', ilObjTest::lookupExamId(
777 $active_id,
778 $pass
779 ));
780 }
781 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
static lookupExamId($active_id, $pass)

References ILIAS\Repository\lng(), ilObjTest\lookupExamId(), ILIAS\Repository\object(), and HTML_Template_IT\setVariable().

Referenced by ilTestEvaluationGUI\outUserPassDetails().

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

◆ populatePassFinishDate()

ilTestServiceGUI::populatePassFinishDate ( ilTemplate  $tpl,
?int  $pass_finish_date 
)
protected

Definition at line 759 of file class.ilTestServiceGUI.php.

759 : void
760 {
761 if ($pass_finish_date === null) {
762 return;
763 }
766 $pass_finish_date_string = ilDatePresentation::formatDate(new ilDateTime($pass_finish_date, IL_CAL_UNIX));
768 $tpl->setVariable("PASS_FINISH_DATE_LABEL", $this->lng->txt('tst_pass_finished_on'));
769 $tpl->setVariable("PASS_FINISH_DATE_VALUE", $pass_finish_date_string);
770 }
@classDescription Date and time handling
ilGlobalTemplateInterface ilTemplate $tpl
sk 2023-08-01: We need this union type, even if it is wrong! To change this
setVariable(string $variable, $value='')
Sets the given variable to the given value.

References ilDatePresentation\formatDate(), IL_CAL_UNIX, ILIAS\Repository\lng(), ilDatePresentation\setUseRelativeDates(), HTML_Template_IT\setVariable(), and ilDatePresentation\useRelativeDates().

Referenced by ilTestEvaluationGUI\outUserPassDetails().

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

◆ setContextResultPresentation()

ilTestServiceGUI::setContextResultPresentation ( bool  $contextResultPresentation)

Definition at line 112 of file class.ilTestServiceGUI.php.

113 {
114 $this->contextResultPresentation = $contextResultPresentation;
115 }

References $contextResultPresentation.

Referenced by ilTestEvaluationGUI\outUserListOfAnswerPasses().

+ Here is the caller graph for this function:

◆ setObjectiveOrientedContainer()

ilTestServiceGUI::setObjectiveOrientedContainer ( ilTestObjectiveOrientedContainer  $objective_oriented_container)
Parameters
ilTestObjectiveOrientedContainer$objective_oriented_container

Definition at line 267 of file class.ilTestServiceGUI.php.

268 {
269 $this->objective_oriented_container = $objective_oriented_container;
270 }

◆ setParticipantData()

ilTestServiceGUI::setParticipantData ( ilTestParticipantData  $participantData)

Definition at line 174 of file class.ilTestServiceGUI.php.

174 : void
175 {
176 $this->participantData = $participantData;
177 }

References $participantData.

Field Documentation

◆ $access

ilAccess ilTestServiceGUI::$access
protected

Definition at line 72 of file class.ilTestServiceGUI.php.

◆ $component_repository

readonly ilComponentRepository ilTestServiceGUI::$component_repository
protected

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

◆ $content_style

readonly ContentStyle ilTestServiceGUI::$content_style
protected

Definition at line 70 of file class.ilTestServiceGUI.php.

◆ $contextResultPresentation

bool ilTestServiceGUI::$contextResultPresentation = true
private

◆ $ctrl

readonly ilCtrlInterface ilTestServiceGUI::$ctrl
protected

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

◆ $db

readonly ilDBInterface ilTestServiceGUI::$db
protected

◆ $error

readonly ilErrorHandling ilTestServiceGUI::$error
protected

Definition at line 71 of file class.ilTestServiceGUI.php.

◆ $global_screen

readonly GlobalScreenServices ilTestServiceGUI::$global_screen
protected

Definition at line 92 of file class.ilTestServiceGUI.php.

◆ $help

readonly ilHelpGUI ilTestServiceGUI::$help
protected

Definition at line 61 of file class.ilTestServiceGUI.php.

◆ $http

readonly HTTPServices ilTestServiceGUI::$http
protected

Definition at line 73 of file class.ilTestServiceGUI.php.

◆ $ilias

readonly ILIAS ilTestServiceGUI::$ilias
protected

Definition at line 90 of file class.ilTestServiceGUI.php.

◆ $lng

readonly ilLanguage ilTestServiceGUI::$lng
protected

Definition at line 59 of file class.ilTestServiceGUI.php.

◆ $logger

readonly TestLogger ilTestServiceGUI::$logger
protected

Definition at line 60 of file class.ilTestServiceGUI.php.

◆ $navigation_history

readonly ilNavigationHistory ilTestServiceGUI::$navigation_history
protected

Definition at line 81 of file class.ilTestServiceGUI.php.

◆ $obj_cache

readonly ilObjectDataCache ilTestServiceGUI::$obj_cache
protected

Definition at line 77 of file class.ilTestServiceGUI.php.

◆ $objective_oriented_container

ilTestObjectiveOrientedContainer ilTestServiceGUI::$objective_oriented_container
private

Definition at line 103 of file class.ilTestServiceGUI.php.

◆ $participant_access_filter

ilTestParticipantAccessFilterFactory ilTestServiceGUI::$participant_access_filter
protected

Definition at line 101 of file class.ilTestServiceGUI.php.

◆ $participantData

◆ $post_wrapper

readonly ArrayBasedRequestWrapper ilTestServiceGUI::$post_wrapper
protected

Definition at line 80 of file class.ilTestServiceGUI.php.

◆ $questionrepository

readonly GeneralQuestionPropertiesRepository ilTestServiceGUI::$questionrepository
protected

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

◆ $rbac_system

readonly ilRbacSystem ilTestServiceGUI::$rbac_system
protected

Definition at line 62 of file class.ilTestServiceGUI.php.

◆ $ref_id

int ilTestServiceGUI::$ref_id
protected

Definition at line 94 of file class.ilTestServiceGUI.php.

◆ $refinery

readonly Refinery ilTestServiceGUI::$refinery
protected

Definition at line 82 of file class.ilTestServiceGUI.php.

◆ $results_data_factory

readonly ResultsDataFactory ilTestServiceGUI::$results_data_factory
protected

Definition at line 87 of file class.ilTestServiceGUI.php.

◆ $results_presentation_factory

readonly ResultsPresentationFactory ilTestServiceGUI::$results_presentation_factory
protected

Definition at line 88 of file class.ilTestServiceGUI.php.

◆ $service

ilTestService ilTestServiceGUI::$service = null
protected

Definition at line 57 of file class.ilTestServiceGUI.php.

◆ $settings

readonly ilSetting ilTestServiceGUI::$settings
protected

Definition at line 91 of file class.ilTestServiceGUI.php.

Referenced by ilTestEvaluationGUI\outUserPassDetails().

◆ $shuffler

readonly ilTestShuffler ilTestServiceGUI::$shuffler
protected

Definition at line 86 of file class.ilTestServiceGUI.php.

◆ $skills_service

readonly SkillService ilTestServiceGUI::$skills_service
protected

Definition at line 85 of file class.ilTestServiceGUI.php.

◆ $tabs

readonly ilTabsGUI ilTestServiceGUI::$tabs
protected

Definition at line 76 of file class.ilTestServiceGUI.php.

◆ $test_result_repository

TestResultRepository ilTestServiceGUI::$test_result_repository
protected

Definition at line 99 of file class.ilTestServiceGUI.php.

◆ $test_sequence_factory

ilTestSequenceFactory ilTestServiceGUI::$test_sequence_factory = null
protected

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

Referenced by ilTestPlayerAbstractGUI\executeCommand().

◆ $test_session_factory

ilTestSessionFactory ilTestServiceGUI::$test_session_factory = null
protected

Definition at line 96 of file class.ilTestServiceGUI.php.

◆ $testquestionsrepository

readonly TestQuestionsRepository ilTestServiceGUI::$testquestionsrepository
protected

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

◆ $testrequest

readonly RequestDataCollector ilTestServiceGUI::$testrequest
protected

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

◆ $toolbar

readonly ilToolbarGUI ilTestServiceGUI::$toolbar
protected

Definition at line 75 of file class.ilTestServiceGUI.php.

Referenced by ilTestSubmissionReviewGUI\buildToolbar().

◆ $tpl

ilGlobalTemplateInterface ilTemplate ilTestServiceGUI::$tpl
protected

sk 2023-08-01: We need this union type, even if it is wrong! To change this

Todo:
we have to fix the rendering of the feedback modal in ilTestPlayerAbstractGUI::populateIntantResponseModal().

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

Referenced by ilTestEvaluationGUI\outUserPassDetails(), and ilTestEvalObjectiveOrientedGUI\showVirtualPassCmd().

◆ $tree

readonly ilTree ilTestServiceGUI::$tree
protected

Definition at line 93 of file class.ilTestServiceGUI.php.

◆ $ui_factory

readonly UIFactory ilTestServiceGUI::$ui_factory
protected

Definition at line 83 of file class.ilTestServiceGUI.php.

◆ $ui_renderer

readonly UIRenderer ilTestServiceGUI::$ui_renderer
protected

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

◆ $user

readonly ilObjUser ilTestServiceGUI::$user
protected

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


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