ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilTestEvalObjectiveOrientedGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
31 {
32  public function executeCommand()
33  {
34  $this->ctrl->saveParameter($this, "active_id");
35 
36  switch ($this->ctrl->getNextClass($this)) {
37  case 'ilassquestionpagegui':
38  $forwarder = new ilAssQuestionPageCommandForwarder();
39  $forwarder->setTestObj($this->object);
40  $forwarder->forward();
41  break;
42 
43  default:
44  $cmd = $this->ctrl->getCmd('showVirtualPass') . 'Cmd';
45  $this->$cmd();
46  }
47  }
48 
50  {
51  $tableGUI = $this->buildPassDetailsOverviewTableGUI($this, 'showVirtualPass');
52  $tableGUI->resetOffset();
53  $tableGUI->writeFilterToSession();
54  $this->showVirtualPassCmd();
55  }
56 
58  {
59  $tableGUI = $this->buildPassDetailsOverviewTableGUI($this, 'showVirtualPass');
60  $tableGUI->resetOffset();
61  $tableGUI->resetFilter();
62  $this->showVirtualPassCmd();
63  }
64 
65  private function showVirtualPassCmd()
66  {
67  $test_session = $this->testSessionFactory->getSession();
68 
69  if (!$this->object->getShowPassDetails()) {
70  $executable = $this->object->isExecutable($test_session, $test_session->getUserId());
71 
72  if ($executable["executable"]) {
73  $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
74  }
75  }
76 
78  $toolbar->build();
79 
80  $virtual_sequence = $this->service->buildVirtualSequence($test_session);
81  $user_results = $this->service->getVirtualSequenceUserResults($virtual_sequence);
82 
83  $objectives_adapter = ilLOTestQuestionAdapter::getInstance($test_session);
84 
85  $objectives_list = $this->buildQuestionRelatedObjectivesList($objectives_adapter, $virtual_sequence);
86  $objectives_list->loadObjectivesTitles();
87 
88  $test_result_header_label_builder = new ilTestResultHeaderLabelBuilder($this->lng, $this->obj_cache);
89 
90  $test_result_header_label_builder->setObjectiveOrientedContainerId($test_session->getObjectiveOrientedContainerId());
91  $test_result_header_label_builder->setUserId($test_session->getUserId());
92  $test_result_header_label_builder->setTestObjId($this->object->getId());
93  $test_result_header_label_builder->setTestRefId($this->object->getRefId());
94  $test_result_header_label_builder->initObjectiveOrientedMode();
95 
96  $tpl = new ilTemplate('tpl.il_as_tst_virtual_pass_details.html', false, false, 'Modules/Test');
97 
98  foreach (array_keys($objectives_list->getObjectives()) as $lo_id) {
99  $user_results_for_lo = $objectives_list->filterResultsByObjective($user_results, $lo_id);
100 
101  $overview_table_gui = $this->getPassDetailsOverviewTableGUI(
102  $user_results_for_lo,
103  $test_session->getActiveId(),
104  $test_session->getPass(),
105  $this,
106  "showVirtualPass",
107  $objectives_list,
108  false
109  );
110  $overview_table_gui->setTitle(
111  $test_result_header_label_builder->getVirtualPassDetailsHeaderLabel(
112  $objectives_list->getObjectiveTitleById($lo_id)
113  )
114  );
115 
116  $lo_status = new ilTestLearningObjectivesStatusGUI(
117  $this->lng,
118  $this->ctrl,
119  $this->ui_factory,
120  $this->ui_renderer,
121  $this->testrequest
122  );
123  $lo_status->setCrsObjId($this->getObjectiveOrientedContainer()->getObjId());
124  $lo_status->setUsrId($test_session->getUserId());
125  $lo_status_html = $lo_status->getHTML($lo_id);
126 
127  $tpl->setCurrentBlock('pass_details');
128  $tpl->setVariable("PASS_DETAILS", $overview_table_gui->getHTML());
129  $tpl->setVariable("LO_STATUS", $lo_status_html);
131  }
132 
133  $this->populateContent($this->ctrl->getHTML($toolbar) . $tpl->get());
134  }
135 }
ilGlobalTemplateInterface ilTemplate $tpl
sk 2023-08-01: We need this union type, even if it is wrong! To change this
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
static getInstance(ilTestSession $a_test_session)
buildPassDetailsOverviewTableGUI(ilTestServiceGUI|ilParticipantsTestResultsGUI $target_gui, string $target_cmd)
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
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)
Service GUI class for tests.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.