ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLearnerProgressDB Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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.

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

34  {
35  $this->items_db = $items_db;
36  $this->access = $access;
37  $this->obj_data_cache = $obj_data_cache;
38  }
ilObjectDataCache $obj_data_cache
+ 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.

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().

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:90
+ 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.

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

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  }
getLearningProgressFor(int $usr_id, LSItem $ls_item)
isItemVisibleForUser(int $usr_id, LSItem $ls_item)
getAvailabilityFor(int $usr_id, LSItem $ls_item)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ 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(), LSItem\getRefId(), ilObjectLP\isSupportedObjectType(), and ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM.

Referenced by getLearnerItems().

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  }
static isSupportedObjectType(string $type)
getRefId()
Definition: LSItem.php:90
static _lookupStatus(int $a_obj_id, int $a_user_id, bool $a_create=true)
Lookup status.
const LP_STATUS_NOT_ATTEMPTED_NUM
+ 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.

References ilObject\_lookupObjId().

Referenced by getLearningProgressFor().

62  : int
63  {
65  }
static _lookupObjId(int $ref_id)
$ref_id
Definition: ltiauth.php:67
+ 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.

References ILIAS\Repository\access(), LSItem\getRefId(), and LSItem\isOnline().

Referenced by getLearnerItems().

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  }
getRefId()
Definition: LSItem.php:90
isOnline()
Definition: LSItem.php:75
+ 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().

◆ $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: