ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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_pass_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.

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 323 of file class.ilTestServiceGUI.php.

References getObjectiveOrientedContainer().

Referenced by ilTestEvaluationGUI\outUserResultsOverview().

324  {
325  $table = new ilTestPassOverviewTableGUI($target_gui, '');
326 
327  $table->setPdfPresentationEnabled(
328  $this->testrequest->isset('pdf') && $this->testrequest->raw('pdf') == 1
329  );
330 
331  $table->setObjectiveOrientedPresentationEnabled(
332  $this->getObjectiveOrientedContainer()?->isObjectiveOrientedPresentationRequired() ?? false
333  );
334 
335  return $table;
336  }
Class ilTestPassOverviewTableGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildQuestionRelatedObjectivesList()

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

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

References ilLOTestQuestionAdapter\buildQuestionRelatedObjectiveList().

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

686  $questionRelatedObjectivesList = new ilTestQuestionRelatedObjectivesList();
687 
688  $objectives_adapter->buildQuestionRelatedObjectiveList($test_sequence, $questionRelatedObjectivesList);
689 
690  return $questionRelatedObjectivesList;
691  }
buildQuestionRelatedObjectiveList(ilTestQuestionSequence $a_test_sequence, ilTestQuestionRelatedObjectivesList $a_objectives_list)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilTestServiceGUI::executeCommand ( )

execute command

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

References ILIAS\Repository\ctrl().

311  {
312  $cmd = $this->ctrl->getCmd();
313  $next_class = $this->ctrl->getNextClass($this);
314 
315  switch ($next_class) {
316  default:
317  $ret = &$this->$cmd();
318  break;
319  }
320  return $ret;
321  }
+ 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 public

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

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

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

549  : string
550  {
551  if (!is_object($testSession)) {
552  throw new InvalidArgumentException('Not an object, expected ilTestSession');
553  }
554  $template = new ilTemplate("tpl.il_as_tst_results_userdata.html", true, true, "components/ILIAS/Test");
555  $user_id = $this->object->_getUserIdFromActiveId($active_id);
556  if (strlen(ilObjUser::_lookupLogin($user_id)) > 0) {
557  $user = new ilObjUser($user_id);
558  } else {
559  $user = new ilObjUser();
560  $user->setLastname($this->lng->txt('deleted_user'));
561  }
562  $t = $testSession->getSubmittedTimestamp();
563  if (!$t) {
564  $t = $this->object->_getLastAccess($testSession->getActiveId());
565  }
566 
567  if ($this->getObjectiveOrientedContainer()?->isObjectiveOrientedPresentationRequired()) {
568  $uname = $this->object->userLookupFullName($user_id, $overwrite_anonymity);
569  $template->setCurrentBlock('name');
570  $template->setVariable('TXT_USR_NAME', $this->lng->txt("name"));
571  $template->setVariable('VALUE_USR_NAME', $uname);
572  $template->parseCurrentBlock();
573  }
574 
575  $title_matric = "";
576  if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == false) || ($overwrite_anonymity))) {
577  $template->setCurrentBlock("matriculation");
578  $template->setVariable("TXT_USR_MATRIC", $this->lng->txt("matriculation"));
579  $template->setVariable("VALUE_USR_MATRIC", $user->getMatriculation());
580  $template->parseCurrentBlock();
581  $title_matric = " - " . $this->lng->txt("matriculation") . ": " . $user->getMatriculation();
582  }
583 
584  $invited_user = array_pop($this->object->getInvitedUsers($user_id));
585  $title_client = '';
586  $template->setVariable("TXT_TEST_TITLE", $this->lng->txt("title"));
587  $template->setVariable("VALUE_TEST_TITLE", $this->object->getTitle());
588 
589  // change the pagetitle (tab title or title in title bar of window)
590  $pagetitle = $this->object->getTitle() . $title_matric . $title_client;
591  $this->tpl->setHeaderPageTitle($pagetitle);
592 
593  return $template->get();
594  }
readonly ilObjUser $user
setLastname(string $a_str)
static _lookupLogin(int $a_user_id)
+ 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 public

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

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

Referenced by outCorrectSolution(), and ilTestPlayerAbstractGUI\outCorrectSolution().

605  : string
606  {
607  $ilUser = $this->user;
608 
609  $test_id = $this->object->getTestId();
610  $question_gui = $this->object->createQuestionGUI("", $question_id);
611 
612  $template = new ilTemplate("tpl.il_as_tst_correct_solution_output.html", true, true, "components/ILIAS/Test");
613  $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? true : false;
614  $result_output = $question_gui->getSolutionOutput($active_id, $pass, true, false, $show_question_only, $this->object->getShowSolutionFeedback(), false, false, true);
615  $best_output = $question_gui->getSolutionOutput($active_id, $pass, false, false, $show_question_only, false, true, false, false);
616  if ($this->object->getShowSolutionFeedback() && $this->testrequest->raw('cmd') != 'outCorrectSolution') {
617  $specificAnswerFeedback = $question_gui->getSpecificFeedbackOutput(
618  $question_gui->getObject()->fetchIndexedValuesFromValuePairs(
619  $question_gui->getObject()->getSolutionValues($active_id, $pass)
620  )
621  );
622  if (strlen($specificAnswerFeedback)) {
623  $template->setCurrentBlock("outline_specific_feedback");
624  $template->setVariable("OUTLINE_SPECIFIC_FEEDBACK", $specificAnswerFeedback);
625  $template->parseCurrentBlock();
626  }
627  }
628  $template->setVariable("TEXT_YOUR_SOLUTION", $this->lng->txt("tst_your_answer_was"));
629  $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
630  // I set both old and new since the old one is set as well in several places.
631  $maxpoints = $question_gui->getObject()->getMaximumPoints();
632  if ($maxpoints == 1) {
633  $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->getObject()->getTitleForHTMLOutput()) . " (" . $maxpoints . " " . $this->lng->txt("point") . ")");
634  } else {
635  $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->getObject()->getTitleForHTMLOutput()) . " (" . $maxpoints . " " . $this->lng->txt("points") . ")");
636  }
637  if ($objectives_list !== null) {
638  $objectives = $this->lng->txt('tst_res_lo_objectives_header') . ': ';
639  $objectives .= $objectives_list->getQuestionRelatedObjectiveTitles($question_gui->getObject()->getId());
640  $template->setVariable('OBJECTIVES', $objectives);
641  }
642  $template->setVariable("SOLUTION_OUTPUT", $result_output);
643  $template->setVariable("RECEIVED_POINTS", sprintf($this->lng->txt("you_received_a_of_b_points"), $question_gui->getObject()->getReachedPoints($active_id, $pass), $maxpoints));
644  $template->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
645  $template->setVariable("BACKLINK_TEXT", "<< " . $this->lng->txt("back"));
646  return $template->get();
647  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$objectives
readonly ilObjUser $user
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGradingMessageBuilder()

ilTestServiceGUI::getGradingMessageBuilder ( int  $active_id)
protected

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

References ILIAS\Repository\lng().

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

674  {
675  $gradingMessageBuilder = new ilTestGradingMessageBuilder($this->lng, $this->tpl, $this->object);
676 
677  $gradingMessageBuilder->setActiveId($active_id);
678 
679  return $gradingMessageBuilder;
680  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObject()

◆ 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 464 of file class.ilTestServiceGUI.php.

References buildPassDetailsOverviewTableGUI(), ILIAS\Repository\ctrl(), null, and ILIAS\Repository\object().

Referenced by ilTestEvalObjectiveOrientedGUI\showVirtualPassCmd().

473  $this->ctrl->setParameter($target_gui, 'active_id', $active_id);
474  $this->ctrl->setParameter($target_gui, 'pass', $pass);
475 
476  $table_gui = $this->buildPassDetailsOverviewTableGUI($target_gui, $target_cmd);
477  $table_gui->setShowHintCount($this->object->isOfferingQuestionHintsEnabled());
478 
479  if ($objectives_list !== null) {
480  $table_gui->setQuestionRelatedObjectivesList($objectives_list);
481  $table_gui->setObjectiveOrientedPresentationEnabled(true);
482  }
483 
484  $table_gui->setMultipleObjectivesInvolved($multiple_objectives_involved);
485 
486  $table_gui->setActiveId($active_id);
487  $table_gui->setShowSuggestedSolution(false);
488 
489  $users_question_solutions = [];
490 
491  foreach ($result_array as $key => $val) {
492  if ($key === 'test' || $key === 'pass') {
493  continue;
494  }
495 
496  if ($this->object->getShowSolutionSuggested() && strlen($val['solution'])) {
497  $table_gui->setShowSuggestedSolution(true);
498  }
499 
500  if (isset($val['pass'])) {
501  $table_gui->setPassColumnEnabled(true);
502  }
503 
504  $users_question_solutions[$key] = $val;
505  }
506 
507  $table_gui->initColumns();
508 
509  $table_gui->setFilterCommand($target_cmd . 'SetTableFilter');
510  $table_gui->setResetCommand($target_cmd . 'ResetTableFilter');
511 
512  $table_gui->setData($users_question_solutions);
513 
514  return $table_gui;
515  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
buildPassDetailsOverviewTableGUI(ilTestServiceGUI $target_gui, string $target_cmd)
+ Here is the call graph for this function:
+ 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 public

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

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

Referenced by ilTestEvaluationGUI\outUserListOfAnswerPasses().

359  : string {
360  $maintemplate = new ilTemplate('tpl.il_as_tst_list_of_answers.html', true, true, 'components/ILIAS/Test');
361 
362  $counter = 1;
363  // output of questions with solutions
364  foreach ($result_array as $question_data) {
365  if (!array_key_exists('workedthrough', $question_data)) {
366  $question_data['workedthrough'] = 0;
367  }
368  if (!array_key_exists('qid', $question_data)) {
369  $question_data['qid'] = -1;
370  }
371 
372  if (($question_data['workedthrough'] == 1) || ($only_answered_questions == false)) {
373  $template = new ilTemplate('tpl.il_as_qpl_question_printview.html', true, true, 'components/ILIAS/TestQuestionPool');
374  $question_id = $question_data["qid"] ?? null;
375  if ($question_id !== null
376  && $question_id !== -1
377  && is_numeric($question_id)) {
378  $maintemplate->setCurrentBlock('printview_question');
379  $question_gui = $this->object->createQuestionGUI("", $question_id);
380 
381  $question_gui->getObject()->setShuffler($this->shuffler->getAnswerShuffleFor(
382  (int) $question_id,
383  (int) $active_id,
384  (int) $pass
385  ));
386  if (is_object($question_gui)) {
387  if ($anchorNav) {
388  $template->setCurrentBlock('block_id');
389  $template->setVariable('BLOCK_ID', "detailed_answer_block_act_{$active_id}_qst_{$question_id}");
390  $template->parseCurrentBlock();
391 
392  $template->setCurrentBlock('back_anchor');
393  $template->setVariable('HREF_BACK_ANCHOR', "#pass_details_tbl_row_act_{$active_id}_qst_{$question_id}");
394  $template->setVariable('TXT_BACK_ANCHOR', $this->lng->txt('tst_back_to_question_list'));
395  $template->parseCurrentBlock();
396  }
397 
398  if ($show_reached_points) {
399  $template->setCurrentBlock("result_points");
400  $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());
401  $template->parseCurrentBlock();
402  }
403  $template->setVariable("COUNTER_QUESTION", $counter . ". ");
404  $template->setVariable("TXT_QUESTION_ID", $this->lng->txt('question_id_short'));
405  $template->setVariable("QUESTION_ID", $question_gui->getObject()->getId());
406  $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->getObject()->getTitleForHTMLOutput()));
407 
408  if ($objectives_list !== null) {
409  $objectives = $this->lng->txt('tst_res_lo_objectives_header') . ': ';
410  $objectives .= $objectives_list->getQuestionRelatedObjectiveTitles($question_gui->getObject()->getId());
411  $template->setVariable("OBJECTIVES", $objectives);
412  }
413 
414  $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? true : false;
415 
416  $show_feedback = $this->isContextResultPresentation() && $this->object->getShowSolutionFeedback();
417  $show_best_solution = $this->isContextResultPresentation() && $show_solutions;
418  $show_graphical_output = $this->isContextResultPresentation();
419 
420  if ($show_best_solution) {
421  $compare_template = new ilTemplate('tpl.il_as_tst_answers_compare.html', true, true, 'components/ILIAS/Test');
422  $test_session = $this->test_session_factory->getSession($active_id);
423  if ($pass <= $test_session->getLastFinishedPass()) {
424  $compare_template->setVariable("HEADER_PARTICIPANT", $this->lng->txt('tst_header_participant'));
425  } else {
426  $compare_template->setVariable("HEADER_PARTICIPANT", $this->lng->txt('tst_header_participant_no_answer'));
427  }
428 
429  $compare_template->setVariable("HEADER_SOLUTION", $this->lng->txt('tst_header_solution'));
430  $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_graphical_output, false, $show_question_only, $show_feedback);
431  $best_output = $question_gui->getSolutionOutput($active_id, $pass, false, false, $show_question_only, false, true);
432 
433  $compare_template->setVariable('PARTICIPANT', $result_output);
434  $compare_template->setVariable('SOLUTION', $best_output);
435  $template->setVariable('SOLUTION_OUTPUT', $compare_template->get());
436  } else {
437  $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_graphical_output, false, $show_question_only, $show_feedback);
438  $template->setVariable('SOLUTION_OUTPUT', $result_output);
439  }
440 
441  $maintemplate->setCurrentBlock('printview_question');
442  $maintemplate->setVariable("QUESTION_PRINTVIEW", $template->get());
443  $maintemplate->parseCurrentBlock();
444  $counter++;
445  }
446  }
447  }
448  }
449 
450  if ($testResultHeaderLabelBuilder !== null) {
451  if ($pass !== null) {
452  $headerText = $testResultHeaderLabelBuilder->getListOfAnswersHeaderLabel($pass + 1);
453  } else {
454  $headerText = $testResultHeaderLabelBuilder->getVirtualListOfAnswersHeaderLabel();
455  }
456  } else {
457  $headerText = '';
458  }
459 
460  $maintemplate->setVariable('RESULTS_OVERVIEW', $headerText);
461  return $maintemplate->get();
462  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$objectives
+ 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.

References $data, ilObjTest\_getResultPass(), buildQuestionRelatedObjectivesList(), ilTestSession\getActiveId(), ilLOTestQuestionAdapter\getInstance(), getObjectiveOrientedContainer(), ilAssQuestionHintTracking\getRequestRequestStatisticDataRegisterByActiveId(), null, and ILIAS\Repository\object().

Referenced by ilTestEvaluationGUI\outUserResultsOverview().

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 
209  $test_session->getActiveId()
210  );
211 
212  foreach ($passes as $pass) {
213  $row = [
214  'scored' => false,
215  'pass' => $pass,
216  'date' => ilObjTest::lookupLastTestPassAccess($test_session->getActiveId(), $pass)
217  ];
218  $considerOptionalQuestions = true;
219 
220  if ($objective_oriented_presentation) {
221  $test_sequence = $this->test_sequence_factory->getSequenceByActiveIdAndPass($test_session->getActiveId(), $pass);
222  $test_sequence->loadFromDb();
223  $test_sequence->loadQuestions();
224 
225  if ($this->object->isRandomTest() && !$test_sequence->isAnsweringOptionalQuestionsConfirmed()) {
226  $considerOptionalQuestions = false;
227  }
228 
229  $test_sequence->setConsiderHiddenQuestionsEnabled($consider_hidden_questions);
230  $test_sequence->setConsiderOptionalQuestionsEnabled($considerOptionalQuestions);
231 
232  $objectives_list = $this->buildQuestionRelatedObjectivesList($objectives_adapter, $test_sequence);
233  $objectives_list->loadObjectivesTitles();
234 
235  $row['objectives'] = $objectives_list->getUniqueObjectivesStringForQuestions($test_sequence->getUserSequenceQuestions());
236  }
237 
238  if (!$with_results) {
239  $data[] = $row;
240  continue;
241  }
242 
243  $result_array = $this->object->getTestResult(
244  $test_session->getActiveId(),
245  $pass,
246  false,
247  $consider_hidden_questions,
248  $considerOptionalQuestions
249  );
250 
251  foreach ($result_array as $result_struct_key => $question) {
252  if ($result_struct_key === 'test'
253  || $result_struct_key === 'pass'
254  || $result_array[$result_struct_key]['requested_hints'] !== null) {
255  continue;
256  }
257 
258  $request_data = $question_hint_request_register->getRequestByTestPassIndexAndQuestionId($pass, $question['qid']);
259 
260  if ($request_data === null) {
261  continue;
262  }
263 
264  $result_array['pass']['total_requested_hints'] += $request_data->getRequestsCount();
265  $result_array[$result_struct_key]['requested_hints'] = $request_data->getRequestsCount();
266  $result_array[$result_struct_key]['hint_points'] = $request_data->getRequestsPoints();
267  }
268 
269  if (!$result_array['pass']['total_max_points']) {
270  $row['percentage'] = 0;
271  } else {
272  $row['percentage'] = ($result_array['pass']['total_reached_points'] / $result_array['pass']['total_max_points']) * 100;
273  }
274 
275  $row['max_points'] = $result_array['pass']['total_max_points'];
276  $row['reached_points'] = $result_array['pass']['total_reached_points'];
277  $row['scored'] = ($pass == $scored_pass);
278  $row['num_workedthrough_questions'] = $result_array['pass']['num_workedthrough'];
279  $row['num_questions_total'] = $result_array['pass']['num_questions_total'];
280 
281  if ($this->object->isOfferingQuestionHintsEnabled()) {
282  $row['hints'] = $result_array['pass']['total_requested_hints'];
283  }
284 
285  $data[] = $row;
286  }
287 
288  return $data;
289  }
static getRequestRequestStatisticDataRegisterByActiveId($activeId)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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)
+ 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 public

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

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

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

523  : string
524  {
525  if ($this->object->getShowSolutionSignature() && !$this->object->getAnonymity()) {
526  $template = new ilTemplate("tpl.il_as_tst_results_userdata_signature.html", true, true, "components/ILIAS/Test");
527  $template->setVariable("TXT_DATE", $this->lng->txt("date"));
530  $template->setVariable("VALUE_DATE", ilDatePresentation::formatDate(new ilDate(time(), IL_CAL_UNIX)));
532  $template->setVariable("TXT_SIGNATURE", $this->lng->txt("tst_signature"));
533  $template->setVariable("IMG_SPACER", ilUtil::getImagePath("media/spacer.png"));
534  return $template->get();
535  } else {
536  return "";
537  }
538  }
static array static setUseRelativeDates(bool $a_status)
set use relative dates
const IL_CAL_UNIX
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
+ 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.

References $contextResultPresentation.

Referenced by getPassListOfAnswers().

107  : bool
108  {
110  }
+ Here is the caller graph for this function:

◆ isGradingMessageRequired()

ilTestServiceGUI::isGradingMessageRequired ( )
protected

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

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

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

656  : bool
657  {
658  $session = $this->test_session_factory->getSession();
659  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()
660  || $this->object->getScoreSettings()->getScoringSettings()->getPassScoring() === ilObjTest::SCORE_LAST_PASS
661  && $session->getLastFinishedPass() < $session->getLastStartedPass()) {
662  return false;
663  }
664 
665  if ($this->object->isShowGradingStatusEnabled()
666  || $this->object->isShowGradingMarkEnabled()) {
667  return true;
668  }
669 
670  return false;
671  }
const SCORE_LAST_PASS
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ outCorrectSolution()

ilTestServiceGUI::outCorrectSolution ( )
protected

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

References $tabs, buildQuestionRelatedObjectivesList(), ILIAS\Repository\ctrl(), ilObjStyleSheet\getContentStylePath(), getCorrectSolutionOutput(), ilLOTestQuestionAdapter\getInstance(), getObjectiveOrientedContainer(), ilUtil\getStyleSheetLocation(), ilObjStyleSheet\getSyntaxStylePath(), ILIAS\Repository\int(), ILIAS\Repository\lng(), null, ILIAS\Repository\object(), and ilTabsGUI\setBackTarget().

Referenced by outCorrectSolutionCmd().

703  : void
704  {
705  if (!$this->object->getShowSolutionDetails()) {
706  $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_permission"), true);
707  $this->ctrl->redirectByClass([ilRepositoryGUI::class, ilObjTestGUI::class, ilInfoScreenGUI::class]);
708  }
709 
710  $testSession = $this->test_session_factory->getSession();
711  $active_id = $testSession->getActiveId();
712 
713  if (!($active_id > 0)) {
714  $this->ctrl->redirectByClass([ilRepositoryGUI::class, ilObjTestGUI::class, ilInfoScreenGUI::class]);
715  }
716 
717  $this->ctrl->saveParameter($this, "pass");
718  $pass = (int) $this->testrequest->raw("pass");
719 
720  $active_id = (int) $this->testrequest->raw('evaluation');
721 
722  $test_sequence = $this->test_sequence_factory->getSequenceByActiveIdAndPass($active_id, $pass);
723  $test_sequence->loadFromDb();
724  $test_sequence->loadQuestions();
725 
726  if (!$test_sequence->questionExists($active_id)) {
727  ilObjTestGUI::accessViolationRedirect();
728  }
729 
730  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
731  $test_sequence = $this->test_sequence_factory->getSequenceByActiveIdAndPass($active_id, $pass);
732  $test_sequence->loadFromDb();
733  $test_sequence->loadQuestions();
734 
735  $objectives_adapter = ilLOTestQuestionAdapter::getInstance($testSession);
736  $objectives_list = $this->buildQuestionRelatedObjectivesList($objectives_adapter, $test_sequence);
737  $objectives_list->loadObjectivesTitles();
738  } else {
739  $objectives_list = null;
740  }
741 
742  $ilTabs = $this->tabs;
743 
744  if ($this instanceof ilTestEvalObjectiveOrientedGUI) {
745  $ilTabs->setBackTarget(
746  $this->lng->txt("tst_back_to_virtual_pass"),
747  $this->ctrl->getLinkTarget($this, 'showVirtualPass')
748  );
749  } else {
750  $ilTabs->setBackTarget(
751  $this->lng->txt("tst_back_to_pass_details"),
752  $this->ctrl->getLinkTarget($this, 'outUserPassDetails')
753  );
754  }
755  $ilTabs->clearSubTabs();
756 
757  $this->tpl->setCurrentBlock("ContentStyle");
758  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
759  $this->tpl->parseCurrentBlock();
760 
761  $this->tpl->setCurrentBlock("SyntaxStyle");
762  $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
763  $this->tpl->parseCurrentBlock();
764 
765  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css"), "print");
766  if ($this->object->getShowSolutionAnswersOnly()) {
767  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css"), "print");
768  }
769 
770  $solution = $this->getCorrectSolutionOutput($active_id, $active_id, $pass, $objectives_list);
771 
772  $this->tpl->setContent($solution);
773  }
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user
getCorrectSolutionOutput($question_id, $active_id, $pass, ?ilTestQuestionRelatedObjectivesList $objectives_list=null)
Returns an output of the solution to an answer compared to the correct solution.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getInstance(ilTestSession $a_test_session)
setBackTarget(string $a_title, string $a_target, string $a_frame="")
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
buildQuestionRelatedObjectivesList(ilLOTestQuestionAdapter $objectives_adapter, ilTestQuestionSequence $test_sequence)
readonly ilTabsGUI $tabs
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ outCorrectSolutionCmd()

ilTestServiceGUI::outCorrectSolutionCmd ( )
protected

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

References outCorrectSolution().

698  : void
699  {
700  $this->outCorrectSolution(); // cannot be named xxxCmd, because it's also called from context without Cmd in names
701  }
+ Here is the call graph for this function:

◆ populateContent()

ilTestServiceGUI::populateContent ( string  $content)
protected

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

Referenced by ilTestEvalObjectiveOrientedGUI\showVirtualPassCmd().

693  : void
694  {
695  $this->tpl->setContent($content);
696  }
+ Here is the caller graph for this function:

◆ populateExamId()

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

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

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

Referenced by ilTestEvaluationGUI\outUserPassDetails().

788  : void
789  {
790  if ($this->object->isShowExamIdInTestResultsEnabled()) {
791  $tpl->setVariable('EXAM_ID_TXT', $this->lng->txt('exam_id'));
792  $tpl->setVariable('EXAM_ID', ilObjTest::lookupExamId(
793  $active_id,
794  $pass
795  ));
796  }
797  }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
static lookupExamId($active_id, $pass)
+ 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 775 of file class.ilTestServiceGUI.php.

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

Referenced by ilTestEvaluationGUI\outUserPassDetails().

775  : void
776  {
777  if ($pass_finish_date === null) {
778  return;
779  }
782  $pass_finish_date_string = ilDatePresentation::formatDate(new ilDateTime($pass_finish_date, IL_CAL_UNIX));
784  $tpl->setVariable("PASS_FINISH_DATE_LABEL", $this->lng->txt('tst_pass_finished_on'));
785  $tpl->setVariable("PASS_FINISH_DATE_VALUE", $pass_finish_date_string);
786  }
static array static setUseRelativeDates(bool $a_status)
set use relative dates
const IL_CAL_UNIX
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContextResultPresentation()

ilTestServiceGUI::setContextResultPresentation ( bool  $contextResultPresentation)

◆ setObjectiveOrientedContainer()

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

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

References $objective_oriented_container.

295  {
296  $this->objective_oriented_container = $objective_oriented_container;
297  }
ilTestObjectiveOrientedContainer $objective_oriented_container

◆ setParticipantData()

ilTestServiceGUI::setParticipantData ( ilTestParticipantData  $participantData)

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

References $participantData.

174  : void
175  {
176  $this->participantData = $participantData;
177  }
ilTestParticipantData $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

◆ $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

◆ $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.

Referenced by outCorrectSolution().

◆ $test_pass_result_repository

TestResultRepository ilTestServiceGUI::$test_pass_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 ilTestPlayerAbstractGUI\getQuestionGuiInstance(), ilTestEvaluationGUI\outUserPassDetails(), ilTestPlayerAbstractGUI\populateInstantResponseModal(), 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.

Referenced by getCorrectSolutionOutput().


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