ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilLearnerProgressDB Class Reference

Get LearningProgress and availability of items in sequence. More...

+ Collaboration diagram for ilLearnerProgressDB:

Public Member Functions

 __construct (ilLSStateDB $state_db, ilAccess $access)
 
 getLearnerItems (int $usr_id, int $container_ref_id, array $ls_items)
 Decorate LSItems with learning progress, availability (from conditions) kiosk-mode state information. More...
 

Protected Member Functions

 getLPStatusRefresher ()
 
 getObjIdForRefId (int $ref_id)
 
 getStateFor (LSItem $ls_item, array $states)
 
 getLearningProgressFor (int $usr_id, LSItem $ls_item)
 
 isItemVisibleForUser (int $usr_id, LSItem $ls_item)
 
 getAvailabilityFor (int $usr_id, LSItem $ls_item)
 

Protected Attributes

 $state_db
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLearnerProgressDB::__construct ( ilLSStateDB  $state_db,
ilAccess  $access 
)

Definition at line 18 of file class.ilLearnerProgressDB.php.

References $state_db.

19  {
20  $this->state_db = $state_db;
21  $this->access = $access;
22  }

Member Function Documentation

◆ getAvailabilityFor()

ilLearnerProgressDB::getAvailabilityFor ( int  $usr_id,
LSItem  $ls_item 
)
protected

Definition at line 92 of file class.ilLearnerProgressDB.php.

References ILIAS\UI\Component\Listing\Workflow\Step\AVAILABLE, LSItem\getRefId(), and ILIAS\UI\Component\Listing\Workflow\Step\NOT_AVAILABLE.

Referenced by getLearnerItems().

92  : int
93  {
94  $readable = $this->access->checkAccessOfUser($usr_id, 'read', '', $ls_item->getRefId());
95  if ($readable) {
97  }
98 
100  }
getRefId()
Definition: LSItem.php:129
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLearnerItems()

ilLearnerProgressDB::getLearnerItems ( int  $usr_id,
int  $container_ref_id,
array  $ls_items 
)

Decorate LSItems with learning progress, availability (from conditions) kiosk-mode state information.

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

References $state, getAvailabilityFor(), getLPStatusRefresher(), getStateFor(), and isItemVisibleForUser().

28  : array
29  {
30  $items = [];
31  $states = $this->state_db->getStatesFor($container_ref_id, [$usr_id]);
32  foreach ($ls_items as $ls_item) {
33  if ($this->isItemVisibleForUser($usr_id, $ls_item) === false) {
34  continue;
35  }
36  $lp_refresher = $this->getLPStatusRefresher();
37  $av = $this->getAvailabilityFor($usr_id, $ls_item);
38  $state = $this->getStateFor($ls_item, $states[$usr_id]);
39  $items[] = new LSLearnerItem($usr_id, $lp_refresher, $av, $state, $ls_item);
40  }
41 
42  return $items;
43  }
isItemVisibleForUser(int $usr_id, LSItem $ls_item)
getAvailabilityFor(int $usr_id, LSItem $ls_item)
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
getStateFor(LSItem $ls_item, array $states)
Add learning progress and availability information to the LSItem.
+ Here is the call graph for this function:

◆ getLearningProgressFor()

ilLearnerProgressDB::getLearningProgressFor ( int  $usr_id,
LSItem  $ls_item 
)
protected

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

References ilLPStatus\_lookupStatus(), getObjIdForRefId(), and LSItem\getRefId().

67  : int
68  {
69  $obj_id = $this->getObjIdForRefId($ls_item->getRefId());
70  $il_lp_status = ilLPStatus::_lookupStatus($obj_id, $usr_id, true);
71 
72  return (int) $il_lp_status;
73  }
getRefId()
Definition: LSItem.php:129
static _lookupStatus($a_obj_id, $a_user_id, $a_create=true)
Lookup status.
+ Here is the call graph for this function:

◆ getLPStatusRefresher()

ilLearnerProgressDB::getLPStatusRefresher ( )
protected

Definition at line 45 of file class.ilLearnerProgressDB.php.

References ilObject\_lookupObjId(), and ilLPStatus\_lookupStatus().

Referenced by getLearnerItems().

45  : \Closure {
46  return function(int $ref_id, int $usr_id) {
47  $obj_id = ilObject::_lookupObjId($ref_id);
48  return (int)ilLPStatus::_lookupStatus($obj_id, $usr_id, true);
49  };
50  }
static _lookupObjId($a_id)
static _lookupStatus($a_obj_id, $a_user_id, $a_create=true)
Lookup status.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjIdForRefId()

ilLearnerProgressDB::getObjIdForRefId ( int  $ref_id)
protected

Definition at line 53 of file class.ilLearnerProgressDB.php.

References ilObject\_lookupObjId().

Referenced by getLearningProgressFor().

53  : int
54  {
55  return (int) ilObject::_lookupObjId($ref_id);
56  }
static _lookupObjId($a_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStateFor()

ilLearnerProgressDB::getStateFor ( LSItem  $ls_item,
array  $states 
)
protected

Definition at line 58 of file class.ilLearnerProgressDB.php.

References LSItem\getRefId().

Referenced by getLearnerItems().

59  {
60  if (array_key_exists($ls_item->getRefId(), $states)) {
61  return $states[$ls_item->getRefId()];
62  }
63 
64  return new ILIAS\KioskMode\State();
65  }
getRefId()
Definition: LSItem.php:129
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isItemVisibleForUser()

ilLearnerProgressDB::isItemVisibleForUser ( int  $usr_id,
LSItem  $ls_item 
)
protected

Definition at line 75 of file class.ilLearnerProgressDB.php.

References LSItem\getRefId(), and LSItem\isOnline().

Referenced by getLearnerItems().

75  : bool
76  {
77  $online = $ls_item->isOnline();
78  $access = $this->access->checkAccessOfUser(
79  $usr_id,
80  "visible",
81  "",
82  $ls_item->getRefId()
83  );
84 
85  if (!($online && $access)) {
86  return false;
87  }
88 
89  return true;
90  }
getRefId()
Definition: LSItem.php:129
isOnline()
Definition: LSItem.php:93
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $state_db

ilLearnerProgressDB::$state_db
protected

Definition at line 16 of file class.ilLearnerProgressDB.php.

Referenced by __construct().


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