19 declare(strict_types=1);
46 $this->
lng->loadLanguageModule(
'rbac');
52 $option->
setInfo($this->
lng->txt(
'tos_crit_type_usr_global_role_info'));
55 $this->
lng->txt(
'perm_global_role'),
56 $this->type->getTypeIdent() .
'_role_id' 58 $roleSelection->setRequired(
true);
61 foreach ($this->rbacReview->getGlobalRoles() as $roleId) {
62 $options[$roleId] = $this->objectCache->lookupTitle($roleId);
65 natcasesort($options);
67 $roleSelection->setOptions([
'' => $this->
lng->txt(
'please_choose')] + $options);
68 $roleSelection->setValue((
string) ((
int) ($config[
'role_id'] ?? 0)));
70 $option->addSubItem($roleSelection);
78 'role_id' => (
int) $form->
getInput($this->type->getTypeIdent() .
'_role_id')
86 return $this->
lng->txt(
'tos_crit_type_usr_global_role');
91 $roleId = $config[
'role_id'] ?? 0;
93 if (!is_numeric($roleId) || $roleId < 1 || $roleId > PHP_INT_MAX || is_float($roleId)) {
94 return $uiFactory->
legacy(
'');
97 $roleId = (
int) $roleId;
98 if (!in_array($roleId, $this->rbacReview->getGlobalRoles(),
true)) {
99 return $uiFactory->
legacy($this->
lng->txt(
'deleted'));
102 return $uiFactory->
legacy($this->objectCache->lookupTitle($roleId));
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface ilTermsOfServiceCriterionTypeGUI.
Class ilTermsOfServiceUserHasGlobalRoleCriterion.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
legacy(string $content)
description: purpose: > This component is used to wrap an existing ILIAS UI element into a UI compon...
Class ilTermsOfServiceCriterionConfig.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
appendOption(ilRadioGroupInputGUI $group, ilTermsOfServiceCriterionConfig $config)
ilObjectDataCache $objectCache
Class ilTermsOfServiceUserHasGlobalRoleCriterionGUI.
__construct(ilTermsOfServiceUserHasGlobalRoleCriterion $type, ilLanguage $lng, ilRbacReview $rbacReview, ilObjectDataCache $objectCache)
getValuePresentation(ilTermsOfServiceCriterionConfig $config, Factory $uiFactory)
ilTermsOfServiceUserHasGlobalRoleCriterion $type
getConfigByForm(ilPropertyFormGUI $form)