ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLPStatusEvent Class Reference
+ Inheritance diagram for ilLPStatusEvent:
+ Collaboration diagram for ilLPStatusEvent:

Public Member Functions

 determineStatus (int $a_obj_id, int $a_usr_id, ?object $a_obj=null)
 
- Public Member Functions inherited from ilLPStatus
 __construct (int $a_obj_id)
 
 _updateStatus (int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
 New status handling (st: status, nr: accesses, p: percentage, t: time spent, m: mark) Learning progress: More...
 
 determinePercentage (int $a_obj_id, int $a_usr_id, ?object $a_obj=null)
 
 determineStatus (int $a_obj_id, int $a_usr_id, ?object $a_obj=null)
 
 refreshStatus (int $a_obj_id, ?array $a_users=null)
 Refresh status. More...
 

Static Public Member Functions

static _getNotAttempted (int $a_obj_id)
 
static _getInProgress (int $a_obj_id)
 
static _getCompleted (int $a_obj_id)
 
static _getStatusInfo (int $a_obj_id)
 
static _lookupCompletedForObject (int $a_obj_id, ?array $a_user_ids=null)
 Get completed users for object. More...
 
static _lookupFailedForObject (int $a_obj_id, ?array $a_user_ids=null)
 Get failed users for object. More...
 
static _lookupInProgressForObject (int $a_obj_id, ?array $a_user_ids=null)
 Get in progress users for object. More...
 
- Static Public Member Functions inherited from ilLPStatus
static _getCountNotAttempted (int $a_obj_id)
 
static _getNotAttempted (int $a_obj_id)
 
static _getCountInProgress (int $a_obj_id)
 
static _getInProgress (int $a_obj_id)
 
static _getCountCompleted (int $a_obj_id)
 
static _getCompleted (int $a_obj_id)
 
static _getFailed (int $a_obj_id)
 
static _getCountFailed (int $a_obj_id)
 
static _getStatusInfo (int $a_obj_id)
 
static _getTypicalLearningTime (string $type, int $obj_id, int $sub_id=0)
 
static checkStatusForObject (int $a_obj_id, ?array $a_users=null)
 This function checks whether the status for a given number of users is dirty and must be recalculated. More...
 
static writeStatus (int $a_obj_id, int $a_user_id, int $a_status, int $a_percentage=0, bool $a_force_per=false, ?int &$a_old_status=self::LP_STATUS_NOT_ATTEMPTED_NUM)
 Write status for user and object. More...
 
static setInProgressIfNotAttempted (int $a_obj_id, int $a_user_id)
 This function shoudl be clalled for normal "read events". More...
 
static setAllDirty ()
 Sets all status to dirty. More...
 
static setDirty (int $a_obj_id)
 Sets status of an object to dirty. More...
 
static _lookupStatus (int $a_obj_id, int $a_user_id, bool $a_create=true)
 Lookup status. More...
 
static _lookupPercentage (int $a_obj_id, int $a_user_id)
 Lookup percentage. More...
 
static _hasUserCompleted (int $a_obj_id, int $a_user_id)
 Lookup user object completion. More...
 
static _lookupStatusChanged (int $a_obj_id, int $a_user_id)
 Lookup status changed. More...
 
static _lookupCompletedForObject (int $a_obj_id, ?array $a_user_ids=null)
 Get completed users for object. More...
 
static _lookupFailedForObject (int $a_obj_id, ?array $a_user_ids=null)
 Get failed users for object. More...
 
static _lookupInProgressForObject (int $a_obj_id, ?array $a_user_ids=null)
 Get in progress users for object. More...
 
static preloadListGUIData (array $a_obj_ids)
 
static getListGUIStatus (int $a_obj_id, bool $a_image_only=true)
 
static hasListGUIStatus (int $a_obj_id)
 

Static Protected Member Functions

static getMembers (int $a_obj_id, bool $a_is_crs_id=false)
 Get members for object. More...
 
- Static Protected Member Functions inherited from ilLPStatus
static raiseEvent (int $a_obj_id, int $a_usr_id, int $a_status, int $a_old_status, int $a_percentage)
 
static _lookupStatusForObject (int $a_obj_id, int $a_status, ?array $a_user_ids=null)
 Get users with given status for object. More...
 
static validateLPForObjects (int $a_user_id, array $a_obj_ids, int $a_parent_ref_id)
 Process given objects for lp-relevance. More...
 
static checkLPModesForObjects (array $a_obj_ids, array &$a_coll_obj_ids)
 Process lp modes for given objects. More...
 
static getLPStatusForObjects (int $a_user_id, array $a_obj_ids)
 Get LP status for given objects (and user) More...
 

Additional Inherited Members

- Data Fields inherited from ilLPStatus
const LP_STATUS_NOT_ATTEMPTED = 'trac_no_attempted'
 
const LP_STATUS_IN_PROGRESS = 'trac_in_progress'
 
const LP_STATUS_COMPLETED = 'trac_completed'
 
const LP_STATUS_FAILED = 'trac_failed'
 
const LP_STATUS_NOT_ATTEMPTED_NUM = 0
 
const LP_STATUS_IN_PROGRESS_NUM = 1
 
const LP_STATUS_COMPLETED_NUM = 2
 
const LP_STATUS_FAILED_NUM = 3
 
const LP_STATUS_REGISTERED = 'trac_registered'
 
const LP_STATUS_NOT_REGISTERED = 'trac_not_registered'
 
const LP_STATUS_PARTICIPATED = 'trac_participated'
 
const LP_STATUS_NOT_PARTICIPATED = 'trac_not_participated'
 
- Static Public Attributes inherited from ilLPStatus
static $list_gui_cache
 
- Protected Attributes inherited from ilLPStatus
int $obj_id
 
ilDBInterface $db
 
ilObjectDataCache $ilObjDataCache
 

Detailed Description

Definition at line 24 of file class.ilLPStatusEvent.php.

Member Function Documentation

◆ _getCompleted()

static ilLPStatusEvent::_getCompleted ( int  $a_obj_id)
static
Parameters
int$a_obj_id
Returns
int[]

Reimplemented from ilLPStatus.

Definition at line 65 of file class.ilLPStatusEvent.php.

65 : array
66 {
67 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
68 return $status_info['participated_users'] ?: array();
69 }
static _getStatusInfo(int $a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.

References ilLPStatusWrapper\_getStatusInfo().

+ Here is the call graph for this function:

◆ _getInProgress()

static ilLPStatusEvent::_getInProgress ( int  $a_obj_id)
static

Reimplemented from ilLPStatus.

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

48 : array
49 {
50 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
51
52 // If registration is disabled in_progress is not available
53 if (!$status_info['registration']) {
54 return array();
55 }
56 // If event has occured in_progress is impossible
57 if ($status_info['starting_time'] < time()) {
58 return array();
59 }
60
61 // Otherwise all users who registered will get the status in progress
62 return $status_info['registered_users'] ?: array();
63 }

References ilLPStatusWrapper\_getStatusInfo().

+ Here is the call graph for this function:

◆ _getNotAttempted()

static ilLPStatusEvent::_getNotAttempted ( int  $a_obj_id)
static
Parameters
int$a_obj_id
Returns
int[]

Reimplemented from ilLPStatus.

Definition at line 26 of file class.ilLPStatusEvent.php.

26 : array
27 {
28 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
29
30 $users = array();
31
32 $members = self::getMembers($status_info['crs_id'], true);
33 if ($members) {
34 // diff in progress and completed (use stored result in LPStatusWrapper)
35 $users = array_diff(
36 $members,
38 );
39 $users = array_diff(
40 $users,
42 );
43 }
44
45 return $users;
46 }
static getMembers(int $a_obj_id, bool $a_is_crs_id=false)
Get members for object.
static _getInProgress(int $a_obj_id)
Static function to read users who have the status 'in_progress'.
static _getCompleted(int $a_obj_id)
Static function to read the users who have the status 'completed'.

References ilLPStatusWrapper\_getCompleted(), ilLPStatusWrapper\_getInProgress(), ilLPStatusWrapper\_getStatusInfo(), and getMembers().

+ Here is the call graph for this function:

◆ _getStatusInfo()

static ilLPStatusEvent::_getStatusInfo ( int  $a_obj_id)
static

Reimplemented from ilLPStatus.

Definition at line 71 of file class.ilLPStatusEvent.php.

71 : array
72 {
73 $tree = $GLOBALS['DIC']->repositoryTree();
74
75 $references = ilObject::_getAllReferences($a_obj_id);
76 $ref_id = end($references);
77
78 $member_ref_id = null;
79 if ($id = $tree->checkForParentType($ref_id, 'grp')) {
80 $member_ref_id = $id;
81 } elseif ($id = $tree->checkForParentType($ref_id, 'crs')) {
82 $member_ref_id = $id;
83 }
84
85 $status_info = array();
86 $status_info['crs_id'] = ilObject::_lookupObjId($member_ref_id);
87 $status_info['registration'] = ilObjSession::_lookupRegistrationEnabled(
88 $a_obj_id
89 );
90 $status_info['title'] = ilObject::_lookupTitle($a_obj_id);
91 $status_info['description'] = ilObject::_lookupDescription($a_obj_id);
92
93 $time_info = ilSessionAppointment::_lookupAppointment($a_obj_id);
94 $status_info['starting_time'] = $time_info['start'];
95 $status_info['ending_time'] = $time_info['end'];
96 $status_info['fullday'] = $time_info['fullday'];
97
98 $status_info['registered_users'] = ilEventParticipants::_getRegistered(
99 $a_obj_id
100 );
101 $status_info['participated_users'] = ilEventParticipants::_getParticipated(
102 $a_obj_id
103 );
104
105 return $status_info;
106 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static _getParticipated(int $a_event_id)
static _getRegistered(int $a_event_id)
static _lookupRegistrationEnabled(int $a_obj_id)
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
static _lookupDescription(int $obj_id)
static _lookupAppointment(int $a_obj_id)
$ref_id
Definition: ltiauth.php:66
$GLOBALS["DIC"]
Definition: wac.php:54

References $GLOBALS, $id, $ref_id, ilObject\_getAllReferences(), ilEventParticipants\_getParticipated(), ilEventParticipants\_getRegistered(), ilSessionAppointment\_lookupAppointment(), ilObject\_lookupDescription(), ilObject\_lookupObjId(), ilObjSession\_lookupRegistrationEnabled(), and ilObject\_lookupTitle().

+ Here is the call graph for this function:

◆ _lookupCompletedForObject()

static ilLPStatusEvent::_lookupCompletedForObject ( int  $a_obj_id,
?array  $a_user_ids = null 
)
static

Get completed users for object.

Reimplemented from ilLPStatus.

Definition at line 182 of file class.ilLPStatusEvent.php.

185 : array {
186 if (!$a_user_ids) {
187 $a_user_ids = self::getMembers($a_obj_id);
188 if (!$a_user_ids) {
189 return array();
190 }
191 }
193 $a_obj_id,
194 self::LP_STATUS_COMPLETED_NUM,
195 $a_user_ids
196 );
197 }
static _lookupStatusForObject(int $a_obj_id, int $a_status, ?array $a_user_ids=null)
Get users with given status for object.

◆ _lookupFailedForObject()

static ilLPStatusEvent::_lookupFailedForObject ( int  $a_obj_id,
?array  $a_user_ids = null 
)
static

Get failed users for object.

Reimplemented from ilLPStatus.

Definition at line 202 of file class.ilLPStatusEvent.php.

205 : array {
206 return array();
207 }

◆ _lookupInProgressForObject()

static ilLPStatusEvent::_lookupInProgressForObject ( int  $a_obj_id,
?array  $a_user_ids = null 
)
static

Get in progress users for object.

Reimplemented from ilLPStatus.

Definition at line 212 of file class.ilLPStatusEvent.php.

215 : array {
216 if (!$a_user_ids) {
217 $a_user_ids = self::getMembers($a_obj_id);
218 if (!$a_user_ids) {
219 return array();
220 }
221 }
223 $a_obj_id,
224 self::LP_STATUS_IN_PROGRESS_NUM,
225 $a_user_ids
226 );
227 }

◆ determineStatus()

ilLPStatusEvent::determineStatus ( int  $a_obj_id,
int  $a_usr_id,
?object  $a_obj = null 
)

Reimplemented from ilLPStatus.

Definition at line 108 of file class.ilLPStatusEvent.php.

112 : int {
113 global $DIC;
114
115 $ilObjDataCache = $DIC['ilObjDataCache'];
116
118 switch ($this->ilObjDataCache->lookupType($a_obj_id)) {
119 case 'sess':
120
122 $a_obj_id
123 );
125 $a_obj_id
126 );
127
128 // If registration is disabled in_progress is not available
129 // If event has occured in_progress is impossible
130 if ($registration && $time_info['start'] >= time()) {
131 // is user registered -> in progress
133 $a_usr_id,
134 $a_obj_id
135 )) {
137 }
138 }
140 $a_usr_id,
141 $a_obj_id
142 )) {
144 }
145 break;
146 }
147 return $status;
148 }
static _isRegistered(int $a_usr_id, int $a_event_id)
static _hasParticipated(int $a_usr_id, int $a_event_id)
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
ilObjectDataCache $ilObjDataCache
global $DIC
Definition: shib_login.php:26

References ilEventParticipants\_hasParticipated(), ilEventParticipants\_isRegistered(), ilSessionAppointment\_lookupAppointment(), ilObjSession\_lookupRegistrationEnabled(), ilLPStatus\LP_STATUS_COMPLETED_NUM, and ilLPStatus\LP_STATUS_IN_PROGRESS_NUM.

+ Here is the call graph for this function:

◆ getMembers()

static ilLPStatusEvent::getMembers ( int  $a_obj_id,
bool  $a_is_crs_id = false 
)
staticprotected

Get members for object.

Definition at line 153 of file class.ilLPStatusEvent.php.

156 : array {
157 if (!$a_is_crs_id) {
158 $tree = $GLOBALS['DIC']->repositoryTree();
159 $references = ilObject::_getAllReferences($a_obj_id);
160 $ref_id = end($references);
161
162 $member_ref_id = null;
163 if ($id = $tree->checkForParentType($ref_id, 'grp')) {
164 $member_ref_id = $id;
165 } elseif ($id = $tree->checkForParentType($ref_id, 'crs')) {
166 $member_ref_id = $id;
167 } else {
168 return [];
169 }
170 $member_obj_id = ilObject::_lookupObjId($member_ref_id);
171 } else {
172 $member_obj_id = $a_obj_id;
173 }
174
175 $member_obj = ilParticipants::getInstanceByObjId($member_obj_id);
176 return $member_obj->getMembers();
177 }
static getInstanceByObjId(int $a_obj_id)
Get instance by obj type.

References $GLOBALS, $id, $ref_id, ilObject\_getAllReferences(), and ilObject\_lookupObjId().

Referenced by _getNotAttempted().

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

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