ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilLearningProgress Class Reference
+ Collaboration diagram for ilLearningProgress:

Public Member Functions

 __construct ()
 

Static Public Member Functions

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

Data Fields

 $db = null
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilLearningProgress::__construct ( )

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

37 {
38 global $ilDB;
39
40 $this->db = $ilDB;
41 }
global $ilDB

References $ilDB.

Member Function Documentation

◆ _getProgress()

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

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

56 {
57 require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
58 $events = ilChangeEvent::_lookupReadEvents($a_obj_id, $a_user_id);
59
60 include_once './Services/Calendar/classes/class.ilDateTime.php';
61
62 foreach($events as $row)
63 {
64 $tmp_date = new ilDateTime($row['last_access'],IL_CAL_UNIX);
65 $row['last_access'] = $tmp_date->get(IL_CAL_UNIX);
66
67 $tmp_date = new ilDateTime($row['first_access'],IL_CAL_DATETIME);
68 $row['first_access'] = $tmp_date->get(IL_CAL_UNIX);
69
70 if ($progress)
71 {
72 $progress['spent_seconds'] += $row['spent_seconds'];
73 $progress['access_time'] = max($progress['access_time'], $row['last_access']);
74 $progress['access_time_min'] = min($progress['access_time_min'], $row['first_access']);
75 }
76 else
77 {
78 $progress['obj_id'] = $row['obj_id'];
79 $progress['user_id'] = $row['usr_id'];
80 $progress['spent_seconds'] = $row['spent_seconds'];
81 $progress['access_time'] = $row['last_access'];
82 $progress['access_time_min'] = $row['first_access'];
83 $progress['visits'] = $row['read_count'];
84 }
85 }
86 return $progress ? $progress : array();
87 }
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 96 of file class.ilLearningProgress.php.

97 {
98 include_once('./Services/Tracking/classes/class.ilChangeEvent.php');
99 foreach(ilChangeEvent::_lookupReadEvents($a_obj_id) as $row)
100 {
101 if(isset($progress[$row['usr_id']]))
102 {
103 $progress[$row['usr_id']]['spent_seconds'] += $row['spent_seconds'];
104 $progress[$row['usr_id']]['read_count'] += $row['read_count'];
105 $progress[$row['usr_id']]['ts'] = max($row['last_access'],$progress[$row['usr_id']]['ts']);
106 }
107 else
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'] = $row['last_access'];
112
113 }
114 $progress[$row['usr_id']]['usr_id'] = $row['usr_id'];
115 $progress[$row['usr_id']]['obj_id'] = $row['obj_id'];
116 }
117 return $progress ? $progress : array();
118 }

References $row, and ilChangeEvent\_lookupReadEvents().

Referenced by ilCourseMembershipGUI\getPrintMemberData(), 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 44 of file class.ilLearningProgress.php.

45 {
46 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
47 ilChangeEvent::_recordReadEvent($a_obj_type, $a_ref_id, $a_obj_id, $a_user_id);
48
49 require_once 'Services/Tracking/classes/class.ilLPStatus.php';
50 ilLPStatus::setInProgressIfNotAttempted($a_obj_id, $a_user_id);
51
52 return true;
53 }
static _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".

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

Referenced by ilSurveyExecutionGUI\outSurveyPage(), 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:

Field Documentation

◆ $db

ilLearningProgress::$db = null

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


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