ILIAS  release_7 Revision v7.30-3-g800a261c036
ilLearnerProgressDB Class Reference

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

+ Collaboration diagram for ilLearnerProgressDB:

Public Member Functions

 __construct (ilLSItemsDB $items_db, ilAccess $access, ilObjectDataCache $obj_data_cache)
 
 getLearnerItems (int $usr_id, int $container_ref_id)
 Decorate LSItems with learning progress and availability (from conditions) More...
 

Protected Member Functions

 getObjIdForRefId (int $ref_id)
 
 getLearningProgressFor (int $usr_id, LSItem $ls_item)
 
 isItemVisibleForUser (int $usr_id, LSItem $ls_item)
 
 getAvailabilityFor (int $usr_id, LSItem $ls_item)
 

Protected Attributes

 $items_db
 
 $access
 
 $obj_data_cache
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLearnerProgressDB::__construct ( ilLSItemsDB  $items_db,
ilAccess  $access,
ilObjectDataCache  $obj_data_cache 
)

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

29 {
30 $this->items_db = $items_db;
31 $this->access = $access;
32 $this->obj_data_cache = $obj_data_cache;
33 }

References $access, $items_db, and $obj_data_cache.

Member Function Documentation

◆ getAvailabilityFor()

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

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

82 : int
83 {
84 $this->access->clear(); //clear access cache; condition-checks refer to previous state otherwise.
85 $readable = $this->access->checkAccessOfUser($usr_id, 'read', '', $ls_item->getRefId());
86 if ($readable) {
88 }
90 }
getRefId()
Definition: LSItem.php:129

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

Referenced by getLearnerItems().

+ 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 
)

Decorate LSItems with learning progress and availability (from conditions)

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

37 : array
38 {
39 $items = [];
40 $ls_items = $this->items_db->getLSItems($container_ref_id);
41
42 foreach ($ls_items as $ls_item) {
43 if ($this->isItemVisibleForUser($usr_id, $ls_item) === false) {
44 continue;
45 }
46 $lp = $this->getLearningProgressFor($usr_id, $ls_item);
47 $av = $this->getAvailabilityFor($usr_id, $ls_item);
48 $items[] = new LSLearnerItem($usr_id, $lp, $av, $ls_item);
49 }
50
51 return $items;
52 }
Add learning progress and availability information to the LSItem.
isItemVisibleForUser(int $usr_id, LSItem $ls_item)
getLearningProgressFor(int $usr_id, LSItem $ls_item)
getAvailabilityFor(int $usr_id, LSItem $ls_item)

References getAvailabilityFor(), getLearningProgressFor(), and isItemVisibleForUser().

+ Here is the call graph for this function:

◆ getLearningProgressFor()

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

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

59 : int
60 {
61 $obj_id = $this->getObjIdForRefId($ls_item->getRefId());
62
64 if (ilObjectLP::isSupportedObjectType($this->obj_data_cache->lookupType($obj_id))) {
65 $il_lp_status = ilLPStatus::_lookupStatus($obj_id, $usr_id, true);
66 }
67 return (int) $il_lp_status;
68 }
static _lookupStatus($a_obj_id, $a_user_id, $a_create=true)
Lookup status.
const LP_STATUS_NOT_ATTEMPTED_NUM
static isSupportedObjectType($type)

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

Referenced by getLearnerItems().

+ 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 54 of file class.ilLearnerProgressDB.php.

54 : int
55 {
56 return (int) $this->obj_data_cache->lookupObjId($ref_id);
57 }

Referenced by getLearningProgressFor().

+ Here is the caller graph for this function:

◆ isItemVisibleForUser()

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

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

70 : bool
71 {
72 $online = $ls_item->isOnline();
73 $access = $this->access->checkAccessOfUser(
74 $usr_id,
75 "visible",
76 "",
77 $ls_item->getRefId()
78 );
79 return ($online && $access);
80 }
isOnline()
Definition: LSItem.php:93

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

Referenced by getLearnerItems().

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

Field Documentation

◆ $access

ilLearnerProgressDB::$access
protected

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

Referenced by __construct(), and isItemVisibleForUser().

◆ $items_db

ilLearnerProgressDB::$items_db
protected

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

Referenced by __construct().

◆ $obj_data_cache

ilLearnerProgressDB::$obj_data_cache
protected

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

Referenced by __construct().


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