79 {
80 $policy_id = null;
81 $upload_policy = null;
82
83
85 $policy_id = $this->
http->wrapper()->query()->retrieve(
88 );
89 $upload_policy = $this->upload_policy_db_repository->get($policy_id);
90 }
91
92
93 $policy_id_hidden_input = $this->ui_factory->input()->field()->hidden()->withValue((string) $policy_id);
94
95
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)
99 )->withValue(
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)
105 )->withValue(
106 $upload_policy?->getUploadLimitInMB()
107 )->withRequired(true);
108 $general_section = $this->ui_factory->input()->field()->section(
109 [
110 self::INPUT_FIELD_TITLE => $policy_title_input,
111 self::INPUT_FIELD_UPLOAD_LIMIT => $upload_limit_input
112 ],
113 $this->
language->txt(self::LABEL_INPUT_SECTION_GENERAL)
114 );
115
116
117 $all_users_option = $this->ui_factory->input()->field()->group(
118 [],
119 $this->
language->txt(self::LABEL_INPUT_OPTION_ALL_USERS),
120 $this->language->txt(self::BYLINE_INPUT_OPTION_ALL_USERS)
121 );
122 $global_role_input = $this->ui_factory->input()->field()->multiSelect(
123 $this->
language->txt(self::LABEL_INPUT_FIELD_GLOBAL_ROLES) .
":",
124 $this->getGlobalRoles()
125 )->withValue(
126 $upload_policy?->getAudience()['global_roles'] ?? []
127 );
128 $global_roles_option = $this->ui_factory->input()->field()->group(
129 [
130 self::INPUT_FIELD_GLOBAL_ROLES => $global_role_input
131 ],
132 $this->
language->txt(self::LABEL_INPUT_OPTION_GLOBAL_ROLES),
133 $this->language->txt(self::BYLINE_INPUT_OPTION_GLOBAL_ROLES)
134 );
135 $audience_input = $this->ui_factory->input()->field()->switchableGroup(
136 [
137 self::INPUT_OPTION_ALL_USERS => $all_users_option,
138 self::INPUT_OPTION_GLOBAL_ROLES => $global_roles_option
139 ],
140 $this->
language->txt(self::LABEL_INPUT_FIELD_AUDIENCE)
141 )->withValue(
143 )->withRequired(true);
144 $audience_section = $this->ui_factory->input()->field()->section(
145 [
146 self::INPUT_FIELD_AUDIENCE => $audience_input
147 ],
148 $this->
language->txt(self::LABEL_INPUT_SECTION_AUDIENCE)
149 )->withAdditionalTransformation(
151 );
152
153
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)
157 )->withValue(
158 $upload_policy?->getValidUntil()
159 );
160 $active_input = $this->ui_factory->input()->field()->checkbox(
161 $this->
language->txt(self::LABEL_INPUT_FIELD_ACTIVE)
162 )->withValue(
163 $upload_policy?->isActive()
164 );
165 $validity_section = $this->ui_factory->input()->field()->section(
166 [
167 self::INPUT_FIELD_VALID_UNTIL => $valid_until_input,
168 self::INPUT_FIELD_ACTIVE => $active_input
169 ],
170 $this->
language->txt(self::LABEL_INPUT_SECTION_VALIDITY)
171 );
172
173
174 $this->
form = $this->ui_factory->input()->container()->form()->standard(
176 [
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,
181 ]
182 );
183 }
const AUDIENCE_TYPE_GLOBAL_ROLE
const CMD_SAVE_UPLOAD_POLICY
static http()
Fetches the global http state from ILIAS.
form( $class_path, string $cmd, string $submit_caption="")