ILIAS  trunk Revision v12.0_alpha-454-g178fcb218fa
ILIAS\BookingManager\Settings\SettingsGUI Class Reference

@ilCtrl_Calls ILIAS\BookingManager\Settings\SettingsGUI: ilDidacticTemplateGUI More...

+ Collaboration diagram for ILIAS\BookingManager\Settings\SettingsGUI:

Public Member Functions

 __construct (protected InternalDataService $data, protected InternalDomainService $domain, protected InternalGUIService $gui, protected int $obj_id, protected int $ref_id, protected bool $creation_mode, protected object $parent_gui)
 
 executeCommand ()
 

Protected Member Functions

 edit ()
 
 getEditForm ()
 
 save ()
 

Detailed Description

@ilCtrl_Calls ILIAS\BookingManager\Settings\SettingsGUI: ilDidacticTemplateGUI

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

Constructor & Destructor Documentation

◆ __construct()

ILIAS\BookingManager\Settings\SettingsGUI::__construct ( protected InternalDataService  $data,
protected InternalDomainService  $domain,
protected InternalGUIService  $gui,
protected int  $obj_id,
protected int  $ref_id,
protected bool  $creation_mode,
protected object  $parent_gui 
)

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

42 {
43 }

Member Function Documentation

◆ edit()

ILIAS\BookingManager\Settings\SettingsGUI::edit ( )
protected

Definition at line 68 of file class.SettingsGUI.php.

68 : void
69 {
70 $mt = $this->gui->ui()->mainTemplate();
71 $form = $this->getEditForm();
72 $mt->setContent($form->render());
73 }

References ILIAS\BookingManager\Settings\SettingsGUI\getEditForm().

+ Here is the call graph for this function:

◆ executeCommand()

ILIAS\BookingManager\Settings\SettingsGUI::executeCommand ( )

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

45 : void
46 {
47 $ctrl = $this->gui->ctrl();
48 $next_class = $ctrl->getNextClass($this);
49 $cmd = $ctrl->getCmd("edit");
50
51 switch ($next_class) {
52 case strtolower(ilDidacticTemplateGUI::class):
53 $ctrl->setReturn($this, 'edit');
54 $did = new ilDidacticTemplateGUI(
55 $this->parent_gui,
57 );
58 $ctrl->forwardCommand($did);
59 break;
60
61 default:
62 if (in_array($cmd, ["edit", "save"])) {
63 $this->$cmd();
64 }
65 }
66 }
GUI class for didactic template settings inside repository objects.

References ILIAS\Repository\Form\getDidacticTemplateIdFromRequest(), and ILIAS\BookingManager\Settings\SettingsGUI\getEditForm().

+ Here is the call graph for this function:

◆ getEditForm()

ILIAS\BookingManager\Settings\SettingsGUI::getEditForm ( )
protected

Definition at line 75 of file class.SettingsGUI.php.

75 : FormAdapterGUI
76 {
77 $lng = $this->domain->lng();
78 $settings = $this->domain->bookingSettings()->getByObjId($this->obj_id);
79 $form = (new FormAdapterGUI([self::class], 'save'))
80 ->section("general", $lng->txt("book_edit"))
82 $this->obj_id,
83 "book"
84 );
85 $form = $form->addDidacticTemplates(
86 "book",
87 $this->ref_id,
88 $this->creation_mode
89 );
90
91 $form = $form
92 ->switch(
93 "stype",
94 $lng->txt("book_schedule_type"),
95 "",
96 (string) $settings->getScheduleType()
97 );
98 $form = $form
99 ->group(
101 $lng->txt("book_schedule_type_fixed"),
102 $lng->txt("book_schedule_type_fixed_info")
103 )
104 ->number(
105 "period",
106 $lng->txt("book_reservation_filter_period"),
107 $lng->txt("days") . " - " .
108 $lng->txt("book_reservation_filter_period_info"),
109 $settings->getReservationPeriod()
110 )
111 ->checkbox(
112 "rmd",
113 $lng->txt("book_reminder_setting"),
114 "",
115 (bool) $settings->getReminderStatus()
116 )
117 ->number(
118 "rmd_day",
119 $lng->txt("book_reminder_day"),
120 "",
121 max($settings->getReminderDay(), 1)
122 )
123 ->group(
125 $lng->txt("book_schedule_type_none_direct"),
126 $lng->txt("book_schedule_type_none_direct_info")
127 )
128 ->number(
129 "limit",
130 $lng->txt("book_overall_limit"),
131 $lng->txt("book_total_individual_bookings_limit"),
132 $settings->getOverallLimit()
133 );
134
135 $pref_options_disabled = false;
136 if ($settings->getScheduleType() === \ilObjBookingPool::TYPE_NO_SCHEDULE_PREFERENCES) {
137 $pref_manager = $this->domain->preferences(
138 new \ilObjBookingPool($this->ref_id)
139 );
140 $pref_options_disabled = $pref_manager->hasRun();
141 }
142
143 $form = $form
144 ->group(
146 $lng->txt("book_schedule_type_none_preference"),
147 $lng->txt("book_schedule_type_none_preference_info")
148 );
149 $form = $form
150 ->number(
151 "preference_nr",
152 $lng->txt("book_nr_of_preferences"),
153 $lng->txt("book_nr_preferences") . " - " .
154 $lng->txt("book_nr_of_preferences_info"),
155 $settings->getPreferenceNr()
156 );
157 if ($pref_options_disabled) {
158 $form = $form->disabled();
159 }
160 $form = $form
161 ->dateTime(
162 "pref_deadline",
163 $lng->txt("book_pref_deadline"),
164 $lng->txt("book_pref_deadline_info"),
165 $settings->getPrefDeadline()
166 ? new \ilDateTime($settings->getPrefDeadline(), IL_CAL_UNIX) : null
167 );
168
169 // #14478
170 $mode_disabled = (count(\ilBookingObject::getList($this->obj_id)));
171
172 if ($pref_options_disabled) {
173 $form = $form->disabled();
174 } else {
175 if (!$mode_disabled) {
176 $form = $form->required();
177 }
178 }
179 $form->end();
180
181 if ($mode_disabled) {
182 $form = $form->disabledGroup(true);
183 }
184
185 $form = $form
186 ->checkbox(
187 "public",
188 $lng->txt("book_public_log"),
189 $lng->txt("book_public_log_info"),
190 $settings->getPublicLog()
191 )
192 ->checkbox(
193 "messages",
194 $lng->txt("book_messages"),
195 $lng->txt("book_messages_info"),
196 $settings->getMessages()
197 );
198
199 $lng->loadLanguageModule("rep");
200
201 $form = $form
202 ->section(
203 "rep",
204 $lng->txt('rep_activation_availability')
205 )
206 ->addOnline(
207 $this->obj_id,
208 "book"
209 );
210
211 $form = $form
212 ->section(
213 "obj_presentation",
214 $lng->txt('obj_presentation')
215 )->addStdTile(
216 $this->obj_id,
217 "book"
218 );
219
220 $form = $form->addAdditionalFeatures(
221 $this->obj_id,
222 [
224 ]
225 );
226
227 return $form;
228 }
const IL_CAL_UNIX
static getList(int $a_pool_id, ?string $a_title=null)
Get list of booking objects.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addStdTitleAndDescription(int $obj_id, string $type)
addOnline(int $obj_id, string $type)
addStdTile(int $obj_id, string $type)
global $lng
Definition: privfeed.php:31

References $lng, ILIAS\Repository\Form\addOnline(), ILIAS\Repository\Form\addStdTile(), ILIAS\Repository\Form\addStdTitleAndDescription(), ilObjectServiceSettingsGUI\CUSTOM_METADATA, ilBookingObject\getList(), IL_CAL_UNIX, ilObjBookingPool\TYPE_FIX_SCHEDULE, ilObjBookingPool\TYPE_NO_SCHEDULE, and ilObjBookingPool\TYPE_NO_SCHEDULE_PREFERENCES.

Referenced by ILIAS\BookingManager\Settings\SettingsGUI\edit(), ILIAS\BookingManager\Settings\SettingsGUI\executeCommand(), and ILIAS\BookingManager\Settings\SettingsGUI\save().

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

◆ save()

ILIAS\BookingManager\Settings\SettingsGUI::save ( )
protected

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

230 : void
231 {
232 $mt = $this->gui->ui()->mainTemplate();
233 $form = $this->getEditForm();
234 $ctrl = $this->gui->ctrl();
235 $lng = $this->domain->lng();
236
237 $old_settings = $this->domain->bookingSettings()->getByObjId($this->obj_id);
238
239 if ($form->isValid()) {
240 $form->saveStdTitleAndDescription(
241 $this->obj_id,
242 "book"
243 );
244 $form->saveStdTile(
245 $this->obj_id,
246 "book"
247 );
248 $form->saveOnline(
249 $this->obj_id,
250 "book"
251 );
252 $form->saveAdditionalFeatures(
253 $this->obj_id,
254 [
256 ]
257 );
258
259 $settings = $this->data->settings(
260 $this->obj_id,
261 (bool) $form->getData("public"),
262 (int) $form->getData("stype"),
263 (int) $form->getData("limit"),
264 (int) $form->getData("period"),
265 (bool) $form->getData("rmd"),
266 (int) $form->getData("rmd_day"),
267 $form->getData("pref_deadline")
268 ? (int) $form->getData("pref_deadline")->getUnixTime()
269 : 0,
270 (int) $form->getData("preference_nr"),
271 (bool) $form->getData("messages")
272 );
273
274 $this->domain->bookingSettings()->update($settings);
275
276
277 // check if template is changed
278 $form->redirectToDidacticConfirmationIfChanged(
279 $this->ref_id,
280 "book",
281 static::class
282 );
283
284 $mt->setOnScreenMessage("success", $lng->txt("msg_obj_modified"), true);
285 $ctrl->redirectByClass(self::class, "edit");
286 } else {
287 $mt = $this->gui->ui()->mainTemplate();
288 $mt->setContent($form->render());
289 }
290 }

References $lng, ilObjectServiceSettingsGUI\CUSTOM_METADATA, and ILIAS\BookingManager\Settings\SettingsGUI\getEditForm().

+ Here is the call graph for this function:

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