ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ILIAS\Category\AssignedRolesRetrieval Class Reference
+ Inheritance diagram for ILIAS\Category\AssignedRolesRetrieval:
+ Collaboration diagram for ILIAS\Category\AssignedRolesRetrieval:

Public Member Functions

 __construct (protected InternalDomainService $domain, protected int $ref_id, protected int $managed_user_id, protected int $managing_user_id)
 
 isFieldNumeric (string $field)
 
 getData (array $fields, ?Range $range=null, ?Order $order=null, array $filter=[], array $parameters=[])
 
 count (array $filter, array $parameters)
 

Protected Attributes

array $data = []
 

Detailed Description

Definition at line 28 of file AssignedRolesRetrieval.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Category\AssignedRolesRetrieval::__construct ( protected InternalDomainService  $domain,
protected int  $ref_id,
protected int  $managed_user_id,
protected int  $managing_user_id 
)

Definition at line 34 of file AssignedRolesRetrieval.php.

39  {
40  }

Member Function Documentation

◆ count()

ILIAS\Category\AssignedRolesRetrieval::count ( array  $filter,
array  $parameters 
)

Definition at line 92 of file AssignedRolesRetrieval.php.

92  : int
93  {
94  return count($this->data);
95  }
count(array $filter, array $parameters)

◆ getData()

ILIAS\Category\AssignedRolesRetrieval::getData ( array  $fields,
?Range  $range = null,
?Order  $order = null,
array  $filter = [],
array  $parameters = [] 
)

Definition at line 48 of file AssignedRolesRetrieval.php.

References $lng, ILIAS\UI\Implementation\Component\Table\$range, and ilObjectFactory\getInstanceByObjId().

54  : \Generator {
55 
56  $rbacreview = $this->domain->rbac()->review();
57  $roles = $this->domain->assignedRolesManager(
58  $this->ref_id,
59  $this->managed_user_id,
60  $this->managing_user_id
61  )->getAssignableRoles();
62  $ass_roles = $rbacreview->assignedRoles($this->managed_user_id);
63  $lng = $this->domain->lng();
64 
65  $data = [];
66  foreach ($roles as $role) {
67  $role_obj = \ilObjectFactory::getInstanceByObjId((int) $role['obj_id']);
68 
69  $assigned = in_array((int) $role['obj_id'], $ass_roles, true);
70  $title = $role_obj?->getTitle() ?: "";
71  $desc = $role_obj?->getDescription() ?: "";
72  $type = ($role['role_type'] ?? '') === 'global' ?
73  $lng->txt('global') :
74  $lng->txt('local');
75  $data[] = [
76  "assigned" => $assigned,
77  "desc" => $desc,
78  "title" => $title,
79  "id" => $role['obj_id'],
80  "type" => $type
81  ];
82  }
83 
84  $data = $this->applyOrder($data, $order);
85  $this->data = $this->applyRange($data, $range);
86 
87  foreach ($this->data as $row) {
88  yield $row;
89  }
90  }
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

◆ isFieldNumeric()

ILIAS\Category\AssignedRolesRetrieval::isFieldNumeric ( string  $field)

Definition at line 43 of file AssignedRolesRetrieval.php.

43  : bool
44  {
45  return in_array($field, ['id', 'obj_id', 'ref_id']);
46  }

Field Documentation

◆ $data

array ILIAS\Category\AssignedRolesRetrieval::$data = []
protected

Definition at line 32 of file AssignedRolesRetrieval.php.


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