ILIAS  release_4-4 Revision
ilLPStatusVisits Class Reference
+ Inheritance diagram for ilLPStatusVisits:
+ Collaboration diagram for ilLPStatusVisits:

Public Member Functions

 ilLPStatusVisits ($a_obj_id)
 
 _getInProgress ($a_obj_id)
 
 _getCompleted ($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

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 16 of file class.ilLPStatusVisits.php.

Member Function Documentation

◆ _getCompleted()

ilLPStatusVisits::_getCompleted (   $a_obj_id)

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

References ilLPStatusWrapper\_getStatusInfo(), and ilChangeEvent\_lookupReadEvents().

47  {
48  global $ilDB;
49 
50  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
51  $required_visits = $status_info['visits'];
52 
53  include_once './Services/Tracking/classes/class.ilChangeEvent.php';
54  $all = ilChangeEvent::_lookupReadEvents($a_obj_id);
55  foreach($all as $event)
56  {
57  if($event['read_count'] >= $required_visits)
58  {
59  $user_ids[] = $event['usr_id'];
60  }
61  }
62  return $user_ids ? $user_ids : array();
63  }
_getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
static _lookupReadEvents($obj_id, $usr_id=null)
Reads all read events which occured on the object which happened after the last time the user caught ...
+ Here is the call graph for this function:

◆ _getInProgress()

ilLPStatusVisits::_getInProgress (   $a_obj_id)

Definition at line 27 of file class.ilLPStatusVisits.php.

References ilLPStatusWrapper\_getStatusInfo(), and ilChangeEvent\_lookupReadEvents().

28  {
29  global $ilDB;
30 
31  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
32  $required_visits = $status_info['visits'];
33 
34  include_once './Services/Tracking/classes/class.ilChangeEvent.php';
35  $all = ilChangeEvent::_lookupReadEvents($a_obj_id);
36  foreach($all as $event)
37  {
38  if($event['read_count'] < $required_visits)
39  {
40  $user_ids[] = $event['usr_id'];
41  }
42  }
43  return $user_ids ? $user_ids : array();
44  }
_getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
static _lookupReadEvents($obj_id, $usr_id=null)
Reads all read events which occured on the object which happened after the last time the user caught ...
+ Here is the call graph for this function:

◆ _getStatusInfo()

ilLPStatusVisits::_getStatusInfo (   $a_obj_id)

Definition at line 65 of file class.ilLPStatusVisits.php.

References ilLPObjSettings\_lookupVisits().

66  {
67  include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
68  $status_info['visits'] = ilLPObjSettings::_lookupVisits($a_obj_id);
69 
70  return $status_info;
71  }
+ Here is the call graph for this function:

◆ determinePercentage()

ilLPStatusVisits::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 118 of file class.ilLPStatusVisits.php.

References ilChangeEvent\_lookupReadEvents(), and ilLPObjSettings\_lookupVisits().

119  {
120  include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
121  $reqv = ilLPObjSettings::_lookupVisits($a_obj_id);
122 
123  $re = ilChangeEvent::_lookupReadEvents($a_obj_id, $a_user_id);
124  $rc = (int) $re[0]["read_count"];
125 
126  if ($reqv > 0)
127  {
128  $per = min(100, 100 / $reqv * $rc);
129  }
130  else
131  {
132  $per = 100;
133  }
134 
135  return $per;
136  }
static _lookupReadEvents($obj_id, $usr_id=null)
Reads all read events which occured on the object which happened after the last time the user caught ...
+ Here is the call graph for this function:

◆ determineStatus()

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

Determine status.

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

Definition at line 81 of file class.ilLPStatusVisits.php.

References ilLPStatusWrapper\_getStatusInfo(), ilChangeEvent\_lookupReadEvents(), and ilChangeEvent\hasAccessed().

82  {
83  global $ilObjDataCache, $ilDB;
84 
85  $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
86  switch ($ilObjDataCache->lookupType($a_obj_id))
87  {
88  case 'lm':
89  include_once './Services/Tracking/classes/class.ilChangeEvent.php';
90  if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id))
91  {
92  $status = self::LP_STATUS_IN_PROGRESS_NUM;
93 
94  // completed?
95  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
96  $required_visits = $status_info['visits'];
97 
98  include_once './Services/Tracking/classes/class.ilChangeEvent.php';
99  $re = ilChangeEvent::_lookupReadEvents($a_obj_id, $a_user_id);
100  if ($re[0]['read_count'] >= $required_visits)
101  {
102  $status = self::LP_STATUS_COMPLETED_NUM;
103  }
104  }
105  break;
106  }
107  return $status;
108  }
static hasAccessed($a_obj_id, $a_usr_id)
Has accessed.
_getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
static _lookupReadEvents($obj_id, $usr_id=null)
Reads all read events which occured on the object which happened after the last time the user caught ...
+ Here is the call graph for this function:

◆ ilLPStatusVisits()

ilLPStatusVisits::ilLPStatusVisits (   $a_obj_id)

Definition at line 19 of file class.ilLPStatusVisits.php.

20  {
21  global $ilDB;
22 
23  parent::ilLPStatus($a_obj_id);
24  $this->db =& $ilDB;
25  }

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