ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
ilObjLearningSequenceSettingsGUI Class Reference
+ Collaboration diagram for ilObjLearningSequenceSettingsGUI:

Public Member Functions

 __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)
 
 executeCommand ()
 

Data Fields

const PROP_TITLE = 'title'
 
const PROP_DESC = 'desc'
 
const PROP_ONLINE = 'online'
 
const PROP_AVAIL_FROM = 'start'
 
const PROP_AVAIL_TO = 'end'
 
const PROP_GALLERY = 'gallery'
 
const CMD_EDIT = "settings"
 
const CMD_SAVE = "update"
 
const CMD_CANCEL = "cancel"
 

Protected Member Functions

 settings ()
 
 cancel ()
 
 buildForm (ilObjLearningSequence $lso, string $submit_action)
 
 buildFormElements (ilObjLearningSequence $lso, ILIAS\UI\Component\Input\Factory $if)
 
 update ()
 

Detailed Description

Definition at line 23 of file class.ilObjLearningSequenceSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjLearningSequenceSettingsGUI::__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 
)

Definition at line 36 of file class.ilObjLearningSequenceSettingsGUI.php.

47 {
48 $this->lng->loadLanguageModule('content');
49 $this->lng->loadLanguageModule('obj');
50 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildForm()

ilObjLearningSequenceSettingsGUI::buildForm ( ilObjLearningSequence  $lso,
string  $submit_action 
)
protected

Definition at line 82 of file class.ilObjLearningSequenceSettingsGUI.php.

86 $if = $this->ui_factory->input();
87
88 $form = $if->container()->form()->standard(
89 $submit_action,
90 $this->buildFormElements(
91 $lso,
92 $if
93 )
94 );
95
96 return $form;
97 }
buildFormElements(ilObjLearningSequence $lso, ILIAS\UI\Component\Input\Factory $if)
This describes a standard form.
Definition: Standard.php:30

Referenced by settings().

+ Here is the caller graph for this function:

◆ buildFormElements()

ilObjLearningSequenceSettingsGUI::buildFormElements ( ilObjLearningSequence  $lso,
ILIAS\UI\Component\Input\Factory  $if 
)
protected

Definition at line 99 of file class.ilObjLearningSequenceSettingsGUI.php.

102 {
103 $txt = fn($id) => $this->lng->txt($id);
104 $shift_trafo = $this->refinery->custom()->transformation(
105 static fn(array $v) => current($v)
106 );
107 $date_format = $this->data_factory->dateFormat()->withTime24(
108 $this->user->getDateFormat()
109 );
110 $props = $lso->getObjectProperties();
111 $ref_props = $lso->getObjectReferenceProperties();
112 $settings = $lso->getLSSettings();
113
114 $formElements = [];
115 $formElements['object'] = $if->field()->section(
116 [
117 $props->getPropertyTitleAndDescription()->toForm(
118 $this->lng,
119 $if->field(),
120 $this->refinery
121 )
122 ],
123 $txt('lso_edit')
124 )->withAdditionalTransformation($shift_trafo);
125
126 $formElements['online'] = $if->field()->section(
127 [
128 $props->getPropertyIsOnline()
129 ->toForm(
130 $this->lng,
131 $if->field(),
132 $this->refinery
133 ),
134 $ref_props->getPropertyAvailabilityPeriod()
135 ->toForm(
136 $this->lng,
137 $if->field(),
138 $this->refinery,
139 [
140 'user_time_zone' => $this->user->getTimeZone(),
141 'user_date_format' => $date_format
142 ]
143 )
144 ],
145 $txt('lso_settings_availability')
146 );
147
148 // Member gallery
149 $gallery = $if->field()->checkbox($txt("members_gallery"), $txt('lso_show_members_info'))
150 ->withValue($settings->getMembersGallery())
151 ->withAdditionalTransformation(
152 $this->refinery->byTrying([
153 $this->refinery->kindlyTo()->bool(),
154 $this->refinery->always(false)
155 ])
156 );
157 $section_additional = $if->field()->section(
158 [
159 self::PROP_GALLERY => $gallery
160 ],
161 $txt('obj_features')
162 );
163 $formElements['additional'] = $section_additional;
164
165 // Common properties
166 $title_icon = $props->getPropertyTitleAndIconVisibility()->toForm(
167 $this->lng,
168 $if->field(),
169 $this->refinery
170 );
171 $header_actions = $props->getPropertyHeaderActionVisibility()->toForm(
172 $this->lng,
173 $if->field(),
174 $this->refinery
175 );
176 $custom_icon = $props->getPropertyIcon()->toForm(
177 $this->lng,
178 $if->field(),
179 $this->refinery
180 );
181 $image = $props->getPropertyTileImage()->toForm(
182 $this->lng,
183 $if->field(),
184 $this->refinery
185 );
186 $section_common = $if->field()->section(
187 array_filter([
188 'icon' => $title_icon,
189 'header_actions' => $header_actions,
190 'custom_icon' => $custom_icon,
191 'image' => $image
192 ]),
193 $txt('cont_presentation')
194 );
195 $formElements['common'] = $section_common;
196
197 return $formElements;
198 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id, ilObjLearningSequence\getLSSettings(), ilObject\getObjectProperties(), ilObjLearningSequence\getObjectReferenceProperties(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ cancel()

ilObjLearningSequenceSettingsGUI::cancel ( )
protected

Definition at line 77 of file class.ilObjLearningSequenceSettingsGUI.php.

77 : void
78 {
79 $this->ctrl->redirectByClass(ilObjLearningSequenceGUI::class);
80 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ executeCommand()

ilObjLearningSequenceSettingsGUI::executeCommand ( )

Definition at line 52 of file class.ilObjLearningSequenceSettingsGUI.php.

52 : void
53 {
54 $cmd = $this->ctrl->getCmd('settings');
55
56 switch ($cmd) {
57 case self::CMD_EDIT:
58 case self::CMD_SAVE:
60 $content = $this->$cmd();
61 break;
62
63 default:
64 throw new ilException("ilObjLearningSequenceSettingsGUI: Command not supported: $cmd");
65 }
66 $this->tpl->setContent($content);
67 }
Base class for ILIAS Exception handling.

References CMD_CANCEL, CMD_EDIT, CMD_SAVE, and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ settings()

ilObjLearningSequenceSettingsGUI::settings ( )
protected

Definition at line 69 of file class.ilObjLearningSequenceSettingsGUI.php.

69 : string
70 {
71 return $this->renderer->render($this->buildForm(
72 $this->obj,
73 $this->ctrl->getFormAction($this, self::CMD_SAVE)
74 ));
75 }
renderer()
buildForm(ilObjLearningSequence $lso, string $submit_action)

References buildForm(), ILIAS\Repository\ctrl(), and renderer().

+ Here is the call graph for this function:

◆ update()

ilObjLearningSequenceSettingsGUI::update ( )
protected

Definition at line 200 of file class.ilObjLearningSequenceSettingsGUI.php.

200 : ?string
201 {
202 $form = $this
203 ->buildForm($this->obj, $this->ctrl->getFormAction($this, self::CMD_SAVE))
204 ->withRequest($this->request);
205
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);
210 }
211
212 $lso = $this->obj;
213 $obj_props = $lso->getObjectProperties();
214
215 $obj_props->storePropertyTitleAndDescription($data['object']);
216 list($online, $availability) = $data['online'];
217 $obj_props->storePropertyIsOnline($online);
218 $lso->storeAvailabilityPeriod($availability);
219
220 $settings = $lso->getLSSettings()
221 ->withMembersGallery($data['additional'][self::PROP_GALLERY]);
222 $lso->updateSettings($settings);
223
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']);
228 }
229 $obj_props->storePropertyTileImage($data['common']['image']);
230
231 $lso->update();
232
233 $this->tpl->setOnScreenMessage("success", $this->lng->txt("msg_obj_modified"), true);
234 $this->ctrl->redirect($this);
235 return null;
236 }

References $data, ILIAS\Repository\ctrl(), ilObjLearningSequence\getLSSettings(), ilObject\getObjectProperties(), ILIAS\Repository\lng(), renderer(), ilObjLearningSequence\storeAvailabilityPeriod(), ilObjLearningSequence\update(), and ilObjLearningSequence\updateSettings().

+ Here is the call graph for this function:

Field Documentation

◆ CMD_CANCEL

const ilObjLearningSequenceSettingsGUI::CMD_CANCEL = "cancel"

Definition at line 34 of file class.ilObjLearningSequenceSettingsGUI.php.

Referenced by executeCommand().

◆ CMD_EDIT

const ilObjLearningSequenceSettingsGUI::CMD_EDIT = "settings"

Definition at line 32 of file class.ilObjLearningSequenceSettingsGUI.php.

Referenced by executeCommand().

◆ CMD_SAVE

const ilObjLearningSequenceSettingsGUI::CMD_SAVE = "update"

Definition at line 33 of file class.ilObjLearningSequenceSettingsGUI.php.

Referenced by executeCommand().

◆ PROP_AVAIL_FROM

const ilObjLearningSequenceSettingsGUI::PROP_AVAIL_FROM = 'start'

Definition at line 28 of file class.ilObjLearningSequenceSettingsGUI.php.

◆ PROP_AVAIL_TO

const ilObjLearningSequenceSettingsGUI::PROP_AVAIL_TO = 'end'

Definition at line 29 of file class.ilObjLearningSequenceSettingsGUI.php.

◆ PROP_DESC

const ilObjLearningSequenceSettingsGUI::PROP_DESC = 'desc'

Definition at line 26 of file class.ilObjLearningSequenceSettingsGUI.php.

◆ PROP_GALLERY

const ilObjLearningSequenceSettingsGUI::PROP_GALLERY = 'gallery'

Definition at line 30 of file class.ilObjLearningSequenceSettingsGUI.php.

◆ PROP_ONLINE

const ilObjLearningSequenceSettingsGUI::PROP_ONLINE = 'online'

Definition at line 27 of file class.ilObjLearningSequenceSettingsGUI.php.

◆ PROP_TITLE

const ilObjLearningSequenceSettingsGUI::PROP_TITLE = 'title'

Definition at line 25 of file class.ilObjLearningSequenceSettingsGUI.php.


The documentation for this class was generated from the following file: