ILIAS  release_7 Revision v7.30-3-g800a261c036
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 $DIC;
39
40 $ilDB = $DIC['ilDB'];
41
42 $this->db = $ilDB;
43 }
global $DIC
Definition: goto.php:24
global $ilDB

References $DIC, and $ilDB.

Member Function Documentation

◆ _getProgress()

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

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

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

95 {
96 include_once('./Services/Tracking/classes/class.ilChangeEvent.php');
97 foreach (ilChangeEvent::_lookupReadEvents($a_obj_id) as $row) {
98 if (isset($progress[$row['usr_id']])) {
99 $progress[$row['usr_id']]['spent_seconds'] += $row['spent_seconds'];
100 $progress[$row['usr_id']]['read_count'] += $row['read_count'];
101 $progress[$row['usr_id']]['ts'] = max($row['last_access'], $progress[$row['usr_id']]['ts']);
102 } else {
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'] = $row['last_access'];
106 }
107 $progress[$row['usr_id']]['usr_id'] = $row['usr_id'];
108 $progress[$row['usr_id']]['obj_id'] = $row['obj_id'];
109 }
110 return $progress ? $progress : array();
111 }

References ilChangeEvent\_lookupReadEvents().

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 (   $a_user_id,
  $a_obj_id,
  $a_ref_id,
  $a_obj_type = '' 
)
static

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

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