19 declare(strict_types=1);
58 $this->
ctrl = $DIC->ctrl();
59 $this->
lng = $DIC->language();
60 $this->
tabs = $DIC->tabs();
61 $this->ui_factory = $DIC->ui()->factory();
62 $this->wrapper = $DIC->http()->wrapper();
70 $this->
tabs->clearSubTabs();
71 $this->
tabs->clearTargets();
72 $back_target = $this->
ctrl->getLinkTargetByClass(
73 ilObjFileIconsOverviewGUI::class,
76 $this->
tabs->setBackTarget($this->
lng->txt(
'back'), $back_target);
78 if ($this->mode === self::MODE_EDIT) {
79 $form_title = $this->
lng->txt(self::FORM_ICON_UPDATING);
80 $form_action = $this->
ctrl->getFormActionByClass(
81 ilObjFileIconsOverviewGUI::class,
85 $form_title = $this->
lng->txt(self::FORM_ICON_CREATION);
86 $form_action = $this->
ctrl->getFormActionByClass(
87 ilObjFileIconsOverviewGUI::class,
92 $rid = $this->icon->getRid();
93 $this->
ctrl->setParameterByClass(ilIconUploadHandlerGUI::class,
'rid', $rid);
94 $icon_input = $this->ui_factory->input()->field()->file(
96 $this->
lng->txt(self::INPUT_ICON),
97 $this->
lng->txt(self::INPUT_DESC_ICON)
98 )->withAcceptedMimeTypes(
99 [MimeType::IMAGE__SVG_XML]
104 $icon_input = $icon_input->withValue([$rid]);
107 $active_input = $this->ui_factory->input()->field()->checkbox(
108 $this->
lng->txt(self::INPUT_ACTIVE),
109 $this->
lng->txt(self::INPUT_DESC_ACTIVE)
111 $this->icon->isActive()
114 $suffix_input = $this->ui_factory->input()->field()->text(
115 $this->
lng->txt(self::INPUT_SUFFIXES),
116 $this->
lng->txt(self::INPUT_DESC_SUFFIXES)
120 $this->icon_repo->turnSuffixesArrayIntoString($this->icon->getSuffixes())
121 )->withAdditionalTransformation(
122 $this->
refinery->custom()->transformation(fn($suffixes_input): array => $this->icon_repo->turnSuffixesStringIntoArray($suffixes_input))
123 )->withAdditionalTransformation(
124 $this->
refinery->custom()->constraint(fn($suffixes_input):
bool => $this->icon_repo->hasSuffixInputOnlyAllowedCharacters($suffixes_input), $this->
lng->txt(
'msg_error_suffixes_with_forbidden_characters'))
125 )->withAdditionalTransformation(
126 $this->
refinery->custom()->constraint(fn($suffixes_input):
bool => $this->icon_repo->hasSuffixInputNoDuplicatesToItsOwnEntries($suffixes_input), $this->
lng->txt(
'msg_error_duplicate_suffix_entries'))
127 )->withAdditionalTransformation(
128 $this->
refinery->custom()->constraint(
function ($suffixes_input):
bool {
130 $section = $this->icon_form->getInputs()[0];
131 $inputs = $section->getInputs();
132 $input_active =
$inputs[self::INPUT_ACTIVE];
133 $field_is_active = $input_active->getName();
135 $post_is_active_value = $this->wrapper->post()->retrieve($field_is_active, $to_bool);
137 return $this->icon_repo->causesNoActiveSuffixesConflict(
139 $post_is_active_value,
142 }, $this->
lng->txt(
'msg_error_active_suffixes_conflict'))
145 $section = $this->ui_factory->input()->field()->section([
146 self::INPUT_ICON => $icon_input,
147 self::INPUT_ACTIVE => $active_input,
148 self::INPUT_SUFFIXES => $suffix_input
150 $this->icon_form = $this->ui_factory->input()->container()->form()->standard($form_action, [$section]);
160 if ($checkbox_input_value !==
null) {
161 $checkbox_input_value_str = $this->
refinery->kindlyTo()->string()->transform($checkbox_input_value);
162 if ($checkbox_input_value_str ==
"checked") {
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null