ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilLSLPEventHandler.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
12{
16 protected $tree;
20 protected $lpstatus;
21
22
23 public function __construct(
25 ilLPStatusWrapper $lp_status_wrapper
26 ) {
27 $this->tree = $tree;
28 $this->lpstatus = $lp_status_wrapper;
29 }
30
31 public function updateLPForChildEvent(array $parameter)
32 {
33 $refs = $this->getRefIdsOfObjId((int) $parameter['obj_id']);
34 foreach ($refs as $ref_id) {
35 $lso_info = $this->getParentLSO((int) $ref_id);
36 if ($lso_info !== false) {
37 $obj_id = $lso_info['obj_id'];
38 $usr_id = $parameter['usr_id'];
39 $this->lpstatus::_refreshStatus($obj_id, [$usr_id]);
40 }
41 }
42 }
43
48 protected function getParentLSO(int $child_ref_id)
49 {
50 $path = $this->tree->getPathFull($child_ref_id);
51 if (!$path) {
52 return false;
53 }
54
55 foreach ($path as $hop) {
56 if ($hop['type'] === 'lso') {
57 return $hop;
58 }
59 }
60 return false;
61 }
62
63 protected function getRefIdsOfObjId(int $triggerer_obj_id) : array
64 {
65 return ilObject::_getAllReferences($triggerer_obj_id);
66 }
67}
$path
Definition: aliased.php:25
An exception for terminatinating execution or to throw for unit testing.
Class ilLPStatusWrapper This class is wrapper for all ilLPStatus classes.
__construct(ilTree $tree, ilLPStatusWrapper $lp_status_wrapper)
getParentLSO(int $child_ref_id)
get the LSO up from $child_ref_if
getRefIdsOfObjId(int $triggerer_obj_id)
updateLPForChildEvent(array $parameter)
static _getAllReferences($a_id)
get all reference ids of object
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...