ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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)
 

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

References $ilDB.

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

Member Function Documentation

◆ _getCompleted()

static ilLPStatusTestPassed::_getCompleted (   $a_obj_id)
static

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

References $ilBench.

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

◆ _getFailed()

static ilLPStatusTestPassed::_getFailed (   $a_obj_id)
static

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

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

◆ _getInProgress()

static ilLPStatusTestPassed::_getInProgress (   $a_obj_id)
static

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

References $ilBench.

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

◆ _getNotAttempted()

static ilLPStatusTestPassed::_getNotAttempted (   $a_obj_id)
static

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

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

◆ _getStatusInfo()

static ilLPStatusTestPassed::_getStatusInfo (   $a_obj_id)
static

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

References ilObjTestAccess\_getPassedUsers().

96  {
97  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
98  $status_info['results'] = ilObjTestAccess::_getPassedUsers($a_obj_id);
99  return $status_info;
100  }
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 216 of file class.ilLPStatusTestPassed.php.

Referenced by determineStatus(), and determineStatusForScoreLastPassTests().

217  {
218  $status = self::LP_STATUS_FAILED_NUM;
219 
220  if ($passed)
221  {
222  $status = self::LP_STATUS_COMPLETED_NUM;
223  }
224 
225  return $status;
226  }
+ 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 236 of file class.ilLPStatusTestPassed.php.

References $ilDB.

237  {
238  global $ilDB;
239 
240  $set = $ilDB->query("SELECT tst_result_cache.*, tst_active.user_fi FROM ".
241  "tst_result_cache JOIN tst_active ON (tst_active.active_id = tst_result_cache.active_fi)".
242  " JOIN tst_tests ON (tst_tests.test_id = tst_active.test_fi) ".
243  " WHERE tst_tests.obj_fi = ".$ilDB->quote($a_obj_id, "integer").
244  " AND tst_active.user_fi = ".$ilDB->quote($a_user_id, "integer"));
245  $per = 0;
246  if ($rec = $ilDB->fetchAssoc($set))
247  {
248  if ($rec["max_points"] > 0)
249  {
250  $per = min(100, 100 / $rec["max_points"] * $rec["reached_points"]);
251  }
252  else
253  {
254  // According to mantis #12305
255  $per = 0;
256  }
257  }
258  return (int) $per;
259  }
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 134 of file class.ilLPStatusTestPassed.php.

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

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

References determineLpStatus().

Referenced by determineStatus().

201  {
202  $status = self::LP_STATUS_IN_PROGRESS_NUM;
203 
204  if($is_finished)
205  {
206  $status = $this->determineLpStatus($passed);
207  }
208 
209  return $status;
210  }
+ 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 78 of file class.ilLPStatusTestPassed.php.

References ilLPStatusWrapper\_getStatusInfo(), and array.

79  {
80  $status_info = ilLPStatusWrapper::_getStatusInfo($objId);
81 
82  $user_ids = array();
83 
84  foreach($status_info['results'] as $user_data)
85  {
86  if($user_data[$resultArrayStatus])
87  {
88  $user_ids[] = $user_data['user_id'];
89  }
90  }
91 
92  return $user_ids;
93  }
Create styles array
The data for the language used.
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: