ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilObjLearningSequenceSettingsGUI Class Reference

Class ilObjLearningSequenceSettingsGUI. More...

+ Collaboration diagram for ilObjLearningSequenceSettingsGUI:

Public Member Functions

 __construct (ilObjLearningSequence $obj, ilCtrl $il_ctrl, ilLanguage $il_language, ilTemplate $il_template, ilObjectService $obj_service)
 
 executeCommand ()
 

Data Fields

const PROP_TITLE = 'title'
 
const PROP_DESC = 'desc'
 
const PROP_ABSTRACT = 'abstract'
 
const PROP_ABSTRACT_IMAGE = 'abstract_img'
 
const PROP_EXTRO = 'extro'
 
const PROP_EXTRO_IMAGE = 'extro_img'
 
const PROP_ONLINE = 'online'
 
const PROP_AVAIL_PERIOD = 'online_period'
 
const PROP_GALLERY = 'gallery'
 
const CMD_SAVE = "update"
 
const CMD_CANCEL = "cancel"
 

Protected Member Functions

 settings ()
 
 cancel ()
 
 buildForm ()
 
 fillForm (\ilPropertyFormGUI $form)
 
 addCommonFieldsToForm (\ilPropertyFormGUI $form)
 
 update ()
 

Private Member Functions

 initImgInput (ilImageFileInputGUI $inpt)
 
 initRTEInput (ilTextAreaInputGUI $inpt)
 

Private Attributes

 $rte_allowed_tags
 
 $img_allowed_suffixes
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjLearningSequenceSettingsGUI::__construct ( ilObjLearningSequence  $obj,
ilCtrl  $il_ctrl,
ilLanguage  $il_language,
ilTemplate  $il_template,
ilObjectService  $obj_service 
)

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

References ilObject\getDescription(), ilObjLearningSequence\getLSActivation(), ilObjLearningSequence\getLSSettings(), ilObject\getTitle(), and settings().

50  {
51  $this->obj = $obj;
52  $this->settings = $obj->getLSSettings();
53  $this->activation = $obj->getLSActivation();
54  $this->obj_title = $obj->getTitle();
55  $this->obj_description = $obj->getDescription();
56  $this->ctrl = $il_ctrl;
57  $this->lng = $il_language;
58  $this->tpl = $il_template;
59  $this->object_service = $object_service;
60  $this->obj_service = $obj_service;
61 
62  $this->lng->loadLanguageModule('content');
63  $this->lng->loadLanguageModule('obj');
64  }
getTitle()
get object title public
getDescription()
get object description
+ Here is the call graph for this function:

Member Function Documentation

◆ addCommonFieldsToForm()

ilObjLearningSequenceSettingsGUI::addCommonFieldsToForm ( \ilPropertyFormGUI  $form)
protected

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

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

Referenced by settings(), and update().

228  {
229  $txt = function ($id) {
230  return $this->lng->txt($id);
231  };
232  $section_appearance = new ilFormSectionHeaderGUI();
233  $section_appearance->setTitle($txt('cont_presentation'));
234  $form->addItem($section_appearance);
235  $form_service = $this->obj_service->commonSettings()->legacyForm($form, $this->obj);
236  $form = $form_service->addTitleIconVisibility();
237  $form = $form_service->addTopActionsVisibility();
238  $form = $form_service->addIcon();
239  $form = $form_service->addTileImage();
240  }
This class represents a section header in a property form.
if(!array_key_exists('StateId', $_REQUEST)) $id
if(isset($_POST['submit'])) $form
$txt
Definition: error.php:11
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildForm()

ilObjLearningSequenceSettingsGUI::buildForm ( )
protected

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

References $form, $id, $title, $txt, IL_CAL_DATETIME, initImgInput(), and initRTEInput().

Referenced by settings(), and update().

115  {
116  $txt = function ($id) {
117  return $this->lng->txt($id);
118  };
119  $settings = $this->settings;
120  $activation = $this->activation;
121  $obj_id = $settings->getObjId();
122 
123  $form = new ilPropertyFormGUI();
124  $form->setFormAction($this->ctrl->getFormAction($this, self::CMD_SAVE));
125  $form->setTitle($this->lng->txt('lso_edit'));
126 
127  $title = new ilTextInputGUI($txt("title"), self::PROP_TITLE);
128  $title->setRequired(true);
129  $desc = new ilTextAreaInputGUI($txt("description"), self::PROP_DESC);
130 
131  $section_avail = new ilFormSectionHeaderGUI();
132  $section_avail->setTitle($txt('lso_settings_availability'));
133  $online = new ilCheckboxInputGUI($txt("online"), self::PROP_ONLINE);
134  $online->setInfo($this->lng->txt('lso_activation_online_info'));
135  $duration = new ilDateDurationInputGUI($txt('avail_time_period'), self::PROP_AVAIL_PERIOD);
136  $duration->setShowTime(true);
137  if ($activation->getActivationStart() !== null) {
138  $duration->setStart(
139  new ilDateTime(
140  (string) $activation->getActivationStart()->format('Y-m-d H:i:s'),
142  )
143  );
144  }
145  if ($activation->getActivationEnd() !== null) {
146  $duration->setEnd(
147  new ilDateTime(
148  (string) $activation->getActivationEnd()->format('Y-m-d H:i:s'),
150  )
151  );
152  }
153 
154  $section_misc = new ilFormSectionHeaderGUI();
155  $section_misc->setTitle($txt('lso_settings_misc'));
156  $show_members_gallery = new ilCheckboxInputGUI($txt("members_gallery"), self::PROP_GALLERY);
157  $show_members_gallery->setInfo($txt('lso_show_members_info'));
158 
159  $abstract = $this->initRTEInput(
160  new ilTextAreaInputGUI($txt("abstract"), self::PROP_ABSTRACT)
161  );
162  $abstract_img = $this->initImgInput(
163  new ilImageFileInputGUI($txt("abstract_img"), self::PROP_ABSTRACT_IMAGE)
164  );
165  $abstract_img->setImage($settings->getAbstractImage());
166 
167  $extro = $this->initRTEInput(
168  new ilTextAreaInputGUI($txt("extro"), self::PROP_EXTRO)
169  );
170  $extro_img = $this->initImgInput(
171  new ilImageFileInputGUI($txt("extro_img"), self::PROP_EXTRO_IMAGE)
172  );
173  $extro_img->setImage($settings->getExtroImage());
174 
175  $section_intro = new ilFormSectionHeaderGUI();
176  $section_intro->setTitle($txt('lso_settings_intro'));
177  $section_extro = new ilFormSectionHeaderGUI();
178  $section_extro->setTitle($txt('lso_settings_extro'));
179 
180  $section_misc = new ilFormSectionHeaderGUI();
181  $section_misc->setTitle($txt('obj_features'));
182  $show_members_gallery = new ilCheckboxInputGUI($txt("members_gallery"), self::PROP_GALLERY);
183  $show_members_gallery->setInfo($txt('lso_show_members_info'));
184 
185  $form->addItem($title);
186  $form->addItem($desc);
187 
188  $form->addItem($section_avail);
189  $form->addItem($online);
190  $form->addItem($duration);
191 
192  $form->addItem($section_intro);
193  $form->addItem($abstract);
194  $form->addItem($abstract_img, true);
195 
196  $form->addItem($section_extro);
197  $form->addItem($extro);
198  $form->addItem($extro_img, true);
199 
200  $form->addItem($section_misc);
201  $form->addItem($show_members_gallery);
202 
203  $form->addCommandButton(self::CMD_SAVE, $txt("save"));
204  $form->addCommandButton(self::CMD_CANCEL, $txt("cancel"));
205 
206  return $form;
207  }
const IL_CAL_DATETIME
This class represents a property form user interface.
This class represents a section header in a property form.
if(!array_key_exists('StateId', $_REQUEST)) $id
This class represents a checkbox property in a property form.
input GUI for a time span (start and end date)
if(isset($_POST['submit'])) $form
This class represents a text property in a property form.
Date and time handling
$txt
Definition: error.php:11
This class represents an image file property in a property form.
This class represents a text area property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilObjLearningSequenceSettingsGUI::cancel ( )
protected

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

93  {
94  $this->ctrl->returnToParent($this);
95  }

◆ executeCommand()

ilObjLearningSequenceSettingsGUI::executeCommand ( )

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

67  {
68  $cmd = $this->ctrl->getCmd('settings');
69 
70  switch ($cmd) {
71  case "settings":
72  case self::CMD_SAVE:
73  case self::CMD_CANCEL:
74  $content = $this->$cmd();
75  break;
76  default:
77  throw new ilException("ilObjLearningSequenceSettingsGUI: " .
78  "Command not supported: $cmd");
79 
80  }
81  $this->tpl->setContent($content);
82  }

◆ fillForm()

ilObjLearningSequenceSettingsGUI::fillForm ( \ilPropertyFormGUI  $form)
protected

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

References $form, $values, and ilPropertyFormGUI\setValuesByArray().

Referenced by settings().

210  {
211  $settings = $this->settings;
212  $activation = $this->activation;
213  $values = [
214  self::PROP_TITLE => $this->obj_title,
215  self::PROP_DESC => $this->obj_description,
216  self::PROP_ABSTRACT => $settings->getAbstract(),
217  self::PROP_EXTRO => $settings->getExtro(),
218  self::PROP_ABSTRACT_IMAGE => $settings->getAbstractImage(),
219  self::PROP_EXTRO_IMAGE => $settings->getExtroImage(),
220  self::PROP_ONLINE => $activation->getIsOnline(),
221  self::PROP_GALLERY => $settings->getMembersGallery()
222  ];
223  $form->setValuesByArray($values);
224  return $form;
225  }
This class represents a property form user interface.
if(isset($_POST['submit'])) $form
$values
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initImgInput()

ilObjLearningSequenceSettingsGUI::initImgInput ( ilImageFileInputGUI  $inpt)
private

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

References ilImageFileInputGUI\setALlowDeletion(), and ilFileInputGUI\setSuffixes().

Referenced by buildForm().

98  {
99  $inpt->setSuffixes($this->img_allowed_suffixes);
100  $inpt->setALlowDeletion(true);
101  return $inpt;
102  }
setALlowDeletion($a_val)
Set allow deletion.
This class represents an image file property in a property form.
setSuffixes($a_suffixes)
Set Accepted Suffixes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initRTEInput()

ilObjLearningSequenceSettingsGUI::initRTEInput ( ilTextAreaInputGUI  $inpt)
private

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

References ilRTE\ILIAS_IMG_MANAGER_PLUGIN, ilTextAreaInputGUI\removePlugin(), ilTextAreaInputGUI\setRteTags(), and ilTextAreaInputGUI\setUseRte().

Referenced by buildForm().

105  {
106  $inpt->setUseRte(true);
108  $inpt->setRteTags($this->rte_allowed_tags);
109  //$inpt->setRTESupport($obj_id, "lso", "learningsequence");
110  return $inpt;
111  }
setUseRte($a_usert, $version='')
Set Use Rich Text Editing.
removePlugin($a_plugin)
Remove RTE plugin.
setRteTags($a_rtetags)
Set Valid RTE Tags.
const ILIAS_IMG_MANAGER_PLUGIN
Definition: class.ilRTE.php:14
This class represents a text area property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ settings()

ilObjLearningSequenceSettingsGUI::settings ( )
protected

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

References $form, addCommonFieldsToForm(), buildForm(), and fillForm().

Referenced by __construct(), and update().

85  {
86  $form = $this->buildForm();
87  $this->fillForm($form);
89  return $form->getHTML();
90  }
if(isset($_POST['submit'])) $form
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilObjLearningSequenceSettingsGUI::update ( )
protected

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

References $_POST, $end, $form, $img, $post, $start, addCommonFieldsToForm(), buildForm(), IL_CAL_DATETIME, ilLearningSequenceFilesystem\IMG_ABSTRACT, ilLearningSequenceFilesystem\IMG_EXTRO, ilUtil\sendFailure(), and settings().

244  {
245  $form = $this->buildForm();
247  if (!$form->checkInput()) {
248  $form->setValuesByPost();
249  ilUtil::sendFailure($this->lng->txt("msg_form_save_error"));
250  return $form->getHTML();
251  }
252 
253  $post = $_POST;
254  $lso = $this->obj;
255 
256  $lso->setTitle($post[self::PROP_TITLE]);
257  $lso->setDescription($post[self::PROP_DESC]);
258 
259  $settings = $this->settings
260  ->withAbstract($post[self::PROP_ABSTRACT])
261  ->withExtro($post[self::PROP_EXTRO])
262  ->withMembersGallery((bool) $post[self::PROP_GALLERY])
263  ;
264 
265  $inpt = $form->getItemByPostVar(self::PROP_AVAIL_PERIOD);
266  $start = $inpt->getStart();
267  $end = $inpt->getEnd();
268  $activation = $this->activation
269  ->withIsOnline((bool) $post[self::PROP_ONLINE]);
270 
271  if ($start) {
272  $activation = $activation
273  ->withActivationStart(
274  \DateTime::createFromFormat(
275  'Y-m-d H:i:s',
276  (string) $start->get(IL_CAL_DATETIME)
277  )
278  );
279  } else {
280  $activation = $activation->withActivationStart();
281  }
282  if ($end) {
283  $activation = $activation
284  ->withActivationEnd(
285  \DateTime::createFromFormat(
286  'Y-m-d H:i:s',
287  (string) $end->get(IL_CAL_DATETIME)
288  )
289  );
290  } else {
291  $activation = $activation->withActivationEnd();
292  }
293 
294  $inpt = $form->getItemByPostVar(self::PROP_ABSTRACT_IMAGE);
295  if ($inpt->getDeletionFlag()) {
296  $settings = $settings->withDeletion(ilLearningSequenceFilesystem::IMG_ABSTRACT);
297  } else {
298  $img = $_POST[self::PROP_ABSTRACT_IMAGE];
299  if ($img['size'] > 0) {
300  $settings = $settings->withUpload($img, ilLearningSequenceFilesystem::IMG_ABSTRACT);
301  }
302  }
303 
304  $inpt = $form->getItemByPostVar(self::PROP_EXTRO_IMAGE);
305  if ($inpt->getDeletionFlag()) {
306  $settings = $settings->withDeletion(ilLearningSequenceFilesystem::IMG_EXTRO);
307  } else {
308  $img = $_POST[self::PROP_EXTRO_IMAGE];
309  if ($img['size'] > 0) {
310  $settings = $settings->withUpload($img, ilLearningSequenceFilesystem::IMG_EXTRO);
311  }
312  }
313 
314  $form_service = $this->obj_service->commonSettings()->legacyForm($form, $this->obj);
315  $form_service->saveTitleIconVisibility();
316  $form_service->saveTopActionsVisibility();
317  $form_service->saveIcon();
318  $form_service->saveTileImage();
319 
320  $lso->updateSettings($settings);
321  $lso->updateActivation($activation);
322  $lso->update();
323 
324  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
325  $this->ctrl->redirect($this);
326  }
const IL_CAL_DATETIME
$start
Definition: bench.php:8
if(isset($_POST['submit'])) $form
$post
Definition: post.php:34
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

Field Documentation

◆ $img_allowed_suffixes

ilObjLearningSequenceSettingsGUI::$img_allowed_suffixes
private
Initial value:
= [
'png',
'jpg',
'jpeg',
'gif'
]

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

◆ $rte_allowed_tags

ilObjLearningSequenceSettingsGUI::$rte_allowed_tags
private
Initial value:
= [
'br',
'em',
'h1',
'h2',
'h3',
'li',
'ol',
'p',
'strong',
'u',
'ul'
]

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

◆ CMD_CANCEL

const ilObjLearningSequenceSettingsGUI::CMD_CANCEL = "cancel"

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

◆ CMD_SAVE

const ilObjLearningSequenceSettingsGUI::CMD_SAVE = "update"

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

◆ PROP_ABSTRACT

const ilObjLearningSequenceSettingsGUI::PROP_ABSTRACT = 'abstract'

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

◆ PROP_ABSTRACT_IMAGE

const ilObjLearningSequenceSettingsGUI::PROP_ABSTRACT_IMAGE = 'abstract_img'

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

◆ PROP_AVAIL_PERIOD

const ilObjLearningSequenceSettingsGUI::PROP_AVAIL_PERIOD = 'online_period'

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

◆ PROP_DESC

const ilObjLearningSequenceSettingsGUI::PROP_DESC = 'desc'

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

◆ PROP_EXTRO

const ilObjLearningSequenceSettingsGUI::PROP_EXTRO = 'extro'

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

◆ PROP_EXTRO_IMAGE

const ilObjLearningSequenceSettingsGUI::PROP_EXTRO_IMAGE = 'extro_img'

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

◆ PROP_GALLERY

const ilObjLearningSequenceSettingsGUI::PROP_GALLERY = 'gallery'

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

◆ PROP_ONLINE

const ilObjLearningSequenceSettingsGUI::PROP_ONLINE = 'online'

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

◆ PROP_TITLE

const ilObjLearningSequenceSettingsGUI::PROP_TITLE = 'title'

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


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