19declare(strict_types=1);
42 protected ILIAS\UI\Factory $ui_factory,
44 protected Psr\Http\Message\ServerRequestInterface $request,
46 protected \
ILIAS\Data\Factory $data_factory
48 $this->
lng->loadLanguageModule(
'content');
49 $this->
lng->loadLanguageModule(
'obj');
54 $cmd = $this->
ctrl->getCmd(
'settings');
60 $content = $this->$cmd();
64 throw new ilException(
"ilObjLearningSequenceSettingsGUI: Command not supported: $cmd");
66 $this->tpl->setContent($content);
73 $this->
ctrl->getFormAction($this, self::CMD_SAVE)
79 $this->
ctrl->redirectByClass(ilObjLearningSequenceGUI::class);
86 $if = $this->ui_factory->input();
88 $form = $if->container()->form()->standard(
104 $shift_trafo = $this->
refinery->custom()->transformation(
105 static fn(array $v) => current($v)
107 $date_format = $this->data_factory->dateFormat()->withTime24(
108 $this->
user->getDateFormat()
115 $formElements[
'object'] = $if->field()->section(
117 $props->getPropertyTitleAndDescription()->toForm(
124 )->withAdditionalTransformation($shift_trafo);
126 $formElements[
'online'] = $if->field()->section(
128 $props->getPropertyIsOnline()
134 $ref_props->getPropertyAvailabilityPeriod()
140 'user_time_zone' => $this->user->getTimeZone(),
141 'user_date_format' => $date_format
145 $txt(
'lso_settings_availability')
149 $gallery = $if->field()->checkbox($txt(
"members_gallery"), $txt(
'lso_show_members_info'))
150 ->withValue($settings->getMembersGallery())
151 ->withAdditionalTransformation(
153 $this->refinery->kindlyTo()->bool(),
154 $this->refinery->always(
false)
157 $section_additional = $if->field()->section(
159 self::PROP_GALLERY => $gallery
163 $formElements[
'additional'] = $section_additional;
166 $title_icon = $props->getPropertyTitleAndIconVisibility()->toForm(
171 $header_actions = $props->getPropertyHeaderActionVisibility()->toForm(
176 $custom_icon = $props->getPropertyIcon()->toForm(
181 $image = $props->getPropertyTileImage()->toForm(
186 $section_common = $if->field()->section(
188 'icon' => $title_icon,
189 'header_actions' => $header_actions,
190 'custom_icon' => $custom_icon,
193 $txt(
'cont_presentation')
195 $formElements[
'common'] = $section_common;
197 return $formElements;
203 ->buildForm($this->obj, $this->
ctrl->getFormAction($this, self::CMD_SAVE))
204 ->withRequest($this->request);
206 $data = $form->getData();
207 if (
$data ===
null) {
208 $this->tpl->setOnScreenMessage(
"failure", $this->
lng->txt(
"msg_form_save_error"));
209 return $this->
renderer->render($form);
215 $obj_props->storePropertyTitleAndDescription(
$data[
'object']);
216 list($online, $availability) =
$data[
'online'];
217 $obj_props->storePropertyIsOnline($online);
221 ->withMembersGallery(
$data[
'additional'][self::PROP_GALLERY]);
224 $obj_props->storePropertyTitleAndIconVisibility(
$data[
'common'][
'icon']);
225 $obj_props->storePropertyHeaderActionVisibility(
$data[
'common'][
'header_actions']);
226 if (array_key_exists(
'custom_icon',
$data[
'common'])) {
227 $obj_props->storePropertyIcon(
$data[
'common'][
'custom_icon']);
229 $obj_props->storePropertyTileImage(
$data[
'common'][
'image']);
233 $this->tpl->setOnScreenMessage(
"success", $this->
lng->txt(
"msg_obj_modified"),
true);
234 $this->
ctrl->redirect($this);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Class ArrayBasedRequestWrapper.
Class ilCtrl provides processing control methods.
Base class for ILIAS Exception handling.
buildFormElements(ilObjLearningSequence $lso, ILIAS\UI\Component\Input\Factory $if)
buildForm(ilObjLearningSequence $lso, string $submit_action)
__construct(protected ilObjLearningSequence $obj, protected ilCtrl $ctrl, protected ilLanguage $lng, protected ilGlobalTemplateInterface $tpl, protected ILIAS\Refinery\Factory $refinery, protected ILIAS\UI\Factory $ui_factory, protected ILIAS\UI\Renderer $renderer, protected Psr\Http\Message\ServerRequestInterface $request, protected \ilObjUser $user, protected \ILIAS\Data\Factory $data_factory)
updateSettings(ilLearningSequenceSettings $settings)
getObjectReferenceProperties()
storeAvailabilityPeriod(AvailabilityPeriod $period)
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.