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

Public Member Functions

 __construct (ilLanguage $lng, ilObjectDataCache $objCache)
 
 getObjectiveOrientedContainerId ()
 
 setObjectiveOrientedContainerId ($objectiveOrientedContainerId)
 
 getTestObjId ()
 
 setTestObjId ($testObjId)
 
 getTestRefId ()
 
 setTestRefId ($testRefId)
 
 getUserId ()
 
 setUserId ($userId)
 
 initObjectiveOrientedMode ()
 
 getPassOverviewHeaderLabel ()
 
 getPassDetailsHeaderLabel ($attemptNumber)
 
 getListOfAnswersHeaderLabel ($attemptNumber)
 
 getVirtualListOfAnswersHeaderLabel ()
 
 getVirtualPassDetailsHeaderLabel ($objectiveTitle)
 

Data Fields

const LO_TEST_TYPE_INITIAL = 'loTestInitial'
 
const LO_TEST_TYPE_QUALIFYING = 'loTestQualifying'
 

Protected Attributes

 $lng
 
 $objCache
 
 $objectiveOrientedContainerId
 
 $testObjId
 
 $testRefId
 
 $userId
 
 $crsTitle
 
 $testType
 
 $objectives
 

Private Member Functions

 initTestType ()
 
 initObjectives ()
 
 initCourseTitle ()
 
 isInitialTest ()
 
 isQualifyingTest ()
 
 isInitialTestForAllObjectives ()
 
 isInitialTestPerObjective ()
 
 isQualifyingTestForAllObjectives ()
 
 isQualifyingTestPerObjective ()
 
 getObjectiveTitle (ilLOTestRun $loRun)
 
 getObjectivesString ()
 
 getAttemptLabel ($attemptNumber)
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilTestResultHeaderLabelBuilder::__construct ( ilLanguage  $lng,
ilObjectDataCache  $objCache 
)
Parameters
ilLanguage$lng
ilObjectDataCache$objCache

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

References $lng, $objCache, and ILIAS\Repository\lng().

81  {
82  $this->lng = $lng;
83  $this->objCache = $objCache;
84 
85  $this->objectiveOrientedContainerId = null;
86  $this->testObjId = null;
87  $this->testRefId = null;
88  $this->userId = null;
89 
90  $this->testType = null;
91  $this->crsTitle = null;
92 
93  $this->objectives = array();
94  }
+ Here is the call graph for this function:

Member Function Documentation

◆ getAttemptLabel()

ilTestResultHeaderLabelBuilder::getAttemptLabel (   $attemptNumber)
private

Definition at line 333 of file class.ilTestResultHeaderLabelBuilder.php.

References ILIAS\Repository\lng().

Referenced by getPassDetailsHeaderLabel().

333  : string
334  {
335  return sprintf($this->lng->txt('tst_res_lo_try_n'), $attemptNumber);
336  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getListOfAnswersHeaderLabel()

ilTestResultHeaderLabelBuilder::getListOfAnswersHeaderLabel (   $attemptNumber)

Definition at line 338 of file class.ilTestResultHeaderLabelBuilder.php.

References getObjectiveOrientedContainerId(), and ILIAS\Repository\lng().

338  : string
339  {
340  $langVar = 'tst_eval_results_by_pass';
341 
342  if ($this->getObjectiveOrientedContainerId()) {
343  $langVar = 'tst_eval_results_by_pass_lo';
344  }
345 
346  return sprintf($this->lng->txt($langVar), $attemptNumber);
347  }
+ Here is the call graph for this function:

◆ getObjectiveOrientedContainerId()

ilTestResultHeaderLabelBuilder::getObjectiveOrientedContainerId ( )

◆ getObjectivesString()

ilTestResultHeaderLabelBuilder::getObjectivesString ( )
private

Definition at line 328 of file class.ilTestResultHeaderLabelBuilder.php.

Referenced by getPassDetailsHeaderLabel(), and getPassOverviewHeaderLabel().

328  : string
329  {
330  return implode(', ', $this->objectives);
331  }
+ Here is the caller graph for this function:

◆ getObjectiveTitle()

ilTestResultHeaderLabelBuilder::getObjectiveTitle ( ilLOTestRun  $loRun)
private

Definition at line 323 of file class.ilTestResultHeaderLabelBuilder.php.

References ilLOTestRun\getObjectiveId(), and ilCourseObjective\lookupObjectiveTitle().

Referenced by initObjectives().

324  {
326  }
static lookupObjectiveTitle(int $a_objective_id, bool $a_add_description=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPassDetailsHeaderLabel()

ilTestResultHeaderLabelBuilder::getPassDetailsHeaderLabel (   $attemptNumber)
Returns
string

Definition at line 235 of file class.ilTestResultHeaderLabelBuilder.php.

References getAttemptLabel(), getObjectiveOrientedContainerId(), getObjectivesString(), isInitialTest(), isQualifyingTest(), and ILIAS\Repository\lng().

235  : string
236  {
237  if (!$this->getObjectiveOrientedContainerId()) {
238  return sprintf(
239  $this->lng->txt('tst_pass_details_overview_table_title'),
240  $attemptNumber
241  );
242  }
243 
244  if ($this->isInitialTest()) {
245  return sprintf(
246  $this->lng->txt('tst_pass_details_header_lo_initial'),
247  $this->getObjectivesString(),
248  $this->getAttemptLabel($attemptNumber)
249  );
250  } elseif ($this->isQualifyingTest()) {
251  return sprintf(
252  $this->lng->txt('tst_pass_details_header_lo_qualifying'),
253  $this->getObjectivesString(),
254  $this->getAttemptLabel($attemptNumber)
255  );
256  }
257 
258  return '';
259  }
+ Here is the call graph for this function:

◆ getPassOverviewHeaderLabel()

ilTestResultHeaderLabelBuilder::getPassOverviewHeaderLabel ( )
Returns
string

Definition at line 199 of file class.ilTestResultHeaderLabelBuilder.php.

References $crsTitle, getObjectiveOrientedContainerId(), getObjectivesString(), isInitialTestForAllObjectives(), isInitialTestPerObjective(), isQualifyingTestForAllObjectives(), isQualifyingTestPerObjective(), and ILIAS\Repository\lng().

199  : string
200  {
201  if (!$this->getObjectiveOrientedContainerId()) {
202  return $this->lng->txt('tst_results_overview');
203  }
204 
205  if ($this->isInitialTestForAllObjectives()) {
206  return sprintf(
207  $this->lng->txt('tst_pass_overview_header_lo_initial_all_objectives'),
209  );
210  } elseif ($this->isInitialTestPerObjective()) {
211  return sprintf(
212  $this->lng->txt('tst_pass_overview_header_lo_initial_per_objective'),
213  $this->getObjectivesString(),
215  );
216  } elseif ($this->isQualifyingTestForAllObjectives()) {
217  return sprintf(
218  $this->lng->txt('tst_pass_overview_header_lo_qualifying_all_objectives'),
220  );
221  } elseif ($this->isQualifyingTestPerObjective()) {
222  return sprintf(
223  $this->lng->txt('tst_pass_overview_header_lo_qualifying_per_objective'),
224  $this->getObjectivesString(),
226  );
227  }
228 
229  return '';
230  }
+ Here is the call graph for this function:

◆ getTestObjId()

ilTestResultHeaderLabelBuilder::getTestObjId ( )
Returns
int

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

References $testObjId.

Referenced by initObjectives().

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

◆ getTestRefId()

ilTestResultHeaderLabelBuilder::getTestRefId ( )
Returns
int

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

References $testRefId.

Referenced by initTestType().

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

◆ getUserId()

ilTestResultHeaderLabelBuilder::getUserId ( )
Returns
int

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

References $userId.

Referenced by initObjectives().

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

◆ getVirtualListOfAnswersHeaderLabel()

ilTestResultHeaderLabelBuilder::getVirtualListOfAnswersHeaderLabel ( )

Definition at line 349 of file class.ilTestResultHeaderLabelBuilder.php.

References ILIAS\Repository\lng().

349  : string
350  {
351  return $this->lng->txt('tst_eval_results_lo');
352  }
+ Here is the call graph for this function:

◆ getVirtualPassDetailsHeaderLabel()

ilTestResultHeaderLabelBuilder::getVirtualPassDetailsHeaderLabel (   $objectiveTitle)

Definition at line 354 of file class.ilTestResultHeaderLabelBuilder.php.

References isInitialTest(), isQualifyingTest(), and ILIAS\Repository\lng().

354  : string
355  {
356  if ($this->isInitialTest()) {
357  return sprintf(
358  $this->lng->txt('tst_virtual_pass_header_lo_initial'),
359  $objectiveTitle
360  );
361  } elseif ($this->isQualifyingTest()) {
362  return sprintf(
363  $this->lng->txt('tst_virtual_pass_header_lo_qualifying'),
364  $objectiveTitle
365  );
366  }
367 
368  return '';
369  }
+ Here is the call graph for this function:

◆ initCourseTitle()

ilTestResultHeaderLabelBuilder::initCourseTitle ( )
private

Definition at line 191 of file class.ilTestResultHeaderLabelBuilder.php.

References getObjectiveOrientedContainerId().

Referenced by initObjectiveOrientedMode().

192  {
193  $this->crsTitle = $this->objCache->lookupTitle((int) $this->getObjectiveOrientedContainerId());
194  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initObjectiveOrientedMode()

ilTestResultHeaderLabelBuilder::initObjectiveOrientedMode ( )

◆ initObjectives()

ilTestResultHeaderLabelBuilder::initObjectives ( )
private

Definition at line 178 of file class.ilTestResultHeaderLabelBuilder.php.

References getObjectiveOrientedContainerId(), getObjectiveTitle(), ilLOTestRun\getRun(), getTestObjId(), and getUserId().

Referenced by initObjectiveOrientedMode().

179  {
180  $loRuns = ilLOTestRun::getRun($this->getObjectiveOrientedContainerId(), $this->getUserId(), $this->getTestObjId());
181 
182  $this->objectives = array();
183 
184  foreach ($loRuns as $loRun) {
185  /* @var ilLOTestRun $loRun */
186 
187  $this->objectives[$loRun->getObjectiveId()] = $this->getObjectiveTitle($loRun);
188  }
189  }
static getRun(int $a_container_id, int $a_user_id, int $a_test_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initTestType()

ilTestResultHeaderLabelBuilder::initTestType ( )
private

Definition at line 167 of file class.ilTestResultHeaderLabelBuilder.php.

References ilLOSettings\getInstanceByObjId(), getObjectiveOrientedContainerId(), and getTestRefId().

Referenced by initObjectiveOrientedMode().

168  {
170 
171  if ($loSettings->getInitialTest() == $this->getTestRefId()) {
172  $this->testType = self::LO_TEST_TYPE_INITIAL;
173  } elseif ($loSettings->getQualifiedTest() == $this->getTestRefId()) {
174  $this->testType = self::LO_TEST_TYPE_QUALIFYING;
175  }
176  }
static getInstanceByObjId(int $a_obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isInitialTest()

ilTestResultHeaderLabelBuilder::isInitialTest ( )
private

Definition at line 261 of file class.ilTestResultHeaderLabelBuilder.php.

Referenced by getPassDetailsHeaderLabel(), and getVirtualPassDetailsHeaderLabel().

261  : bool
262  {
263  return $this->testType == self::LO_TEST_TYPE_INITIAL;
264  }
+ Here is the caller graph for this function:

◆ isInitialTestForAllObjectives()

ilTestResultHeaderLabelBuilder::isInitialTestForAllObjectives ( )
private

Definition at line 271 of file class.ilTestResultHeaderLabelBuilder.php.

Referenced by getPassOverviewHeaderLabel().

271  : bool
272  {
273  if ($this->testType != self::LO_TEST_TYPE_INITIAL) {
274  return false;
275  }
276 
277  if (count($this->objectives) <= 1) {
278  return false;
279  }
280 
281  return true;
282  }
+ Here is the caller graph for this function:

◆ isInitialTestPerObjective()

ilTestResultHeaderLabelBuilder::isInitialTestPerObjective ( )
private

Definition at line 284 of file class.ilTestResultHeaderLabelBuilder.php.

Referenced by getPassOverviewHeaderLabel().

284  : bool
285  {
286  if ($this->testType != self::LO_TEST_TYPE_INITIAL) {
287  return false;
288  }
289 
290  if (count($this->objectives) > 1) {
291  return false;
292  }
293 
294  return true;
295  }
+ Here is the caller graph for this function:

◆ isQualifyingTest()

ilTestResultHeaderLabelBuilder::isQualifyingTest ( )
private

Definition at line 266 of file class.ilTestResultHeaderLabelBuilder.php.

Referenced by getPassDetailsHeaderLabel(), and getVirtualPassDetailsHeaderLabel().

266  : bool
267  {
268  return $this->testType == self::LO_TEST_TYPE_QUALIFYING;
269  }
+ Here is the caller graph for this function:

◆ isQualifyingTestForAllObjectives()

ilTestResultHeaderLabelBuilder::isQualifyingTestForAllObjectives ( )
private

Definition at line 297 of file class.ilTestResultHeaderLabelBuilder.php.

Referenced by getPassOverviewHeaderLabel().

297  : bool
298  {
299  if ($this->testType != self::LO_TEST_TYPE_QUALIFYING) {
300  return false;
301  }
302 
303  if (count($this->objectives) <= 1) {
304  return false;
305  }
306 
307  return true;
308  }
+ Here is the caller graph for this function:

◆ isQualifyingTestPerObjective()

ilTestResultHeaderLabelBuilder::isQualifyingTestPerObjective ( )
private

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

Referenced by getPassOverviewHeaderLabel().

310  : bool
311  {
312  if ($this->testType != self::LO_TEST_TYPE_QUALIFYING) {
313  return false;
314  }
315 
316  if (count($this->objectives) > 1) {
317  return false;
318  }
319 
320  return true;
321  }
+ Here is the caller graph for this function:

◆ setObjectiveOrientedContainerId()

ilTestResultHeaderLabelBuilder::setObjectiveOrientedContainerId (   $objectiveOrientedContainerId)
Parameters
int$objectiveOrientedContainerId

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

References $objectiveOrientedContainerId.

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

◆ setTestObjId()

ilTestResultHeaderLabelBuilder::setTestObjId (   $testObjId)
Parameters
int$testObjId

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

References $testObjId.

124  {
125  $this->testObjId = $testObjId;
126  }

◆ setTestRefId()

ilTestResultHeaderLabelBuilder::setTestRefId (   $testRefId)
Parameters
int$testRefId

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

References $testRefId.

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

◆ setUserId()

ilTestResultHeaderLabelBuilder::setUserId (   $userId)
Parameters
int$userId

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

References $userId.

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

Field Documentation

◆ $crsTitle

ilTestResultHeaderLabelBuilder::$crsTitle
protected

Definition at line 64 of file class.ilTestResultHeaderLabelBuilder.php.

Referenced by getPassOverviewHeaderLabel().

◆ $lng

ilTestResultHeaderLabelBuilder::$lng
protected

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

Referenced by __construct().

◆ $objCache

ilTestResultHeaderLabelBuilder::$objCache
protected

Definition at line 39 of file class.ilTestResultHeaderLabelBuilder.php.

Referenced by __construct().

◆ $objectiveOrientedContainerId

ilTestResultHeaderLabelBuilder::$objectiveOrientedContainerId
protected

◆ $objectives

ilTestResultHeaderLabelBuilder::$objectives
protected

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

◆ $testObjId

ilTestResultHeaderLabelBuilder::$testObjId
protected

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

Referenced by getTestObjId(), and setTestObjId().

◆ $testRefId

ilTestResultHeaderLabelBuilder::$testRefId
protected

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

Referenced by getTestRefId(), and setTestRefId().

◆ $testType

ilTestResultHeaderLabelBuilder::$testType
protected

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

◆ $userId

ilTestResultHeaderLabelBuilder::$userId
protected

Definition at line 59 of file class.ilTestResultHeaderLabelBuilder.php.

Referenced by getUserId(), and setUserId().

◆ LO_TEST_TYPE_INITIAL

const ilTestResultHeaderLabelBuilder::LO_TEST_TYPE_INITIAL = 'loTestInitial'

Definition at line 29 of file class.ilTestResultHeaderLabelBuilder.php.

◆ LO_TEST_TYPE_QUALIFYING

const ilTestResultHeaderLabelBuilder::LO_TEST_TYPE_QUALIFYING = 'loTestQualifying'

Definition at line 30 of file class.ilTestResultHeaderLabelBuilder.php.


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