ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLearnerProgressDB Class Reference

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

+ Inheritance diagram for ilLearnerProgressDB:
+ 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

ilLSItemsDB $items_db
 
ilAccess $access
 
ilObjectDataCache $obj_data_cache
 

Detailed Description

Get LearningProgress and availability of items in sequence.

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

Constructor & Destructor Documentation

◆ __construct()

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

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

34 {
35 $this->items_db = $items_db;
36 $this->access = $access;
37 $this->obj_data_cache = $obj_data_cache;
38 }
ilObjectDataCache $obj_data_cache

References $access, $items_db, $obj_data_cache, and ILIAS\Repository\access().

+ Here is the call graph for this function:

Member Function Documentation

◆ getAvailabilityFor()

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

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

90 : int
91 {
92 $this->access->clear(); //clear access cache; condition-checks refer to previous state otherwise.
93 $readable = $this->access->checkAccessOfUser($usr_id, 'read', '', $ls_item->getRefId());
94 if ($readable) {
96 }
98 }
getRefId()
Definition: LSItem.php:93

References ILIAS\Repository\access(), 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)

Returns
LSLearnerItem[]|[]

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

45 : array
46 {
47 $items = [];
48 $ls_items = $this->items_db->getLSItems($container_ref_id);
49
50 foreach ($ls_items as $ls_item) {
51 if ($this->isItemVisibleForUser($usr_id, $ls_item) === false) {
52 continue;
53 }
54 $lp = $this->getLearningProgressFor($usr_id, $ls_item);
55 $av = $this->getAvailabilityFor($usr_id, $ls_item);
56 $items[] = new LSLearnerItem($usr_id, $lp, $av, $ls_item);
57 }
58
59 return $items;
60 }
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

Reimplemented in ilLearnerProgressDBStub.

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

67 : int
68 {
69 $obj_id = $this->getObjIdForRefId($ls_item->getRefId());
70
72 if (ilObjectLP::isSupportedObjectType($this->obj_data_cache->lookupType($obj_id))) {
73 $il_lp_status = ilLPStatus::_lookupStatus($obj_id, $usr_id, true);
74 }
75 return (int) $il_lp_status;
76 }
const LP_STATUS_NOT_ATTEMPTED_NUM
static _lookupStatus(int $a_obj_id, int $a_user_id, bool $a_create=true)
Lookup status.
static isSupportedObjectType(string $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 62 of file class.ilLearnerProgressDB.php.

62 : int
63 {
65 }
static _lookupObjId(int $ref_id)
$ref_id
Definition: ltiauth.php:66

References $ref_id, and ilObject\_lookupObjId().

Referenced by getLearningProgressFor().

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

78 : bool
79 {
80 $online = $ls_item->isOnline();
81 $access = $this->access->checkAccessOfUser(
82 $usr_id,
83 "visible",
84 "",
85 $ls_item->getRefId()
86 );
87 return ($online && $access);
88 }
isOnline()
Definition: LSItem.php:78

References $access, ILIAS\Repository\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

ilAccess ilLearnerProgressDB::$access
protected

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

Referenced by __construct(), and isItemVisibleForUser().

◆ $items_db

ilLSItemsDB ilLearnerProgressDB::$items_db
protected

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

Referenced by __construct().

◆ $obj_data_cache

ilObjectDataCache ilLearnerProgressDB::$obj_data_cache
protected

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

Referenced by __construct().


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