ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
ILIAS\LegalDocuments\Condition\Definition\RoleDefinition Class Reference
+ Inheritance diagram for ILIAS\LegalDocuments\Condition\Definition\RoleDefinition:
+ Collaboration diagram for ILIAS\LegalDocuments\Condition\Definition\RoleDefinition:

Public Member Functions

 __construct (private readonly UI $ui, private readonly ilObjectDataCache $cache, private readonly ilRbacReview $review, private readonly Closure $required)
 
 formGroup (array $arguments=[])
 
 translatedRole (int $role)
 
 translatedType ()
 
 withCriterion (CriterionContent $criterion)
 

Private Member Functions

 radio (string $lang_key, array $options, $value)
 

Detailed Description

Definition at line 35 of file RoleDefinition.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\LegalDocuments\Condition\Definition\RoleDefinition::__construct ( private readonly UI  $ui,
private readonly ilObjectDataCache  $cache,
private readonly ilRbacReview  $review,
private readonly Closure  $required 
)
Parameters
Closure(array<int|string,mixed>)Constraint $required

Definition at line 40 of file RoleDefinition.php.

45  {
46  }

Member Function Documentation

◆ formGroup()

ILIAS\LegalDocuments\Condition\Definition\RoleDefinition::formGroup ( array  $arguments = [])

Implements ILIAS\LegalDocuments\ConditionDefinition.

Definition at line 48 of file RoleDefinition.php.

References ILIAS\LegalDocuments\Condition\Definition\RoleDefinition\radio(), SYSTEM_ROLE_ID, ILIAS\LegalDocuments\Condition\Definition\RoleDefinition\translatedRole(), and ILIAS\Repository\ui().

48  : Group
49  {
50  $roles = $this->review->getGlobalRoles();
51  $roles = array_combine($roles, array_map($this->translatedRole(...), $roles));
52  $default_role = isset($roles[SYSTEM_ROLE_ID]) ? SYSTEM_ROLE_ID : key($roles);
53 
54  return $this->ui->create()->input()->field()->group([
55  'role_id' => $this->radio(
56  $this->ui->txt('perm_global_role'),
57  $roles,
58  $arguments['role_id'] ?? $default_role
59  )->withRequired(true, ($this->required)($roles)),
60  ], $this->ui->txt('crit_type_usr_global_role'), $this->ui->txt('crit_type_usr_global_role_info'));
61  }
const SYSTEM_ROLE_ID
Definition: constants.php:29
radio(string $lang_key, array $options, $value)
+ Here is the call graph for this function:

◆ radio()

ILIAS\LegalDocuments\Condition\Definition\RoleDefinition::radio ( string  $lang_key,
array  $options,
  $value 
)
private
Parameters
array<string|int,string>$options

Definition at line 81 of file RoleDefinition.php.

References null, and ILIAS\Repository\ui().

Referenced by ILIAS\LegalDocuments\Condition\Definition\RoleDefinition\formGroup().

81  : Radio
82  {
83  $field = $this->ui->create()->input()->field()->radio($lang_key);
84  foreach ($options as $key => $label) {
85  $field = $field->withOption((string) $key, $label);
86  }
87  return $value === null ? $field : $field->withValue($value);
88  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ translatedRole()

ILIAS\LegalDocuments\Condition\Definition\RoleDefinition::translatedRole ( int  $role)

Definition at line 63 of file RoleDefinition.php.

Referenced by ILIAS\LegalDocuments\Condition\Definition\RoleDefinition\formGroup().

63  : string
64  {
65  return $this->cache->lookupTitle($role);
66  }
+ Here is the caller graph for this function:

◆ translatedType()

ILIAS\LegalDocuments\Condition\Definition\RoleDefinition::translatedType ( )

Implements ILIAS\LegalDocuments\ConditionDefinition.

Definition at line 68 of file RoleDefinition.php.

References ILIAS\Repository\ui().

68  : string
69  {
70  return $this->ui->txt('crit_type_usr_global_role');
71  }
+ Here is the call graph for this function:

◆ withCriterion()

ILIAS\LegalDocuments\Condition\Definition\RoleDefinition::withCriterion ( CriterionContent  $criterion)

Implements ILIAS\LegalDocuments\ConditionDefinition.

Definition at line 73 of file RoleDefinition.php.

References ILIAS\Repository\ui().

73  : Condition
74  {
75  return new Role($criterion, $this, $this->ui->create(), $this->review);
76  }
+ Here is the call graph for this function:

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