ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 11 of file class.ilTestResultHeaderLabelBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

References $lng, $objCache, and array.

65  {
66  $this->lng = $lng;
67  $this->objCache = $objCache;
68 
69  $this->objectiveOrientedContainerId = null;
70  $this->testObjId = null;
71  $this->testRefId = null;
72  $this->userId = null;
73 
74  $this->testType = null;
75  $this->crsTitle = null;
76 
77  $this->objectives = array();
78  }
Create styles array
The data for the language used.

Member Function Documentation

◆ getAttemptLabel()

ilTestResultHeaderLabelBuilder::getAttemptLabel (   $attemptNumber)
private

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

Referenced by getPassDetailsHeaderLabel().

321  {
322  return sprintf($this->lng->txt('tst_res_lo_try_n'), $attemptNumber);
323  }
+ Here is the caller graph for this function:

◆ getListOfAnswersHeaderLabel()

ilTestResultHeaderLabelBuilder::getListOfAnswersHeaderLabel (   $attemptNumber)

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

References getObjectiveOrientedContainerId().

326  {
327  $langVar = 'tst_eval_results_by_pass';
328 
329  if ($this->getObjectiveOrientedContainerId()) {
330  $langVar = 'tst_eval_results_by_pass_lo';
331  }
332 
333  return sprintf($this->lng->txt($langVar), $attemptNumber);
334  }
+ Here is the call graph for this function:

◆ getObjectiveOrientedContainerId()

ilTestResultHeaderLabelBuilder::getObjectiveOrientedContainerId ( )

◆ getObjectivesString()

ilTestResultHeaderLabelBuilder::getObjectivesString ( )
private

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

Referenced by getPassDetailsHeaderLabel(), and getPassOverviewHeaderLabel().

316  {
317  return implode(', ', $this->objectives);
318  }
+ Here is the caller graph for this function:

◆ getObjectiveTitle()

ilTestResultHeaderLabelBuilder::getObjectiveTitle ( ilLOTestRun  $loRun)
private

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

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

Referenced by initObjectives().

310  {
311  require_once 'Modules/Course/classes/class.ilCourseObjective.php';
313  }
static lookupObjectiveTitle($a_objective_id, $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 221 of file class.ilTestResultHeaderLabelBuilder.php.

References getAttemptLabel(), getObjectiveOrientedContainerId(), getObjectivesString(), isInitialTest(), and isQualifyingTest().

222  {
223  if (!$this->getObjectiveOrientedContainerId()) {
224  return sprintf(
225  $this->lng->txt('tst_pass_details_overview_table_title'),
226  $attemptNumber
227  );
228  }
229 
230  if ($this->isInitialTest()) {
231  return sprintf(
232  $this->lng->txt('tst_pass_details_header_lo_initial'),
233  $this->getObjectivesString(),
234  $this->getAttemptLabel($attemptNumber)
235  );
236  } elseif ($this->isQualifyingTest()) {
237  return sprintf(
238  $this->lng->txt('tst_pass_details_header_lo_qualifying'),
239  $this->getObjectivesString(),
240  $this->getAttemptLabel($attemptNumber)
241  );
242  }
243 
244  return '';
245  }
+ Here is the call graph for this function:

◆ getPassOverviewHeaderLabel()

ilTestResultHeaderLabelBuilder::getPassOverviewHeaderLabel ( )
Returns
string

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

References $crsTitle, getObjectiveOrientedContainerId(), getObjectivesString(), isInitialTestForAllObjectives(), isInitialTestPerObjective(), isQualifyingTestForAllObjectives(), and isQualifyingTestPerObjective().

186  {
187  if (!$this->getObjectiveOrientedContainerId()) {
188  return $this->lng->txt('tst_results_overview');
189  }
190 
191  if ($this->isInitialTestForAllObjectives()) {
192  return sprintf(
193  $this->lng->txt('tst_pass_overview_header_lo_initial_all_objectives'),
195  );
196  } elseif ($this->isInitialTestPerObjective()) {
197  return sprintf(
198  $this->lng->txt('tst_pass_overview_header_lo_initial_per_objective'),
199  $this->getObjectivesString(),
201  );
202  } elseif ($this->isQualifyingTestForAllObjectives()) {
203  return sprintf(
204  $this->lng->txt('tst_pass_overview_header_lo_qualifying_all_objectives'),
206  );
207  } elseif ($this->isQualifyingTestPerObjective()) {
208  return sprintf(
209  $this->lng->txt('tst_pass_overview_header_lo_qualifying_per_objective'),
210  $this->getObjectivesString(),
212  );
213  }
214 
215  return '';
216  }
+ Here is the call graph for this function:

◆ getTestObjId()

ilTestResultHeaderLabelBuilder::getTestObjId ( )
Returns
int

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

References $testObjId.

Referenced by initObjectives().

+ Here is the caller graph for this function:

◆ getTestRefId()

ilTestResultHeaderLabelBuilder::getTestRefId ( )
Returns
int

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

References $testRefId.

Referenced by initTestType().

+ Here is the caller graph for this function:

◆ getUserId()

ilTestResultHeaderLabelBuilder::getUserId ( )
Returns
int

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

References $userId.

Referenced by initObjectives().

+ Here is the caller graph for this function:

◆ getVirtualListOfAnswersHeaderLabel()

ilTestResultHeaderLabelBuilder::getVirtualListOfAnswersHeaderLabel ( )

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

337  {
338  return $this->lng->txt('tst_eval_results_lo');
339  }

◆ getVirtualPassDetailsHeaderLabel()

ilTestResultHeaderLabelBuilder::getVirtualPassDetailsHeaderLabel (   $objectiveTitle)

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

References isInitialTest(), and isQualifyingTest().

342  {
343  if ($this->isInitialTest()) {
344  return sprintf(
345  $this->lng->txt('tst_virtual_pass_header_lo_initial'),
346  $objectiveTitle
347  );
348  } elseif ($this->isQualifyingTest()) {
349  return sprintf(
350  $this->lng->txt('tst_virtual_pass_header_lo_qualifying'),
351  $objectiveTitle
352  );
353  }
354 
355  return '';
356  }
+ Here is the call graph for this function:

◆ initCourseTitle()

ilTestResultHeaderLabelBuilder::initCourseTitle ( )
private

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

References getObjectiveOrientedContainerId().

Referenced by initObjectiveOrientedMode().

178  {
179  $this->crsTitle = $this->objCache->lookupTitle($this->getObjectiveOrientedContainerId());
180  }
+ 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 163 of file class.ilTestResultHeaderLabelBuilder.php.

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

Referenced by initObjectiveOrientedMode().

164  {
165  require_once 'Modules/Course/classes/Objectives/class.ilLOTestRun.php';
166  $loRuns = ilLOTestRun::getRun($this->getObjectiveOrientedContainerId(), $this->getUserId(), $this->getTestObjId());
167 
168  $this->objectives = array();
169 
170  foreach ($loRuns as $loRun) {
171  /* @var ilLOTestRun $loRun */
172 
173  $this->objectives[$loRun->getObjectiveId()] = $this->getObjectiveTitle($loRun);
174  }
175  }
static getRun($a_container_id, $a_user_id, $a_test_id)
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initTestType()

ilTestResultHeaderLabelBuilder::initTestType ( )
private

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

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

Referenced by initObjectiveOrientedMode().

152  {
153  require_once 'Modules/Course/classes/Objectives/class.ilLOSettings.php';
155 
156  if ($loSettings->getInitialTest() == $this->getTestRefId()) {
157  $this->testType = self::LO_TEST_TYPE_INITIAL;
158  } elseif ($loSettings->getQualifiedTest() == $this->getTestRefId()) {
159  $this->testType = self::LO_TEST_TYPE_QUALIFYING;
160  }
161  }
static getInstanceByObjId($a_obj_id)
get singleton instance
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isInitialTest()

ilTestResultHeaderLabelBuilder::isInitialTest ( )
private

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

Referenced by getPassDetailsHeaderLabel(), and getVirtualPassDetailsHeaderLabel().

248  {
249  return $this->testType == self::LO_TEST_TYPE_INITIAL;
250  }
+ Here is the caller graph for this function:

◆ isInitialTestForAllObjectives()

ilTestResultHeaderLabelBuilder::isInitialTestForAllObjectives ( )
private

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

Referenced by getPassOverviewHeaderLabel().

258  {
259  if ($this->testType != self::LO_TEST_TYPE_INITIAL) {
260  return false;
261  }
262 
263  if (count($this->objectives) <= 1) {
264  return false;
265  }
266 
267  return true;
268  }
+ Here is the caller graph for this function:

◆ isInitialTestPerObjective()

ilTestResultHeaderLabelBuilder::isInitialTestPerObjective ( )
private

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

Referenced by getPassOverviewHeaderLabel().

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

◆ isQualifyingTest()

ilTestResultHeaderLabelBuilder::isQualifyingTest ( )
private

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

Referenced by getPassDetailsHeaderLabel(), and getVirtualPassDetailsHeaderLabel().

253  {
254  return $this->testType == self::LO_TEST_TYPE_QUALIFYING;
255  }
+ Here is the caller graph for this function:

◆ isQualifyingTestForAllObjectives()

ilTestResultHeaderLabelBuilder::isQualifyingTestForAllObjectives ( )
private

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

Referenced by getPassOverviewHeaderLabel().

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

◆ isQualifyingTestPerObjective()

ilTestResultHeaderLabelBuilder::isQualifyingTestPerObjective ( )
private

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

Referenced by getPassOverviewHeaderLabel().

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

◆ setObjectiveOrientedContainerId()

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

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

References $objectiveOrientedContainerId.

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

◆ setTestObjId()

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

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

References $testObjId.

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

◆ setTestRefId()

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

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

References $testRefId.

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

◆ setUserId()

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

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

References $userId.

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

Field Documentation

◆ $crsTitle

ilTestResultHeaderLabelBuilder::$crsTitle
protected

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

Referenced by getPassOverviewHeaderLabel().

◆ $lng

ilTestResultHeaderLabelBuilder::$lng
protected

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

Referenced by __construct().

◆ $objCache

ilTestResultHeaderLabelBuilder::$objCache
protected

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

Referenced by __construct().

◆ $objectiveOrientedContainerId

ilTestResultHeaderLabelBuilder::$objectiveOrientedContainerId
protected

◆ $objectives

ilTestResultHeaderLabelBuilder::$objectives
protected

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

◆ $testObjId

ilTestResultHeaderLabelBuilder::$testObjId
protected

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

Referenced by getTestObjId(), and setTestObjId().

◆ $testRefId

ilTestResultHeaderLabelBuilder::$testRefId
protected

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

Referenced by getTestRefId(), and setTestRefId().

◆ $testType

ilTestResultHeaderLabelBuilder::$testType
protected

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

◆ $userId

ilTestResultHeaderLabelBuilder::$userId
protected

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

Referenced by getUserId(), and setUserId().

◆ LO_TEST_TYPE_INITIAL

const ilTestResultHeaderLabelBuilder::LO_TEST_TYPE_INITIAL = 'loTestInitial'

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

◆ LO_TEST_TYPE_QUALIFYING

const ilTestResultHeaderLabelBuilder::LO_TEST_TYPE_QUALIFYING = 'loTestQualifying'

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


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