19 declare(strict_types=1);
42 protected ILIAS\
UI\Factory $ui_factory,
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);
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(
187 $section_common = $if->field()->section(
189 'icon' => $title_icon,
190 'header_actions' => $header_actions,
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 $result = $form->getInputGroup()->getContent();
208 if ($result->isOK()) {
209 $values = $result->value();
212 $lso->setTitle($values[
'object'][self::PROP_TITLE]);
213 $lso->setDescription($values[
'object'][self::PROP_DESC]);
215 $settings = $lso->getLSSettings()
216 ->withMembersGallery($values[
'additional'][self::PROP_GALLERY]);
217 $lso->updateSettings($settings);
219 $activation = $lso->getLSActivation()
220 ->withIsOnline($values[
'online'][self::PROP_ONLINE])
221 ->withActivationStart(
null)
222 ->withActivationEnd(
null);
223 if ($values[
'online'][self::PROP_AVAIL_FROM] !==
null) {
224 $activation = $activation
225 ->withActivationStart(
226 DateTime::createFromImmutable($values[
'online'][self::PROP_AVAIL_FROM])
229 if ($values[
'online'][self::PROP_AVAIL_TO] !==
null) {
230 $activation = $activation
232 DateTime::createFromImmutable($values[
'online'][self::PROP_AVAIL_TO])
235 $lso->updateActivation($activation);
238 $lso->getObjectProperties()->storePropertyIsOnline(
242 $lso->getObjectProperties()->storePropertyTitleAndIconVisibility($values[
'common'][
'icon']);
243 $lso->getObjectProperties()->storePropertyHeaderActionVisibility($values[
'common'][
'header_actions']);
244 $lso->getObjectProperties()->storePropertyTileImage($values[
'common'][
'image']);
248 $this->tpl->setOnScreenMessage(
"success", $this->
lng->txt(
"msg_obj_modified"),
true);
249 $this->
ctrl->redirect($this);
252 $this->tpl->setOnScreenMessage(
"failure", $this->
lng->txt(
"msg_form_save_error"));
253 return $this->
renderer->render($form);
buildForm(ilObjLearningSequence $lso, string $submit_action)
Interface Observer Contains several chained tasks and infos about them.
__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)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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)