ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 337 of file class.ilTestResultHeaderLabelBuilder.php.

Referenced by getPassDetailsHeaderLabel().

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

◆ getListOfAnswersHeaderLabel()

ilTestResultHeaderLabelBuilder::getListOfAnswersHeaderLabel (   $attemptNumber)

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

References getObjectiveOrientedContainerId().

343  {
344  $langVar = 'tst_eval_results_by_pass';
345 
346  if( $this->getObjectiveOrientedContainerId() )
347  {
348  $langVar = 'tst_eval_results_by_pass_lo';
349  }
350 
351  return sprintf($this->lng->txt($langVar), $attemptNumber);
352  }
+ Here is the call graph for this function:

◆ getObjectiveOrientedContainerId()

ilTestResultHeaderLabelBuilder::getObjectiveOrientedContainerId ( )

◆ getObjectivesString()

ilTestResultHeaderLabelBuilder::getObjectivesString ( )
private

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

Referenced by getPassDetailsHeaderLabel(), and getPassOverviewHeaderLabel().

333  {
334  return implode(', ', $this->objectives);
335  }
+ Here is the caller graph for this function:

◆ getObjectiveTitle()

ilTestResultHeaderLabelBuilder::getObjectiveTitle ( ilLOTestRun  $loRun)
private

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

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

Referenced by initObjectives().

327  {
328  require_once 'Modules/Course/classes/class.ilCourseObjective.php';
330  }
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 229 of file class.ilTestResultHeaderLabelBuilder.php.

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

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

◆ getPassOverviewHeaderLabel()

ilTestResultHeaderLabelBuilder::getPassOverviewHeaderLabel ( )
Returns
string

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

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

190  {
191  if( !$this->getObjectiveOrientedContainerId() )
192  {
193  return $this->lng->txt('tst_results_overview');
194  }
195 
196  if( $this->isInitialTestForAllObjectives() )
197  {
198  return sprintf(
199  $this->lng->txt('tst_pass_overview_header_lo_initial_all_objectives'), $this->crsTitle
200  );
201  }
202  elseif( $this->isInitialTestPerObjective() )
203  {
204  return sprintf(
205  $this->lng->txt('tst_pass_overview_header_lo_initial_per_objective'),
207  );
208  }
209  elseif( $this->isQualifyingTestForAllObjectives() )
210  {
211  return sprintf(
212  $this->lng->txt('tst_pass_overview_header_lo_qualifying_all_objectives'), $this->crsTitle
213  );
214  }
215  elseif( $this->isQualifyingTestPerObjective() )
216  {
217  return sprintf(
218  $this->lng->txt('tst_pass_overview_header_lo_qualifying_per_objective'),
220  );
221  }
222 
223  return '';
224  }
+ 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 354 of file class.ilTestResultHeaderLabelBuilder.php.

355  {
356  return $this->lng->txt('tst_eval_results_lo');
357  }

◆ getVirtualPassDetailsHeaderLabel()

ilTestResultHeaderLabelBuilder::getVirtualPassDetailsHeaderLabel (   $objectiveTitle)

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

References isInitialTest(), and isQualifyingTest().

360  {
361  if( $this->isInitialTest() )
362  {
363  return sprintf(
364  $this->lng->txt('tst_virtual_pass_header_lo_initial'), $objectiveTitle
365  );
366  }
367  elseif( $this->isQualifyingTest() )
368  {
369  return sprintf(
370  $this->lng->txt('tst_virtual_pass_header_lo_qualifying'), $objectiveTitle
371  );
372  }
373 
374  return '';
375  }
+ Here is the call graph for this function:

◆ initCourseTitle()

ilTestResultHeaderLabelBuilder::initCourseTitle ( )
private

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

References getObjectiveOrientedContainerId().

Referenced by initObjectiveOrientedMode().

182  {
183  $this->crsTitle = $this->objCache->lookupTitle($this->getObjectiveOrientedContainerId());
184  }
+ 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 166 of file class.ilTestResultHeaderLabelBuilder.php.

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

Referenced by initObjectiveOrientedMode().

167  {
168  require_once 'Modules/Course/classes/Objectives/class.ilLOTestRun.php';
169  $loRuns = ilLOTestRun::getRun($this->getObjectiveOrientedContainerId(), $this->getUserId(), $this->getTestObjId());
170 
171  $this->objectives = array();
172 
173  foreach( $loRuns as $loRun )
174  {
175  /* @var ilLOTestRun $loRun */
176 
177  $this->objectives[$loRun->getObjectiveId()] = $this->getObjectiveTitle($loRun);
178  }
179  }
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  {
158  $this->testType = self::LO_TEST_TYPE_INITIAL;
159  }
160  elseif( $loSettings->getQualifiedTest() == $this->getTestRefId() )
161  {
162  $this->testType = self::LO_TEST_TYPE_QUALIFYING;
163  }
164  }
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 256 of file class.ilTestResultHeaderLabelBuilder.php.

Referenced by getPassDetailsHeaderLabel(), and getVirtualPassDetailsHeaderLabel().

257  {
258  return $this->testType == self::LO_TEST_TYPE_INITIAL;
259  }
+ Here is the caller graph for this function:

◆ isInitialTestForAllObjectives()

ilTestResultHeaderLabelBuilder::isInitialTestForAllObjectives ( )
private

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

Referenced by getPassOverviewHeaderLabel().

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

◆ isInitialTestPerObjective()

ilTestResultHeaderLabelBuilder::isInitialTestPerObjective ( )
private

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

Referenced by getPassOverviewHeaderLabel().

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

◆ isQualifyingTest()

ilTestResultHeaderLabelBuilder::isQualifyingTest ( )
private

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

Referenced by getPassDetailsHeaderLabel(), and getVirtualPassDetailsHeaderLabel().

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

◆ isQualifyingTestForAllObjectives()

ilTestResultHeaderLabelBuilder::isQualifyingTestForAllObjectives ( )
private

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

Referenced by getPassOverviewHeaderLabel().

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

◆ isQualifyingTestPerObjective()

ilTestResultHeaderLabelBuilder::isQualifyingTestPerObjective ( )
private

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

Referenced by getPassOverviewHeaderLabel().

312  {
313  if( $this->testType != self::LO_TEST_TYPE_QUALIFYING )
314  {
315  return false;
316  }
317 
318  if( count($this->objectives) > 1 )
319  {
320  return false;
321  }
322 
323  return true;
324  }
+ 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: