19declare(strict_types=1);
74 protected HttpServices
$http,
78 protected UIFactory $ui_factory
81 $upload_policy =
null;
85 $policy_id = $this->
http->wrapper()->query()->retrieve(
89 $upload_policy = $this->upload_policy_db_repository->get($policy_id);
93 $policy_id_hidden_input = $this->ui_factory->input()->field()->hidden()->withValue((
string) $policy_id);
96 $policy_title_input = $this->ui_factory->input()->field()->text(
97 $this->
language->txt(self::LABEL_INPUT_FIELD_TITLE),
98 $this->language->txt(self::BYLINE_INPUT_FIELD_TITLE)
101 )->withRequired(
true);
102 $upload_limit_input = $this->ui_factory->input()->field()->numeric(
103 $this->
language->txt(self::LABEL_INPUT_FIELD_UPLOAD_LIMIT),
104 $this->language->txt(self::BYLINE_INPUT_FIELD_UPLOAD_LIMIT)
106 $upload_policy?->getUploadLimitInMB()
107 )->withRequired(
true);
108 $general_section = $this->ui_factory->input()->field()->section(
110 self::INPUT_FIELD_TITLE => $policy_title_input,
111 self::INPUT_FIELD_UPLOAD_LIMIT => $upload_limit_input
113 $this->
language->txt(self::LABEL_INPUT_SECTION_GENERAL)
117 $all_users_option = $this->ui_factory->input()->field()->group(
119 $this->
language->txt(self::LABEL_INPUT_OPTION_ALL_USERS),
120 $this->language->txt(self::BYLINE_INPUT_OPTION_ALL_USERS)
122 $global_role_input = $this->ui_factory->input()->field()->multiSelect(
123 $this->
language->txt(self::LABEL_INPUT_FIELD_GLOBAL_ROLES) .
":",
124 $this->getGlobalRoles()
126 $upload_policy?->getAudience()[
'global_roles'] ?? []
128 $global_roles_option = $this->ui_factory->input()->field()->group(
130 self::INPUT_FIELD_GLOBAL_ROLES => $global_role_input
132 $this->
language->txt(self::LABEL_INPUT_OPTION_GLOBAL_ROLES),
133 $this->language->txt(self::BYLINE_INPUT_OPTION_GLOBAL_ROLES)
135 $audience_input = $this->ui_factory->input()->field()->switchableGroup(
137 self::INPUT_OPTION_ALL_USERS => $all_users_option,
138 self::INPUT_OPTION_GLOBAL_ROLES => $global_roles_option
140 $this->
language->txt(self::LABEL_INPUT_FIELD_AUDIENCE)
143 )->withRequired(
true);
144 $audience_section = $this->ui_factory->input()->field()->section(
146 self::INPUT_FIELD_AUDIENCE => $audience_input
148 $this->
language->txt(self::LABEL_INPUT_SECTION_AUDIENCE)
149 )->withAdditionalTransformation(
154 $valid_until_input = $this->ui_factory->input()->field()->dateTime(
155 $this->
language->txt(self::LABEL_INPUT_FIELD_VALID_UNTIL),
156 $this->language->txt(self::BYLINE_INPUT_FIELD_VALID_UNTIL)
158 $upload_policy?->getValidUntil()
160 $active_input = $this->ui_factory->input()->field()->checkbox(
161 $this->
language->txt(self::LABEL_INPUT_FIELD_ACTIVE)
163 $upload_policy?->isActive()
165 $validity_section = $this->ui_factory->input()->field()->section(
167 self::INPUT_FIELD_VALID_UNTIL => $valid_until_input,
168 self::INPUT_FIELD_ACTIVE => $active_input
170 $this->
language->txt(self::LABEL_INPUT_SECTION_VALIDITY)
174 $this->
form = $this->ui_factory->input()->container()->form()->standard(
177 self::INPUT_SECTION_GENERAL => $general_section,
178 self::INPUT_SECTION_AUDIENCE => $audience_section,
179 self::INPUT_SECTION_VALIDITY => $validity_section,
180 self::HIDDEN_INPUT_POLICY_ID => $policy_id_hidden_input,
194 $global_roles = $this->rbac_review->getRolesForIDs(
195 $this->rbac_review->getGlobalRoles(),
200 foreach ($global_roles as $global_role) {
201 $roles[$global_role[
'rol_id']] = $global_role[
'title'];
209 return $this->
refinery->custom()->transformation(
function (array $audience_section): array {
210 $audience_type = match ($audience_section[self::INPUT_FIELD_AUDIENCE][0]) {
216 self::INPUT_FIELD_AUDIENCE_TYPE => $audience_type,
Builds a Color from either hex- or rgb values.
const AUDIENCE_TYPE_GLOBAL_ROLE
const AUDIENCE_TYPE_ALL_USERS
class ilRbacReview Contains Review functions of core Rbac.
const CMD_SAVE_UPLOAD_POLICY
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.
form( $class_path, string $cmd, string $submit_caption="")