18 declare(strict_types=1);
    80         $upload_policy = null;
    84             $policy_id = $this->
http->wrapper()->query()->retrieve(
    88             $upload_policy = $this->upload_policy_db_repository->get($policy_id);
    92         $policy_id_hidden_input = $this->ui_factory->input()->field()->hidden()->withValue((
string) $policy_id);
    95         $policy_title_input = $this->ui_factory->input()->field()->text(
    96             $this->
language->txt(self::LABEL_INPUT_FIELD_TITLE),
    97             $this->
language->txt(self::BYLINE_INPUT_FIELD_TITLE)
   100         )->withRequired(
true);
   101         $upload_limit_input = $this->ui_factory->input()->field()->numeric(
   102             $this->
language->txt(self::LABEL_INPUT_FIELD_UPLOAD_LIMIT),
   103             $this->
language->txt(self::BYLINE_INPUT_FIELD_UPLOAD_LIMIT)
   105             $upload_policy?->getUploadLimitInMB()
   106         )->withRequired(
true);
   107         $general_section = $this->ui_factory->input()->field()->section(
   109                 self::INPUT_FIELD_TITLE => $policy_title_input,
   110                 self::INPUT_FIELD_UPLOAD_LIMIT => $upload_limit_input
   112             $this->
language->txt(self::LABEL_INPUT_SECTION_GENERAL)
   116         $all_users_option = $this->ui_factory->input()->field()->group(
   118             $this->
language->txt(self::LABEL_INPUT_OPTION_ALL_USERS),
   119             $this->
language->txt(self::BYLINE_INPUT_OPTION_ALL_USERS)
   121         $global_role_input = $this->ui_factory->input()->field()->multiSelect(
   122             $this->
language->txt(self::LABEL_INPUT_FIELD_GLOBAL_ROLES) . 
":",
   125             $upload_policy?->getAudience()[
'global_roles'] ?? []
   127         $global_roles_option = $this->ui_factory->input()->field()->group(
   129                 self::INPUT_FIELD_GLOBAL_ROLES => $global_role_input
   131             $this->
language->txt(self::LABEL_INPUT_OPTION_GLOBAL_ROLES),
   132             $this->
language->txt(self::BYLINE_INPUT_OPTION_GLOBAL_ROLES)
   134         $audience_input = $this->ui_factory->input()->field()->switchableGroup(
   136                 self::INPUT_OPTION_ALL_USERS => $all_users_option,
   137                 self::INPUT_OPTION_GLOBAL_ROLES => $global_roles_option
   139             $this->
language->txt(self::LABEL_INPUT_FIELD_AUDIENCE)
   142         )->withRequired(
true);
   143         $audience_section = $this->ui_factory->input()->field()->section(
   145                 self::INPUT_FIELD_AUDIENCE => $audience_input
   147             $this->
language->txt(self::LABEL_INPUT_SECTION_AUDIENCE)
   153         $valid_until_input = $this->ui_factory->input()->field()->dateTime(
   154             $this->
language->txt(self::LABEL_INPUT_FIELD_VALID_UNTIL),
   155             $this->
language->txt(self::BYLINE_INPUT_FIELD_VALID_UNTIL)
   157             $upload_policy?->getValidUntil()
   159         $active_input = $this->ui_factory->input()->field()->checkbox(
   160             $this->
language->txt(self::LABEL_INPUT_FIELD_ACTIVE)
   162             $upload_policy?->isActive()
   164         $validity_section = $this->ui_factory->input()->field()->section(
   166                 self::INPUT_FIELD_VALID_UNTIL => $valid_until_input,
   167                 self::INPUT_FIELD_ACTIVE => $active_input
   169             $this->
language->txt(self::LABEL_INPUT_SECTION_VALIDITY)
   173         $this->
form = $this->ui_factory->input()->container()->form()->standard(
   176                 self::INPUT_SECTION_GENERAL => $general_section,
   177                 self::INPUT_SECTION_AUDIENCE => $audience_section,
   178                 self::INPUT_SECTION_VALIDITY => $validity_section,
   179                 self::HIDDEN_INPUT_POLICY_ID => $policy_id_hidden_input,
   193         $global_roles = $this->rbac_review->getRolesForIDs(
   194             $this->rbac_review->getGlobalRoles(),
   199         foreach ($global_roles as $global_role) {
   200             $roles[$global_role[
'rol_id']] = $global_role[
'title'];
   208         return $this->
refinery->custom()->transformation(
function ($audience_section): array {
   209             switch ($audience_section[self::INPUT_FIELD_AUDIENCE][0]) {
   210                 case self::INPUT_OPTION_GLOBAL_ROLES:
   213                 case self::INPUT_OPTION_ALL_USERS:
   220                 self::INPUT_FIELD_AUDIENCE_TYPE => $audience_type,
   221                 self::INPUT_FIELD_AUDIENCE_DATA => $audience_section[self::INPUT_FIELD_AUDIENCE][1]
 
const AUDIENCE_TYPE_GLOBAL_ROLE
 
static http()
Fetches the global http state from ILIAS. 
 
const CMD_SAVE_UPLOAD_POLICY
 
const AUDIENCE_TYPE_ALL_USERS
 
form( $class_path, string $cmd, string $submit_caption="")
 
language()
 description: > Example for rendring a language glyph.