ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
ilLearningProgress Class Reference
+ Collaboration diagram for ilLearningProgress:

Static Public Member Functions

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

Detailed Description

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

Member Function Documentation

◆ _getProgress()

static ilLearningProgress::_getProgress ( int  $a_user_id,
int  $a_obj_id 
)
static

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

46 : array
47 {
48 $events = ilChangeEvent::_lookupReadEvents($a_obj_id, $a_user_id);
49
50 $progress = [];
51 foreach ($events as $row) {
52 $tmp_date = new ilDateTime($row['last_access'], IL_CAL_UNIX);
53 $row['last_access'] = $tmp_date->get(IL_CAL_UNIX);
54
55 $tmp_date = new ilDateTime($row['first_access'], IL_CAL_DATETIME);
56 $row['first_access'] = $tmp_date->get(IL_CAL_UNIX);
57
58 if ($progress) {
59 $progress['spent_seconds'] += (int) $row['spent_seconds'];
60 $progress['access_time'] = max(
61 $progress['access_time'],
62 (int) $row['last_access']
63 );
64 $progress['access_time_min'] = min(
65 $progress['access_time_min'],
66 (int) $row['first_access']
67 );
68 } else {
69 $progress['obj_id'] = (int) $row['obj_id'];
70 $progress['user_id'] = (int) $row['usr_id'];
71 $progress['spent_seconds'] = (int) $row['spent_seconds'];
72 $progress['access_time'] = (int) $row['last_access'];
73 $progress['access_time_min'] = (int) $row['first_access'];
74 $progress['visits'] = (int) $row['read_count'];
75 }
76 }
77 return $progress;
78 }
const IL_CAL_UNIX
const IL_CAL_DATETIME
static _lookupReadEvents($obj_id, $usr_id=null)
Reads all read events which occured on the object.
@classDescription Date and time handling

References ilChangeEvent\_lookupReadEvents(), IL_CAL_DATETIME, IL_CAL_UNIX, and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ _lookupProgressByObjId()

static ilLearningProgress::_lookupProgressByObjId ( int  $a_obj_id)
static

lookup progress for a specific object

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

83 : array
84 {
85 $progress = [];
86 foreach (ilChangeEvent::_lookupReadEvents($a_obj_id) as $row) {
87 if (isset($progress[$row['usr_id']])) {
88 $progress[$row['usr_id']]['spent_seconds'] += (int) $row['spent_seconds'];
89 $progress[$row['usr_id']]['read_count'] += (int) $row['read_count'];
90 $progress[$row['usr_id']]['ts'] = max(
91 (int) $row['last_access'],
92 (int) $progress[$row['usr_id']]['ts']
93 );
94 } else {
95 $progress[$row['usr_id']]['spent_seconds'] = (int) $row['spent_seconds'];
96 $progress[$row['usr_id']]['read_count'] = (int) $row['read_count'];
97 $progress[$row['usr_id']]['ts'] = (int) $row['last_access'];
98 }
99 $progress[$row['usr_id']]['usr_id'] = (int) $row['usr_id'];
100 $progress[$row['usr_id']]['obj_id'] = (int) $row['obj_id'];
101 }
102 return $progress;
103 }

References ilChangeEvent\_lookupReadEvents(), and ILIAS\Repository\int().

Referenced by ilCourseMembershipGUI\getPrintMemberData(), ilObjGroupGUI\readMemberData(), ilObjCourseGUI\readMemberData(), and ilLearningSequenceRoles\readMemberData().

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

◆ _tracProgress()

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

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

33 : bool {
35 $a_obj_type,
36 $a_ref_id,
37 $a_obj_id,
38 $a_user_id
39 );
40
41 ilLPStatus::setInProgressIfNotAttempted($a_obj_id, $a_user_id);
42
43 return true;
44 }
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, $a_ext_rc=null, $a_ext_time=null)
static setInProgressIfNotAttempted(int $a_obj_id, int $a_user_id)
This function shoudl be clalled for normal "read events".

Referenced by ilObjCourseGUI\executeCommand(), ilObjGroupGUI\executeCommand(), ilInfoScreenGUI\saveProgress(), ilObjExerciseGUI\showOverviewObject(), ilObjFileGUI\toggleLearningProgress(), ilObjContentPage\trackProgress(), ilObjFolderGUI\viewObject(), and ilObjGroupGUI\viewObject().

+ Here is the caller graph for this function:

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