ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

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

ilTestParticipantsGUI constructor.

Parameters
ilObjTest$testObj

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

References $questionSetConfig, and $testObj.

59  {
60  $this->testObj = $testObj;
61  $this->questionSetConfig = $questionSetConfig;
62  }

Member Function Documentation

◆ executeCommand()

ilTestResultsGUI::executeCommand ( )

Execute Command.

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

References $DIC, $testSession, ilObjTestGUI\accessViolationRedirect(), 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.

164  {
165  global $DIC; /* @var ILIAS\DI\Container $DIC */
166 
167  $this->getTestTabs()->activateTab(ilTestTabsManager::TAB_ID_RESULTS);
168  $this->getTestTabs()->getResultsSubTabs();
169 
170  switch ($DIC->ctrl()->getNextClass()) {
171  case 'ilparticipantstestresultsgui':
172 
173  if (!$this->getTestAccess()->checkManageParticipantsAccess() && !$this->getTestAccess()->checkParticipantsResultsAccess()) {
175  }
176 
178 
179  require_once 'Modules/Test/classes/class.ilParticipantsTestResultsGUI.php';
180  $gui = new ilParticipantsTestResultsGUI();
181  $gui->setTestObj($this->getTestObj());
182  $gui->setQuestionSetConfig($this->getQuestionSetConfig());
183  $gui->setTestAccess($this->getTestAccess());
184  $gui->setObjectiveParent($this->getObjectiveParent());
185  $DIC->ctrl()->forwardCommand($gui);
186  break;
187 
188  case 'ilmytestresultsgui':
189 
190  if (!$this->getTestTabs()->needsMyResultsSubTab()) {
192  }
193 
194  $this->getTestTabs()->activateSubTab(ilTestTabsManager::SUBTAB_ID_MY_RESULTS);
195 
196  require_once 'Modules/Test/classes/class.ilMyTestResultsGUI.php';
197  $gui = new ilMyTestResultsGUI();
198  $gui->setTestObj($this->getTestObj());
199  $gui->setTestAccess($this->getTestAccess());
200  $gui->setTestSession($this->getTestSession());
201  $gui->setObjectiveParent($this->getObjectiveParent());
202  $DIC->ctrl()->forwardCommand($gui);
203  break;
204 
205  case 'iltestevalobjectiveorientedgui':
206 
207  if (!$this->getTestTabs()->needsLoResultsSubTab()) {
209  }
210 
211  $this->getTestTabs()->activateSubTab(ilTestTabsManager::SUBTAB_ID_LO_RESULTS);
212 
213  require_once 'Modules/Test/classes/class.ilTestEvalObjectiveOrientedGUI.php';
214  $gui = new ilTestEvalObjectiveOrientedGUI($this->getTestObj());
215  $gui->setObjectiveOrientedContainer($this->getObjectiveParent());
216  $DIC->ctrl()->forwardCommand($gui);
217  break;
218 
219  case 'ilmytestsolutionsgui':
220 
221  if (!$this->getTestTabs()->needsMySolutionsSubTab()) {
223  }
224 
225  $this->getTestTabs()->activateSubTab(ilTestTabsManager::SUBTAB_ID_MY_SOLUTIONS);
226 
227  require_once 'Modules/Test/classes/class.ilMyTestSolutionsGUI.php';
228  $gui = new ilMyTestSolutionsGUI();
229  $gui->setTestObj($this->getTestObj());
230  $gui->setTestAccess($this->getTestAccess());
231  $gui->setObjectiveParent($this->getObjectiveParent());
232  $DIC->ctrl()->forwardCommand($gui);
233  break;
234 
235  case 'iltesttoplistgui':
236 
237  if (!$this->getTestTabs()->needsHighSoreSubTab()) {
239  }
240 
241  $this->getTestTabs()->activateSubTab(ilTestTabsManager::SUBTAB_ID_HIGHSCORE);
242 
243  require_once './Modules/Test/classes/class.ilTestToplistGUI.php';
244  $gui = new ilTestToplistGUI($this->getTestObj());
245  $DIC->ctrl()->forwardCommand($gui);
246  break;
247 
248  case 'iltestskillevaluationgui':
249 
251 
252  global $DIC; /* @var ILIAS\DI\Container $DIC */
253  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
254  if ($this->getTestObj()->isDynamicTest()) {
255  require_once 'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
256  $dynamicQuestionSetConfig = new ilObjTestDynamicQuestionSetConfig(
257  $DIC->repositoryTree(),
258  $DIC->database(),
259  $DIC['ilPluginAdmin'],
260  $this->getTestObj()
261  );
262  $dynamicQuestionSetConfig->loadFromDb();
263  $questionList = new ilAssQuestionList($DIC->database(), $DIC->language(), $DIC['ilPluginAdmin']);
264  $questionList->setParentObjId($dynamicQuestionSetConfig->getSourceQuestionPoolId());
265  $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_ORIGINALS);
266  } else {
267  $questionList = new ilAssQuestionList($DIC->database(), $DIC->language(), $DIC['ilPluginAdmin']);
268  $questionList->setParentObjId($this->getTestObj()->getId());
269  $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES);
270  }
271  $questionList->load();
272 
273  require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
274  $testSessionFactory = new ilTestSessionFactory($this->getTestObj());
275  $testSession = $testSessionFactory->getSession();
276 
277  require_once 'Modules/Test/classes/class.ilTestSkillEvaluationGUI.php';
278  $gui = new ilTestSkillEvaluationGUI(
279  $DIC->ctrl(),
280  $DIC->tabs(),
281  $DIC->ui()->mainTemplate(),
282  $DIC->language(),
283  $DIC->database(),
284  $this->getTestObj()
285  );
286  $gui->setQuestionList($questionList);
287  $gui->setTestSession($testSession);
288  $gui->setObjectiveOrientedContainer($this->getObjectiveParent());
289 
290  $DIC->ctrl()->forwardCommand($gui);
291  break;
292 
293  case strtolower(__CLASS__):
294  default:
295 
296  $command = $DIC->ctrl()->getCmd(self::DEFAULT_CMD) . 'Cmd';
297  $this->{$command}();
298  }
299  }
Scoring class for tests.
global $DIC
Definition: saml.php:7
loadFromDb()
loads the question set config for current test from the database
static accessViolationRedirect()
+ Here is the call graph for this function:

◆ getObjectiveParent()

ilTestResultsGUI::getObjectiveParent ( )
Returns
ilTestObjectiveOrientedContainer

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

References $objectiveParent.

Referenced by executeCommand().

68  {
70  }
+ Here is the caller graph for this function:

◆ getQuestionSetConfig()

ilTestResultsGUI::getQuestionSetConfig ( )
Returns
ilTestQuestionSetConfig

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

References $questionSetConfig.

Referenced by executeCommand().

100  {
102  }
+ Here is the caller graph for this function:

◆ getTestAccess()

ilTestResultsGUI::getTestAccess ( )
Returns
ilTestAccess

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

References $testAccess.

Referenced by executeCommand().

116  {
117  return $this->testAccess;
118  }
+ Here is the caller graph for this function:

◆ getTestObj()

ilTestResultsGUI::getTestObj ( )
Returns
ilObjTest

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

References $testObj.

Referenced by executeCommand(), and showCmd().

84  {
85  return $this->testObj;
86  }
+ Here is the caller graph for this function:

◆ getTestSession()

ilTestResultsGUI::getTestSession ( )
Returns
ilTestSession

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

References $testSession.

Referenced by executeCommand().

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

◆ getTestTabs()

ilTestResultsGUI::getTestTabs ( )
Returns
ilTestTabsManager

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

References $testTabs.

Referenced by executeCommand().

148  {
149  return $this->testTabs;
150  }
+ Here is the caller graph for this function:

◆ setObjectiveParent()

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

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

References $objectiveParent.

76  {
77  $this->objectiveParent = $objectiveParent;
78  }

◆ setQuestionSetConfig()

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

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

References $questionSetConfig.

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

◆ setTestAccess()

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

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

References $testAccess.

Referenced by ilObjTestGUI\executeCommand().

124  {
125  $this->testAccess = $testAccess;
126  }
+ Here is the caller graph for this function:

◆ setTestObj()

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

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

References $testObj.

92  {
93  $this->testObj = $testObj;
94  }

◆ setTestSession()

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

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

References $testSession.

140  {
141  $this->testSession = $testSession;
142  }

◆ setTestTabs()

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

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

References $testTabs.

156  {
157  $this->testTabs = $testTabs;
158  }

◆ showCmd()

ilTestResultsGUI::showCmd ( )
protected

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

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

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

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

Referenced by showCmd().

326  {
327  global $DIC; /* @var ILIAS\DI\Container $DIC */
328 
329  $message = $DIC->language()->txt('tst_res_tab_msg_res_after_taking_test');
330 
331  switch ($this->testObj->getScoreReporting()) {
333 
334  if ($this->testObj->hasAnyTestResult($this->getTestSession())) {
335  $message = $DIC->language()->txt('tst_res_tab_msg_res_after_finish_test');
336  }
337 
338  break;
339 
341 
342  $date = new ilDateTime($this->testObj->getReportingDate(), IL_CAL_TIMESTAMP);
343 
344  if (!$this->testObj->hasAnyTestResult($this->getTestSession())) {
345  $message = sprintf(
346  $DIC->language()->txt('tst_res_tab_msg_res_after_date_no_res'),
348  );
349  break;
350  }
351 
352  $message = sprintf(
353  $DIC->language()->txt('tst_res_tab_msg_res_after_date'),
355  );
356  break;
357 
359  $message = $DIC->language()->txt('tst_res_tab_msg_res_after_test_passed');
360  break;
361  }
362 
364  }
global $DIC
Definition: saml.php:7
const SCORE_REPORTING_AFTER_PASSED
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
catch(Exception $e) $message
Date and time handling
const SCORE_REPORTING_FINISHED
const SCORE_REPORTING_DATE
const IL_CAL_TIMESTAMP
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $objectiveParent

ilTestResultsGUI::$objectiveParent
protected

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

Referenced by getObjectiveParent(), and setObjectiveParent().

◆ $questionSetConfig

ilTestResultsGUI::$questionSetConfig
protected

◆ $testAccess

ilTestResultsGUI::$testAccess
protected

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

Referenced by getTestAccess(), and setTestAccess().

◆ $testObj

ilTestResultsGUI::$testObj
protected

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

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

◆ $testSession

ilTestResultsGUI::$testSession
protected

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

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

◆ $testTabs

ilTestResultsGUI::$testTabs
protected

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

Referenced by getTestTabs(), and setTestTabs().

◆ DEFAULT_CMD

const ilTestResultsGUI::DEFAULT_CMD = 'show'

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


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