ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilTestResultsGUI Class Reference
+ Collaboration diagram for ilTestResultsGUI:

Public Member Functions

 __construct (private ilObjTest $testObj, private ilTestQuestionSetConfig $question_set_config, private ilCtrl $ctrl, private ilAccess $access, private ilDBInterface $db, private Refinery $refinery, private ilObjUser $user, private ilLanguage $lng, private LoggingServices $logging_services, private ilComponentRepository $component_repository, private ilTabsGUI $tabs, private ilToolbarGUI $toolbar, private ilGlobalTemplateInterface $main_tpl, private UIFactory $ui_factory, private UIRenderer $ui_renderer, private SkillService $skills_service, private InternalRequestService $testrequest, private QuestionInfoService $questioninfo, private GlobalHttpState $http)
 
 getObjectiveParent ()
 
 setObjectiveParent ($objectiveParent)
 
 getTestObj ()
 
 setTestObj ($testObj)
 
 getQuestionSetConfig ()
 
 setQuestionSetConfig (ilTestQuestionSetConfig $question_set_config)
 
 getTestAccess ()
 
 setTestAccess (ilTestAccess $testAccess)
 
 getTestSession ()
 
 setTestSession (ilTestSession $testSession)
 
 getTestTabs ()
 
 setTestTabs (ilTestTabsManager $testTabs)
 
 executeCommand ()
 

Data Fields

const DEFAULT_CMD = 'show'
 

Protected Member Functions

 showCmd ()
 
 showNoResultsReportingMessage ()
 

Protected Attributes

ilTestAccess $testAccess
 
ilTestSession $testSession
 
ilTestTabsManager $testTabs
 
ilTestObjectiveOrientedContainer $objectiveParent
 

Private Attributes

ILIAS DI UIServices $ui
 

Detailed Description

Definition at line 46 of file class.ilTestResultsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestResultsGUI::__construct ( private ilObjTest  $testObj,
private ilTestQuestionSetConfig  $question_set_config,
private ilCtrl  $ctrl,
private ilAccess  $access,
private ilDBInterface  $db,
private Refinery  $refinery,
private ilObjUser  $user,
private ilLanguage  $lng,
private LoggingServices  $logging_services,
private ilComponentRepository  $component_repository,
private ilTabsGUI  $tabs,
private ilToolbarGUI  $toolbar,
private ilGlobalTemplateInterface  $main_tpl,
private UIFactory  $ui_factory,
private UIRenderer  $ui_renderer,
private SkillService  $skills_service,
private InternalRequestService  $testrequest,
private QuestionInfoService  $questioninfo,
private GlobalHttpState  $http 
)

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

77  {
78  }

Member Function Documentation

◆ executeCommand()

ilTestResultsGUI::executeCommand ( )

Definition at line 152 of file class.ilTestResultsGUI.php.

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Survey\Mode\getId(), getObjectiveParent(), getQuestionSetConfig(), getTestAccess(), getTestObj(), getTestSession(), getTestTabs(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ilAssQuestionList\QUESTION_INSTANCE_TYPE_DUPLICATES, ILIAS\Repository\refinery(), ilTestTabsManager\SUBTAB_ID_HIGHSCORE, ilTestTabsManager\SUBTAB_ID_LO_RESULTS, ilTestTabsManager\SUBTAB_ID_MY_RESULTS, ilTestTabsManager\SUBTAB_ID_MY_SOLUTIONS, ilTestTabsManager\SUBTAB_ID_PARTICIPANTS_RESULTS, ilTestTabsManager\SUBTAB_ID_SKILL_RESULTS, ilTestTabsManager\TAB_ID_RESULTS, ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

152  : void
153  {
154  $this->getTestTabs()->activateTab(ilTestTabsManager::TAB_ID_RESULTS);
155  $this->getTestTabs()->getResultsSubTabs();
156 
157  switch ($this->ctrl->getNextClass()) {
158  case 'ilparticipantstestresultsgui':
159  if (!$this->getTestAccess()->checkParticipantsResultsAccess()) {
160  ilObjTestGUI::accessViolationRedirect();
161  }
162 
164 
165  $gui = new ilParticipantsTestResultsGUI(
166  $this->ctrl,
167  $this->lng,
168  $this->db,
169  $this->user,
170  $this->tabs,
171  $this->toolbar,
172  $this->main_tpl,
173  $this->ui_factory,
174  $this->ui_renderer,
176  $this->testrequest,
177  $this->http,
178  $this->refinery
179  );
180  $gui->setTestObj($this->getTestObj());
181  $gui->setQuestionSetConfig($this->getQuestionSetConfig());
182  $gui->setTestAccess($this->getTestAccess());
183  $gui->setObjectiveParent($this->getObjectiveParent());
184  $this->ctrl->forwardCommand($gui);
185  break;
186 
187  case 'ilmytestresultsgui':
188  if (!$this->getTestTabs()->needsMyResultsSubTab()) {
189  ilObjTestGUI::accessViolationRedirect();
190  }
191 
192  $this->getTestTabs()->activateSubTab(ilTestTabsManager::SUBTAB_ID_MY_RESULTS);
193 
194  $gui = new ilMyTestResultsGUI();
195  $gui->setTestObj($this->getTestObj());
196  $gui->setTestAccess($this->getTestAccess());
197  $gui->setTestSession($this->getTestSession());
198  $gui->setObjectiveParent($this->getObjectiveParent());
199  $this->ctrl->forwardCommand($gui);
200  break;
201 
202  case 'iltestevalobjectiveorientedgui':
203  if (!$this->getTestTabs()->needsLoResultsSubTab()) {
204  ilObjTestGUI::accessViolationRedirect();
205  }
206 
207  $this->getTestTabs()->activateSubTab(ilTestTabsManager::SUBTAB_ID_LO_RESULTS);
208 
209  $gui = new ilTestEvalObjectiveOrientedGUI($this->getTestObj());
210  $gui->setObjectiveOrientedContainer($this->getObjectiveParent());
211  $this->ctrl->forwardCommand($gui);
212  break;
213 
214  case 'ilmytestsolutionsgui':
215  if (!$this->getTestTabs()->needsMySolutionsSubTab()) {
216  ilObjTestGUI::accessViolationRedirect();
217  }
218 
219  $this->getTestTabs()->activateSubTab(ilTestTabsManager::SUBTAB_ID_MY_SOLUTIONS);
220 
221  $gui = new ilMyTestSolutionsGUI();
222  $gui->setTestObj($this->getTestObj());
223  $gui->setTestAccess($this->getTestAccess());
224  $gui->setObjectiveParent($this->getObjectiveParent());
225  $this->ctrl->forwardCommand($gui);
226  break;
227 
228  case 'iltesttoplistgui':
229  if (!$this->getTestTabs()->needsHighSoreSubTab()) {
230  ilObjTestGUI::accessViolationRedirect();
231  }
232 
233  $this->getTestTabs()->activateSubTab(ilTestTabsManager::SUBTAB_ID_HIGHSCORE);
234 
235  $gui = new ilTestToplistGUI(
236  $this->getTestObj(),
237  new ilTestTopList($this->getTestObj(), $this->db),
238  $this->ctrl,
239  $this->main_tpl,
240  $this->lng,
241  $this->user,
242  $this->ui_factory,
243  $this->ui_renderer
244  );
245  $this->ctrl->forwardCommand($gui);
246  break;
247 
248  case 'iltestskillevaluationgui':
250 
251  $questionList = new ilAssQuestionList($this->db, $this->lng, $this->refinery, $this->component_repository);
252  $questionList->setParentObjId($this->getTestObj()->getId());
253  $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES);
254  $questionList->load();
255 
256  $testSessionFactory = new ilTestSessionFactory($this->getTestObj(), $this->db, $this->user);
257  $testSession = $testSessionFactory->getSession();
258 
259  $gui = new ilTestSkillEvaluationGUI(
260  $this->getTestObj(),
261  $this->ctrl,
262  $this->main_tpl,
263  $this->lng,
264  $this->db,
265  $this->logging_services,
266  $this->skills_service,
267  $this->testrequest
268  );
269  $gui->setQuestionList($questionList);
270  $gui->setTestSession($testSession);
271  $gui->setObjectiveOrientedContainer($this->getObjectiveParent());
272 
273  $this->ctrl->forwardCommand($gui);
274  break;
275 
276  case strtolower(__CLASS__):
277  default:
278  $command = $this->ctrl->getCmd(self::DEFAULT_CMD) . 'Cmd';
279  $this->{$command}();
280  }
281  }
ilParticipantsTestResultsGUI: ilTestEvaluationGUI ilParticipantsTestResultsGUI: ilAssQuestionPageGUI...
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ getObjectiveParent()

ilTestResultsGUI::getObjectiveParent ( )
Returns
ilTestObjectiveOrientedContainer

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

References $objectiveParent.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ getQuestionSetConfig()

ilTestResultsGUI::getQuestionSetConfig ( )

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

Referenced by executeCommand().

113  {
114  return $this->question_set_config;
115  }
+ Here is the caller graph for this function:

◆ getTestAccess()

ilTestResultsGUI::getTestAccess ( )

Definition at line 122 of file class.ilTestResultsGUI.php.

References $testAccess.

Referenced by executeCommand().

122  : ilTestAccess
123  {
124  return $this->testAccess;
125  }
+ Here is the caller graph for this function:

◆ getTestObj()

ilTestResultsGUI::getTestObj ( )
Returns
ilObjTest

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

Referenced by executeCommand(), showCmd(), and showNoResultsReportingMessage().

99  : ilObjTest
100  {
101  return $this->testObj;
102  }
+ Here is the caller graph for this function:

◆ getTestSession()

ilTestResultsGUI::getTestSession ( )

Definition at line 132 of file class.ilTestResultsGUI.php.

References $testSession.

Referenced by executeCommand().

132  : ilTestSession
133  {
134  return $this->testSession;
135  }
+ Here is the caller graph for this function:

◆ getTestTabs()

ilTestResultsGUI::getTestTabs ( )

Definition at line 142 of file class.ilTestResultsGUI.php.

References $testTabs.

Referenced by executeCommand().

143  {
144  return $this->testTabs;
145  }
ilTestTabsManager $testTabs
+ Here is the caller graph for this function:

◆ setObjectiveParent()

ilTestResultsGUI::setObjectiveParent (   $objectiveParent)
Parameters
ilTestObjectiveOrientedContainer$objectiveParent

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

References $objectiveParent.

92  {
93  $this->objectiveParent = $objectiveParent;
94  }
ilTestObjectiveOrientedContainer $objectiveParent

◆ setQuestionSetConfig()

ilTestResultsGUI::setQuestionSetConfig ( ilTestQuestionSetConfig  $question_set_config)

Definition at line 117 of file class.ilTestResultsGUI.php.

117  : void
118  {
119  $this->question_set_config = $question_set_config;
120  }

◆ setTestAccess()

ilTestResultsGUI::setTestAccess ( ilTestAccess  $testAccess)

Definition at line 127 of file class.ilTestResultsGUI.php.

References $testAccess.

Referenced by ilObjTestGUI\executeCommand().

127  : void
128  {
129  $this->testAccess = $testAccess;
130  }
+ Here is the caller graph for this function:

◆ setTestObj()

ilTestResultsGUI::setTestObj (   $testObj)
Parameters
ilObjTest$testObj

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

108  {
109  $this->testObj = $testObj;
110  }

◆ setTestSession()

ilTestResultsGUI::setTestSession ( ilTestSession  $testSession)

Definition at line 137 of file class.ilTestResultsGUI.php.

References $testSession.

137  : void
138  {
139  $this->testSession = $testSession;
140  }

◆ setTestTabs()

ilTestResultsGUI::setTestTabs ( ilTestTabsManager  $testTabs)

Definition at line 147 of file class.ilTestResultsGUI.php.

References $testTabs.

147  : void
148  {
149  $this->testTabs = $testTabs;
150  }
ilTestTabsManager $testTabs

◆ showCmd()

ilTestResultsGUI::showCmd ( )
protected

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

References ILIAS\Repository\ctrl(), getTestObj(), showNoResultsReportingMessage(), ILIAS\Repository\toolbar(), and ILIAS\Repository\ui().

283  : void
284  {
285  if ($this->testObj->canShowTestResults($this->getTestSession())) {
286  if ($this->objectiveParent->isObjectiveOrientedPresentationRequired()) {
287  $this->ctrl->redirectByClass('ilTestEvalObjectiveOrientedGUI');
288  }
289 
290  $this->ctrl->redirectByClass(['ilMyTestResultsGUI', 'ilTestEvaluationGUI']);
291  }
292 
293  $validator = new ilCertificateDownloadValidator();
294  if ($validator->isCertificateDownloadable($this->user->getId(), $this->getTestObj()->getId())) {
295  $button = $this->ui->factory()->button()->standard('certficiate', $this->ctrl->getFormActionByClass(ilTestEvaluationGUI::class, 'outCertificate'));
296  $this->toolbar->addComponent($button);
297  }
298 
300  }
Validates if an active certificate is stored in the database and can be downloaded by the user...
+ Here is the call graph for this function:

◆ showNoResultsReportingMessage()

ilTestResultsGUI::showNoResultsReportingMessage ( )
protected

Definition at line 302 of file class.ilTestResultsGUI.php.

References $message, getTestObj(), ILIAS\Repository\lng(), ilObjTestSettingsResultSummary\SCORE_REPORTING_AFTER_PASSED, ilObjTestSettingsResultSummary\SCORE_REPORTING_DATE, ilObjTestSettingsResultSummary\SCORE_REPORTING_FINISHED, ilCalendarSettings\TIME_FORMAT_12, and ILIAS\Repository\user().

Referenced by showCmd().

302  : void
303  {
304  $message = $this->lng->txt('tst_res_tab_msg_res_after_taking_test');
305 
306  switch ($this->testObj->getScoreReporting()) {
308  if ($this->testObj->hasAnyTestResult($this->getTestSession())) {
309  $message = $this->lng->txt('tst_res_tab_msg_res_after_finish_test');
310  }
311 
312  break;
313 
315  $date = $this->getTestObj()->getScoreSettings()->getResultSummarySettings()->getReportingDate()
316  ->setTimezone(new \DateTimeZone($this->user->getTimeZone()));
317  $date_format = $this->user->getDateFormat();
318  if ($this->user->getTimeFormat() === (string) ilCalendarSettings::TIME_FORMAT_12) {
319  $format = (new DataFactory())->dateFormat()->withTime12($date_format)->toString();
320  } else {
321  $format = (new DataFactory())->dateFormat()->withTime24($date_format)->toString();
322  }
323 
324  if (!$this->testObj->hasAnyTestResult($this->getTestSession())) {
325  $message = sprintf(
326  $this->lng->txt('tst_res_tab_msg_res_after_date_no_res'),
327  $date->format($format)
328  );
329  break;
330  }
331 
332  $message = sprintf(
333  $this->lng->txt('tst_res_tab_msg_res_after_date'),
334  $date->format($format)
335  );
336  break;
337 
339  $message = $this->lng->txt('tst_res_tab_msg_res_after_test_passed');
340  break;
341  }
342 
343  $this->main_tpl->setOnScreenMessage('info', $message);
344  }
$message
Definition: xapiexit.php:32
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $objectiveParent

ilTestObjectiveOrientedContainer ilTestResultsGUI::$objectiveParent
protected

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

Referenced by getObjectiveParent(), and setObjectiveParent().

◆ $testAccess

ilTestAccess ilTestResultsGUI::$testAccess
protected

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

Referenced by getTestAccess(), and setTestAccess().

◆ $testSession

ilTestSession ilTestResultsGUI::$testSession
protected

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

Referenced by getTestSession(), and setTestSession().

◆ $testTabs

ilTestTabsManager ilTestResultsGUI::$testTabs
protected

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

Referenced by getTestTabs(), and setTestTabs().

◆ $ui

ILIAS DI UIServices ilTestResultsGUI::$ui
private

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

◆ DEFAULT_CMD

const ilTestResultsGUI::DEFAULT_CMD = 'show'

Definition at line 48 of file class.ilTestResultsGUI.php.


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