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

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 _getFailed (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)
 
- 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 26 of file class.ilLPStatusObjectives.php.

Member Function Documentation

◆ _getCompleted()

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

Reimplemented from ilLPStatus.

Definition at line 68 of file class.ilLPStatusObjectives.php.

68 : array
69 {
70 $objective_results = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
71 $usr_ids = (array) ($objective_results['user_status'][self::LP_STATUS_COMPLETED_NUM] ?? []);
72
73 if ($usr_ids) {
74 // Exclude all non members
75 $usr_ids = array_intersect(self::getMembers($a_obj_id), $usr_ids);
76 }
77
78 return $usr_ids ?: array();
79 }
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:

◆ _getFailed()

static ilLPStatusObjectives::_getFailed ( int  $a_obj_id)
static
Parameters
int$a_obj_id
Returns
int[]

Reimplemented from ilLPStatus.

Definition at line 81 of file class.ilLPStatusObjectives.php.

81 : array
82 {
83 $objective_results = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
84 $usr_ids = (array) ($objective_results['user_status'][self::LP_STATUS_FAILED_NUM] ?? []);
85
86 if ($usr_ids) {
87 // Exclude all non members
88 $usr_ids = array_intersect(self::getMembers($a_obj_id), $usr_ids);
89 }
90
91 return $usr_ids;
92 }

References ilLPStatusWrapper\_getStatusInfo().

+ Here is the call graph for this function:

◆ _getInProgress()

static ilLPStatusObjectives::_getInProgress ( int  $a_obj_id)
static

Reimplemented from ilLPStatus.

Definition at line 51 of file class.ilLPStatusObjectives.php.

51 : array
52 {
53 $objective_results = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
54 $usr_ids = (array) ($objective_results['user_status'][self::LP_STATUS_IN_PROGRESS_NUM] ?? []);
55
56 if ($usr_ids) {
57 // Exclude all non members
58 $usr_ids = array_intersect(self::getMembers($a_obj_id), $usr_ids);
59 }
60
61 if ($usr_ids) {
62 return $usr_ids;
63 } else {
64 return array();
65 }
66 }

References ilLPStatusWrapper\_getStatusInfo().

+ Here is the call graph for this function:

◆ _getNotAttempted()

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

Reimplemented from ilLPStatus.

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

28 : array
29 {
30 $users = array();
31
32 $members = self::getMembers($a_obj_id);
33 if ($members) {
34 // diff in progress, completed and failed (use stored result in LPStatusWrapper)
35 $users = array_diff(
36 (array) $members,
38 );
39 $users = array_diff(
40 (array) $members,
42 );
43 $users = array_diff(
44 (array) $members,
46 );
47 }
48 return $users;
49 }
static getMembers(int $a_obj_id)
static _getInProgress(int $a_obj_id)
Static function to read users who have the status 'in_progress'.
static _getFailed(int $a_obj_id)
Static function to read the users who have the status 'completed'.
static _getCompleted(int $a_obj_id)
Static function to read the users who have the status 'completed'.

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

+ Here is the call graph for this function:

◆ _getStatusInfo()

static ilLPStatusObjectives::_getStatusInfo ( int  $a_obj_id)
static

Reimplemented from ilLPStatus.

Definition at line 94 of file class.ilLPStatusObjectives.php.

94 : array
95 {
96 global $DIC;
97
98 $ilDB = $DIC['ilDB'];
99
100 $status_info = array();
101 $status_info['user_status'] = array();
102 $status_info['objectives'] = ilCourseObjective::_getObjectiveIds(
103 $a_obj_id,
104 true
105 );
106 $status_info['num_objectives'] = count($status_info['objectives']);
107
108 if ($status_info['num_objectives']) {
109 $in = $ilDB->in(
110 'objective_id',
111 $status_info['objectives'],
112 false,
113 'integer'
114 );
115
117 $a_obj_id,
118 $status_info['objectives']
119 ) as $user_id => $user_status) {
120 $status_info['user_status'][$user_status][] = $user_id;
121 }
122
123 // change event should lead to "in progress" - see determineStatus()
125 $a_obj_id
126 ) as $user_id) {
127 if (!isset(
128 $status_info['user_status'][ilLPStatus::LP_STATUS_IN_PROGRESS_NUM]
129 ) ||
130 !in_array(
131 $user_id,
132 $status_info['user_status'][ilLPStatus::LP_STATUS_IN_PROGRESS_NUM]
133 )) {
134 $status_info['user_status'][ilLPStatus::LP_STATUS_IN_PROGRESS_NUM][] = $user_id;
135 }
136 }
137
138 // Read title/description
139 $query = "SELECT * FROM crs_objectives WHERE " . $in;
140 $res = $ilDB->query($query);
141 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
142 $status_info['objective_title'][$row->objective_id] = $row->title;
143 $status_info['objective_description'][$row->objective_id] = $row->description;
144 }
145 }
146 return $status_info;
147 }
static lookupUsersInProgress(int $a_obj_id)
static _getObjectiveIds(int $course_id, bool $a_activated_only=false)
static getSummarizedObjectiveStatusForLP(int $a_obj_id, array $a_objective_ids, int $a_user_id=0)
const LP_STATUS_IN_PROGRESS_NUM
$res
Definition: ltiservices.php:69
global $DIC
Definition: shib_login.php:26

References $DIC, $ilDB, $res, $user_id, ilCourseObjective\_getObjectiveIds(), ilDBConstants\FETCHMODE_OBJECT, ilLOUserResults\getSummarizedObjectiveStatusForLP(), ilChangeEvent\lookupUsersInProgress(), and ilLPStatus\LP_STATUS_IN_PROGRESS_NUM.

+ Here is the call graph for this function:

◆ _lookupCompletedForObject()

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

Get completed users for object.

Reimplemented from ilLPStatus.

Definition at line 205 of file class.ilLPStatusObjectives.php.

208 : array {
209 if (!$a_user_ids) {
210 $a_user_ids = self::getMembers($a_obj_id);
211 if (!$a_user_ids) {
212 return array();
213 }
214 }
216 $a_obj_id,
217 self::LP_STATUS_COMPLETED_NUM,
218 $a_user_ids
219 );
220 }
static _lookupStatusForObject(int $a_obj_id, int $a_status, ?array $a_user_ids=null)
Get users with given status for object.

◆ _lookupFailedForObject()

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

Get failed users for object.

Reimplemented from ilLPStatus.

Definition at line 225 of file class.ilLPStatusObjectives.php.

228 : array {
229 return array();
230 }

◆ _lookupInProgressForObject()

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

Get in progress users for object.

Reimplemented from ilLPStatus.

Definition at line 235 of file class.ilLPStatusObjectives.php.

238 : array {
239 if (!$a_user_ids) {
240 $a_user_ids = self::getMembers($a_obj_id);
241 if (!$a_user_ids) {
242 return array();
243 }
244 }
246 $a_obj_id,
247 self::LP_STATUS_IN_PROGRESS_NUM,
248 $a_user_ids
249 );
250 }

◆ determineStatus()

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

Reimplemented from ilLPStatus.

Definition at line 149 of file class.ilLPStatusObjectives.php.

153 : int {
154 // the status completed depends on:
155 // $status_info['num_objectives'] (ilLPStatusWrapper::_getStatusInfo($a_obj_id);)
156 // - ilCourseObjective::_getObjectiveIds($a_obj_id);
157 // - table crs_objectives manipulated in
158 // - ilCourseObjective
159
160 // $status_info['objective_result'] (ilLPStatusWrapper::_getStatusInfo($a_obj_id);)
161 // table crs_objective_status (must not contain a dataset)
162 // ilCourseObjectiveResult -> added ilLPStatusWrapper::_updateStatus()
163
165 switch ($this->ilObjDataCache->lookupType($a_obj_id)) {
166 case "crs":
167 if (ilChangeEvent::hasAccessed($a_obj_id, $a_usr_id)) {
168 // an initial test (only) should also lead to "in progress"
170
172 $a_obj_id,
173 true
174 );
175 if ($objectives) {
176 // #14051 - getSummarizedObjectiveStatusForLP() might return null
178 $a_obj_id,
180 $a_usr_id
181 );
182 if ($objtv_status !== null) {
183 $status = $objtv_status;
184 }
185 }
186 }
187 break;
188 }
189 return $status;
190 }
static hasAccessed(int $a_obj_id, int $a_usr_id)
Has accessed.
const LP_STATUS_NOT_ATTEMPTED_NUM
$objectives

References $objectives, ilCourseObjective\_getObjectiveIds(), ilLOUserResults\getSummarizedObjectiveStatusForLP(), ilChangeEvent\hasAccessed(), and ilLPStatus\LP_STATUS_IN_PROGRESS_NUM.

+ Here is the call graph for this function:

◆ getMembers()

static ilLPStatusObjectives::getMembers ( int  $a_obj_id)
staticprotected
Parameters
int$a_obj_id
Returns
int[]

Definition at line 196 of file class.ilLPStatusObjectives.php.

196 : array
197 {
198 $member_obj = ilCourseParticipants::_getInstanceByObjId($a_obj_id);
199 return $member_obj->getMembers();
200 }
static _getInstanceByObjId(int $a_obj_id)

References ilCourseParticipants\_getInstanceByObjId().

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: