ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTestResultsGUI Class Reference
+ Collaboration diagram for ilTestResultsGUI:

Public Member Functions

 __construct (ilObjTest $testObj, ilTestQuestionSetConfig $questionSetConfig)
 ilTestParticipantsGUI constructor. More...
 
 getObjectiveParent ()
 
 setObjectiveParent ($objectiveParent)
 
 getTestObj ()
 
 setTestObj ($testObj)
 
 getQuestionSetConfig ()
 
 setQuestionSetConfig ($questionSetConfig)
 
 getTestAccess ()
 
 setTestAccess ($testAccess)
 
 getTestSession ()
 
 setTestSession ($testSession)
 
 getTestTabs ()
 
 setTestTabs ($testTabs)
 
 executeCommand ()
 Execute Command. More...
 

Data Fields

const DEFAULT_CMD = 'show'
 

Protected Member Functions

 showCmd ()
 
 showNoResultsReportingMessage ()
 

Protected Attributes

 $testObj
 
 $questionSetConfig
 
 $testAccess
 
 $testSession
 
 $testTabs
 
 $objectiveParent
 

Private Attributes

ilGlobalTemplateInterface $main_tpl
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilTestResultsGUI::__construct ( ilObjTest  $testObj,
ilTestQuestionSetConfig  $questionSetConfig 
)

ilTestParticipantsGUI constructor.

Parameters
ilObjTest$testObj

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

References $DIC, $questionSetConfig, and $testObj.

74  {
75  global $DIC;
76  $this->main_tpl = $DIC->ui()->mainTemplate();
77  $this->testObj = $testObj;
78  $this->questionSetConfig = $questionSetConfig;
79  }
global $DIC
Definition: feed.php:28

Member Function Documentation

◆ executeCommand()

ilTestResultsGUI::executeCommand ( )

Execute Command.

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

References $DIC, $testSession, ilObjTestGUI\accessViolationRedirect(), ILIAS\Survey\Mode\getId(), getObjectiveParent(), getQuestionSetConfig(), getTestAccess(), getTestObj(), getTestSession(), getTestTabs(), ilObjTestDynamicQuestionSetConfig\loadFromDb(), ilAssQuestionList\QUESTION_INSTANCE_TYPE_DUPLICATES, ilAssQuestionList\QUESTION_INSTANCE_TYPE_ORIGINALS, ilAssQuestionList\setParentObjId(), ilTestSkillEvaluationGUI\setQuestionList(), 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, and ilTestTabsManager\TAB_ID_RESULTS.

181  {
182  global $DIC; /* @var ILIAS\DI\Container $DIC */
183 
184  $this->getTestTabs()->activateTab(ilTestTabsManager::TAB_ID_RESULTS);
185  $this->getTestTabs()->getResultsSubTabs();
186 
187  switch ($DIC->ctrl()->getNextClass()) {
188  case 'ilparticipantstestresultsgui':
189 
190  if (!$this->getTestAccess()->checkParticipantsResultsAccess()) {
192  }
193 
195 
196  $gui = new ilParticipantsTestResultsGUI();
197  $gui->setTestObj($this->getTestObj());
198  $gui->setQuestionSetConfig($this->getQuestionSetConfig());
199  $gui->setTestAccess($this->getTestAccess());
200  $gui->setObjectiveParent($this->getObjectiveParent());
201  $DIC->ctrl()->forwardCommand($gui);
202  break;
203 
204  case 'ilmytestresultsgui':
205 
206  if (!$this->getTestTabs()->needsMyResultsSubTab()) {
208  }
209 
210  $this->getTestTabs()->activateSubTab(ilTestTabsManager::SUBTAB_ID_MY_RESULTS);
211 
212  $gui = new ilMyTestResultsGUI();
213  $gui->setTestObj($this->getTestObj());
214  $gui->setTestAccess($this->getTestAccess());
215  $gui->setTestSession($this->getTestSession());
216  $gui->setObjectiveParent($this->getObjectiveParent());
217  $DIC->ctrl()->forwardCommand($gui);
218  break;
219 
220  case 'iltestevalobjectiveorientedgui':
221 
222  if (!$this->getTestTabs()->needsLoResultsSubTab()) {
224  }
225 
226  $this->getTestTabs()->activateSubTab(ilTestTabsManager::SUBTAB_ID_LO_RESULTS);
227 
228  $gui = new ilTestEvalObjectiveOrientedGUI($this->getTestObj());
229  $gui->setObjectiveOrientedContainer($this->getObjectiveParent());
230  $DIC->ctrl()->forwardCommand($gui);
231  break;
232 
233  case 'ilmytestsolutionsgui':
234 
235  if (!$this->getTestTabs()->needsMySolutionsSubTab()) {
237  }
238 
239  $this->getTestTabs()->activateSubTab(ilTestTabsManager::SUBTAB_ID_MY_SOLUTIONS);
240 
241  $gui = new ilMyTestSolutionsGUI();
242  $gui->setTestObj($this->getTestObj());
243  $gui->setTestAccess($this->getTestAccess());
244  $gui->setObjectiveParent($this->getObjectiveParent());
245  $DIC->ctrl()->forwardCommand($gui);
246  break;
247 
248  case 'iltesttoplistgui':
249 
250  if (!$this->getTestTabs()->needsHighSoreSubTab()) {
252  }
253 
254  $this->getTestTabs()->activateSubTab(ilTestTabsManager::SUBTAB_ID_HIGHSCORE);
255 
256  $gui = new ilTestToplistGUI($this->getTestObj());
257  $DIC->ctrl()->forwardCommand($gui);
258  break;
259 
260  case 'iltestskillevaluationgui':
261 
263 
264  global $DIC; /* @var ILIAS\DI\Container $DIC */
265  if ($this->getTestObj()->isDynamicTest()) {
266  $dynamicQuestionSetConfig = new ilObjTestDynamicQuestionSetConfig(
267  $DIC->repositoryTree(),
268  $DIC->database(),
269  $DIC['component.repository'],
270  $this->getTestObj()
271  );
272  $dynamicQuestionSetConfig->loadFromDb();
273  $questionList = new ilAssQuestionList($DIC->database(), $DIC->language(), $DIC['refinery'], $DIC['component.repository']);
274  $questionList->setParentObjId($dynamicQuestionSetConfig->getSourceQuestionPoolId());
275  $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_ORIGINALS);
276  } else {
277  $questionList = new ilAssQuestionList($DIC->database(), $DIC->language(), $DIC['refinery'], $DIC['component.repository']);
278  $questionList->setParentObjId($this->getTestObj()->getId());
279  $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES);
280  }
281  $questionList->load();
282 
283  $testSessionFactory = new ilTestSessionFactory($this->getTestObj());
284  $testSession = $testSessionFactory->getSession();
285 
286  $gui = new ilTestSkillEvaluationGUI(
287  $DIC->ctrl(),
288  $DIC->tabs(),
289  $DIC->ui()->mainTemplate(),
290  $DIC->language(),
291  $DIC->database(),
292  $this->getTestObj()
293  );
294  $gui->setQuestionList($questionList);
295  $gui->setTestSession($testSession);
296  $gui->setObjectiveOrientedContainer($this->getObjectiveParent());
297 
298  $DIC->ctrl()->forwardCommand($gui);
299  break;
300 
301  case strtolower(__CLASS__):
302  default:
303 
304  $command = $DIC->ctrl()->getCmd(self::DEFAULT_CMD) . 'Cmd';
305  $this->{$command}();
306  }
307  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
loadFromDb()
loads the question set config for current test from the database
static accessViolationRedirect()
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ getObjectiveParent()

ilTestResultsGUI::getObjectiveParent ( )

◆ getQuestionSetConfig()

ilTestResultsGUI::getQuestionSetConfig ( )
Returns
ilTestQuestionSetConfig

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

References $questionSetConfig.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ getTestAccess()

ilTestResultsGUI::getTestAccess ( )
Returns
ilTestAccess

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

References $testAccess.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ getTestObj()

ilTestResultsGUI::getTestObj ( )
Returns
ilObjTest

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

References $testObj.

Referenced by executeCommand(), and showCmd().

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

◆ getTestSession()

ilTestResultsGUI::getTestSession ( )
Returns
ilTestSession

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

References $testSession.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ getTestTabs()

ilTestResultsGUI::getTestTabs ( )
Returns
ilTestTabsManager

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

References $testTabs.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ setObjectiveParent()

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

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

References $objectiveParent.

93  {
94  $this->objectiveParent = $objectiveParent;
95  }

◆ setQuestionSetConfig()

ilTestResultsGUI::setQuestionSetConfig (   $questionSetConfig)
Parameters
ilTestQuestionSetConfig$questionSetConfig

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

References $questionSetConfig.

125  {
126  $this->questionSetConfig = $questionSetConfig;
127  }

◆ setTestAccess()

ilTestResultsGUI::setTestAccess (   $testAccess)
Parameters
ilTestAccess$testAccess

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

References $testAccess.

Referenced by ilObjTestGUI\executeCommand().

141  {
142  $this->testAccess = $testAccess;
143  }
+ Here is the caller graph for this function:

◆ setTestObj()

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

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

References $testObj.

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

◆ setTestSession()

ilTestResultsGUI::setTestSession (   $testSession)
Parameters
ilTestSession$testSession

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

References $testSession.

157  {
158  $this->testSession = $testSession;
159  }

◆ setTestTabs()

ilTestResultsGUI::setTestTabs (   $testTabs)
Parameters
ilTestTabsManager$testTabs

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

References $testTabs.

173  {
174  $this->testTabs = $testTabs;
175  }

◆ showCmd()

ilTestResultsGUI::showCmd ( )
protected

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

References $DIC, ilLinkButton\getInstance(), getTestObj(), and showNoResultsReportingMessage().

310  {
311  global $DIC; /* @var ILIAS\DI\Container $DIC */
312 
313  if ($this->testObj->canShowTestResults($this->getTestSession())) {
314  if ($this->objectiveParent->isObjectiveOrientedPresentationRequired()) {
315  $DIC->ctrl()->redirectByClass('ilTestEvalObjectiveOrientedGUI');
316  }
317 
318  $DIC->ctrl()->redirectByClass(array('ilMyTestResultsGUI', 'ilTestEvaluationGUI'));
319  }
320 
321  $toolbar = $DIC->toolbar();
322  $validator = new ilCertificateDownloadValidator();
323  if ($validator->isCertificateDownloadable($DIC->user()->getId(), $this->getTestObj()->getId())) {
324  $button = ilLinkButton::getInstance();
325  $button->setCaption('certificate');
326  $button->setUrl($DIC->ctrl()->getFormActionByClass(ilTestEvaluationGUI::class, 'outCertificate'));
327  $toolbar->addButtonInstance($button);
328  }
329 
331  }
global $DIC
Definition: feed.php:28
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 333 of file class.ilTestResultsGUI.php.

References $DIC, $message, ilDatePresentation\formatDate(), IL_CAL_TIMESTAMP, ilObjTest\SCORE_REPORTING_AFTER_PASSED, ilObjTest\SCORE_REPORTING_DATE, and ilObjTest\SCORE_REPORTING_FINISHED.

Referenced by showCmd().

334  {
335  global $DIC; /* @var ILIAS\DI\Container $DIC */
336 
337  $message = $DIC->language()->txt('tst_res_tab_msg_res_after_taking_test');
338 
339  switch ($this->testObj->getScoreReporting()) {
341 
342  if ($this->testObj->hasAnyTestResult($this->getTestSession())) {
343  $message = $DIC->language()->txt('tst_res_tab_msg_res_after_finish_test');
344  }
345 
346  break;
347 
349  $reporting_date = $this->testObj->getScoreSettings()->getResultSummarySettings()->getReportingDate();
350  $reporting_date = new ilDateTime(
351  $reporting_date->format('YmdHis'),
353  $reporting_date->getTimezone()->getName() //date is provided in UTC, formatDate prints it in user timezone
354  );
355 
356  if (!$this->testObj->hasAnyTestResult($this->getTestSession())) {
357  $message = sprintf(
358  $DIC->language()->txt('tst_res_tab_msg_res_after_date_no_res'),
359  ilDatePresentation::formatDate($reporting_date)
360  );
361  break;
362  }
363 
364  $message = sprintf(
365  $DIC->language()->txt('tst_res_tab_msg_res_after_date'),
366  ilDatePresentation::formatDate($reporting_date)
367  );
368  break;
369 
371  $message = $DIC->language()->txt('tst_res_tab_msg_res_after_test_passed');
372  break;
373  }
374 
375  $this->main_tpl->setOnScreenMessage('info', $message);
376  }
const SCORE_REPORTING_AFTER_PASSED
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
global $DIC
Definition: feed.php:28
const SCORE_REPORTING_FINISHED
const SCORE_REPORTING_DATE
$message
Definition: xapiexit.php:32
const IL_CAL_TIMESTAMP
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $main_tpl

ilGlobalTemplateInterface ilTestResultsGUI::$main_tpl
private

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

◆ $objectiveParent

ilTestResultsGUI::$objectiveParent
protected

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

Referenced by getObjectiveParent(), and setObjectiveParent().

◆ $questionSetConfig

ilTestResultsGUI::$questionSetConfig
protected

◆ $testAccess

ilTestResultsGUI::$testAccess
protected

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

Referenced by getTestAccess(), and setTestAccess().

◆ $testObj

ilTestResultsGUI::$testObj
protected

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

Referenced by __construct(), getTestObj(), and setTestObj().

◆ $testSession

ilTestResultsGUI::$testSession
protected

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

Referenced by executeCommand(), getTestSession(), and setTestSession().

◆ $testTabs

ilTestResultsGUI::$testTabs
protected

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

Referenced by getTestTabs(), and setTestTabs().

◆ DEFAULT_CMD

const ilTestResultsGUI::DEFAULT_CMD = 'show'

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


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