19declare(strict_types=1);
41 private readonly
UI $ui,
44 private readonly Closure $required
50 $roles = $this->review->getGlobalRoles();
51 $roles = array_combine($roles, array_map($this->
translatedRole(...), $roles));
54 return $this->
ui->create()->input()->field()->group([
55 'role_id' => $this->
radio(
56 $this->
ui->txt(
'perm_global_role'),
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'));
65 return $this->cache->lookupTitle($role);
70 return $this->
ui->txt(
'crit_type_usr_global_role');
75 return new Role($criterion, $this, $this->
ui->create(), $this->review);
81 private function radio(
string $lang_key, array $options, $value):
Radio
83 $field = $this->
ui->create()->input()->field()->radio($lang_key);
84 foreach ($options as $key => $label) {
85 $field = $field->withOption((
string) $key, $label);
87 return $value ===
null ? $field : $field->withValue($value);
radio(string $lang_key, array $options, $value)
formGroup(array $arguments=[])
withCriterion(CriterionContent $criterion)
translatedRole(int $role)
__construct(private readonly UI $ui, private readonly ilObjectDataCache $cache, private readonly ilRbacReview $review, private readonly Closure $required)
class ilRbacReview Contains Review functions of core Rbac.
A constraint encodes some resrtictions on values.