19 declare(strict_types=1);
43 protected ILIAS\
UI\Renderer $renderer,
44 protected Psr\Http\Message\ServerRequestInterface $request
46 $this->
lng->loadLanguageModule(
'content');
47 $this->
lng->loadLanguageModule(
'obj');
52 $cmd = $this->
ctrl->getCmd(
'settings');
57 case self::CMD_CANCEL:
58 $content = $this->$cmd();
62 throw new ilException(
"ilObjLearningSequenceSettingsGUI: Command not supported: $cmd");
64 $this->tpl->setContent($content);
69 return $this->renderer->render($this->
buildForm(
71 $this->
ctrl->getFormAction($this, self::CMD_SAVE)
77 $this->
ctrl->redirectByClass(ilObjLearningSequenceGUI::class);
84 $if = $this->ui_factory->input();
86 $form = $if->container()->form()->standard(
107 $title = $if->field()->text(
$txt(
"title"))
110 $description = $if->field()->text(
$txt(
"description"))
112 $section_object = $if->field()->section(
114 self::PROP_TITLE => $title,
115 self::PROP_DESC => $description
119 $formElements[
'object'] = $section_object;
122 $online = $if->field()->checkbox(
124 $txt(
'lso_activation_online_info')
125 )->withValue($activation->getIsOnline());
126 $online_start = $if->field()->dateTime(
$txt(
'from'))
128 ->withValue(($activation->getActivationStart()) ? $activation->getActivationStart()->format(
'Y-m-d H:i') :
'');
129 $online_end = $if->field()->dateTime(
$txt(
'to'))
131 ->withValue(($activation->getActivationEnd()) ? $activation->getActivationEnd()->format(
'Y-m-d H:i') :
'');
132 $section_online = $if->field()->section(
134 self::PROP_ONLINE => $online,
135 self::PROP_AVAIL_FROM => $online_start,
136 self::PROP_AVAIL_TO => $online_end
138 $txt(
'lso_settings_availability')
139 )->withAdditionalTransformation(
140 $this->
refinery->custom()->constraint(
142 $start = $values[self::PROP_AVAIL_FROM] ??
'';
143 $end = $values[self::PROP_AVAIL_TO] ??
'';
144 if (($start !==
'' && $end !==
'') && ($end < $start)) {
149 $txt(
'lso_settings_availability_error')
152 $formElements[
'online'] = $section_online;
155 $gallery = $if->field()->checkbox(
$txt(
"members_gallery"),
$txt(
'lso_show_members_info'))
156 ->withValue(
$settings->getMembersGallery())
159 $this->refinery->kindlyTo()->bool(),
163 $section_additional = $if->field()->section(
165 self::PROP_GALLERY => $gallery
169 $formElements[
'additional'] = $section_additional;
177 $header_actions = $lso->
getObjectProperties()->getPropertyHeaderActionVisibility()->toForm(
192 $section_common = $if->field()->section(
194 'icon' => $title_icon,
195 'header_actions' => $header_actions,
196 'custom_icon' => $custom_icon,
199 $txt(
'cont_presentation')
201 $formElements[
'common'] = $section_common;
203 return $formElements;
209 ->buildForm($this->obj, $this->
ctrl->getFormAction($this, self::CMD_SAVE))
210 ->withRequest($this->request);
212 $result = $form->getInputGroup()->getContent();
214 if ($result->isOK()) {
215 $values = $result->value();
218 $lso->setTitle($values[
'object'][self::PROP_TITLE]);
219 $lso->setDescription($values[
'object'][self::PROP_DESC]);
222 ->withMembersGallery($values[
'additional'][self::PROP_GALLERY]);
225 $activation = $lso->getLSActivation()
226 ->withIsOnline($values[
'online'][self::PROP_ONLINE])
227 ->withActivationStart(null)
228 ->withActivationEnd(null);
229 if ($values[
'online'][self::PROP_AVAIL_FROM] !== null) {
230 $activation = $activation
231 ->withActivationStart(
232 DateTime::createFromImmutable($values[
'online'][self::PROP_AVAIL_FROM])
235 if ($values[
'online'][self::PROP_AVAIL_TO] !== null) {
236 $activation = $activation
238 DateTime::createFromImmutable($values[
'online'][self::PROP_AVAIL_TO])
241 $lso->updateActivation($activation);
244 $lso->getObjectProperties()->storePropertyIsOnline(
248 $lso->getObjectProperties()->storePropertyTitleAndIconVisibility($values[
'common'][
'icon']);
249 $lso->getObjectProperties()->storePropertyHeaderActionVisibility($values[
'common'][
'header_actions']);
250 $lso->getObjectProperties()->storePropertyIcon($values[
'common'][
'custom_icon']);
251 $lso->getObjectProperties()->storePropertyTileImage($values[
'common'][
'image']);
255 $this->tpl->setOnScreenMessage(
"success", $this->
lng->txt(
"msg_obj_modified"),
true);
256 $this->
ctrl->redirect($this);
259 $this->tpl->setOnScreenMessage(
"failure", $this->
lng->txt(
"msg_form_save_error"));
260 return $this->renderer->render($form);
buildForm(ilObjLearningSequence $lso, string $submit_action)
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__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)
static isOffline(int $ref_id)
buildFormElements(ilObjLearningSequence $lso, ILIAS\UI\Component\Input\Factory $if)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
getLongDescription()
get object long description (stored in object_description)
Refinery Factory $refinery