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

Handle LP-events. More...

+ Inheritance diagram for ilLSLPEventHandler:
+ Collaboration diagram for ilLSLPEventHandler:

Public Member Functions

 __construct (ilTree $tree, ilLPStatusWrapper $lp_status_wrapper)
 
 updateLPForChildEvent (array $parameter)
 

Protected Member Functions

 getParentLSOObjId (int $child_ref_id)
 get the LSO up from $child_ref_if More...
 
 getRefIdsOfObjId (int $triggerer_obj_id)
 

Protected Attributes

ilTree $tree
 
ilLPStatusWrapper $lpstatus
 
array $cached_parent_lso = []
 
array $cached_refs_for_obj = []
 

Private Member Functions

 getParentLSOIdFromTree (int $child_ref_id)
 

Detailed Description

Handle LP-events.

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

Constructor & Destructor Documentation

◆ __construct()

ilLSLPEventHandler::__construct ( ilTree  $tree,
ilLPStatusWrapper  $lp_status_wrapper 
)

Definition at line 31 of file class.ilLSLPEventHandler.php.

34 {
35 $this->tree = $tree;
36 $this->lpstatus = $lp_status_wrapper;
37 }

References $tree.

Member Function Documentation

◆ getParentLSOIdFromTree()

ilLSLPEventHandler::getParentLSOIdFromTree ( int  $child_ref_id)
private

Definition at line 62 of file class.ilLSLPEventHandler.php.

62 : ?int
63 {
64 $parent_nd = $this->tree->getParentNodeData($child_ref_id);
65 if (isset($parent_nd['type']) && $parent_nd['type'] === 'lso') {
66 return (int) $parent_nd['obj_id'];
67 }
68 return null;
69 }

Referenced by getParentLSOObjId().

+ Here is the caller graph for this function:

◆ getParentLSOObjId()

ilLSLPEventHandler::getParentLSOObjId ( int  $child_ref_id)
protected

get the LSO up from $child_ref_if

Definition at line 54 of file class.ilLSLPEventHandler.php.

54 : ?int
55 {
56 if (!array_key_exists($child_ref_id, $this->cached_parent_lso)) {
57 $this->cached_parent_lso[$child_ref_id] = $this->getParentLSOIdFromTree($child_ref_id);
58 }
59 return $this->cached_parent_lso[$child_ref_id];
60 }
getParentLSOIdFromTree(int $child_ref_id)

References getParentLSOIdFromTree().

Referenced by updateLPForChildEvent().

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

◆ getRefIdsOfObjId()

ilLSLPEventHandler::getRefIdsOfObjId ( int  $triggerer_obj_id)
protected
Returns
array<int|string>

Reimplemented in ilLSLPEventHandlerStub.

Definition at line 74 of file class.ilLSLPEventHandler.php.

74 : array
75 {
76 if (!array_key_exists($triggerer_obj_id, $this->cached_refs_for_obj)) {
77 $this->cached_refs_for_obj[$triggerer_obj_id] = ilObject::_getAllReferences($triggerer_obj_id);
78 }
79 return $this->cached_refs_for_obj[$triggerer_obj_id];
80 }
static _getAllReferences(int $id)
get all reference ids for object ID

References ilObject\_getAllReferences().

Referenced by updateLPForChildEvent().

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

◆ updateLPForChildEvent()

ilLSLPEventHandler::updateLPForChildEvent ( array  $parameter)

Definition at line 39 of file class.ilLSLPEventHandler.php.

39 : void
40 {
41 $refs = $this->getRefIdsOfObjId((int) $parameter['obj_id']);
42 foreach ($refs as $ref_id) {
43 $lso_id = $this->getParentLSOObjId((int) $ref_id);
44 if ($lso_id !== null) {
45 $usr_id = $parameter['usr_id'];
46 $this->lpstatus::_updateStatus($lso_id, $usr_id);
47 }
48 }
49 }
getParentLSOObjId(int $child_ref_id)
get the LSO up from $child_ref_if
getRefIdsOfObjId(int $triggerer_obj_id)
$ref_id
Definition: ltiauth.php:66

References $ref_id, getParentLSOObjId(), and getRefIdsOfObjId().

+ Here is the call graph for this function:

Field Documentation

◆ $cached_parent_lso

array ilLSLPEventHandler::$cached_parent_lso = []
protected

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

◆ $cached_refs_for_obj

array ilLSLPEventHandler::$cached_refs_for_obj = []
protected

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

◆ $lpstatus

ilLPStatusWrapper ilLSLPEventHandler::$lpstatus
protected

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

◆ $tree

ilTree ilLSLPEventHandler::$tree
protected

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

Referenced by __construct().


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