ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
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 (int $a_obj_id)
 
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 12 of file class.ilLPStatusObjectives.php.

Member Function Documentation

◆ _getCompleted()

static ilLPStatusObjectives::_getCompleted ( int  $a_obj_id)
static

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

References ilLPStatusWrapper\_getStatusInfo().

54  : array
55  {
56  $objective_results = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
57  $usr_ids = (array) ($objective_results['user_status'][self::LP_STATUS_COMPLETED_NUM] ?? []);
58 
59  if ($usr_ids) {
60  // Exclude all non members
61  $usr_ids = array_intersect(self::getMembers($a_obj_id), $usr_ids);
62  }
63 
64  return $usr_ids ?: array();
65  }
static _getStatusInfo(int $a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
+ Here is the call graph for this function:

◆ _getFailed()

static ilLPStatusObjectives::_getFailed ( int  $a_obj_id)
static

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

References ilLPStatusWrapper\_getStatusInfo().

67  : array
68  {
69  $objective_results = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
70  $usr_ids = (array) ($objective_results['user_status'][self::LP_STATUS_FAILED_NUM] ?? []);
71 
72  if ($usr_ids) {
73  // Exclude all non members
74  $usr_ids = array_intersect(self::getMembers($a_obj_id), $usr_ids);
75  }
76 
77  return $usr_ids;
78  }
static _getStatusInfo(int $a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
+ Here is the call graph for this function:

◆ _getInProgress()

static ilLPStatusObjectives::_getInProgress ( int  $a_obj_id)
static

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

References ilLPStatusWrapper\_getStatusInfo().

37  : array
38  {
39  $objective_results = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
40  $usr_ids = (array) ($objective_results['user_status'][self::LP_STATUS_IN_PROGRESS_NUM] ?? []);
41 
42  if ($usr_ids) {
43  // Exclude all non members
44  $usr_ids = array_intersect(self::getMembers($a_obj_id), $usr_ids);
45  }
46 
47  if ($usr_ids) {
48  return $usr_ids;
49  } else {
50  return array();
51  }
52  }
static _getStatusInfo(int $a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
+ Here is the call graph for this function:

◆ _getNotAttempted()

static ilLPStatusObjectives::_getNotAttempted ( int  $a_obj_id)
static

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

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

14  : array
15  {
16  $users = array();
17 
18  $members = self::getMembers($a_obj_id);
19  if ($members) {
20  // diff in progress, completed and failed (use stored result in LPStatusWrapper)
21  $users = array_diff(
22  (array) $members,
24  );
25  $users = array_diff(
26  (array) $members,
28  );
29  $users = array_diff(
30  (array) $members,
32  );
33  }
34  return $users;
35  }
static _getCompleted(int $a_obj_id)
Static function to read the users who have the status 'completed'.
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'.
+ Here is the call graph for this function:

◆ _getStatusInfo()

static ilLPStatusObjectives::_getStatusInfo ( int  $a_obj_id)
static

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

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

80  : array
81  {
82  global $DIC;
83 
84  $ilDB = $DIC['ilDB'];
85 
86  $status_info = array();
87  $status_info['user_status'] = array();
88  $status_info['objectives'] = ilCourseObjective::_getObjectiveIds(
89  $a_obj_id,
90  true
91  );
92  $status_info['num_objectives'] = count($status_info['objectives']);
93 
94  if ($status_info['num_objectives']) {
95  $in = $ilDB->in(
96  'objective_id',
97  $status_info['objectives'],
98  false,
99  'integer'
100  );
101 
103  $a_obj_id,
104  $status_info['objectives']
105  ) as $user_id => $user_status) {
106  $status_info['user_status'][$user_status][] = $user_id;
107  }
108 
109  // change event should lead to "in progress" - see determineStatus()
111  $a_obj_id
112  ) as $user_id) {
113  if (!isset(
114  $status_info['user_status'][ilLPStatus::LP_STATUS_IN_PROGRESS_NUM]
115  ) ||
116  !in_array(
117  $user_id,
118  $status_info['user_status'][ilLPStatus::LP_STATUS_IN_PROGRESS_NUM]
119  )) {
120  $status_info['user_status'][ilLPStatus::LP_STATUS_IN_PROGRESS_NUM][] = $user_id;
121  }
122  }
123 
124  // Read title/description
125  $query = "SELECT * FROM crs_objectives WHERE " . $in;
126  $res = $ilDB->query($query);
127  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
128  $status_info['objective_title'][$row->objective_id] = $row->title;
129  $status_info['objective_description'][$row->objective_id] = $row->description;
130  }
131  }
132  return $status_info;
133  }
$res
Definition: ltiservices.php:69
static getSummarizedObjectiveStatusForLP(int $a_obj_id, array $a_objective_ids, int $a_user_id=0)
const LP_STATUS_IN_PROGRESS_NUM
static _getObjectiveIds(int $course_id, bool $a_activated_only=false)
global $DIC
Definition: feed.php:28
static lookupUsersInProgress(int $a_obj_id)
$query
+ 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.

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

194  : array {
195  if (!$a_user_ids) {
196  $a_user_ids = self::getMembers($a_obj_id);
197  if (!$a_user_ids) {
198  return array();
199  }
200  }
201  return self::_lookupStatusForObject(
202  $a_obj_id,
203  self::LP_STATUS_COMPLETED_NUM,
204  $a_user_ids
205  );
206  }

◆ _lookupFailedForObject()

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

Get failed users for object.

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

214  : array {
215  return array();
216  }

◆ _lookupInProgressForObject()

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

Get in progress users for object.

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

224  : array {
225  if (!$a_user_ids) {
226  $a_user_ids = self::getMembers($a_obj_id);
227  if (!$a_user_ids) {
228  return array();
229  }
230  }
231  return self::_lookupStatusForObject(
232  $a_obj_id,
233  self::LP_STATUS_IN_PROGRESS_NUM,
234  $a_user_ids
235  );
236  }

◆ determineStatus()

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

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

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

139  : int {
140  // the status completed depends on:
141  // $status_info['num_objectives'] (ilLPStatusWrapper::_getStatusInfo($a_obj_id);)
142  // - ilCourseObjective::_getObjectiveIds($a_obj_id);
143  // - table crs_objectives manipulated in
144  // - ilCourseObjective
145 
146  // $status_info['objective_result'] (ilLPStatusWrapper::_getStatusInfo($a_obj_id);)
147  // table crs_objective_status (must not contain a dataset)
148  // ilCourseObjectiveResult -> added ilLPStatusWrapper::_updateStatus()
149 
150  $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
151  switch ($this->ilObjDataCache->lookupType($a_obj_id)) {
152  case "crs":
153  if (ilChangeEvent::hasAccessed($a_obj_id, $a_usr_id)) {
154  // an initial test (only) should also lead to "in progress"
155  $status = self::LP_STATUS_IN_PROGRESS_NUM;
156 
158  $a_obj_id,
159  true
160  );
161  if ($objectives) {
162  // #14051 - getSummarizedObjectiveStatusForLP() might return null
164  $a_obj_id,
165  $objectives,
166  $a_usr_id
167  );
168  if ($objtv_status !== null) {
169  $status = $objtv_status;
170  }
171  }
172  }
173  break;
174  }
175  return $status;
176  }
static getSummarizedObjectiveStatusForLP(int $a_obj_id, array $a_objective_ids, int $a_user_id=0)
static hasAccessed(int $a_obj_id, int $a_usr_id)
Has accessed.
static _getObjectiveIds(int $course_id, bool $a_activated_only=false)
$objectives
+ 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 182 of file class.ilLPStatusObjectives.php.

References ilCourseParticipants\_getInstanceByObjId().

182  : array
183  {
184  $member_obj = ilCourseParticipants::_getInstanceByObjId($a_obj_id);
185  return $member_obj->getMembers();
186  }
static _getInstanceByObjId(int $a_obj_id)
+ Here is the call graph for this function:

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