19declare(strict_types=1);
38 protected int $obj_id,
40 protected bool $creation_mode,
41 protected object $parent_gui
47 $ctrl = $this->gui->ctrl();
48 $next_class = $ctrl->getNextClass($this);
49 $cmd = $ctrl->getCmd(
"edit");
51 switch ($next_class) {
52 case strtolower(ilDidacticTemplateGUI::class):
53 $ctrl->setReturn($this,
'edit');
58 $ctrl->forwardCommand($did);
62 if (in_array($cmd, [
"edit",
"save"])) {
68 protected function edit(): void
70 $mt = $this->gui->ui()->mainTemplate();
72 $mt->setContent($form->render());
77 $lng = $this->domain->lng();
78 $settings = $this->domain->bookingSettings()->getByObjId($this->obj_id);
80 ->section(
"general",
$lng->txt(
"book_edit"))
85 $form = $form->addDidacticTemplates(
94 $lng->txt(
"book_schedule_type"),
96 (string) $settings->getScheduleType()
101 $lng->txt(
"book_schedule_type_fixed"),
102 $lng->txt(
"book_schedule_type_fixed_info")
106 $lng->txt(
"book_reservation_filter_period"),
107 $lng->txt(
"days") .
" - " .
108 $lng->txt(
"book_reservation_filter_period_info"),
109 $settings->getReservationPeriod()
113 $lng->txt(
"book_reminder_setting"),
115 (bool) $settings->getReminderStatus()
119 $lng->txt(
"book_reminder_day"),
121 max($settings->getReminderDay(), 1)
125 $lng->txt(
"book_schedule_type_none_direct"),
126 $lng->txt(
"book_schedule_type_none_direct_info")
130 $lng->txt(
"book_overall_limit"),
131 $lng->txt(
"book_total_individual_bookings_limit"),
132 $settings->getOverallLimit()
135 $pref_options_disabled =
false;
137 $pref_manager = $this->domain->preferences(
140 $pref_options_disabled = $pref_manager->hasRun();
146 $lng->txt(
"book_schedule_type_none_preference"),
147 $lng->txt(
"book_schedule_type_none_preference_info")
152 $lng->txt(
"book_nr_of_preferences"),
153 $lng->txt(
"book_nr_preferences") .
" - " .
154 $lng->txt(
"book_nr_of_preferences_info"),
155 $settings->getPreferenceNr()
157 if ($pref_options_disabled) {
158 $form = $form->disabled();
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
172 if ($pref_options_disabled) {
173 $form = $form->disabled();
175 if (!$mode_disabled) {
176 $form = $form->required();
181 if ($mode_disabled) {
182 $form = $form->disabledGroup(
true);
188 $lng->txt(
"book_public_log"),
189 $lng->txt(
"book_public_log_info"),
190 $settings->getPublicLog()
194 $lng->txt(
"book_messages"),
195 $lng->txt(
"book_messages_info"),
196 $settings->getMessages()
199 $lng->loadLanguageModule(
"rep");
204 $lng->txt(
'rep_activation_availability')
214 $lng->txt(
'obj_presentation')
220 $form = $form->addAdditionalFeatures(
230 protected function save(): void
232 $mt = $this->gui->ui()->mainTemplate();
234 $ctrl = $this->gui->ctrl();
235 $lng = $this->domain->lng();
237 $old_settings = $this->domain->bookingSettings()->getByObjId($this->obj_id);
239 if ($form->isValid()) {
240 $form->saveStdTitleAndDescription(
252 $form->saveAdditionalFeatures(
259 $settings = $this->data->settings(
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()
270 (
int) $form->getData(
"preference_nr"),
271 (
bool) $form->getData(
"messages")
274 $this->domain->bookingSettings()->update($settings);
278 $form->redirectToDidacticConfirmationIfChanged(
284 $mt->setOnScreenMessage(
"success",
$lng->txt(
"msg_obj_modified"),
true);
285 $ctrl->redirectByClass(self::class,
"edit");
287 $mt = $this->gui->ui()->mainTemplate();
288 $mt->setContent($form->render());
Repository internal data service.
Author: Alexander Killing killing@leifos.de
@ilCtrl_Calls ILIAS\BookingManager\Settings\SettingsGUI: ilDidacticTemplateGUI
__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)
static getList(int $a_pool_id, ?string $a_title=null)
Get list of booking objects.
GUI class for didactic template settings inside repository objects.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const TYPE_NO_SCHEDULE_PREFERENCES