ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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=false)
 

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)

Reimplemented from ilLPStatus.

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

38 {
39 global $ilDB;
40
41 parent::__construct($a_obj_id);
42 $this->db = $ilDB;
43 }
global $ilDB

References $ilDB.

Member Function Documentation

◆ _getCompleted()

static ilLPStatusTestPassed::_getCompleted (   $a_obj_id)
static

Reimplemented from ilLPStatus.

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

57 {
58 global $ilBench;
59
60 $ilBench->start('LearningProgress', '9183_LPStatusTestPassed_completed');
61 $userIds = self::getUserIdsByResultArrayStatus($a_obj_id, 'passed');
62 $ilBench->stop('LearningProgress', '9183_LPStatusTestPassed_completed');
63
64 return $userIds;
65 }
static getUserIdsByResultArrayStatus($objId, $resultArrayStatus)
global $ilBench
Definition: ilias.php:18

References $ilBench, and getUserIdsByResultArrayStatus().

+ Here is the call graph for this function:

◆ _getFailed()

static ilLPStatusTestPassed::_getFailed (   $a_obj_id)
static

Reimplemented from ilLPStatus.

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

73 {
74 return self::getUserIdsByResultArrayStatus($a_obj_id, 'failed');
75 }

References getUserIdsByResultArrayStatus().

+ Here is the call graph for this function:

◆ _getInProgress()

static ilLPStatusTestPassed::_getInProgress (   $a_obj_id)
static

Reimplemented from ilLPStatus.

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

46 {
47 global $ilBench;
48
49 $ilBench->start('LearningProgress', '9182_LPStatusTestPassed_inProgress');
50 $userIds = self::getUserIdsByResultArrayStatus($a_obj_id, 'in_progress');
51 $ilBench->stop('LearningProgress', '9182_LPStatusTestPassed_inProgress');
52
53 return $userIds;
54 }

References $ilBench, and getUserIdsByResultArrayStatus().

+ Here is the call graph for this function:

◆ _getNotAttempted()

static ilLPStatusTestPassed::_getNotAttempted (   $a_obj_id)
static

Reimplemented from ilLPStatus.

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

68 {
69 return self::getUserIdsByResultArrayStatus($a_obj_id, 'not_attempted');
70 }

References getUserIdsByResultArrayStatus().

+ Here is the call graph for this function:

◆ _getStatusInfo()

static ilLPStatusTestPassed::_getStatusInfo (   $a_obj_id)
static

Reimplemented from ilLPStatus.

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

93 {
94 include_once './Modules/Test/classes/class.ilObjTestAccess.php';
95 $status_info['results'] = ilObjTestAccess::_getPassedUsers($a_obj_id);
96 return $status_info;
97 }
static _getPassedUsers($a_obj_id)
Returns an array containing the users who passed the test.

References ilObjTestAccess\_getPassedUsers().

+ Here is the call graph for this function:

◆ determineLpStatus()

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

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

205 {
207
208 if ($passed) {
210 }
211
212 return $status;
213 }
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_FAILED_NUM

References ilLPStatus\LP_STATUS_COMPLETED_NUM, and ilLPStatus\LP_STATUS_FAILED_NUM.

Referenced by determineStatus(), and determineStatusForScoreLastPassTests().

+ 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

Reimplemented from ilLPStatus.

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

224 {
225 global $ilDB;
226
227 $set = $ilDB->query("SELECT tst_result_cache.*, tst_active.user_fi FROM " .
228 "tst_result_cache JOIN tst_active ON (tst_active.active_id = tst_result_cache.active_fi)" .
229 " JOIN tst_tests ON (tst_tests.test_id = tst_active.test_fi) " .
230 " WHERE tst_tests.obj_fi = " . $ilDB->quote($a_obj_id, "integer") .
231 " AND tst_active.user_fi = " . $ilDB->quote($a_user_id, "integer"));
232 $per = 0;
233 if ($rec = $ilDB->fetchAssoc($set)) {
234 if ($rec["max_points"] > 0) {
235 $per = min(100, 100 / $rec["max_points"] * $rec["reached_points"]);
236 } else {
237 // According to mantis #12305
238 $per = 0;
239 }
240 }
241 return (int) $per;
242 }

References $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

Reimplemented from ilLPStatus.

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

132 {
133 global $ilDB;
134
136 require_once 'Modules/Test/classes/class.ilObjTestAccess.php';
137 $res = $ilDB->query("
138 SELECT tst_active.active_id, tst_active.tries, count(tst_sequence.active_fi) " . $ilDB->quoteIdentifier("sequences") . ", tst_active.last_finished_pass,
139 CASE WHEN
140 (tst_tests.nr_of_tries - 1) = tst_active.last_finished_pass
141 THEN '1'
142 ELSE '0'
143 END is_last_pass
144 FROM tst_active
145 LEFT JOIN tst_sequence
146 ON tst_sequence.active_fi = tst_active.active_id
147 LEFT JOIN tst_tests
148 ON tst_tests.test_id = tst_active.test_fi
149 WHERE tst_active.user_fi = {$ilDB->quote($a_user_id, "integer")}
150 AND tst_active.test_fi = {$ilDB->quote(ilObjTestAccess::_getTestIDFromObjectID($a_obj_id))}
151 GROUP BY tst_active.active_id, tst_active.tries, is_last_pass
152 ");
153
154 if ($rec = $ilDB->fetchAssoc($res)) {
155 if ($rec['sequences'] > 0) {
156 require_once 'Modules/Test/classes/class.ilObjTest.php';
157
158 $test_obj = new ilObjTest($a_obj_id, false);
159 $is_passed = ilObjTestAccess::_isPassed($a_user_id, $a_obj_id);
160
161 if ($test_obj->getPassScoring() == SCORE_LAST_PASS) {
162 $is_finished = false;
163 if ($rec['last_finished_pass'] != null && $rec['sequences'] - 1 == $rec['last_finished_pass']) {
164 $is_finished = true;
165 }
166 $status = $this->determineStatusForScoreLastPassTests($is_finished, $is_passed);
167 } elseif ($test_obj->getPassScoring() == SCORE_BEST_PASS) {
169
170 if ($rec['last_finished_pass'] != null) {
171 $status = $this->determineLpStatus($is_passed);
172 }
173
174 if (!$rec['is_last_pass'] && $status == self::LP_STATUS_FAILED_NUM) {
176 }
177 }
178 }
179 }
180
181 return $status;
182 }
determineStatusForScoreLastPassTests($is_finished, $passed)
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
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.
const SCORE_BEST_PASS
const SCORE_LAST_PASS
foreach($_POST as $key=> $value) $res

References $ilDB, $res, ilObjTestAccess\_isPassed(), determineLpStatus(), determineStatusForScoreLastPassTests(), ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM, SCORE_BEST_PASS, and SCORE_LAST_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 189 of file class.ilLPStatusTestPassed.php.

190 {
192
193 if ($is_finished) {
194 $status = $this->determineLpStatus($passed);
195 }
196
197 return $status;
198 }

References determineLpStatus(), and ilLPStatus\LP_STATUS_IN_PROGRESS_NUM.

Referenced by determineStatus().

+ 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 77 of file class.ilLPStatusTestPassed.php.

78 {
79 $status_info = ilLPStatusWrapper::_getStatusInfo($objId);
80
81 $user_ids = array();
82
83 foreach ($status_info['results'] as $user_data) {
84 if ($user_data[$resultArrayStatus]) {
85 $user_ids[] = $user_data['user_id'];
86 }
87 }
88
89 return $user_ids;
90 }
static _getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.

References ilLPStatusWrapper\_getStatusInfo().

Referenced by _getCompleted(), _getFailed(), _getInProgress(), and _getNotAttempted().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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