ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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 25 of file class.ilTestResultHeaderLabelBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

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

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

Member Function Documentation

◆ getAttemptLabel()

ilTestResultHeaderLabelBuilder::getAttemptLabel (   $attemptNumber)
private

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

References ILIAS\Repository\lng().

Referenced by getPassDetailsHeaderLabel().

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

◆ getListOfAnswersHeaderLabel()

ilTestResultHeaderLabelBuilder::getListOfAnswersHeaderLabel (   $attemptNumber)

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

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

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

◆ getObjectiveOrientedContainerId()

ilTestResultHeaderLabelBuilder::getObjectiveOrientedContainerId ( )

◆ getObjectivesString()

ilTestResultHeaderLabelBuilder::getObjectivesString ( )
private

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

Referenced by getPassDetailsHeaderLabel(), and getPassOverviewHeaderLabel().

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

◆ getObjectiveTitle()

ilTestResultHeaderLabelBuilder::getObjectiveTitle ( ilLOTestRun  $loRun)
private

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

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

Referenced by initObjectives().

322  {
324  }
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 233 of file class.ilTestResultHeaderLabelBuilder.php.

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

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

◆ getPassOverviewHeaderLabel()

ilTestResultHeaderLabelBuilder::getPassOverviewHeaderLabel ( )
Returns
string

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

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

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

◆ getTestObjId()

ilTestResultHeaderLabelBuilder::getTestObjId ( )
Returns
int

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

References $testObjId.

Referenced by initObjectives().

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

◆ getTestRefId()

ilTestResultHeaderLabelBuilder::getTestRefId ( )
Returns
int

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

References $testRefId.

Referenced by initTestType().

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

◆ getUserId()

ilTestResultHeaderLabelBuilder::getUserId ( )
Returns
int

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

References $userId.

Referenced by initObjectives().

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

◆ getVirtualListOfAnswersHeaderLabel()

ilTestResultHeaderLabelBuilder::getVirtualListOfAnswersHeaderLabel ( )

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

References ILIAS\Repository\lng().

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

◆ getVirtualPassDetailsHeaderLabel()

ilTestResultHeaderLabelBuilder::getVirtualPassDetailsHeaderLabel (   $objectiveTitle)

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

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

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

◆ initCourseTitle()

ilTestResultHeaderLabelBuilder::initCourseTitle ( )
private

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

References getObjectiveOrientedContainerId().

Referenced by initObjectiveOrientedMode().

190  {
191  $this->crsTitle = $this->objCache->lookupTitle((int) $this->getObjectiveOrientedContainerId());
192  }
+ 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 176 of file class.ilTestResultHeaderLabelBuilder.php.

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

Referenced by initObjectiveOrientedMode().

177  {
178  $loRuns = ilLOTestRun::getRun($this->getObjectiveOrientedContainerId(), $this->getUserId(), $this->getTestObjId());
179 
180  $this->objectives = array();
181 
182  foreach ($loRuns as $loRun) {
183  /* @var ilLOTestRun $loRun */
184 
185  $this->objectives[$loRun->getObjectiveId()] = $this->getObjectiveTitle($loRun);
186  }
187  }
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 165 of file class.ilTestResultHeaderLabelBuilder.php.

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

Referenced by initObjectiveOrientedMode().

166  {
168 
169  if ($loSettings->getInitialTest() == $this->getTestRefId()) {
170  $this->testType = self::LO_TEST_TYPE_INITIAL;
171  } elseif ($loSettings->getQualifiedTest() == $this->getTestRefId()) {
172  $this->testType = self::LO_TEST_TYPE_QUALIFYING;
173  }
174  }
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 259 of file class.ilTestResultHeaderLabelBuilder.php.

Referenced by getPassDetailsHeaderLabel(), and getVirtualPassDetailsHeaderLabel().

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

◆ isInitialTestForAllObjectives()

ilTestResultHeaderLabelBuilder::isInitialTestForAllObjectives ( )
private

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

Referenced by getPassOverviewHeaderLabel().

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

◆ isInitialTestPerObjective()

ilTestResultHeaderLabelBuilder::isInitialTestPerObjective ( )
private

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

Referenced by getPassOverviewHeaderLabel().

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

◆ isQualifyingTest()

ilTestResultHeaderLabelBuilder::isQualifyingTest ( )
private

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

Referenced by getPassDetailsHeaderLabel(), and getVirtualPassDetailsHeaderLabel().

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

◆ isQualifyingTestForAllObjectives()

ilTestResultHeaderLabelBuilder::isQualifyingTestForAllObjectives ( )
private

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

Referenced by getPassOverviewHeaderLabel().

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

◆ isQualifyingTestPerObjective()

ilTestResultHeaderLabelBuilder::isQualifyingTestPerObjective ( )
private

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

Referenced by getPassOverviewHeaderLabel().

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

◆ setObjectiveOrientedContainerId()

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

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

References $objectiveOrientedContainerId.

106  {
107  $this->objectiveOrientedContainerId = $objectiveOrientedContainerId;
108  }

◆ setTestObjId()

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

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

References $testObjId.

122  {
123  $this->testObjId = $testObjId;
124  }

◆ setTestRefId()

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

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

References $testRefId.

138  {
139  $this->testRefId = $testRefId;
140  }

◆ setUserId()

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

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

References $userId.

154  {
155  $this->userId = $userId;
156  }

Field Documentation

◆ $crsTitle

ilTestResultHeaderLabelBuilder::$crsTitle
protected

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

Referenced by getPassOverviewHeaderLabel().

◆ $lng

ilTestResultHeaderLabelBuilder::$lng
protected

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

Referenced by __construct().

◆ $objCache

ilTestResultHeaderLabelBuilder::$objCache
protected

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

Referenced by __construct().

◆ $objectiveOrientedContainerId

ilTestResultHeaderLabelBuilder::$objectiveOrientedContainerId
protected

◆ $objectives

ilTestResultHeaderLabelBuilder::$objectives
protected

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

◆ $testObjId

ilTestResultHeaderLabelBuilder::$testObjId
protected

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

Referenced by getTestObjId(), and setTestObjId().

◆ $testRefId

ilTestResultHeaderLabelBuilder::$testRefId
protected

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

Referenced by getTestRefId(), and setTestRefId().

◆ $testType

ilTestResultHeaderLabelBuilder::$testType
protected

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

◆ $userId

ilTestResultHeaderLabelBuilder::$userId
protected

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

Referenced by getUserId(), and setUserId().

◆ LO_TEST_TYPE_INITIAL

const ilTestResultHeaderLabelBuilder::LO_TEST_TYPE_INITIAL = 'loTestInitial'

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

◆ LO_TEST_TYPE_QUALIFYING

const ilTestResultHeaderLabelBuilder::LO_TEST_TYPE_QUALIFYING = 'loTestQualifying'

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


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