ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilLPStatusCollection Class Reference
+ Inheritance diagram for ilLPStatusCollection:
+ Collaboration diagram for ilLPStatusCollection:

Public Member Functions

 __construct (int $a_obj_id)
 
 determineStatus (int $a_obj_id, int $a_usr_id, ?object $a_obj=null)
 
 determinePercentage (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)
 Get completed users New handling for optional grouped assignments. More...
 
static _getFailed (int $a_obj_id)
 
static _getStatusInfo (int $a_obj_id)
 
static _getTypicalLearningTime (string $type, int $obj_id, int $sub_id=0)
 
static determineGroupingStatus (array $status, array $gr_info, int $user_id, bool $is_grouping)
 Determine grouping status. 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 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)
 

Protected Member Functions

 isMember (int $objId, int $usrId)
 

Static Protected Member Functions

static getMembers (int $a_obj_id)
 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...
 

Private Attributes

ilTree $tree
 

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 25 of file class.ilLPStatusCollection.php.

Constructor & Destructor Documentation

◆ __construct()

ilLPStatusCollection::__construct ( int  $a_obj_id)

Definition at line 29 of file class.ilLPStatusCollection.php.

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

30  {
31  global $DIC;
32 
33  parent::__construct($a_obj_id);
34  $this->tree = $DIC->repositoryTree();
35  }
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ _getCompleted()

static ilLPStatusCollection::_getCompleted ( int  $a_obj_id)
static

Get completed users New handling for optional grouped assignments.

Definition at line 107 of file class.ilLPStatusCollection.php.

References $DIC, ilLPStatus\$ilObjDataCache, ilLPStatusWrapper\_getCompleted(), ilLPStatusWrapper\_getFailed(), ilObjectLP\getInstance(), and ilObjectDataCache\lookupObjId().

107  : array
108  {
109  global $DIC;
110 
111  $ilObjDataCache = $DIC['ilObjDataCache'];
112 
113  $olp = ilObjectLP::getInstance($a_obj_id);
114  $collection = $olp->getCollectionInstance();
115  $grouped_items = [];
116  if ($collection) {
117  $grouped_items = $collection->getGroupedItemsForLPStatus();
118  }
119  if (!count($grouped_items)) {
120  // #11513 - empty collections cannot be completed
121  return array();
122  } else {
123  // New handling for optional assignments
124  $counter = 0;
125  $users = array();
126  foreach ($grouped_items as $grouping_id => $grouping) {
127  $isGrouping = $grouping_id ? true : false;
128  $grouping_completed = array();
129  $grouping_completed_users_num = array();
130  foreach ((array) $grouping['items'] as $item) {
131  $item_id = $ilObjDataCache->lookupObjId((int) $item);
132  $tmp_users = ilLPStatusWrapper::_getCompleted($item_id);
133  if ($isGrouping) {
134  // Iterated through all grouped items and count the number of fullfiled items
135  foreach ($tmp_users as $tmp_user_id) {
136  $grouping_completed_users_num[$tmp_user_id] =
137  ($grouping_completed_users_num[$tmp_user_id] ?? 0) + 1;
138  }
139  } elseif (!$counter++) {
140  $users = $tmp_users;
141  } else {
142  $users = array_intersect($users, $tmp_users);
143  }
144  }
145  if ($isGrouping) {
146  // Iterate through all "grouping_completed_users_num"
147  // All users with completed items greater equal than "num_obligatory" are completed
148  foreach ($grouping_completed_users_num as $tmp_user_id => $grouping_num_completed) {
149  if ($grouping_num_completed >= $grouping['num_obligatory']) {
150  $grouping_completed[] = $tmp_user_id;
151  }
152  }
153 
154  // build intersection of users
155  if (!$counter++) {
156  $users = $grouping_completed;
157  } else {
158  $users = array_intersect($users, $grouping_completed);
159  }
160  }
161  }
162  }
163 
164  $users = array_diff($users, ilLPStatusWrapper::_getFailed($a_obj_id));
165 
166  if ($users) {
167  // Exclude all non members
168  $users = array_intersect(self::getMembers($a_obj_id), $users);
169  }
170 
171  return (array) $users;
172  }
static _getCompleted(int $a_obj_id)
Static function to read the users who have the status 'completed'.
static _getFailed(int $a_obj_id)
Static function to read the users who have the status 'completed'.
global $DIC
Definition: shib_login.php:22
ilObjectDataCache $ilObjDataCache
static getInstance(int $obj_id)
+ Here is the call graph for this function:

◆ _getFailed()

static ilLPStatusCollection::_getFailed ( int  $a_obj_id)
static

Definition at line 174 of file class.ilLPStatusCollection.php.

References $DIC, ilLPStatus\$ilObjDataCache, ilLPStatusWrapper\_getFailed(), ilObjectLP\getInstance(), and ilObjectDataCache\lookupObjId().

174  : array
175  {
176  global $DIC;
177 
178  $ilObjDataCache = $DIC['ilObjDataCache'];
179 
180  $users = array();
181 
182  $olp = ilObjectLP::getInstance($a_obj_id);
183  $collection = $olp->getCollectionInstance();
184  if ($collection) {
185  foreach ($collection->getGroupedItemsForLPStatus(
186  ) as $grouping_id => $grouping) {
187  $isGrouping = $grouping_id ? true : false;
188 
189  $gr_failed = array();
190  $gr_failed_users_num = array();
191  $counter = 0;
192  foreach ((array) $grouping['items'] as $item) {
193  $item_id = $ilObjDataCache->lookupObjId((int) $item);
194  $tmp_users = ilLPStatusWrapper::_getFailed($item_id);
195 
196  if ($isGrouping) {
197  foreach ($tmp_users as $tmp_user_id) {
198  $gr_failed_users_num[$tmp_user_id] =
199  ($gr_failed_users_num[$tmp_user_id] ?? 0) + 1;
200  }
201  } else {
202  // One item failed is sufficient for status failed.
203  $gr_failed = array_merge($gr_failed, $tmp_users);
204  }
205  $counter++;
206  }
207  if ($isGrouping) {
208  $allowed_failed = count(
209  $grouping['items']
210  ) - $grouping['num_obligatory'];
211  // Itereate over all failed users and check whether the allowd_failed value exceeded
212  foreach ($gr_failed_users_num as $tmp_user_id => $num_failed) {
213  if ($num_failed > $allowed_failed) {
214  $gr_failed[] = $tmp_user_id;
215  }
216  }
217  }
218  $users = array_unique(array_merge($users, $gr_failed));
219  }
220  }
221 
222  if ($users) {
223  // Exclude all non members
224  $users = array_intersect(self::getMembers($a_obj_id), $users);
225  }
226 
227  return array_unique($users);
228  }
static _getFailed(int $a_obj_id)
Static function to read the users who have the status 'completed'.
global $DIC
Definition: shib_login.php:22
ilObjectDataCache $ilObjDataCache
static getInstance(int $obj_id)
+ Here is the call graph for this function:

◆ _getInProgress()

static ilLPStatusCollection::_getInProgress ( int  $a_obj_id)
static

Definition at line 61 of file class.ilLPStatusCollection.php.

References ilLPStatusWrapper\_getCompleted(), ilLPStatusWrapper\_getFailed(), ilLPStatusWrapper\_getInProgress(), ilObject\_lookupObjId(), ilObjectLP\getInstance(), and ilChangeEvent\lookupUsersInProgress().

61  : array
62  {
63  $users = ilChangeEvent::lookupUsersInProgress($a_obj_id);
64 
65  $olp = ilObjectLP::getInstance($a_obj_id);
66  $collection = $olp->getCollectionInstance();
67  if ($collection) {
68  foreach ($collection->getItems() as $item_id) {
69  $item_id = ilObject::_lookupObjId($item_id);
70 
71  // merge arrays of users with status 'in progress'
72  $users = array_unique(
73  array_merge(
74  $users,
76  )
77  );
78  $users = array_unique(
79  array_merge(
80  $users,
82  )
83  );
84  }
85  }
86 
87  // Exclude all users with status completed.
88  $users = array_diff(
89  $users,
91  );
92  // Exclude all users with status failed.
93  $users = array_diff($users, ilLPStatusWrapper::_getFailed($a_obj_id));
94 
95  if ($users) {
96  // Exclude all non members
97  $users = array_intersect(self::getMembers($a_obj_id), $users);
98  }
99 
100  return $users;
101  }
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 _lookupObjId(int $ref_id)
static lookupUsersInProgress(int $a_obj_id)
static _getFailed(int $a_obj_id)
Static function to read the users who have the status 'completed'.
static getInstance(int $obj_id)
+ Here is the call graph for this function:

◆ _getNotAttempted()

static ilLPStatusCollection::_getNotAttempted ( int  $a_obj_id)
static

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

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

37  : array
38  {
39  $users = array();
40 
41  $members = self::getMembers($a_obj_id);
42  if ($members) {
43  // diff in progress and completed (use stored result in LPStatusWrapper)
44  $users = array_diff(
45  (array) $members,
47  );
48  $users = array_diff(
49  $users,
51  );
52  $users = array_diff(
53  $users,
55  );
56  }
57 
58  return $users;
59  }
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 ilLPStatusCollection::_getStatusInfo ( int  $a_obj_id)
static

Definition at line 230 of file class.ilLPStatusCollection.php.

References ilObjectLP\getInstance().

230  : array
231  {
232  $status_info = array();
233 
234  $olp = ilObjectLP::getInstance($a_obj_id);
235  $collection = $olp->getCollectionInstance();
236  if ($collection) {
237  $status_info['collections'] = $collection->getItems();
238  $status_info['num_collections'] = count(
239  $status_info['collections']
240  );
241  }
242 
243  return $status_info;
244  }
static getInstance(int $obj_id)
+ Here is the call graph for this function:

◆ _getTypicalLearningTime()

static ilLPStatusCollection::_getTypicalLearningTime ( string  $type,
int  $obj_id,
int  $sub_id = 0 
)
static

Definition at line 246 of file class.ilLPStatusCollection.php.

References $DIC, ilLPStatus\$ilObjDataCache, ilLPStatusWrapper\_getStatusInfo(), ilLPStatusWrapper\_getTypicalLearningTime(), ilObjectDataCache\lookupObjId(), and ilObjectDataCache\lookupType().

246  : int
247  {
248  global $DIC;
249 
250  $ilObjDataCache = $DIC['ilObjDataCache'];
251 
252  if ($type == 'sahs') {
253  return parent::_getTypicalLearningTime($type, $obj_id);
254  }
255 
256  $tlt = 0;
258  foreach ($status_info['collections'] as $item) {
259  $obj_id = $ilObjDataCache->lookupObjId((int) $item);
262  $type,
263  $obj_id
264  );
265  }
266  return $tlt;
267  }
static _getStatusInfo(int $a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
global $DIC
Definition: shib_login.php:22
ilObjectDataCache $ilObjDataCache
static _getTypicalLearningTime(string $type, int $a_obj_id)
Reads Typical learning time.
+ Here is the call graph for this function:

◆ _lookupCompletedForObject()

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

Get completed users for object.

Definition at line 483 of file class.ilLPStatusCollection.php.

486  : array {
487  if (!$a_user_ids) {
488  $a_user_ids = self::getMembers($a_obj_id);
489  if (!$a_user_ids) {
490  return array();
491  }
492  }
493  return self::_lookupStatusForObject(
494  $a_obj_id,
495  self::LP_STATUS_COMPLETED_NUM,
496  $a_user_ids
497  );
498  }

◆ _lookupFailedForObject()

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

Get failed users for object.

Definition at line 503 of file class.ilLPStatusCollection.php.

506  : array {
507  if (!$a_user_ids) {
508  $a_user_ids = self::getMembers($a_obj_id);
509  if (!$a_user_ids) {
510  return array();
511  }
512  }
513  return self::_lookupStatusForObject(
514  $a_obj_id,
515  self::LP_STATUS_FAILED_NUM,
516  $a_user_ids
517  );
518  }

◆ _lookupInProgressForObject()

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

Get in progress users for object.

Definition at line 523 of file class.ilLPStatusCollection.php.

526  : array {
527  if (!$a_user_ids) {
528  $a_user_ids = self::getMembers($a_obj_id);
529  if (!$a_user_ids) {
530  return array();
531  }
532  }
533  return self::_lookupStatusForObject(
534  $a_obj_id,
535  self::LP_STATUS_IN_PROGRESS_NUM,
536  $a_user_ids
537  );
538  }

◆ determineGroupingStatus()

static ilLPStatusCollection::determineGroupingStatus ( array  $status,
array  $gr_info,
int  $user_id,
bool  $is_grouping 
)
static

Determine grouping status.

Definition at line 335 of file class.ilLPStatusCollection.php.

References $DIC, ilLPStatus\$ilObjDataCache, ilLPStatusWrapper\_determineStatus(), and ilObjectDataCache\lookupObjId().

340  : array {
341  global $DIC;
342 
343  $ilObjDataCache = $DIC['ilObjDataCache'];
344 
345  $items = $gr_info['items'];
346  if ($is_grouping) {
347  $max_allowed_failed = count($items) - $gr_info['num_obligatory'];
348  $required_completed = $gr_info['num_obligatory'];
349  } else {
350  $max_allowed_failed = 0;
351  $required_completed = count($items);
352  }
353 
354  // Required for grouping with a number of obligatory items
355  $num_failed = 0;
356  $num_completed = 0;
357 
358  foreach ($items as $item_id) {
359  $item_id = $ilObjDataCache->lookupObjId((int) $item_id);
361  $item_id,
362  $user_id
363  );
364 
365  if ($gr_status == self::LP_STATUS_FAILED_NUM) {
366  if (++$num_failed > $max_allowed_failed) {
367  $status['failed'] = true;
368  $status['completed'] = false;
369  return $status;
370  }
371  }
372  if ($gr_status == self::LP_STATUS_COMPLETED_NUM) {
373  if (++$num_completed >= $required_completed) {
374  return $status;
375  }
376  }
377  }
378  // Not completed since returned above
379  $status['completed'] = false;
380  return $status;
381  }
global $DIC
Definition: shib_login.php:22
ilObjectDataCache $ilObjDataCache
static _determineStatus(int $a_obj_id, int $a_usr_id)
+ Here is the call graph for this function:

◆ determinePercentage()

ilLPStatusCollection::determinePercentage ( int  $a_obj_id,
int  $a_usr_id,
?object  $a_obj = null 
)

Definition at line 540 of file class.ilLPStatusCollection.php.

References ilLPStatus\$obj_id, ilLPStatusWrapper\_determineStatus(), ilObject\_lookupObjId(), and ILIAS\Repository\int().

540  : int
541  {
542  $status_info = self::_getStatusInfo($a_obj_id);
543  if (empty($status_info)) {
544  return 0;
545  }
546  $passed = 0;
547  foreach ($status_info['collections'] as $item_ref_id) {
548  $obj_id = ilObject::_lookupObjId($item_ref_id);
549  if (ilLPStatusWrapper::_determineStatus($obj_id, $a_usr_id) === self::LP_STATUS_COMPLETED_NUM) {
550  $passed++;
551  }
552  }
553  $percentage = 0;
554  if ($status_info["num_collections"] > 0) {
555  $percentage = (int) ((100.0 / $status_info["num_collections"]) * $passed);
556  }
557  return $percentage;
558  }
static _lookupObjId(int $ref_id)
static _determineStatus(int $a_obj_id, int $a_usr_id)
+ Here is the call graph for this function:

◆ determineStatus()

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

Definition at line 269 of file class.ilLPStatusCollection.php.

References $DIC, ilLPStatus\$ilObjDataCache, ilObjectLP\getInstance(), ilChangeEvent\hasAccessed(), and isMember().

273  : int {
274  global $DIC;
275 
276  $ilObjDataCache = $DIC['ilObjDataCache'];
277 
278  $status['completed'] = true;
279  $status['failed'] = false;
280  $status['in_progress'] = false;
281 
282  switch ($this->ilObjDataCache->lookupType($a_obj_id)) {
283  case "crs":
284  case "fold":
285  case "grp":
286  case "lso":
287  if (ilChangeEvent::hasAccessed($a_obj_id, $a_usr_id)) {
288  $status['in_progress'] = true;
289  }
290 
291  $olp = ilObjectLP::getInstance($a_obj_id);
292  $collection = $olp->getCollectionInstance();
293  $grouped_items = [];
294  if ($collection) {
295  $grouped_items = $collection->getGroupedItemsForLPStatus();
296  }
297  if (!count($grouped_items)) {
298  // #11513 - empty collections cannot be completed
299  $status['completed'] = false;
300  } else {
301  foreach ($grouped_items as $grouping_id => $grouping) {
302  $isGrouping = $grouping_id ? true : false;
303  $status = self::determineGroupingStatus(
304  $status,
305  $grouping,
306  $a_usr_id,
307  $isGrouping
308  );
309  }
310  }
311 
312  if ($status['completed']) {
313  if (!$this->isMember((int) $a_obj_id, (int) $a_usr_id)) {
314  return self::LP_STATUS_IN_PROGRESS_NUM;
315  }
316 
317  return self::LP_STATUS_COMPLETED_NUM;
318  }
319 
320  if ($status['failed']) {
321  return self::LP_STATUS_FAILED_NUM;
322  }
323 
324  if ($status['in_progress']) {
325  return self::LP_STATUS_IN_PROGRESS_NUM;
326  }
327  break;
328  }
329  return self::LP_STATUS_NOT_ATTEMPTED_NUM;
330  }
static hasAccessed(int $a_obj_id, int $a_usr_id)
Has accessed.
isMember(int $objId, int $usrId)
global $DIC
Definition: shib_login.php:22
ilObjectDataCache $ilObjDataCache
static getInstance(int $obj_id)
+ Here is the call graph for this function:

◆ getMembers()

static ilLPStatusCollection::getMembers ( int  $a_obj_id)
staticprotected

Get members for object.

Parameters
int$a_obj_id
Returns
int[]

Definition at line 426 of file class.ilLPStatusCollection.php.

References $DIC, ilLPStatus\$ilObjDataCache, ilObject\_getAllReferences(), ilCourseParticipants\_getInstanceByObjId(), ilLearningSequenceParticipants\_getInstanceByObjId(), ilGroupParticipants\_getInstanceByObjId(), ilObject\_lookupObjId(), ilTree\checkForParentType(), and ilObjectDataCache\lookupType().

426  : array
427  {
428  global $DIC;
429 
430  $ilObjDataCache = $DIC['ilObjDataCache'];
431  $tree = $DIC['tree'];
432 
433  switch ($ilObjDataCache->lookupType($a_obj_id)) {
434  case 'crs':
436  $a_obj_id
437  );
438  return $member_obj->getMembers();
439 
440  case 'grp':
442  $a_obj_id
443  );
444  return $member_obj->getMembers();
445 
446  case 'fold':
447  $folder_ref_ids = ilObject::_getAllReferences($a_obj_id);
448  $folder_ref_id = current($folder_ref_ids);
449  if ($crs_id = $tree->checkForParentType(
450  $folder_ref_id,
451  'crs'
452  )) {
454  ilObject::_lookupObjId($crs_id)
455  );
456  return $member_obj->getMembers();
457  }
458  if ($grp_id = $tree->checkForParentType(
459  $folder_ref_id,
460  'grp'
461  )) {
463  ilObject::_lookupObjId($grp_id)
464  );
465  return $member_obj->getMembers();
466  }
467  break;
468 
469  case 'lso':
471  $a_obj_id
472  );
473  return $member_obj->getMembers();
474  break;
475  }
476 
477  return array();
478  }
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupObjId(int $ref_id)
checkForParentType(int $a_ref_id, string $a_type, bool $a_exclude_source_check=false)
Check for parent type e.g check if a folder (ref_id 3) is in a parent course obj => checkForParentTyp...
static _getInstanceByObjId(int $a_obj_id)
global $DIC
Definition: shib_login.php:22
ilObjectDataCache $ilObjDataCache
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
+ Here is the call graph for this function:

◆ isMember()

ilLPStatusCollection::isMember ( int  $objId,
int  $usrId 
)
protected
Parameters
int$objId
int$usrId
Returns
bool

Definition at line 388 of file class.ilLPStatusCollection.php.

References ilObject\_getAllReferences(), ilCourseParticipant\_getInstanceByObjId(), ilLearningSequenceParticipants\_getInstanceByObjId(), ilGroupParticipants\_getInstanceByObjId(), and ilObject\_lookupObjId().

Referenced by determineStatus().

388  : bool
389  {
390  switch ($this->ilObjDataCache->lookupType($objId)) {
391  case 'crs':
392  $participants = ilCourseParticipant::_getInstanceByObjId($objId, $usrId);
393  return $participants->isMember();
394 
395  case 'grp':
397  return $participants->isMember($usrId);
398 
399  case 'fold':
400  $folderRefIds = ilObject::_getAllReferences($objId);
401  $folderRefId = current($folderRefIds);
402  if ($crsRefId = $this->tree->checkForParentType($folderRefId, 'crs')) {
403  $participants = ilCourseParticipant::_getInstanceByObjId(ilObject::_lookupObjId($crsRefId), $usrId);
404  return $participants->isMember();
405  }
406 
407  if ($grpRefId = $this->tree->checkForParentType($folderRefId, 'grp')) {
409  return $participants->isMember($usrId);
410  }
411  break;
412 
413  case 'lso':
415  return $participants->isMember($usrId);
416  }
417 
418  return true;
419  }
static _getInstanceByObjId(int $a_obj_id, int $a_usr_id)
static _getAllReferences(int $id)
get all reference ids for object ID
$objId
Definition: xapitoken.php:57
static _lookupObjId(int $ref_id)
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $tree

ilTree ilLPStatusCollection::$tree
private

Definition at line 27 of file class.ilLPStatusCollection.php.


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