ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilLearningProgress Class Reference
+ Collaboration diagram for ilLearningProgress:

Public Member Functions

 ilLearningProgress ()
 
 _getProgress ($a_user_id, $a_obj_id)
 

Static Public Member Functions

static _tracProgress ($a_user_id, $a_obj_id, $a_ref_id, $a_obj_type='')
 
static _lookupProgressByObjId ($a_obj_id)
 lookup progress for a specific object More...
 

Data Fields

 $db = null
 

Detailed Description

Definition at line 36 of file class.ilLearningProgress.php.

Member Function Documentation

◆ _getProgress()

ilLearningProgress::_getProgress (   $a_user_id,
  $a_obj_id 
)

Definition at line 61 of file class.ilLearningProgress.php.

62 {
63 require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
64 $events = ilChangeEvent::_lookupReadEvents($a_obj_id, $a_user_id);
65
66 include_once './Services/Calendar/classes/class.ilDateTime.php';
67
68 foreach($events as $row)
69 {
70 $tmp_date = new ilDateTime($row['last_access'],IL_CAL_UNIX);
71 $row['last_access'] = $tmp_date->get(IL_CAL_UNIX);
72
73 $tmp_date = new ilDateTime($row['first_access'],IL_CAL_DATETIME);
74 $row['first_access'] = $tmp_date->get(IL_CAL_UNIX);
75
76 if ($progress)
77 {
78 $progress['spent_seconds'] += $row['spent_seconds'];
79 $progress['access_time'] = max($progress['access_time'], $row['last_access']);
80 $progress['access_time_min'] = min($progress['access_time_min'], $row['first_access']);
81 }
82 else
83 {
84 $progress['obj_id'] = $row['obj_id'];
85 $progress['user_id'] = $row['usr_id'];
86 $progress['spent_seconds'] = $row['spent_seconds'];
87 $progress['access_time'] = $row['last_access'];
88 $progress['access_time_min'] = $row['first_access'];
89 $progress['visits'] = $row['read_count'];
90 }
91 }
92 return $progress ? $progress : array();
93 }
const IL_CAL_UNIX
const IL_CAL_DATETIME
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 ...
@classDescription Date and time handling

References $row, ilChangeEvent\_lookupReadEvents(), IL_CAL_DATETIME, and IL_CAL_UNIX.

Referenced by ilLearningProgressBaseGUI\__appendLPDetails(), and ilInfoScreenGUI\showLearningProgress().

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

◆ _lookupProgressByObjId()

static ilLearningProgress::_lookupProgressByObjId (   $a_obj_id)
static

lookup progress for a specific object

@access public

Parameters
intobj_id
Returns
array of progress data

Definition at line 102 of file class.ilLearningProgress.php.

103 {
104 include_once('./Services/Tracking/classes/class.ilChangeEvent.php');
105 foreach(ilChangeEvent::_lookupReadEvents($a_obj_id) as $row)
106 {
107 if(isset($progress[$row['usr_id']]))
108 {
109 $progress[$row['usr_id']]['spent_seconds'] += $row['spent_seconds'];
110 $progress[$row['usr_id']]['read_count'] += $row['read_count'];
111 $progress[$row['usr_id']]['ts'] = max($row['last_access'],$progress[$row['usr_id']]['ts']);
112 }
113 else
114 {
115 $progress[$row['usr_id']]['spent_seconds'] = $row['spent_seconds'];
116 $progress[$row['usr_id']]['read_count'] = $row['read_count'];
117 $progress[$row['usr_id']]['ts'] = $row['last_access'];
118
119 }
120 $progress[$row['usr_id']]['usr_id'] = $row['usr_id'];
121 $progress[$row['usr_id']]['obj_id'] = $row['obj_id'];
122 }
123 return $progress ? $progress : array();
124 }

References $row, and ilChangeEvent\_lookupReadEvents().

Referenced by ilObjCourseGUI\fetchPrintMemberData(), ilObjCourseGUI\readMemberData(), and ilObjGroupGUI\readMemberData().

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

◆ _tracProgress()

static ilLearningProgress::_tracProgress (   $a_user_id,
  $a_obj_id,
  $a_ref_id,
  $a_obj_type = '' 
)
static

Definition at line 48 of file class.ilLearningProgress.php.

49 {
50 global $ilDB;
51
52 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
53 ilChangeEvent::_recordReadEvent($a_obj_type, $a_ref_id, $a_obj_id, $a_user_id);
54
55 require_once 'Services/Tracking/classes/class.ilLPStatus.php';
56 ilLPStatus::setInProgressIfNotAttempted($a_obj_id, $a_user_id);
57
58 return true;
59 }
_recordReadEvent($a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
static setInProgressIfNotAttempted($a_obj_id, $a_user_id)
This function shoudl be clalled for normal "read events".
global $ilDB

References $ilDB, ilChangeEvent\_recordReadEvent(), and ilLPStatus\setInProgressIfNotAttempted().

Referenced by ilSurveyExecutionGUI\outSurveyPage(), ilTestSession\saveToDb(), ilTestSessionDynamicQuestionSet\saveToDb(), ilObjFileBasedLMGUI\showLearningModule(), ilObjExerciseGUI\showOverviewObject(), ilLMTracker\trackAccess(), ilObjCourseGUI\viewObject(), ilObjFolderGUI\viewObject(), and ilObjGroupGUI\viewObject().

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

◆ ilLearningProgress()

ilLearningProgress::ilLearningProgress ( )

Definition at line 40 of file class.ilLearningProgress.php.

41 {
42 global $ilDB;
43
44 $this->db = $ilDB;
45 }

References $ilDB.

Field Documentation

◆ $db

ilLearningProgress::$db = null

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


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