ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLPStatusTestPassed Class Reference
+ Inheritance diagram for ilLPStatusTestPassed:
+ Collaboration diagram for ilLPStatusTestPassed:

Public Member Functions

 ilLPStatusTestPassed ($a_obj_id)
 
 _getInProgress ($a_obj_id)
 
 _getCompleted ($a_obj_id)
 
 _getNotAttempted ($a_obj_id)
 
 _getFailed ($a_obj_id)
 
 _getStatusInfo ($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
 ilLPStatus ($a_obj_id)
 
 _getCountNotAttempted ($a_obj_id)
 
 _getNotAttempted ($a_obj_id)
 
 _getCountInProgress ($a_obj_id)
 
 _getInProgress ($a_obj_id)
 
 _getCountCompleted ($a_obj_id)
 
 _getCompleted ($a_obj_id)
 
 _getFailed ($a_obj_id)
 
 _getCountFailed ()
 
 _getStatusInfo ($a_obj_id)
 
 _getTypicalLearningTime ($a_obj_id)
 
 _updateStatus ($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_no_raise=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...
 
 _lookupStatusChanged ($a_obj_id, $a_user_id)
 Lookup status changed. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilLPStatus
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)
 Lookup status. More...
 
static _hasUserCompleted ($a_obj_id, $a_user_id)
 Lookup user object completion. 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)
 
- 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
 
- Protected Member Functions inherited from ilLPStatus
 raiseEvent ($a_obj_id, $a_usr_id, $a_status, $a_percentage)
 
- Static Protected Member Functions inherited from ilLPStatus
static _lookupStatusForObject ($a_obj_id, $a_status, $a_user_ids=null)
 Get users with given status for object. More...
 

Detailed Description

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

Member Function Documentation

◆ _getCompleted()

ilLPStatusTestPassed::_getCompleted (   $a_obj_id)

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

References $ilBench, and ilLPStatusWrapper\_getStatusInfo().

74  {
75  global $ilDB;
76 
77  global $ilBench;
78  $ilBench->start('LearningProgress','9183_LPStatusTestPassed_completed');
79 
80  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
81 
82  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
83  foreach($status_info['results'] as $user_data)
84  {
85  if($user_data['passed'])
86  {
87  $user_ids[] = $user_data['user_id'];
88  }
89  }
90 
91  $ilBench->stop('LearningProgress','9183_LPStatusTestPassed_completed');
92  return $user_ids ? $user_ids : array();
93  }
_getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
global $ilBench
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ _getFailed()

ilLPStatusTestPassed::_getFailed (   $a_obj_id)

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

References ilLPStatusWrapper\_getStatusInfo().

112  {
113  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
114  foreach($status_info['results'] as $user_data)
115  {
116  if($user_data['failed'])
117  {
118  $user_ids[] = $user_data['user_id'];
119  }
120  }
121  return $user_ids ? $user_ids : array();
122  }
_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:

◆ _getInProgress()

ilLPStatusTestPassed::_getInProgress (   $a_obj_id)

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

References $ilBench, $query, $res, $row, ilLPStatusWrapper\_getCompleted(), ilLPStatusWrapper\_getFailed(), ilLPStatusWrapper\_getNotAttempted(), and DB_FETCHMODE_OBJECT.

47  {
48  global $ilDB;
49 
50  global $ilBench;
51  $ilBench->start('LearningProgress','9182_LPStatusTestPassed_inProgress');
52 
53 
54  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
55 
56  $query = "SELECT DISTINCT(user_fi) FROM tst_active ".
57  "WHERE test_fi = '".ilObjTestAccess::_getTestIDFromObjectID($a_obj_id)."'";
58 
59  $res = $ilDB->query($query);
60  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
61  {
62  $user_ids[] = $row->user_fi;
63  }
64 
65  $users = array_diff((array) $user_ids,ilLPStatusWrapper::_getCompleted($a_obj_id));
66  $users = array_diff((array) $users,ilLPStatusWrapper::_getFailed($a_obj_id));
67  $users = array_diff((array) $users,ilLPStatusWrapper::_getNotAttempted($a_obj_id));
68 
69  $ilBench->stop('LearningProgress','9182_LPStatusTestPassed_inProgress');
70  return $users ? $users : array();
71  }
_getNotAttempted($a_obj_id)
Static function to read the number of user who have the status 'not_attempted'.
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
_getFailed($a_obj_id)
Static function to read the users who have the status 'completed'.
_getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.
global $ilBench
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ _getNotAttempted()

ilLPStatusTestPassed::_getNotAttempted (   $a_obj_id)

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

References ilLPStatusWrapper\_getStatusInfo().

96  {
97  $user_ids = array();
98 
99  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
100 
101  foreach($status_info['results'] as $user_data)
102  {
103  if( !$user_data['failed'] && !$user_data['passed'] )
104  {
105  $user_ids[] = $user_data['user_id'];
106  }
107  }
108  return $user_ids;
109  }
_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:

◆ _getStatusInfo()

ilLPStatusTestPassed::_getStatusInfo (   $a_obj_id)

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

References ilObjTestAccess\_getPassedUsers().

125  {
126  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
127  $status_info['results'] = ilObjTestAccess::_getPassedUsers($a_obj_id);
128  return $status_info;
129  }
& _getPassedUsers($a_obj_id)
Returns an array containing the users who passed the test.
+ Here is the call 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 212 of file class.ilLPStatusTestPassed.php.

213  {
214  global $ilDB;
215 
216  $set = $ilDB->query("SELECT tst_result_cache.*, tst_active.user_fi FROM ".
217  "tst_result_cache JOIN tst_active ON (tst_active.active_id = tst_result_cache.active_fi)".
218  " JOIN tst_tests ON (tst_tests.test_id = tst_active.test_fi) ".
219  " WHERE tst_tests.obj_fi = ".$ilDB->quote($a_obj_id, "integer").
220  " AND tst_active.user_fi = ".$ilDB->quote($a_user_id, "integer"));
221  $per = 0;
222  if ($rec = $ilDB->fetchAssoc($set))
223  {
224  if ($rec["max_points"] > 0)
225  {
226  $per = min(100, 100 / $rec["max_points"] * $rec["reached_points"]);
227  }
228  else
229  {
230  // According to mantis #12305
231  $per = 0;
232  }
233  }
234  return (int) $per;
235  }

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

References $ilLog, $res, and ilObjTestAccess\_isPassed().

164  {
165  global $ilObjDataCache, $ilDB, $ilLog;
166 
167  $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
168 
169  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
170 
171  $res = $ilDB->query("
172  SELECT tst_active.active_id, tst_active.tries, count(tst_sequence.active_fi) sequences
173  FROM tst_active
174  LEFT JOIN tst_sequence
175  ON tst_sequence.active_fi = tst_active.active_id
176  WHERE tst_active.user_fi = {$ilDB->quote($a_user_id, "integer")}
177  AND tst_active.test_fi = {$ilDB->quote(ilObjTestAccess::_getTestIDFromObjectID($a_obj_id))}
178  GROUP BY tst_active.active_id, tst_active.tries
179  ");
180 
181  if ($rec = $ilDB->fetchAssoc($res))
182  {
183  if( $rec['sequences'] > 0 )
184  {
185  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
186  if (ilObjTestAccess::_isPassed($a_user_id, $a_obj_id))
187  {
188  $status = self::LP_STATUS_COMPLETED_NUM;
189  }
190  else
191  {
192  $status = self::LP_STATUS_FAILED_NUM;
193  }
194  }
195  else
196  {
197  $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
198  }
199  }
200 
201  return $status;
202  }
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...
+ Here is the call graph for this function:

◆ ilLPStatusTestPassed()

ilLPStatusTestPassed::ilLPStatusTestPassed (   $a_obj_id)

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

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

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