76 protected string $seed,
77 protected string $sseed,
80 protected int $context_obj_id = 0
84 $this->
ctrl = $DIC->ctrl();
85 $this->tpl =
$DIC->ui()->mainTemplate();
86 $this->
lng = $DIC->language();
92 $this->
tabs = $DIC->tabs();
93 $this->obj_data_cache =
$DIC[
'ilObjDataCache'];
94 $this->
user = $DIC->user();
95 $this->ui_factory =
$DIC->ui()->factory();
96 $this->ui_renderer =
$DIC->ui()->renderer();
97 $this->ui_service =
$DIC->uiService();
100 $this->process_manager =
$DIC->bookingManager()->internal()->domain()->process();
101 $this->data_factory =
new DataFactory();
107 $this->book_request =
$DIC
112 $this->gui =
$DIC->bookingManager()->internal()->gui();
113 $this->schedule_manager =
$DIC
117 ->schedules($this->pool->getId());
123 ->getByObjId($this->pool->getId());
125 $this->bulk_creation_gui = $this->gui->objects()->ilBookBulkCreationGUI($this->pool);
127 $schedule_type = $a_parent_obj->
getObject()->getScheduleType();
130 $this->pool_overall_limit = !$this->pool_has_schedule ? $a_parent_obj->
getObject()->getOverallLimit() :
null;
132 $this->object_id = $this->book_request->getObjectId();
133 $this->ref_id = $this->book_request->getRefId();
134 $this->
ctrl->saveParameter($this,
'object_id');
136 $this->rsv_ids = array_map(
'intval', $this->book_request->getReservationIdsFromString());
137 $this->objects_manager =
$DIC
141 ->objects($this->pool->getId());
143 $this->
access->validateBookingObjId($this->object_id, (
int) $a_parent_obj->
getObject()?->getId());
148 $this->management = $a_val;
158 return $this->a_parent_obj->getRefId();
163 return $this->pool->getId();
181 switch (strtolower($this->
ctrl->getNextClass($this))) {
182 case strtolower(ilPropertyFormGUI::class):
187 case strtolower(ilBookingProcessWithScheduleGUI::class):
188 $this->
ctrl->setReturn($this, $this->pool_uses_preferences ?
'returnToPreferences' :
'render');
189 $process_gui = $this->gui->process()->ilBookingProcessWithScheduleGUI(
192 $this->context_obj_id,
193 $this->seed ?? $this->sseed
195 $this->
ctrl->forwardCommand($process_gui);
198 case strtolower(ilBookingProcessWithoutScheduleGUI::class):
199 $this->
ctrl->setReturn($this, $this->pool_uses_preferences ?
'returnToPreferences' :
'render');
200 $process_gui = $this->gui->process()->ilBookingProcessWithoutScheduleGUI(
203 $this->context_obj_id
205 $this->
ctrl->forwardCommand($process_gui);
208 case strtolower(ilBookBulkCreationGUI::class):
209 $this->
ctrl->setReturn($this,
'');
210 $this->
ctrl->forwardCommand($this->bulk_creation_gui);
214 $cmd = $this->
ctrl->getCmd(
'render');
222 $this->
ctrl->redirectByClass(ilBookingPreferencesGUI::class);
227 $this->a_parent_obj->showNoScheduleMessage();
233 if ($this->
access->canManageObjects($this->getPoolRefId())) {
234 $bar->addButton($this->
lng->txt(
'book_add_object'), $this->ctrl->getLinkTarget($this,
'create'));
237 $this->bulk_creation_gui->modifyToolbar(
$bar);
240 if (
$bar->getItems() !== []) {
241 $bar->addSeparator();
245 $mode_control = $this->gui->ui()->factory()->viewControl()->mode(
247 $this->
lng->txt(
'book_table') => $this->ctrl->getLinkTarget($this,
''),
248 $this->lng->txt(
'book_week') => $this->ctrl->getLinkTargetByClass(ilBookingProcessWithScheduleGUI::class,
'week')
250 $this->lng->txt(
'book_view')
252 $bar->addComponent($mode_control);
259 if ($modal !==
null) {
263 $this->tpl->setPermanentLink(
'book', $this->
getPoolRefId());
264 $this->tpl->setContent(
$bar . $this->ui_renderer->render(
$components));
281 $this->process_manager,
286 $this->context_obj_id,
301 $this->process_manager,
306 $this->context_obj_id,
318 if ($modal !==
null) {
322 $this->
ctrl->redirectByClass(self::class,
'render');
328 $this->data_factory->uri(ILIAS_HTTP_PATH .
"/{$this->ctrl->getLinkTarget($this, 'executeTableAction')}")
334 if (!$this->
access->canManageObjects($this->ref_id)) {
338 $this->
tabs->clearTargets();
339 $this->
tabs->setBackTarget($this->
lng->txt(
'book_back_to_list'), $this->ctrl->getLinkTarget($this,
'render'));
344 $this->tpl->setContent($a_form->getHTML());
349 if (!$this->
access->canManageObjects($this->ref_id)) {
353 $this->
tabs->clearTargets();
354 $this->
tabs->setBackTarget($this->
lng->txt(
'book_back_to_list'), $this->ctrl->getLinkTarget($this,
'render'));
358 $a_form ??= $this->
initForm(
'edit', $this->object_id);
359 $this->tpl->setContent($a_form->getHTML());
364 $this->
help->setHelpId($a_id);
372 $title->setRequired(
true);
374 $title->setMaxLength(120);
375 $form_gui->addItem($title);
380 $desc->setMaxNumOfChars(1000);
381 $form_gui->addItem($desc);
383 $file =
new ilFileInputGUI($this->
lng->txt(
'book_additional_info_file'),
'file');
384 $file->setAllowDeletion(
true);
385 $form_gui->addItem($file);
388 $nr->setRequired(
true);
390 $nr->setMaxLength(3);
391 $nr->setSuffix($this->
lng->txt(
'book_booking_objects'));
392 $form_gui->addItem($nr);
397 static fn(
string $schedule_title):
string => $schedule_title,
398 $this->schedule_manager->getScheduleList()
401 $schedule->setRequired(
true);
403 $form_gui->addItem($schedule);
407 $post->setTitle($this->
lng->txt(
'book_post_booking_information'));
408 $form_gui->addItem($post);
413 $pdesc->setInfo($this->
lng->txt(
'book_post_booking_text_info'));
414 $form_gui->addItem($pdesc);
416 $pfile =
new ilFileInputGUI($this->
lng->txt(
'book_post_booking_file'),
'post_file');
417 $pfile->setAllowDeletion(
true);
418 $form_gui->addItem($pfile);
428 $this->record_gui->setPropertyForm($form_gui);
429 $this->record_gui->parse();
431 if ($a_mode ===
'edit') {
432 $form_gui->setTitle($this->
lng->txt(
'book_edit_object'));
435 $item->setValue(
$id);
436 $form_gui->addItem($item);
439 $title->setValue($obj->getTitle());
440 $desc->setValue($obj->getDescription());
441 $nr->setValue($obj->getNrOfItems());
442 $pdesc->setValue($obj->getPostText());
443 $file->setValue($this->objects_manager->getObjectInfoFilename(
$id));
444 $pfile->setValue($this->objects_manager->getBookingInfoFilename(
$id));
446 $schedule?->setValue($obj->getScheduleId());
448 $form_gui->addCommandButton(
'update', $this->
lng->txt(
'save'));
450 $form_gui->setTitle($this->
lng->txt(
'book_add_object'));
451 $form_gui->addCommandButton(
'save', $this->
lng->txt(
'save'));
452 $form_gui->addCommandButton(
'render', $this->
lng->txt(
'cancel'));
455 $form_gui->setFormAction($this->
ctrl->getFormAction($this));
471 if (!$this->
access->canManageObjects($this->ref_id)) {
475 $form = $create ? $this->
initForm() : $this->
initForm(
'edit', $this->object_id);
485 $obj->setTitle($form->getInput(
'title'));
486 $obj->setDescription($form->getInput(
'desc'));
487 $obj->setNrOfItems($form->getInput(
'items'));
488 $obj->setPostText($form->getInput(
'post_text'));
491 $obj->setScheduleId($form->getInput(
'schedule'));
501 if ($_FILES[
'file'][
'tmp_name']) {
502 $this->objects_manager->importObjectInfoFromLegacyUpload($obj->getId(), $_FILES[
'file']);
503 } elseif ($form->getItemByPostVar(
'file')?->getDeletionFlag()) {
504 $this->objects_manager->deleteObjectInfo($obj->getId());
507 if ($_FILES[
'post_file'][
'tmp_name']) {
508 $this->objects_manager->importBookingInfoFromLegacyUpload($obj->getId(), $_FILES[
'post_file']);
509 } elseif ($form->getItemByPostVar(
'post_file')?->getDeletionFlag()) {
510 $this->objects_manager->deleteBookingInfo($obj->getId());
516 ? $this->record_gui?->writeEditForm(
null, $obj->getId())
517 : $this->record_gui?->writeEditForm();
519 $this->tpl->setOnScreenMessage(
521 $this->
lng->txt($create ?
'book_object_added' :
'book_object_updated'),
524 $this->
ctrl->redirect($this, $create ?
'render' :
'edit');
527 $form->setValuesByPost();
528 $create ? $this->
create($form) : $this->
edit($form);
533 if (!$this->
access->canManageObjects($this->ref_id)) {
537 $this->
tabs->clearTargets();
538 $this->
tabs->setBackTarget($this->
lng->txt(
'book_back_to_list'), $this->ctrl->getLinkTarget($this,
'render'));
541 $conf->setFormAction($this->
ctrl->getFormAction($this));
542 $conf->setHeaderText($this->
lng->txt(
'book_confirm_delete'));
545 $conf->addItem(
'object_id', $this->object_id, $type->getTitle());
546 $conf->setConfirm($this->
lng->txt(
'delete'),
'delete');
547 $conf->setCancel($this->
lng->txt(
'cancel'),
'render');
549 $this->tpl->setContent($conf->getHTML());
552 public function delete():
void
554 if (!$this->
access->canManageObjects($this->ref_id)) {
559 $obj->deleteReservationsAndCalEntries($this->object_id);
562 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'book_object_deleted'),
true);
563 $this->
ctrl->setParameter($this,
'object_id',
'');
564 $this->
ctrl->redirect($this,
'render');
569 if (!$this->object_id) {
573 $this->objects_manager->deliverObjectInfo($this->object_id);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Builds a Color from either hex- or rgb values.
importEditFormPostValues()
Load edit form values from post.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
@ilCtrl_Calls ilBookingObjectGUI: ilPropertyFormGUI, ilBookingProcessWithScheduleGUI,...
ScheduleManager $schedule_manager
StandardGUIRequest $book_request
ilBookBulkCreationGUI $bulk_creation_gui
activateManagement(bool $a_val)
BookingProcessManager $process_manager
ilAdvancedMDRecordGUI $record_gui
render(?Modal $modal=null)
initForm(string $a_mode='create', ?int $id=null)
ilObjectDataCache $obj_data_cache
edit(?ilPropertyFormGUI $a_form=null)
ilGlobalTemplateInterface $tpl
DataFactory $data_factory
bool $pool_uses_preferences
ObjectsManager $objects_manager
create(?ilPropertyFormGUI $a_form=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilCtrl provides processing control methods.
@ilCtrl_Calls ilObjBookingPoolGUI: ilPermissionGUI, ilBookingObjectGUI @ilCtrl_Calls ilObjBookingPool...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const TYPE_NO_SCHEDULE_PREFERENCES
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
This class represents a text property in a property form.
This describes commonalities between the different modals.
This is how the factory for UI elements looks.
An entity that renders components to a string output.
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc