ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 $testSession, $passes, $withResults)
 This method uses the data of a given test pass to create an evaluation for displaying into a table used in the ilTestEvaluationGUI. More...
 
 setObjectiveOrientedContainer (ilTestObjectiveOrientedContainer $objective_oriented_container)
 
 getObjectiveOrientedContainer ()
 
 executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 Retrieves the ilCtrl 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, ilTestResultHeaderLabelBuilder $testResultHeaderLabelBuilder=null)
 Returns the list of answers of a users test pass. More...
 
 getPassListOfAnswersWithScoring (&$result_array, $active_id, $pass, $show_solutions=false)
 Returns the list of answers of a users test pass and offers a scoring option. 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...
 
 getResultsOfUserOutput (ilTestSession $testSession, int $active_id, int $pass, ilParticipantsTestResultsGUI $target_gui, bool $show_pass_details=true, bool $show_answers=true, bool $show_question_only=false, bool $show_reached_points=false)
 Output of the pass overview for a test called by a test participant. More...
 
 getResultsHeadUserAndPass ($active_id, $pass)
 Returns the user and pass data for a test results output. More...
 
 getQuestionResultForTestUsers (int $question_id, int $test_id)
 
 getObject ()
 

Protected Member Functions

 getPassDetailsOverviewTableGUI (array $result_array, int $active_id, int $pass, ilTestServiceGUI|ilParticipantsTestResultsGUI $target_gui, string $target_cmd, ilTestQuestionRelatedObjectivesList $objectives_list=null, bool $multiple_objectives_involved=true)
 
 buildPassDetailsOverviewTableGUI (ilTestServiceGUI|ilParticipantsTestResultsGUI $target_gui, string $target_cmd)
 
 isGradingMessageRequired ()
 
 getGradingMessageBuilder (int $active_id)
 
 buildQuestionRelatedObjectivesList (ilLOTestQuestionAdapter $objectives_adapter, ilTestQuestionSequence $test_sequence)
 
 getFilteredTestResult (int $active_id, int $pass, bool $considerHiddenQuestions, bool $considerOptionalQuestions)
 
 populateContent ($content)
 
 buildUserTestResultsToolbarGUI ()
 
 outCorrectSolutionCmd ()
 
 outCorrectSolution ()
 Creates an output of the solution of an answer compared to the correct solution. More...
 
 populatePassFinishDate (ilTemplate $tpl, ?int $pass_finish_date)
 
 populateExamId (ilTemplate $tpl, int $active_id, int $pass)
 

Protected Attributes

InternalRequestService $testrequest
 
ILIAS TestQuestionPool QuestionInfoService $questioninfo
 
ilTestService $service = null
 
ilDBInterface $db
 
ilLanguage $lng
 
LoggingServices $logging_services
 
ilHelpGUI $help
 
ilRbacSystem $rbac_system
 
ilGlobalTemplateInterface ilTemplate $tpl
 sk 2023-08-01: We need this union type, even if it is wrong! To change this More...
 
ContentStyle $content_style
 
ilErrorHandling $error
 
ilAccess $access
 
HTTPServices $http
 
ilCtrl $ctrl
 
ilToolbarGUI $toolbar
 
ilTabsGUI $tabs
 
ilObjectDataCache $obj_cache
 
ilComponentRepository $component_repository
 
ilObjUser $user
 
ArrayBasedRequestWrapper $post_wrapper
 
ilNavigationHistory $navigation_history
 
Refinery $refinery
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
SkillService $skills_service
 
ilTestShuffler $shuffler
 
ilTestResultsFactory $results_factory
 
ilTestResultsPresentationFactory $results_presentation_factory
 
ILIAS $ilias
 
ilSetting $settings
 
GlobalScreenServices $global_screen
 
ilTree $tree
 
int $ref_id
 
ilTestSessionFactory $testSessionFactory = null
 
ilTestSequenceFactory $testSequenceFactory = null
 
ilTestParticipantData $participantData = null
 
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 48 of file class.ilTestServiceGUI.php.

Member Function Documentation

◆ buildPassDetailsOverviewTableGUI()

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

◆ buildPassOverviewTableGUI()

ilTestServiceGUI::buildPassOverviewTableGUI ( ilTestEvaluationGUI  $target_gui)

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

References getObjectiveOrientedContainer().

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

316  {
317  $table = new ilTestPassOverviewTableGUI($target_gui, '');
318 
319  $table->setPdfPresentationEnabled(
320  $this->testrequest->isset('pdf') && $this->testrequest->raw('pdf') == 1
321  );
322 
323  $table->setObjectiveOrientedPresentationEnabled(
324  $this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()
325  );
326 
327  return $table;
328  }
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 1002 of file class.ilTestServiceGUI.php.

References ilLOTestQuestionAdapter\buildQuestionRelatedObjectiveList().

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

1006  $questionRelatedObjectivesList = new ilTestQuestionRelatedObjectivesList();
1007 
1008  $objectives_adapter->buildQuestionRelatedObjectiveList($test_sequence, $questionRelatedObjectivesList);
1009 
1010  return $questionRelatedObjectivesList;
1011  }
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:

◆ buildUserTestResultsToolbarGUI()

◆ executeCommand()

ilTestServiceGUI::executeCommand ( )

execute command

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

References ILIAS\Repository\ctrl(), and getCommand().

292  {
293  $cmd = $this->ctrl->getCmd();
294  $next_class = $this->ctrl->getNextClass($this);
295 
296  $cmd = $this->getCommand($cmd);
297  switch ($next_class) {
298  default:
299  $ret = &$this->$cmd();
300  break;
301  }
302  return $ret;
303  }
getCommand($cmd)
Retrieves the ilCtrl command.
+ 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 628 of file class.ilTestServiceGUI.php.

References ilObjUser\_lookupLogin(), ilObjUser\getMatriculation(), getObjectiveOrientedContainer(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilObjUser\setLastname().

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

628  : string
629  {
630  if (!is_object($testSession)) {
631  throw new InvalidArgumentException('Not an object, expected ilTestSession');
632  }
633  $template = new ilTemplate("tpl.il_as_tst_results_userdata.html", true, true, "Modules/Test");
634  $user_id = $this->object->_getUserIdFromActiveId($active_id);
635  if (strlen(ilObjUser::_lookupLogin($user_id)) > 0) {
636  $user = new ilObjUser($user_id);
637  } else {
638  $user = new ilObjUser();
639  $user->setLastname($this->lng->txt("deleted_user"));
640  }
641  $t = $testSession->getSubmittedTimestamp();
642  if (!$t) {
643  $t = $this->object->_getLastAccess($testSession->getActiveId());
644  }
645 
646  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
647  $uname = $this->object->userLookupFullName($user_id, $overwrite_anonymity);
648  $template->setCurrentBlock("name");
649  $template->setVariable('TXT_USR_NAME', $this->lng->txt("name"));
650  $template->setVariable('VALUE_USR_NAME', $uname);
651  $template->parseCurrentBlock();
652  }
653 
654  $title_matric = "";
655  if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == false) || ($overwrite_anonymity))) {
656  $template->setCurrentBlock("matriculation");
657  $template->setVariable("TXT_USR_MATRIC", $this->lng->txt("matriculation"));
658  $template->setVariable("VALUE_USR_MATRIC", $user->getMatriculation());
659  $template->parseCurrentBlock();
660  $title_matric = " - " . $this->lng->txt("matriculation") . ": " . $user->getMatriculation();
661  }
662 
663  $invited_user = array_pop($this->object->getInvitedUsers($user_id));
664  $title_client = '';
665  if (is_array($invited_user)
666  && array_key_exists('clientip', $invited_user)
667  && is_string($invited_user['clientip'])
668  && trim($invited_user['clientip']) !== ''
669  ) {
670  $template->setCurrentBlock("client_ip");
671  $template->setVariable("TXT_CLIENT_IP", $this->lng->txt("client_ip"));
672  $template->setVariable("VALUE_CLIENT_IP", $invited_user["clientip"]);
673  $template->parseCurrentBlock();
674  $title_client = " - " . $this->lng->txt("clientip") . ": " . $invited_user["clientip"];
675  }
676 
677  $template->setVariable("TXT_TEST_TITLE", $this->lng->txt("title"));
678  $template->setVariable("VALUE_TEST_TITLE", $this->object->getTitle());
679 
680  // change the pagetitle (tab title or title in title bar of window)
681  $pagetitle = $this->object->getTitle() . $title_matric . $title_client;
682  $this->tpl->setHeaderPageTitle($pagetitle);
683 
684  return $template->get();
685  }
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:

◆ getCommand()

ilTestServiceGUI::getCommand (   $cmd)

Retrieves the ilCtrl command.

public

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

Referenced by ilTestOutputGUI\executeCommand(), and executeCommand().

311  {
312  return $cmd;
313  }
+ 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 696 of file class.ilTestServiceGUI.php.

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

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

696  : string
697  {
698  $ilUser = $this->user;
699 
700  $test_id = $this->object->getTestId();
701  $question_gui = $this->object->createQuestionGUI("", $question_id);
702 
703  $template = new ilTemplate("tpl.il_as_tst_correct_solution_output.html", true, true, "Modules/Test");
704  $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? true : false;
705  $result_output = $question_gui->getSolutionOutput($active_id, $pass, true, false, $show_question_only, $this->object->getShowSolutionFeedback(), false, false, true);
706  $best_output = $question_gui->getSolutionOutput($active_id, $pass, false, false, $show_question_only, false, true, false, false);
707  if ($this->object->getShowSolutionFeedback() && $this->testrequest->raw('cmd') != 'outCorrectSolution') {
708  $specificAnswerFeedback = $question_gui->getSpecificFeedbackOutput(
709  $question_gui->object->fetchIndexedValuesFromValuePairs(
710  $question_gui->object->getSolutionValues($active_id, $pass)
711  )
712  );
713  if (strlen($specificAnswerFeedback)) {
714  $template->setCurrentBlock("outline_specific_feedback");
715  $template->setVariable("OUTLINE_SPECIFIC_FEEDBACK", $specificAnswerFeedback);
716  $template->parseCurrentBlock();
717  }
718  }
719  $template->setVariable("TEXT_YOUR_SOLUTION", $this->lng->txt("tst_your_answer_was"));
720  $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
721  // I set both old and new since the old one is set as well in several places.
722  $maxpoints = $question_gui->object->getMaximumPoints();
723  if ($maxpoints == 1) {
724  $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitleForHTMLOutput()) . " (" . $maxpoints . " " . $this->lng->txt("point") . ")");
725  } else {
726  $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitleForHTMLOutput()) . " (" . $maxpoints . " " . $this->lng->txt("points") . ")");
727  }
728  if ($objectives_list !== null) {
729  $objectives = $this->lng->txt('tst_res_lo_objectives_header') . ': ';
730  $objectives .= $objectives_list->getQuestionRelatedObjectiveTitles($question_gui->object->getId());
731  $template->setVariable('OBJECTIVES', $objectives);
732  }
733  $template->setVariable("SOLUTION_OUTPUT", $result_output);
734  $template->setVariable("RECEIVED_POINTS", sprintf($this->lng->txt("you_received_a_of_b_points"), $question_gui->object->getReachedPoints($active_id, $pass), $maxpoints));
735  $template->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
736  $template->setVariable("BACKLINK_TEXT", "<< " . $this->lng->txt("back"));
737  return $template->get();
738  }
$objectives
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFilteredTestResult()

ilTestServiceGUI::getFilteredTestResult ( int  $active_id,
int  $pass,
bool  $considerHiddenQuestions,
bool  $considerOptionalQuestions 
)
protected

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

References $component_repository, $db, $ilDB, buildPassDetailsOverviewTableGUI(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilAssQuestionList\QUESTION_INSTANCE_TYPE_DUPLICATES, and ILIAS\Repository\refinery().

1018  : array {
1019  $ilDB = $this->db;
1021 
1022  $table_gui = $this->buildPassDetailsOverviewTableGUI($this, 'outUserPassDetails');
1023 
1024  $questionList = new ilAssQuestionList($ilDB, $this->lng, $this->refinery, $component_repository);
1025 
1026  $questionList->setParentObjIdsFilter([$this->object->getId()]);
1027  $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES);
1028 
1029  foreach ($table_gui->getFilterItems() as $item) {
1030  if (substr($item->getPostVar(), 0, strlen('tax_')) == 'tax_') {
1031  $v = $item->getValue();
1032 
1033  if (is_array($v) && count($v) && !(int) $v[0]) {
1034  continue;
1035  }
1036 
1037  $taxId = substr($item->getPostVar(), strlen('tax_'));
1038  $questionList->addTaxonomyFilter($taxId, $item->getValue(), $this->object->getId(), 'tst');
1039  } elseif ($item->getValue() !== false) {
1040  $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
1041  }
1042  }
1043 
1044  $questionList->load();
1045 
1046  $filteredTestResult = [];
1047 
1048  $resultData = $this->object->getTestResult($active_id, $pass, false, $considerHiddenQuestions, $considerOptionalQuestions);
1049 
1050  foreach ($resultData as $resultItemKey => $resultItemValue) {
1051  if ($resultItemKey === 'test' || $resultItemKey === 'pass') {
1052  continue;
1053  }
1054 
1055  if (!$questionList->isInList($resultItemValue['qid'])) {
1056  continue;
1057  }
1058 
1059  $filteredTestResult[] = $resultItemValue;
1060  }
1061 
1062  return $filteredTestResult;
1063  }
ilComponentRepository $component_repository
buildPassDetailsOverviewTableGUI(ilTestServiceGUI|ilParticipantsTestResultsGUI $target_gui, string $target_cmd)
+ Here is the call graph for this function:

◆ getGradingMessageBuilder()

ilTestServiceGUI::getGradingMessageBuilder ( int  $active_id)
protected

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

References ILIAS\Repository\lng().

Referenced by getResultsOfUserOutput(), ilTestEvaluationGUI\outParticipantsPassDetails(), ilTestEvaluationGUI\outParticipantsResultsOverview(), ilTestEvaluationGUI\outUserPassDetails(), and ilTestEvaluationGUI\outUserResultsOverview().

994  {
995  $gradingMessageBuilder = new ilTestGradingMessageBuilder($this->lng, $this->tpl, $this->object);
996 
997  $gradingMessageBuilder->setActiveId($active_id);
998 
999  return $gradingMessageBuilder;
1000  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObject()

◆ getObjectiveOrientedContainer()

◆ getParticipantData()

ilTestServiceGUI::getParticipantData ( )

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

References $participantData.

◆ getPassDetailsOverviewTableGUI()

ilTestServiceGUI::getPassDetailsOverviewTableGUI ( array  $result_array,
int  $active_id,
int  $pass,
ilTestServiceGUI|ilParticipantsTestResultsGUI  $target_gui,
string  $target_cmd,
ilTestQuestionRelatedObjectivesList  $objectives_list = null,
bool  $multiple_objectives_involved = true 
)
protected

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

References ILIAS\LTI\ToolProvider\$key, buildPassDetailsOverviewTableGUI(), ILIAS\Repository\ctrl(), and ILIAS\Repository\object().

Referenced by getResultsOfUserOutput(), and ilTestEvalObjectiveOrientedGUI\showVirtualPassCmd().

552  $this->ctrl->setParameter($target_gui, 'active_id', $active_id);
553  $this->ctrl->setParameter($target_gui, 'pass', $pass);
554 
555  $table_gui = $this->buildPassDetailsOverviewTableGUI($target_gui, $target_cmd);
556  $table_gui->setShowHintCount($this->object->isOfferingQuestionHintsEnabled());
557 
558  if ($objectives_list !== null) {
559  $table_gui->setQuestionRelatedObjectivesList($objectives_list);
560  $table_gui->setObjectiveOrientedPresentationEnabled(true);
561  }
562 
563  $table_gui->setMultipleObjectivesInvolved($multiple_objectives_involved);
564 
565  $table_gui->setActiveId($active_id);
566  $table_gui->setShowSuggestedSolution(false);
567 
568  $users_question_solutions = [];
569 
570  foreach ($result_array as $key => $val) {
571  if ($key === 'test' || $key === 'pass') {
572  continue;
573  }
574 
575  if ($this->object->getShowSolutionSuggested() && strlen($val['solution'])) {
576  $table_gui->setShowSuggestedSolution(true);
577  }
578 
579  if (isset($val['pass'])) {
580  $table_gui->setPassColumnEnabled(true);
581  }
582 
583  $users_question_solutions[$key] = $val;
584  }
585 
586  $table_gui->initColumns();
587 
588  $table_gui->setFilterCommand($target_cmd . 'SetTableFilter');
589  $table_gui->setResetCommand($target_cmd . 'ResetTableFilter');
590 
591  $table_gui->setData($users_question_solutions);
592 
593  return $table_gui;
594  }
string $key
Consumer key/client ID value.
Definition: System.php:193
buildPassDetailsOverviewTableGUI(ilTestServiceGUI|ilParticipantsTestResultsGUI $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,
ilTestResultHeaderLabelBuilder  $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 340 of file class.ilTestServiceGUI.php.

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

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

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

◆ getPassListOfAnswersWithScoring()

ilTestServiceGUI::getPassListOfAnswersWithScoring ( $result_array,
  $active_id,
  $pass,
  $show_solutions = false 
)

Returns the list of answers of a users test pass and offers a scoring option.

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
Deprecated:

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

References ilObjAssessmentFolder\_getManualScoring(), assQuestion\_getReachedPoints(), ILIAS\Repository\ctrl(), ilObjTest\getSingleManualFeedback(), ilYuiUtil\initDomEvent(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilLegacyFormElementsUtil\prepareFormOutput().

468  : string
469  {
470  $maintemplate = new ilTemplate("tpl.il_as_tst_list_of_answers.html", true, true, "Modules/Test");
472 
473  $counter = 1;
474  // output of questions with solutions
475  foreach ($result_array as $question_data) {
476  $question = $question_data["qid"];
477  if (is_numeric($question)) {
478  $question_gui = $this->object->createQuestionGUI("", $question);
479  if (in_array($question_gui->object->getQuestionTypeID(), $scoring)) {
480  $template = new ilTemplate("tpl.il_as_qpl_question_printview.html", true, true, "Modules/TestQuestionPool");
481  $scoretemplate = new ilTemplate("tpl.il_as_tst_manual_scoring_points.html", true, true, "Modules/Test");
482  #mbecker: No such block. $this->tpl->setCurrentBlock("printview_question");
483  $template->setVariable("COUNTER_QUESTION", $counter . ". ");
484  $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitleForHTMLOutput()));
485  $points = $question_gui->object->getMaximumPoints();
486  if ($points == 1) {
487  $template->setVariable("QUESTION_POINTS", $points . " " . $this->lng->txt("point"));
488  } else {
489  $template->setVariable("QUESTION_POINTS", $points . " " . $this->lng->txt("points"));
490  }
491 
492  $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? true : false;
493  $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, false, $show_question_only, $this->object->getShowSolutionFeedback(), false, true);
494 
495  $solout = $question_gui->object->getSuggestedSolutionOutput();
496  if (strlen($solout)) {
497  $scoretemplate->setCurrentBlock("suggested_solution");
498  $scoretemplate->setVariable("TEXT_SUGGESTED_SOLUTION", $this->lng->txt("solution_hint"));
499  $scoretemplate->setVariable("VALUE_SUGGESTED_SOLUTION", $solout);
500  $scoretemplate->parseCurrentBlock();
501  }
502 
503  $scoretemplate->setCurrentBlock("feedback");
504  $scoretemplate->setVariable("FEEDBACK_NAME_INPUT", $question);
505  $feedback = ilObjTest::getSingleManualFeedback((int) $active_id, (int) $question, (int) $pass)['feedback'] ?? '';
506  $scoretemplate->setVariable(
507  "VALUE_FEEDBACK",
509  $this->object->prepareTextareaOutput($feedback, true)
510  )
511  );
512  $scoretemplate->setVariable("TEXT_MANUAL_FEEDBACK", $this->lng->txt("set_manual_feedback"));
513  $scoretemplate->parseCurrentBlock();
514 
515  $scoretemplate->setVariable("NAME_INPUT", $question);
516  $this->ctrl->setParameter($this, "active_id", $active_id);
517  $this->ctrl->setParameter($this, "pass", $pass);
518  $scoretemplate->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "manscoring"));
519  $scoretemplate->setVariable("LABEL_INPUT", $this->lng->txt("tst_change_points_for_question"));
520  $scoretemplate->setVariable("VALUE_INPUT", " value=\"" . assQuestion::_getReachedPoints($active_id, $question_data["qid"], $pass) . "\"");
521  $scoretemplate->setVariable("VALUE_SAVE", $this->lng->txt("save"));
522 
523  $template->setVariable("SOLUTION_OUTPUT", $result_output);
524  $maintemplate->setCurrentBlock("printview_question");
525  $maintemplate->setVariable("QUESTION_PRINTVIEW", $template->get());
526  $maintemplate->setVariable("QUESTION_SCORING", $scoretemplate->get());
527  $maintemplate->parseCurrentBlock();
528  }
529  $counter++;
530  }
531  }
532  if ($counter == 1) {
533  // no scorable questions found
534  $maintemplate->setVariable("NO_QUESTIONS_FOUND", $this->lng->txt("manscoring_questions_not_found"));
535  }
536  $maintemplate->setVariable("RESULTS_OVERVIEW", sprintf($this->lng->txt("manscoring_results_pass"), $pass + 1));
537 
539 
540  return $maintemplate->get();
541  }
static initDomEvent(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI DomEvent used in Services/Calendar, Modules/Session, Modules/Test (Jan 2022) ...
static prepareFormOutput($a_str, bool $a_strip=false)
static getSingleManualFeedback(int $active_id, int $question_id, int $pass)
static _getReachedPoints(int $active_id, int $question_id, int $pass)
static _getManualScoring()
Retrieve the manual scoring settings.
+ Here is the call graph for this function:

◆ getPassOverviewTableData()

ilTestServiceGUI::getPassOverviewTableData ( ilTestSession  $testSession,
  $passes,
  $withResults 
)

This method uses the data of a given test pass to create an evaluation for displaying into a table used in the ilTestEvaluationGUI.

Parameters
ilTestSession$testSessionthe current test session
array$passesAn integer array of test runs
boolean$withResults$withResults tells the method to include all scoring data into the returned row
Returns
array The array contains the date of the requested row

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

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

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

187  : array
188  {
189  $data = [];
190 
191  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
192  $considerHiddenQuestions = false;
193 
194  $objectives_adapter = ilLOTestQuestionAdapter::getInstance($testSession);
195  } else {
196  $considerHiddenQuestions = true;
197  }
198 
199  $scoredPass = $this->object->_getResultPass($testSession->getActiveId());
200 
202  $testSession->getActiveId()
203  );
204 
205  foreach ($passes as $pass) {
206  $row = [
207  'scored' => false,
208  'pass' => $pass,
209  'date' => ilObjTest::lookupLastTestPassAccess($testSession->getActiveId(), $pass)
210  ];
211  $considerOptionalQuestions = true;
212 
213  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
214  $test_sequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($testSession->getActiveId(), $pass);
215  $test_sequence->loadFromDb();
216  $test_sequence->loadQuestions();
217 
218  if ($this->object->isRandomTest() && !$test_sequence->isAnsweringOptionalQuestionsConfirmed()) {
219  $considerOptionalQuestions = false;
220  }
221 
222  $test_sequence->setConsiderHiddenQuestionsEnabled($considerHiddenQuestions);
223  $test_sequence->setConsiderOptionalQuestionsEnabled($considerOptionalQuestions);
224 
225  $objectives_list = $this->buildQuestionRelatedObjectivesList($objectives_adapter, $test_sequence);
226  $objectives_list->loadObjectivesTitles();
227 
228  $row['objectives'] = $objectives_list->getUniqueObjectivesStringForQuestions($test_sequence->getUserSequenceQuestions());
229  }
230 
231  if ($withResults) {
232  $result_array = $this->object->getTestResult($testSession->getActiveId(), $pass, false, $considerHiddenQuestions, $considerOptionalQuestions);
233 
234  foreach ($result_array as $resultStructKEY => $question) {
235  if ($resultStructKEY === 'test' || $resultStructKEY === 'pass') {
236  continue;
237  }
238 
239  $requestData = $questionHintRequestRegister->getRequestByTestPassIndexAndQuestionId($pass, $question['qid']);
240 
241  if ($requestData instanceof ilAssQuestionHintRequestStatisticData && $result_array[$resultStructKEY]['requested_hints'] === null) {
242  $result_array['pass']['total_requested_hints'] += $requestData->getRequestsCount();
243 
244  $result_array[$resultStructKEY]['requested_hints'] = $requestData->getRequestsCount();
245  $result_array[$resultStructKEY]['hint_points'] = $requestData->getRequestsPoints();
246  }
247  }
248 
249  if (!$result_array['pass']['total_max_points']) {
250  $row['percentage'] = 0;
251  } else {
252  $row['percentage'] = ($result_array['pass']['total_reached_points'] / $result_array['pass']['total_max_points']) * 100;
253  }
254 
255  $row['max_points'] = $result_array['pass']['total_max_points'];
256  $row['reached_points'] = $result_array['pass']['total_reached_points'];
257  $row['scored'] = ($pass == $scoredPass);
258  $row['num_workedthrough_questions'] = $result_array['pass']['num_workedthrough'];
259  $row['num_questions_total'] = $result_array['pass']['num_questions_total'];
260 
261  if ($this->object->isOfferingQuestionHintsEnabled()) {
262  $row['hints'] = $result_array['pass']['total_requested_hints'];
263  }
264  }
265 
266  $data[] = $row;
267  }
268 
269  return $data;
270  }
static getRequestRequestStatisticDataRegisterByActiveId($activeId)
static getInstance(ilTestSession $a_test_session)
buildQuestionRelatedObjectivesList(ilLOTestQuestionAdapter $objectives_adapter, ilTestQuestionSequence $test_sequence)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionResultForTestUsers()

ilTestServiceGUI::getQuestionResultForTestUsers ( int  $question_id,
int  $test_id 
)

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

References getResultsHeadUserAndPass(), ILIAS\Repository\object(), and assQuestionGUI\RENDER_PURPOSE_PRINT_PDF.

Referenced by ilTestEvaluationGUI\exportQuestionForAllParticipants().

933  : string
934  {
935  $question_gui = $this->object->createQuestionGUI("", $question_id);
936 
937  $this->object->setAccessFilteredParticipantList(
938  $this->object->buildStatisticsAccessFilteredParticipantList()
939  );
940 
941  $foundusers = $this->object->getParticipantsForTestAndQuestion($test_id, $question_id);
942  $output = '';
943  foreach ($foundusers as $active_id => $passes) {
944  $resultpass = $this->object->_getResultPass($active_id);
945  for ($i = 0; $i < count($passes); $i++) {
946  if (($resultpass !== null) && ($resultpass == $passes[$i]["pass"])) {
947  if ($output) {
948  $output .= "<br /><br /><br />";
949  }
950 
951  // check if re-instantiation is really neccessary
952  $question_gui = $this->object->createQuestionGUI("", $passes[$i]["qid"]);
953  $output .= $this->getResultsHeadUserAndPass($active_id, $resultpass + 1);
954  $question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PRINT_PDF);
955  $output .= $question_gui->getSolutionOutput(
956  $active_id,
957  $resultpass,
958  $graphicalOutput = false,
959  $result_output = false,
960  $show_question_only = false,
961  $show_feedback = false
962  );
963  }
964  }
965  }
966  return $output;
967  }
getResultsHeadUserAndPass($active_id, $pass)
Returns the user and pass data for a test results output.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getResultsHeadUserAndPass()

ilTestServiceGUI::getResultsHeadUserAndPass (   $active_id,
  $pass 
)

Returns the user and pass data for a test results output.

Parameters
integer$active_idThe active ID of the user
Returns
string HTML code of the user data for the test results public

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

References ilObjUser\_lookupLogin(), ilObjUser\getMatriculation(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilObjUser\setLastname().

Referenced by getQuestionResultForTestUsers().

894  : string
895  {
896  $template = new ilTemplate("tpl.il_as_tst_results_head_user_pass.html", true, true, "Modules/Test");
897  $user_id = $this->object->_getUserIdFromActiveId($active_id);
898  if (strlen(ilObjUser::_lookupLogin($user_id)) > 0) {
899  $user = new ilObjUser($user_id);
900  } else {
901  $user = new ilObjUser();
902  $user->setLastname($this->lng->txt("deleted_user"));
903  }
904  if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == false))) {
905  $template->setCurrentBlock("user_matric");
906  $template->setVariable("TXT_USR_MATRIC", $this->lng->txt("matriculation"));
907  $template->parseCurrentBlock();
908  $template->setCurrentBlock("user_matric_value");
909  $template->setVariable("VALUE_USR_MATRIC", $user->getMatriculation());
910  $template->parseCurrentBlock();
911  $template->touchBlock("user_matric_separator");
912  }
913 
914  $invited_user = array_pop($this->object->getInvitedUsers($user_id));
915  if (strlen($invited_user["clientip"] ?? '')) {
916  $template->setCurrentBlock("user_clientip");
917  $template->setVariable("TXT_CLIENT_IP", $this->lng->txt("client_ip"));
918  $template->parseCurrentBlock();
919  $template->setCurrentBlock("user_clientip_value");
920  $template->setVariable("VALUE_CLIENT_IP", $invited_user["clientip"]);
921  $template->parseCurrentBlock();
922  $template->touchBlock("user_clientip_separator");
923  }
924 
925  $template->setVariable("TXT_USR_NAME", $this->lng->txt("name"));
926  $uname = $this->object->userLookupFullName($user_id, false);
927  $template->setVariable("VALUE_USR_NAME", $uname);
928  $template->setVariable("TXT_PASS", $this->lng->txt("scored_pass"));
929  $template->setVariable("VALUE_PASS", $pass);
930  return $template->get();
931  }
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:

◆ getResultsOfUserOutput()

ilTestServiceGUI::getResultsOfUserOutput ( ilTestSession  $testSession,
int  $active_id,
int  $pass,
ilParticipantsTestResultsGUI  $target_gui,
bool  $show_pass_details = true,
bool  $show_answers = true,
bool  $show_question_only = false,
bool  $show_reached_points = false 
)

Output of the pass overview for a test called by a test participant.

Parameters
ilTestSession$testSession
integer$active_id
integer$pass
boolean$show_pass_details
boolean$show_answers
boolean$show_question_only
boolean$show_reached_pointspublic

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

References buildQuestionRelatedObjectivesList(), ilSession\get(), ilTestSession\getActiveId(), getAdditionalUsrDataHtmlAndPopulateWindowTitle(), getGradingMessageBuilder(), ilLOTestQuestionAdapter\getInstance(), getObjectiveOrientedContainer(), ilTestSession\getObjectiveOrientedContainerId(), getPassDetailsOverviewTableGUI(), getPassListOfAnswers(), getResultsSignature(), ilTestSession\getUserId(), isGradingMessageRequired(), ILIAS\Repository\lng(), ilObjTest\lookupExamId(), ILIAS\Repository\object(), populateExamId(), and populatePassFinishDate().

761  : string {
762  $template = new ilTemplate("tpl.il_as_tst_results_participant.html", true, true, "Modules/Test");
763 
764  if ($this->participantData instanceof ilTestParticipantData) {
765  $user_id = $this->participantData->getUserIdByActiveId($active_id);
766  $uname = $this->participantData->getConcatedFullnameByActiveId($active_id, false);
767  } else {
768  $user_id = $this->object->_getUserIdFromActiveId($active_id);
769  $uname = $this->object->userLookupFullName($user_id, true);
770  }
771 
772  if ($this->object->getAnonymity()) {
773  $uname = $this->lng->txt('anonymous');
774  }
775 
776  if ((($this->testrequest->isset('pass')) && (strlen($this->testrequest->raw("pass")) > 0)) || (!is_null($pass))) {
777  if (is_null($pass)) {
778  $pass = $this->testrequest->raw("pass");
779  }
780  }
781 
782  if (!is_null($pass)) {
783  $testResultHeaderLabelBuilder = new ilTestResultHeaderLabelBuilder($this->lng, $this->obj_cache);
784  $objectives_list = null;
785 
786  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
787  $test_sequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($active_id, $pass);
788  $test_sequence->loadFromDb();
789  $test_sequence->loadQuestions();
790 
791  $objectives_adapter = ilLOTestQuestionAdapter::getInstance($testSession);
792 
793  $objectives_list = $this->buildQuestionRelatedObjectivesList($objectives_adapter, $test_sequence);
794  $objectives_list->loadObjectivesTitles();
795 
796  $testResultHeaderLabelBuilder->setObjectiveOrientedContainerId($testSession->getObjectiveOrientedContainerId());
797  $testResultHeaderLabelBuilder->setUserId($testSession->getUserId());
798  $testResultHeaderLabelBuilder->setTestObjId($this->object->getId());
799  $testResultHeaderLabelBuilder->setTestRefId($this->object->getRefId());
800  $testResultHeaderLabelBuilder->initObjectiveOrientedMode();
801  }
802 
803  $result_array = $this->object->getTestResult(
804  $active_id,
805  $pass,
806  false,
807  !$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()
808  );
809 
810  $user_id = $this->object->_getUserIdFromActiveId($active_id);
811  $showAllAnswers = true;
812  if ($this->object->isExecutable($testSession, $user_id)) {
813  $showAllAnswers = false;
814  }
815  if ($show_answers) {
816  $list_of_answers = $this->getPassListOfAnswers(
817  $result_array,
818  $active_id,
819  $pass,
820  ilSession::get('tst_results_show_best_solutions'),
821  $showAllAnswers,
822  $show_question_only,
823  $show_reached_points,
824  $show_pass_details,
825  $objectives_list,
826  $testResultHeaderLabelBuilder
827  );
828  $template->setVariable("LIST_OF_ANSWERS", $list_of_answers);
829  }
830 
831  if ($show_pass_details) {
832  $overviewTableGUI = $this->getPassDetailsOverviewTableGUI(
833  $result_array,
834  $active_id,
835  $pass,
836  $target_gui,
837  "getResultsOfUserOutput",
838  $objectives_list
839  );
840  $overviewTableGUI->setTitle($testResultHeaderLabelBuilder->getPassDetailsHeaderLabel($pass + 1));
841  $template->setVariable("PASS_DETAILS", $overviewTableGUI->getHTML());
842  }
843 
844  $signature = $this->getResultsSignature();
845  $template->setVariable("SIGNATURE", $signature);
846 
847  if ($this->object->isShowExamIdInTestResultsEnabled()) {
848  $template->setCurrentBlock('exam_id_footer');
849  $template->setVariable('EXAM_ID_VAL', ilObjTest::lookupExamId(
850  $testSession->getActiveId(),
851  $pass
852  ));
853  $template->setVariable('EXAM_ID_TXT', $this->lng->txt('exam_id'));
854  $template->parseCurrentBlock();
855  }
856  }
857 
858  $template->setCurrentBlock('participant_back_anchor');
859  $template->setVariable("HREF_PARTICIPANT_BACK_ANCHOR", "#tst_results_toolbar");
860  $template->setVariable("TXT_PARTICIPANT_BACK_ANCHOR", $this->lng->txt('tst_back_to_top'));
861  $template->parseCurrentBlock();
862 
863  $template->setCurrentBlock('participant_block_id');
864  $template->setVariable("PARTICIPANT_BLOCK_ID", "participant_active_{$active_id}");
865  $template->parseCurrentBlock();
866 
867  if ($this->isGradingMessageRequired()) {
868  $gradingMessageBuilder = $this->getGradingMessageBuilder($active_id);
869  $gradingMessageBuilder->buildList();
870 
871  $template->setCurrentBlock('grading_message');
872  $template->setVariable('GRADING_MESSAGE', $gradingMessageBuilder->getList());
873  $template->parseCurrentBlock();
874  }
875 
876 
877  $user_data = $this->getAdditionalUsrDataHtmlAndPopulateWindowTitle($testSession, $active_id, true);
878  $template->setVariable("TEXT_HEADING", sprintf($this->lng->txt("tst_result_user_name"), $uname));
879  $template->setVariable("USER_DATA", $user_data);
880 
881  $this->populateExamId($template, (int) $active_id, (int) $pass);
882  $this->populatePassFinishDate($template, ilObjTest::lookupLastTestPassAccess($active_id, $pass));
883 
884  return $template->get();
885  }
static get(string $a_var)
populateExamId(ilTemplate $tpl, int $active_id, int $pass)
getAdditionalUsrDataHtmlAndPopulateWindowTitle($testSession, $active_id, $overwrite_anonymity=false)
Returns the user data for a test results output.
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, ilTestResultHeaderLabelBuilder $testResultHeaderLabelBuilder=null)
Returns the list of answers of a users test pass.
static getInstance(ilTestSession $a_test_session)
getGradingMessageBuilder(int $active_id)
getPassDetailsOverviewTableGUI(array $result_array, int $active_id, int $pass, ilTestServiceGUI|ilParticipantsTestResultsGUI $target_gui, string $target_cmd, ilTestQuestionRelatedObjectivesList $objectives_list=null, bool $multiple_objectives_involved=true)
buildQuestionRelatedObjectivesList(ilLOTestQuestionAdapter $objectives_adapter, ilTestQuestionSequence $test_sequence)
populatePassFinishDate(ilTemplate $tpl, ?int $pass_finish_date)
static lookupExamId($active_id, $pass)
+ Here is the call 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 602 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 getResultsOfUserOutput(), ilTestEvaluationGUI\outUserListOfAnswerPasses(), ilTestEvaluationGUI\outUserPassDetails(), and ilTestPlayerAbstractGUI\showListOfAnswers().

602  : string
603  {
604  if ($this->object->getShowSolutionSignature() && !$this->object->getAnonymity()) {
605  $template = new ilTemplate("tpl.il_as_tst_results_userdata_signature.html", true, true, "Modules/Test");
606  $template->setVariable("TXT_DATE", $this->lng->txt("date"));
609  $template->setVariable("VALUE_DATE", ilDatePresentation::formatDate(new ilDate(time(), IL_CAL_UNIX)));
611  $template->setVariable("TXT_SIGNATURE", $this->lng->txt("tst_signature"));
612  $template->setVariable("IMG_SPACER", ilUtil::getImagePath("media/spacer.png"));
613  return $template->get();
614  } else {
615  return "";
616  }
617  }
static getImagePath(string $img, 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)
const IL_CAL_UNIX
static setUseRelativeDates(bool $a_status)
set use relative dates
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isContextResultPresentation()

ilTestServiceGUI::isContextResultPresentation ( )

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

References $contextResultPresentation.

Referenced by getPassListOfAnswers().

101  : bool
102  {
104  }
+ Here is the caller graph for this function:

◆ isGradingMessageRequired()

ilTestServiceGUI::isGradingMessageRequired ( )
protected

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

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

Referenced by getResultsOfUserOutput(), ilTestEvaluationGUI\outParticipantsPassDetails(), ilTestEvaluationGUI\outParticipantsResultsOverview(), ilTestEvaluationGUI\outUserPassDetails(), and ilTestEvaluationGUI\outUserResultsOverview().

976  : bool
977  {
978  $session = $this->testSessionFactory->getSession();
979  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()
980  || $this->object->getScoreSettings()->getScoringSettings()->getPassScoring() === SCORE_LAST_PASS
981  && $session->getLastFinishedPass() < $session->getLastStartedPass()) {
982  return false;
983  }
984 
985  if ($this->object->isShowGradingStatusEnabled()
986  || $this->object->isShowGradingMarkEnabled()) {
987  return true;
988  }
989 
990  return false;
991  }
const SCORE_LAST_PASS
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ outCorrectSolution()

ilTestServiceGUI::outCorrectSolution ( )
protected

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

Definition at line 1091 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(), ILIAS\Repository\object(), and ilTabsGUI\setBackTarget().

Referenced by outCorrectSolutionCmd().

1091  : void
1092  {
1093  if (!$this->object->getShowSolutionDetails()) {
1094  $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_permission"), true);
1095  $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
1096  }
1097 
1098  $testSession = $this->testSessionFactory->getSession();
1099  $active_id = $testSession->getActiveId();
1100 
1101  if (!($active_id > 0)) {
1102  $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
1103  }
1104 
1105  $this->ctrl->saveParameter($this, "pass");
1106  $pass = (int) $this->testrequest->raw("pass");
1107 
1108  $active_id = (int) $this->testrequest->raw('evaluation');
1109 
1110  $test_sequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($active_id, $pass);
1111  $test_sequence->loadFromDb();
1112  $test_sequence->loadQuestions();
1113 
1114  if (!$test_sequence->questionExists($active_id)) {
1115  ilObjTestGUI::accessViolationRedirect();
1116  }
1117 
1118  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
1119  $test_sequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($active_id, $pass);
1120  $test_sequence->loadFromDb();
1121  $test_sequence->loadQuestions();
1122 
1123  $objectives_adapter = ilLOTestQuestionAdapter::getInstance($testSession);
1124  $objectives_list = $this->buildQuestionRelatedObjectivesList($objectives_adapter, $test_sequence);
1125  $objectives_list->loadObjectivesTitles();
1126  } else {
1127  $objectives_list = null;
1128  }
1129 
1130  $ilTabs = $this->tabs;
1131 
1132  if ($this instanceof ilTestEvalObjectiveOrientedGUI) {
1133  $ilTabs->setBackTarget(
1134  $this->lng->txt("tst_back_to_virtual_pass"),
1135  $this->ctrl->getLinkTarget($this, 'showVirtualPass')
1136  );
1137  } else {
1138  $ilTabs->setBackTarget(
1139  $this->lng->txt("tst_back_to_pass_details"),
1140  $this->ctrl->getLinkTarget($this, 'outUserPassDetails')
1141  );
1142  }
1143  $ilTabs->clearSubTabs();
1144 
1145  $this->tpl->setCurrentBlock("ContentStyle");
1146  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
1147  $this->tpl->parseCurrentBlock();
1148 
1149  $this->tpl->setCurrentBlock("SyntaxStyle");
1150  $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
1151  $this->tpl->parseCurrentBlock();
1152 
1153  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
1154  if ($this->object->getShowSolutionAnswersOnly()) {
1155  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
1156  }
1157 
1158  $solution = $this->getCorrectSolutionOutput($active_id, $active_id, $pass, $objectives_list);
1159 
1160  $this->tpl->setContent($solution);
1161  }
static getStyleSheetLocation(string $mode="output", string $a_css_name="", string $a_css_location="")
get full style sheet file name (path inclusive) of current user
static getInstance(ilTestSession $a_test_session)
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.
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)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ outCorrectSolutionCmd()

ilTestServiceGUI::outCorrectSolutionCmd ( )
protected

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

References outCorrectSolution().

1084  {
1085  $this->outCorrectSolution(); // cannot be named xxxCmd, because it's also called from context without Cmd in names
1086  }
outCorrectSolution()
Creates an output of the solution of an answer compared to the correct solution.
+ Here is the call graph for this function:

◆ populateContent()

ilTestServiceGUI::populateContent (   $content)
protected
Parameters
string$content

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

Referenced by ilTestEvalObjectiveOrientedGUI\showVirtualPassCmd().

1069  {
1070  $this->tpl->setContent($content);
1071  }
+ Here is the caller graph for this function:

◆ populateExamId()

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

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

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

Referenced by getResultsOfUserOutput(), ilTestEvaluationGUI\multiParticipantsPassDetails(), ilTestEvaluationGUI\outParticipantsPassDetails(), and ilTestEvaluationGUI\outUserPassDetails().

1176  : void
1177  {
1178  if ($this->object->isShowExamIdInTestResultsEnabled()) {
1179  $tpl->setVariable('EXAM_ID_TXT', $this->lng->txt('exam_id'));
1180  $tpl->setVariable('EXAM_ID', ilObjTest::lookupExamId(
1181  $active_id,
1182  $pass
1183  ));
1184  }
1185  }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:546
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 1163 of file class.ilTestServiceGUI.php.

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

Referenced by getResultsOfUserOutput(), ilTestEvaluationGUI\multiParticipantsPassDetails(), ilTestEvaluationGUI\outParticipantsPassDetails(), and ilTestEvaluationGUI\outUserPassDetails().

1163  : void
1164  {
1165  if ($pass_finish_date === null) {
1166  return;
1167  }
1168  $old_value = ilDatePresentation::useRelativeDates();
1170  $pass_finish_date_string = ilDatePresentation::formatDate(new ilDateTime($pass_finish_date, IL_CAL_UNIX));
1172  $tpl->setVariable("PASS_FINISH_DATE_LABEL", $this->lng->txt('tst_pass_finished_on'));
1173  $tpl->setVariable("PASS_FINISH_DATE_VALUE", $pass_finish_date_string);
1174  }
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
const IL_CAL_UNIX
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:546
static setUseRelativeDates(bool $a_status)
set use relative dates
+ 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 275 of file class.ilTestServiceGUI.php.

References $objective_oriented_container.

276  {
277  $this->objective_oriented_container = $objective_oriented_container;
278  }
ilTestObjectiveOrientedContainer $objective_oriented_container

◆ setParticipantData()

ilTestServiceGUI::setParticipantData ( ilTestParticipantData  $participantData)

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

References $participantData.

169  : void
170  {
171  $this->participantData = $participantData;
172  }
ilTestParticipantData $participantData

Field Documentation

◆ $access

ilAccess ilTestServiceGUI::$access
protected

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

◆ $component_repository

◆ $content_style

ContentStyle ilTestServiceGUI::$content_style
protected

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

◆ $contextResultPresentation

bool ilTestServiceGUI::$contextResultPresentation = true
private

◆ $ctrl

ilCtrl ilTestServiceGUI::$ctrl
protected

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

◆ $db

◆ $error

ilErrorHandling ilTestServiceGUI::$error
protected

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

◆ $global_screen

GlobalScreenServices ilTestServiceGUI::$global_screen
protected

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

◆ $help

ilHelpGUI ilTestServiceGUI::$help
protected

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

◆ $http

HTTPServices ilTestServiceGUI::$http
protected

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

◆ $ilias

ILIAS ilTestServiceGUI::$ilias
protected

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

◆ $lng

◆ $logging_services

LoggingServices ilTestServiceGUI::$logging_services
protected

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

◆ $navigation_history

ilNavigationHistory ilTestServiceGUI::$navigation_history
protected

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

◆ $obj_cache

ilObjectDataCache ilTestServiceGUI::$obj_cache
protected

◆ $objective_oriented_container

ilTestObjectiveOrientedContainer ilTestServiceGUI::$objective_oriented_container
private

◆ $participant_access_filter

ilTestParticipantAccessFilterFactory ilTestServiceGUI::$participant_access_filter
protected

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

◆ $participantData

◆ $post_wrapper

ArrayBasedRequestWrapper ilTestServiceGUI::$post_wrapper
protected

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

◆ $questioninfo

ILIAS TestQuestionPool QuestionInfoService ilTestServiceGUI::$questioninfo
protected

◆ $rbac_system

ilRbacSystem ilTestServiceGUI::$rbac_system
protected

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

◆ $ref_id

int ilTestServiceGUI::$ref_id
protected

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

◆ $refinery

Refinery ilTestServiceGUI::$refinery
protected

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

◆ $results_factory

ilTestResultsFactory ilTestServiceGUI::$results_factory
protected

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

◆ $results_presentation_factory

ilTestResultsPresentationFactory ilTestServiceGUI::$results_presentation_factory
protected

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

◆ $service

ilTestService ilTestServiceGUI::$service = null
protected

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

◆ $settings

ilSetting ilTestServiceGUI::$settings
protected

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

◆ $shuffler

ilTestShuffler ilTestServiceGUI::$shuffler
protected

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

◆ $skills_service

SkillService ilTestServiceGUI::$skills_service
protected

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

◆ $tabs

◆ $testrequest

InternalRequestService ilTestServiceGUI::$testrequest
protected

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

◆ $testSequenceFactory

ilTestSequenceFactory ilTestServiceGUI::$testSequenceFactory = null
protected

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

◆ $testSessionFactory

ilTestSessionFactory ilTestServiceGUI::$testSessionFactory = null
protected

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

Referenced by ilTestOutputGUI\executeCommand().

◆ $toolbar

◆ $tpl

ilGlobalTemplateInterface ilTemplate ilTestServiceGUI::$tpl
protected

◆ $tree

ilTree ilTestServiceGUI::$tree
protected

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

◆ $ui_factory

UIFactory ilTestServiceGUI::$ui_factory
protected

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

◆ $ui_renderer

UIRenderer ilTestServiceGUI::$ui_renderer
protected

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

◆ $user

ilObjUser ilTestServiceGUI::$user
protected

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

Referenced by getCorrectSolutionOutput().


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