ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilLPStatusTestPassed Class Reference
+ Inheritance diagram for ilLPStatusTestPassed:
+ Collaboration diagram for ilLPStatusTestPassed:

Public Member Functions

 __construct ($a_obj_id)
 
 determineStatus ($a_obj_id, $a_user_id, $a_obj=null)
 Determine status. More...
 
 determinePercentage ($a_obj_id, $a_user_id, $a_obj=null)
 Determine percentage. More...
 
- Public Member Functions inherited from ilLPStatus
 __construct ($a_obj_id)
 
 _updateStatus ($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
 New status handling (st: status, nr: accesses, p: percentage, t: time spent, m: mark) More...
 
 determinePercentage ($a_obj_id, $a_usr_id, $a_obj=null)
 Determine percentage. More...
 
 determineStatus ($a_obj_id, $a_usr_id, $a_obj=null)
 Determine status. More...
 
 refreshStatus ($a_obj_id, $a_users=null)
 Refresh status. More...
 

Static Public Member Functions

static _getInProgress ($a_obj_id)
 
static _getCompleted ($a_obj_id)
 
static _getNotAttempted ($a_obj_id)
 
static _getFailed ($a_obj_id)
 
static _getStatusInfo ($a_obj_id)
 
- Static Public Member Functions inherited from ilLPStatus
static _getCountNotAttempted ($a_obj_id)
 
static _getNotAttempted ($a_obj_id)
 
static _getCountInProgress ($a_obj_id)
 
static _getInProgress ($a_obj_id)
 
static _getCountCompleted ($a_obj_id)
 
static _getCompleted ($a_obj_id)
 
static _getFailed ($a_obj_id)
 
static _getCountFailed ()
 
static _getStatusInfo ($a_obj_id)
 
static _getTypicalLearningTime ($a_obj_id)
 
static checkStatusForObject ($a_obj_id, $a_users=false)
 This function checks whether the status for a given number of users is dirty and must be recalculated. More...
 
static writeStatus ($a_obj_id, $a_user_id, $a_status, $a_percentage=false, $a_force_per=false)
 Write status for user and object. More...
 
static setInProgressIfNotAttempted ($a_obj_id, $a_user_id)
 This function shoudl be clalled for normal "read events". More...
 
static setAllDirty ()
 Sets all status to dirty. More...
 
static setDirty ($a_obj_id)
 Sets status of an object to dirty. More...
 
static _lookupStatus ($a_obj_id, $a_user_id, $a_create=true)
 Lookup status. More...
 
static _lookupPercentage ($a_obj_id, $a_user_id)
 Lookup percentage. More...
 
static _hasUserCompleted ($a_obj_id, $a_user_id)
 Lookup user object completion. More...
 
static _lookupStatusChanged ($a_obj_id, $a_user_id)
 Lookup status changed. More...
 
static _lookupCompletedForObject ($a_obj_id, $a_user_ids=null)
 Get completed users for object. More...
 
static _lookupFailedForObject ($a_obj_id, $a_user_ids=null)
 Get failed users for object. More...
 
static _lookupInProgressForObject ($a_obj_id, $a_user_ids=null)
 Get in progress users for object. More...
 
static preloadListGUIData ($a_obj_ids)
 
static getListGUIStatus ($a_obj_id, $a_image_only=true)
 

Protected Member Functions

 determineStatusForScoreLastPassTests ($is_finished, $passed)
 
 determineLpStatus ($passed)
 

Static Private Member Functions

static getUserIdsByResultArrayStatus ($objId, $resultArrayStatus)
 

Additional Inherited Members

- Data Fields inherited from ilLPStatus
 $obj_id = null
 
 $db = null
 
const LP_STATUS_NOT_ATTEMPTED = 'trac_no_attempted'
 
const LP_STATUS_IN_PROGRESS = 'trac_in_progress'
 
const LP_STATUS_COMPLETED = 'trac_completed'
 
const LP_STATUS_FAILED = 'trac_failed'
 
const LP_STATUS_NOT_ATTEMPTED_NUM = 0
 
const LP_STATUS_IN_PROGRESS_NUM = 1
 
const LP_STATUS_COMPLETED_NUM = 2
 
const LP_STATUS_FAILED_NUM = 3
 
const LP_STATUS_REGISTERED = 'trac_registered'
 
const LP_STATUS_NOT_REGISTERED = 'trac_not_registered'
 
const LP_STATUS_PARTICIPATED = 'trac_participated'
 
const LP_STATUS_NOT_PARTICIPATED = 'trac_not_participated'
 
- Static Public Attributes inherited from ilLPStatus
static $list_gui_cache
 
- Static Protected Member Functions inherited from ilLPStatus
static raiseEvent ($a_obj_id, $a_usr_id, $a_status, $a_percentage)
 
static _lookupStatusForObject ($a_obj_id, $a_status, $a_user_ids=null)
 Get users with given status for object. More...
 
static validateLPForObjects ($a_user_id, $a_obj_ids, $a_parent_ref_id)
 Process given objects for lp-relevance. More...
 
static checkLPModesForObjects ($a_obj_ids, array &$a_coll_obj_ids)
 Process lp modes for given objects. More...
 
static getLPStatusForObjects ($a_user_id, $a_obj_ids)
 Get LP status for given objects (and user) More...
 

Detailed Description

Definition at line 35 of file class.ilLPStatusTestPassed.php.

Constructor & Destructor Documentation

◆ __construct()

ilLPStatusTestPassed::__construct (   $a_obj_id)

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

References $DIC, and $ilDB.

38  {
39  global $DIC;
40 
41  $ilDB = $DIC['ilDB'];
42 
43  parent::__construct($a_obj_id);
44  $this->db = $ilDB;
45  }
global $DIC
Definition: saml.php:7
global $ilDB

Member Function Documentation

◆ _getCompleted()

static ilLPStatusTestPassed::_getCompleted (   $a_obj_id)
static

Definition at line 60 of file class.ilLPStatusTestPassed.php.

References $DIC, and $ilBench.

61  {
62  global $DIC;
63 
64  $ilBench = $DIC['ilBench'];
65 
66  $ilBench->start('LearningProgress', '9183_LPStatusTestPassed_completed');
67  $userIds = self::getUserIdsByResultArrayStatus($a_obj_id, 'passed');
68  $ilBench->stop('LearningProgress', '9183_LPStatusTestPassed_completed');
69 
70  return $userIds;
71  }
global $DIC
Definition: saml.php:7
global $ilBench
Definition: ilias.php:18

◆ _getFailed()

static ilLPStatusTestPassed::_getFailed (   $a_obj_id)
static

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

79  {
80  return self::getUserIdsByResultArrayStatus($a_obj_id, 'failed');
81  }

◆ _getInProgress()

static ilLPStatusTestPassed::_getInProgress (   $a_obj_id)
static

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

References $DIC, and $ilBench.

48  {
49  global $DIC;
50 
51  $ilBench = $DIC['ilBench'];
52 
53  $ilBench->start('LearningProgress', '9182_LPStatusTestPassed_inProgress');
54  $userIds = self::getUserIdsByResultArrayStatus($a_obj_id, 'in_progress');
55  $ilBench->stop('LearningProgress', '9182_LPStatusTestPassed_inProgress');
56 
57  return $userIds;
58  }
global $DIC
Definition: saml.php:7
global $ilBench
Definition: ilias.php:18

◆ _getNotAttempted()

static ilLPStatusTestPassed::_getNotAttempted (   $a_obj_id)
static

Definition at line 73 of file class.ilLPStatusTestPassed.php.

74  {
75  return self::getUserIdsByResultArrayStatus($a_obj_id, 'not_attempted');
76  }

◆ _getStatusInfo()

static ilLPStatusTestPassed::_getStatusInfo (   $a_obj_id)
static

Definition at line 98 of file class.ilLPStatusTestPassed.php.

References ilObjTestAccess\_getPassedUsers().

99  {
100  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
101  $status_info['results'] = ilObjTestAccess::_getPassedUsers($a_obj_id);
102  return $status_info;
103  }
static _getPassedUsers($a_obj_id)
Returns an array containing the users who passed the test.
+ Here is the call graph for this function:

◆ determineLpStatus()

ilLPStatusTestPassed::determineLpStatus (   $passed)
protected
Parameters
$passed
Returns
int

Definition at line 212 of file class.ilLPStatusTestPassed.php.

Referenced by determineStatus(), and determineStatusForScoreLastPassTests().

213  {
214  $status = self::LP_STATUS_FAILED_NUM;
215 
216  if ($passed) {
217  $status = self::LP_STATUS_COMPLETED_NUM;
218  }
219 
220  return $status;
221  }
+ Here is the caller graph for this function:

◆ determinePercentage()

ilLPStatusTestPassed::determinePercentage (   $a_obj_id,
  $a_user_id,
  $a_obj = null 
)

Determine percentage.

Parameters
integerobject id
integeruser id
objectobject (optional depends on object type)
Returns
integer percentage

Definition at line 231 of file class.ilLPStatusTestPassed.php.

References $DIC, and $ilDB.

232  {
233  global $DIC;
234 
235  $ilDB = $DIC['ilDB'];
236 
237  $set = $ilDB->query("SELECT tst_result_cache.*, tst_active.user_fi FROM " .
238  "tst_result_cache JOIN tst_active ON (tst_active.active_id = tst_result_cache.active_fi)" .
239  " JOIN tst_tests ON (tst_tests.test_id = tst_active.test_fi) " .
240  " WHERE tst_tests.obj_fi = " . $ilDB->quote($a_obj_id, "integer") .
241  " AND tst_active.user_fi = " . $ilDB->quote($a_user_id, "integer"));
242  $per = 0;
243  if ($rec = $ilDB->fetchAssoc($set)) {
244  if ($rec["max_points"] > 0) {
245  $per = min(100, 100 / $rec["max_points"] * $rec["reached_points"]);
246  } else {
247  // According to mantis #12305
248  $per = 0;
249  }
250  }
251  return (int) $per;
252  }
global $DIC
Definition: saml.php:7
global $ilDB

◆ determineStatus()

ilLPStatusTestPassed::determineStatus (   $a_obj_id,
  $a_user_id,
  $a_obj = null 
)

Determine status.

Behaviour of "old" 4.0 learning progress:

Setting "Multiple Pass Scoring": Score the last pass

  • Test not started: No entry
  • First question opened: Icon/Text: Failed, Score 0%
  • First question answered (correct, points enough for passing): Icon/Text: Completed, Score 66%
  • No change after successfully finishing the pass. (100%)
  • 2nd Pass, first question opened: Still Completed/Completed
  • First question answered (incorrect, success possible): Icon/Text Failed, Score 33%
  • Second question answered (correct): Icon/Text completed
  • 3rd pass, like 2nd, but two times wrong answer: Icon/Text: Failed

Setting "Multiple Pass Scoring": Score the best pass

  • Test not started: No entry
  • First question opened: Icon/Text: Failed, Score 0%
  • First question answered (correct, points enough for passing): Icon/Text: Completed, Score 66%
  • No change after successfully finishing the pass. (100%)
  • 2nd Pass, first question opened: Still Completed/Completed
  • First question answered (incorrect, success possible): Still Completed/Completed

Due to this behaviour in 4.0 we do not have a "in progress" status. During the test the status is "failed" unless the score is enough to pass the test, which makes the learning progress status "completed".

Parameters
integerobject id
integeruser id
objectobject (optional depends on object type)
Returns
integer status

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

References $DIC, $ilDB, $res, ilObjTestAccess\_isPassed(), determineLpStatus(), determineStatusForScoreLastPassTests(), SCORE_BEST_PASS, and SCORE_LAST_PASS.

138  {
139  global $DIC;
140 
141  $ilDB = $DIC['ilDB'];
142 
143  $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
144  require_once 'Modules/Test/classes/class.ilObjTestAccess.php';
145  $res = $ilDB->query("
146  SELECT tst_active.active_id, tst_active.tries, count(tst_sequence.active_fi) " . $ilDB->quoteIdentifier("sequences") . ", tst_active.last_finished_pass,
147  CASE WHEN
148  (tst_tests.nr_of_tries - 1) = tst_active.last_finished_pass
149  THEN '1'
150  ELSE '0'
151  END is_last_pass
152  FROM tst_active
153  LEFT JOIN tst_sequence
154  ON tst_sequence.active_fi = tst_active.active_id
155  LEFT JOIN tst_tests
156  ON tst_tests.test_id = tst_active.test_fi
157  WHERE tst_active.user_fi = {$ilDB->quote($a_user_id, "integer")}
158  AND tst_active.test_fi = {$ilDB->quote(ilObjTestAccess::_getTestIDFromObjectID($a_obj_id))}
159  GROUP BY tst_active.active_id, tst_active.tries, is_last_pass
160  ");
161 
162  if ($rec = $ilDB->fetchAssoc($res)) {
163  if ($rec['sequences'] > 0) {
164  require_once 'Modules/Test/classes/class.ilObjTest.php';
165 
166  $test_obj = new ilObjTest($a_obj_id, false);
167  $is_passed = ilObjTestAccess::_isPassed($a_user_id, $a_obj_id);
168 
169  if ($test_obj->getPassScoring() == SCORE_LAST_PASS) {
170  $is_finished = false;
171  if ($rec['last_finished_pass'] != null && $rec['sequences'] - 1 == $rec['last_finished_pass']) {
172  $is_finished = true;
173  }
174  $status = $this->determineStatusForScoreLastPassTests($is_finished, $is_passed);
175  } elseif ($test_obj->getPassScoring() == SCORE_BEST_PASS) {
176  $status = self::LP_STATUS_IN_PROGRESS_NUM;
177 
178  if ($rec['last_finished_pass'] != null) {
179  $status = $this->determineLpStatus($is_passed);
180  }
181 
182  if (!$rec['is_last_pass'] && $status == self::LP_STATUS_FAILED_NUM) {
183  $status = self::LP_STATUS_IN_PROGRESS_NUM;
184  }
185  }
186  }
187  }
188 
189  return $status;
190  }
global $DIC
Definition: saml.php:7
const SCORE_LAST_PASS
static _isPassed($user_id, $a_obj_id)
Returns TRUE if the user with the user id $user_id passed the test with the object id $a_obj_id...
foreach($_POST as $key=> $value) $res
determineStatusForScoreLastPassTests($is_finished, $passed)
global $ilDB
const SCORE_BEST_PASS
+ Here is the call graph for this function:

◆ determineStatusForScoreLastPassTests()

ilLPStatusTestPassed::determineStatusForScoreLastPassTests (   $is_finished,
  $passed 
)
protected
Parameters
$is_finished
$passed
Returns
int

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

References determineLpStatus().

Referenced by determineStatus().

198  {
199  $status = self::LP_STATUS_IN_PROGRESS_NUM;
200 
201  if ($is_finished) {
202  $status = $this->determineLpStatus($passed);
203  }
204 
205  return $status;
206  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUserIdsByResultArrayStatus()

static ilLPStatusTestPassed::getUserIdsByResultArrayStatus (   $objId,
  $resultArrayStatus 
)
staticprivate

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

References ilLPStatusWrapper\_getStatusInfo().

84  {
85  $status_info = ilLPStatusWrapper::_getStatusInfo($objId);
86 
87  $user_ids = array();
88 
89  foreach ($status_info['results'] as $user_data) {
90  if ($user_data[$resultArrayStatus]) {
91  $user_ids[] = $user_data['user_id'];
92  }
93  }
94 
95  return $user_ids;
96  }
static _getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
+ Here is the call graph for this function:

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