19 declare(strict_types=1);
40 private readonly
UI $ui,
43 private readonly
Closure $required
49 $roles = $this->review->getGlobalRoles();
50 $roles = array_combine($roles, array_map($this->
translatedRole(...), $roles));
53 return $this->
ui->create()->input()->field()->group([
54 'role_id' => $this->
radio(
55 $this->
ui->txt(
'perm_global_role'),
57 $arguments[
'role_id'] ?? $default_role
58 )->withRequired(
true, ($this->required)($roles)),
59 ], $this->
ui->txt(
'crit_type_usr_global_role'), $this->
ui->txt(
'crit_type_usr_global_role_info'));
64 return $this->cache->lookupTitle($role);
69 return $this->
ui->txt(
'crit_type_usr_global_role');
74 return new Role($criterion, $this, $this->
ui->create(), $this->review);
80 private function radio($lang_key, array $options, $value)
82 $field = $this->
ui->create()->input()->field()->radio($lang_key);
83 foreach ($options as
$key => $label) {
84 $field = $field->withOption((
string)
$key, $label);
86 return $value === null ? $field : $field->withValue($value);
withCriterion(CriterionContent $criterion)
__construct(private readonly UI $ui, private readonly ilObjectDataCache $cache, private readonly ilRbacReview $review, private readonly Closure $required)
radio($lang_key, array $options, $value)
translatedRole(int $role)
formGroup(array $arguments=[])