ILIAS  release_7 Revision v7.30-3-g800a261c036
ilObjLearningSequenceSettingsGUI Class Reference

Class ilObjLearningSequenceSettingsGUI. More...

+ Collaboration diagram for ilObjLearningSequenceSettingsGUI:

Public Member Functions

 __construct (ilObjLearningSequence $obj, ilCtrl $il_ctrl, ilLanguage $il_language, ilGlobalTemplateInterface $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,
ilGlobalTemplateInterface  $il_template,
ilObjectService  $obj_service 
)

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

51 {
52 $this->obj = $obj;
53 $this->settings = $obj->getLSSettings();
54 $this->activation = $obj->getLSActivation();
55 $this->obj_title = $obj->getTitle();
56 $this->obj_description = $obj->getDescription();
57 $this->ctrl = $il_ctrl;
58 $this->lng = $il_language;
59 $this->tpl = $il_template;
60 $this->object_service = $object_service;
61 $this->obj_service = $obj_service;
62
63 $this->lng->loadLanguageModule('content');
64 $this->lng->loadLanguageModule('obj');
65 }
getDescription()
get object description
getTitle()
get object title @access public

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addCommonFieldsToForm()

ilObjLearningSequenceSettingsGUI::addCommonFieldsToForm ( \ilPropertyFormGUI  $form)
protected

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

229 {
230 $txt = function ($id) {
231 return $this->lng->txt($id);
232 };
233 $section_appearance = new ilFormSectionHeaderGUI();
234 $section_appearance->setTitle($txt('cont_presentation'));
235 $form->addItem($section_appearance);
236 $form_service = $this->obj_service->commonSettings()->legacyForm($form, $this->obj);
237 $form = $form_service->addTitleIconVisibility();
238 $form = $form_service->addTopActionsVisibility();
239 $form = $form_service->addIcon();
240 $form = $form_service->addTileImage();
241 }
This class represents a section header in a property form.
$txt
Definition: error.php:13

References $txt, and ilPropertyFormGUI\addItem().

Referenced by settings(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildForm()

ilObjLearningSequenceSettingsGUI::buildForm ( )
protected

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

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

References $txt, IL_CAL_DATETIME, initImgInput(), and initRTEInput().

Referenced by settings(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilObjLearningSequenceSettingsGUI::cancel ( )
protected

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

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

◆ executeCommand()

ilObjLearningSequenceSettingsGUI::executeCommand ( )

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

68 {
69 $cmd = $this->ctrl->getCmd('settings');
70
71 switch ($cmd) {
72 case "settings":
73 case self::CMD_SAVE:
75 $content = $this->$cmd();
76 break;
77 default:
78 throw new ilException("ilObjLearningSequenceSettingsGUI: " .
79 "Command not supported: $cmd");
80
81 }
82 $this->tpl->setContent($content);
83 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References CMD_CANCEL, and CMD_SAVE.

◆ fillForm()

ilObjLearningSequenceSettingsGUI::fillForm ( \ilPropertyFormGUI  $form)
protected

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

211 {
212 $settings = $this->settings;
213 $activation = $this->activation;
214 $values = [
215 self::PROP_TITLE => $this->obj_title,
216 self::PROP_DESC => $this->obj_description,
217 self::PROP_ABSTRACT => $settings->getAbstract(),
218 self::PROP_EXTRO => $settings->getExtro(),
219 self::PROP_ABSTRACT_IMAGE => $settings->getAbstractImage(),
220 self::PROP_EXTRO_IMAGE => $settings->getExtroImage(),
221 self::PROP_ONLINE => $activation->getIsOnline(),
222 self::PROP_GALLERY => $settings->getMembersGallery()
223 ];
224 $form->setValuesByArray($values);
225 return $form;
226 }
setValuesByArray($a_values, $a_restrict_to_value_keys=false)
Set form values from an array.

References ilPropertyFormGUI\setValuesByArray().

Referenced by settings().

+ 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 98 of file class.ilObjLearningSequenceSettingsGUI.php.

99 {
100 $inpt->setSuffixes($this->img_allowed_suffixes);
101 $inpt->setALlowDeletion(true);
102 return $inpt;
103 }
setSuffixes($a_suffixes)
Set Accepted Suffixes.
setALlowDeletion($a_val)
Set allow deletion.

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

Referenced by buildForm().

+ 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 105 of file class.ilObjLearningSequenceSettingsGUI.php.

106 {
107 $inpt->setUseRte(true);
109 $inpt->setRteTags($this->rte_allowed_tags);
110 //$inpt->setRTESupport($obj_id, "lso", "learningsequence");
111 return $inpt;
112 }
const ILIAS_IMG_MANAGER_PLUGIN
Definition: class.ilRTE.php:14
setUseRte($a_usert, $version='')
Set Use Rich Text Editing.
removePlugin($a_plugin)
Remove RTE plugin.
setRteTags($a_rtetags)
Set Valid RTE Tags.

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

Referenced by buildForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ settings()

ilObjLearningSequenceSettingsGUI::settings ( )
protected

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

86 {
87 $form = $this->buildForm();
88 $this->fillForm($form);
89 $this->addCommonFieldsToForm($form);
90 return $form->getHTML();
91 }

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

Referenced by __construct(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilObjLearningSequenceSettingsGUI::update ( )
protected

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

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

References $_POST, $img, addCommonFieldsToForm(), buildForm(), IL_CAL_DATETIME, ilLearningSequenceFilesystem\IMG_ABSTRACT, ilLearningSequenceFilesystem\IMG_EXTRO, PROP_ABSTRACT_IMAGE, PROP_EXTRO_IMAGE, ilUtil\sendFailure(), and settings().

+ 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 38 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',
'a'
]

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.

Referenced by executeCommand().

◆ CMD_SAVE

const ilObjLearningSequenceSettingsGUI::CMD_SAVE = "update"

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

Referenced by executeCommand().

◆ 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.

Referenced by update().

◆ 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.

Referenced by update().

◆ 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: