ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $tmp_date = new ilDateTime($row['last_access'], IL_CAL_UNIX);
64 $row['last_access'] = $tmp_date->get(IL_CAL_UNIX);
65
66 $tmp_date = new ilDateTime($row['first_access'], IL_CAL_DATETIME);
67 $row['first_access'] = $tmp_date->get(IL_CAL_UNIX);
68
69 if ($progress) {
70 $progress['spent_seconds'] += $row['spent_seconds'];
71 $progress['access_time'] = max($progress['access_time'], $row['last_access']);
72 $progress['access_time_min'] = min($progress['access_time_min'], $row['first_access']);
73 } else {
74 $progress['obj_id'] = $row['obj_id'];
75 $progress['user_id'] = $row['usr_id'];
76 $progress['spent_seconds'] = $row['spent_seconds'];
77 $progress['access_time'] = $row['last_access'];
78 $progress['access_time_min'] = $row['first_access'];
79 $progress['visits'] = $row['read_count'];
80 }
81 }
82 return $progress ? $progress : array();
83 }
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 92 of file class.ilLearningProgress.php.

93 {
94 include_once('./Services/Tracking/classes/class.ilChangeEvent.php');
95 foreach (ilChangeEvent::_lookupReadEvents($a_obj_id) as $row) {
96 if (isset($progress[$row['usr_id']])) {
97 $progress[$row['usr_id']]['spent_seconds'] += $row['spent_seconds'];
98 $progress[$row['usr_id']]['read_count'] += $row['read_count'];
99 $progress[$row['usr_id']]['ts'] = max($row['last_access'], $progress[$row['usr_id']]['ts']);
100 } else {
101 $progress[$row['usr_id']]['spent_seconds'] = $row['spent_seconds'];
102 $progress[$row['usr_id']]['read_count'] = $row['read_count'];
103 $progress[$row['usr_id']]['ts'] = $row['last_access'];
104 }
105 $progress[$row['usr_id']]['usr_id'] = $row['usr_id'];
106 $progress[$row['usr_id']]['obj_id'] = $row['obj_id'];
107 }
108 return $progress ? $progress : array();
109 }

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 ilObjCourseGUI\executeCommand(), ilObjGroupGUI\executeCommand(), 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: