ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjLearningSequenceSettingsGUI Class Reference
+ Collaboration diagram for ilObjLearningSequenceSettingsGUI:

Public Member Functions

 __construct (ilObjLearningSequence $obj, ilCtrl $ctrl, ilLanguage $lng, ilGlobalTemplateInterface $tpl, ilObjectService $obj_service, ArrayBasedRequestWrapper $post_wrapper, ILIAS\Refinery\Factory $refinery, ilToolbarGUI $toolbar)
 
 executeCommand ()
 
 addLegacypagesToToolbar ()
 

Data Fields

const PROP_TITLE = 'title'
 
const PROP_DESC = 'desc'
 
const PROP_ONLINE = 'online'
 
const PROP_AVAIL_PERIOD = 'online_period'
 
const PROP_GALLERY = 'gallery'
 
const CMD_EDIT = "settings"
 
const CMD_SAVE = "update"
 
const CMD_CANCEL = "cancel"
 
const CMD_OLD_INTRO = "viewlegacyi"
 
const CMD_OLD_EXTRO = "viewlegacye"
 

Protected Member Functions

 settings ()
 
 cancel ()
 
 showLegacyPage (string $cmd)
 
 buildForm ()
 
 fillForm (ilPropertyFormGUI $form)
 
 addCommonFieldsToForm (ilPropertyFormGUI $form)
 
 update ()
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilObjLearningSequenceSettingsGUI::__construct ( ilObjLearningSequence  $obj,
ilCtrl  $ctrl,
ilLanguage  $lng,
ilGlobalTemplateInterface  $tpl,
ilObjectService  $obj_service,
ArrayBasedRequestWrapper  $post_wrapper,
ILIAS\Refinery\Factory  $refinery,
ilToolbarGUI  $toolbar 
)

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

References $lng, ILIAS\Repository\$refinery, $tpl, ILIAS\Repository\ctrl(), ilObject\getLongDescription(), ilObjLearningSequence\getLSActivation(), ilObjLearningSequence\getLSSettings(), ilObject\getTitle(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), settings(), and ILIAS\Repository\toolbar().

47  {
48  $this->obj = $obj;
49  $this->ctrl = $ctrl;
50  $this->lng = $lng;
51  $this->tpl = $tpl;
52  $this->obj_service = $obj_service;
53  $this->post_wrapper = $post_wrapper;
54  $this->refinery = $refinery;
55 
56  $this->settings = $obj->getLSSettings();
57  $this->activation = $obj->getLSActivation();
58  $this->obj_title = $obj->getTitle();
59  $this->obj_description = $obj->getLongDescription();
60 
61  $this->lng->loadLanguageModule('content');
62  $this->lng->loadLanguageModule('obj');
63  $this->toolbar = $toolbar;
64  }
$lng
getLongDescription()
get object long description (stored in object_description)
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
Refinery Factory $refinery
+ Here is the call graph for this function:

Member Function Documentation

◆ addCommonFieldsToForm()

ilObjLearningSequenceSettingsGUI::addCommonFieldsToForm ( ilPropertyFormGUI  $form)
protected

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

References $id, $txt, ilPropertyFormGUI\addItem(), and ILIAS\Repository\lng().

Referenced by settings(), and update().

217  : void
218  {
219  $txt = fn ($id) => $this->lng->txt($id);
220  $section_appearance = new ilFormSectionHeaderGUI();
221  $section_appearance->setTitle($txt('cont_presentation'));
222  $form->addItem($section_appearance);
223  $form_service = $this->obj_service->commonSettings()->legacyForm($form, $this->obj);
224  $form_service->addTitleIconVisibility();
225  $form_service->addTopActionsVisibility();
226  $form_service->addIcon();
227  $form_service->addTileImage();
228  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$txt
Definition: error.php:13
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addLegacypagesToToolbar()

ilObjLearningSequenceSettingsGUI::addLegacypagesToToolbar ( )

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

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

Referenced by settings().

106  : void
107  {
108  $this->toolbar->addButton(
109  $this->lng->txt("lso_settings_old_intro"),
110  $this->ctrl->getLinkTarget($this, self::CMD_OLD_INTRO)
111  );
112 
113  $this->toolbar->addButton(
114  $this->lng->txt("lso_settings_old_extro"),
115  $this->ctrl->getLinkTarget($this, self::CMD_OLD_EXTRO)
116  );
117  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildForm()

ilObjLearningSequenceSettingsGUI::buildForm ( )
protected

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

References $id, ILIAS\LTI\ToolProvider\$settings, $txt, ILIAS\Repository\ctrl(), IL_CAL_DATETIME, and ILIAS\Repository\lng().

Referenced by settings(), and update().

147  {
148  $txt = fn ($id) => $this->lng->txt($id);
150  $activation = $this->activation;
151 
152  $form = new ilPropertyFormGUI();
153  $form->setFormAction($this->ctrl->getFormAction($this, self::CMD_SAVE));
154  $form->setTitle($this->lng->txt('lso_edit'));
155 
156  $title = new ilTextInputGUI($txt("title"), self::PROP_TITLE);
157  $title->setRequired(true);
158  $desc = new ilTextAreaInputGUI($txt("description"), self::PROP_DESC);
159 
160  $section_avail = new ilFormSectionHeaderGUI();
161  $section_avail->setTitle($txt('lso_settings_availability'));
162  $online = new ilCheckboxInputGUI($txt("online"), self::PROP_ONLINE);
163  $online->setInfo($this->lng->txt('lso_activation_online_info'));
164  $duration = new ilDateDurationInputGUI($txt('avail_time_period'), self::PROP_AVAIL_PERIOD);
165  $duration->setShowTime(true);
166  if ($activation->getActivationStart() !== null) {
167  $duration->setStart(
168  new ilDateTime(
169  $activation->getActivationStart()->format('Y-m-d H:i:s'),
171  )
172  );
173  }
174  if ($activation->getActivationEnd() !== null) {
175  $duration->setEnd(
176  new ilDateTime(
177  $activation->getActivationEnd()->format('Y-m-d H:i:s'),
179  )
180  );
181  }
182 
183  $section_misc = new ilFormSectionHeaderGUI();
184  $section_misc->setTitle($txt('obj_features'));
185  $show_members_gallery = new ilCheckboxInputGUI($txt("members_gallery"), self::PROP_GALLERY);
186  $show_members_gallery->setInfo($txt('lso_show_members_info'));
187 
188  $form->addItem($title);
189  $form->addItem($desc);
190 
191  $form->addItem($section_avail);
192  $form->addItem($online);
193  $form->addItem($duration);
194  $form->addItem($section_misc);
195  $form->addItem($show_members_gallery);
196 
197  $form->addCommandButton(self::CMD_SAVE, $txt("save"));
198  $form->addCommandButton(self::CMD_CANCEL, $txt("cancel"));
199 
200  return $form;
201  }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
const IL_CAL_DATETIME
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a checkbox property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$txt
Definition: error.php:13
This class represents a text area property in a property form.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilObjLearningSequenceSettingsGUI::cancel ( )
protected

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

References ILIAS\Repository\ctrl().

99  : void
100  {
101  $this->ctrl->redirectByClass(ilObjLearningSequenceGUI::class);
102  }
+ Here is the call graph for this function:

◆ executeCommand()

ilObjLearningSequenceSettingsGUI::executeCommand ( )

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

References ILIAS\Repository\ctrl(), and showLegacyPage().

66  : void
67  {
68  $cmd = $this->ctrl->getCmd('settings');
69 
70  switch ($cmd) {
71  case self::CMD_EDIT:
72  case self::CMD_SAVE:
73  case self::CMD_CANCEL:
74  $content = $this->$cmd();
75  break;
76  case self::CMD_OLD_INTRO:
77  case self::CMD_OLD_EXTRO:
78  $content = $this->showLegacyPage($cmd);
79  break;
80 
81  default:
82  throw new ilException("ilObjLearningSequenceSettingsGUI: Command not supported: $cmd");
83 
84  }
85  $this->tpl->setContent($content);
86  }
+ Here is the call graph for this function:

◆ fillForm()

ilObjLearningSequenceSettingsGUI::fillForm ( ilPropertyFormGUI  $form)
protected

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

References ILIAS\LTI\ToolProvider\$settings, and ilPropertyFormGUI\setValuesByArray().

Referenced by settings().

204  {
206  $activation = $this->activation;
207  $values = [
208  self::PROP_TITLE => $this->obj_title,
209  self::PROP_DESC => $this->obj_description,
210  self::PROP_ONLINE => $activation->getIsOnline(),
211  self::PROP_GALLERY => $settings->getMembersGallery()
212  ];
213  $form->setValuesByArray($values);
214  return $form;
215  }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
setValuesByArray(array $a_values, bool $a_restrict_to_value_keys=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ settings()

ilObjLearningSequenceSettingsGUI::settings ( )
protected

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

References addCommonFieldsToForm(), addLegacypagesToToolbar(), buildForm(), fillForm(), and ILIAS\Repository\lng().

Referenced by __construct(), and update().

88  : string
89  {
90  $this->addLegacypagesToToolbar();
91  $this->tpl->setOnScreenMessage("info", $this->lng->txt("lso_intropages_deprecationhint"));
92 
93  $form = $this->buildForm();
94  $this->fillForm($form);
95  $this->addCommonFieldsToForm($form);
96  return $form->getHTML();
97  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showLegacyPage()

ilObjLearningSequenceSettingsGUI::showLegacyPage ( string  $cmd)
protected

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

References $img, $out, ILIAS\LTI\ToolProvider\$settings, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

Referenced by executeCommand().

119  : string
120  {
121  $this->toolbar->addButton(
122  $this->lng->txt('back'),
123  $this->ctrl->getLinkTarget($this, self::CMD_EDIT)
124  );
125 
126  $out = [];
128  if ($cmd === self::CMD_OLD_INTRO) {
129  $out[] = $settings->getAbstract();
130  $img = $settings->getAbstractImage();
131  if ($img) {
132  $out[] = '<img src="' . $img . '"/>';
133  }
134  }
135  if ($cmd === self::CMD_OLD_EXTRO) {
136  $out[] = $settings->getExtro();
137  $img = $settings->getExtroImage();
138  if ($img) {
139  $out[] = '<img src="' . $img . '"/>';
140  }
141  }
142 
143  return implode('<hr>', $out);
144  }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
$out
Definition: buildRTE.php:24
$img
Definition: imgupload.php:83
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilObjLearningSequenceSettingsGUI::update ( )
protected

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

References ILIAS\LTI\ToolProvider\$settings, addCommonFieldsToForm(), buildForm(), ILIAS\Repository\ctrl(), IL_CAL_DATETIME, ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and settings().

230  : ?string
231  {
232  $form = $this->buildForm();
233  $this->addCommonFieldsToForm($form);
234  if (!$form->checkInput()) {
235  $form->setValuesByPost();
236  $this->tpl->setOnScreenMessage("failure", $this->lng->txt("msg_form_save_error"));
237  return $form->getHTML();
238  }
239 
240  $lso = $this->obj;
241 
242  $lso->setTitle($this->post_wrapper->retrieve(self::PROP_TITLE, $this->refinery->kindlyTo()->string()));
243  $lso->setDescription($this->post_wrapper->retrieve(self::PROP_DESC, $this->refinery->kindlyTo()->string()));
244 
245  $settings = $this->settings
246  ->withMembersGallery(
247  $this->post_wrapper->retrieve(
248  self::PROP_GALLERY,
249  $this->refinery->byTrying([
250  $this->refinery->kindlyTo()->bool(),
251  $this->refinery->always(false)
252  ])
253  )
254  );
255 
256  $inpt = $form->getItemByPostVar(self::PROP_AVAIL_PERIOD);
257  $start = $inpt->getStart();
258  $end = $inpt->getEnd();
259  $activation = $this->activation
260  ->withIsOnline(
261  $this->post_wrapper->retrieve(
262  self::PROP_ONLINE,
263  $this->refinery->byTrying([
264  $this->refinery->kindlyTo()->bool(),
265  $this->refinery->always(false)
266  ])
267  )
268  );
269 
270  if ($start) {
271  $activation = $activation
272  ->withActivationStart(DateTime::createFromFormat('Y-m-d H:i:s', (string) $start->get(IL_CAL_DATETIME)));
273  } else {
274  $activation = $activation->withActivationStart();
275  }
276  if ($end) {
277  $activation = $activation
278  ->withActivationEnd(DateTime::createFromFormat('Y-m-d H:i:s', (string) $end->get(IL_CAL_DATETIME)));
279  } else {
280  $activation = $activation->withActivationEnd();
281  }
282 
283  $form_service = $this->obj_service->commonSettings()->legacyForm($form, $this->obj);
284  $form_service->saveTitleIconVisibility();
285  $form_service->saveTopActionsVisibility();
286  $form_service->saveIcon();
287  $form_service->saveTileImage();
288 
289  $lso->updateSettings($settings);
290  $lso->updateActivation($activation);
291  $lso->update();
292 
293  $this->tpl->setOnScreenMessage("success", $this->lng->txt("msg_obj_modified"), true);
294  $this->ctrl->redirect($this);
295  return null;
296  }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
const IL_CAL_DATETIME
+ Here is the call graph for this function:

Field Documentation

◆ CMD_CANCEL

const ilObjLearningSequenceSettingsGUI::CMD_CANCEL = "cancel"

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

◆ CMD_EDIT

const ilObjLearningSequenceSettingsGUI::CMD_EDIT = "settings"

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

◆ CMD_OLD_EXTRO

const ilObjLearningSequenceSettingsGUI::CMD_OLD_EXTRO = "viewlegacye"

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

◆ CMD_OLD_INTRO

const ilObjLearningSequenceSettingsGUI::CMD_OLD_INTRO = "viewlegacyi"

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

◆ CMD_SAVE

const ilObjLearningSequenceSettingsGUI::CMD_SAVE = "update"

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

◆ PROP_AVAIL_PERIOD

const ilObjLearningSequenceSettingsGUI::PROP_AVAIL_PERIOD = 'online_period'

Definition at line 28 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 29 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: