30 protected \ILIAS\BookingManager\InternalGUIService
$gui;
31 protected \ILIAS\BookingManager\Access\AccessManager
$access;
60 int $context_obj_id = 0
64 $this->
ctrl = $DIC->ctrl();
65 $this->tpl = $DIC[
"tpl"];
66 $this->
lng = $DIC->language();
67 $this->
access = $DIC->bookingManager()->internal()->domain()->access();
68 $this->
tabs = $DIC->tabs();
70 $this->obj_data_cache = $DIC[
"ilObjDataCache"];
71 $this->
user = $DIC->user();
77 $this->book_request = $DIC
82 $this->gui = $DIC->bookingManager()->internal()->gui();
83 $this->schedule_manager = $DIC
87 ->schedules($this->pool->getId());
94 $this->pool_gui = $a_parent_obj;
95 $this->bulk_creation_gui = $this->gui->objects()
96 ->ilBookBulkCreationGUI($this->pool);
98 $this->pool_has_schedule =
100 $this->pool_uses_preferences =
102 $this->pool_overall_limit = $this->pool_has_schedule
104 : $a_parent_obj->
getObject()->getOverallLimit();
106 $this->object_id = $this->book_request->getObjectId();
107 $this->ref_id = $this->book_request->getRefId();
108 $this->
ctrl->saveParameter($this,
"object_id");
110 $this->rsv_ids =
array_map(
'intval', $this->book_request->getReservationIdsFromString());
111 $this->objects_manager = $DIC->bookingManager()->internal()->domain()->objects($this->pool->getId());
113 $this->
access->validateBookingObjId(
115 (
int) $this->pool_gui->getObject()?->getId()
121 $this->management = $a_val;
134 return $this->pool_gui->getRefId();
139 return $this->pool_gui->getObject()->getId();
157 : $this->pool_gui->getObject()->getOverallLimit();
163 public function executeCommand():
void 169 switch ($next_class) {
170 case "ilpropertyformgui":
173 $this->
ctrl->forwardCommand($form);
176 case "ilbookingprocesswithschedulegui":
177 if (!$this->pool_uses_preferences) {
178 $ilCtrl->setReturn($this,
"render");
180 $ilCtrl->setReturn($this,
"returnToPreferences");
183 $pool = $this->pool_gui->getObject();
184 $process_gui = $this->gui->process()->ilBookingProcessWithScheduleGUI(
187 $this->context_obj_id,
188 $this->seed ?? $this->sseed
190 $this->
ctrl->forwardCommand($process_gui);
193 case "ilbookingprocesswithoutschedulegui":
194 if (!$this->pool_uses_preferences) {
195 $ilCtrl->setReturn($this,
"render");
197 $ilCtrl->setReturn($this,
"returnToPreferences");
200 $pool = $this->pool_gui->getObject();
201 $process_gui = $this->gui->process()->ilBookingProcessWithoutScheduleGUI(
204 $this->context_obj_id
206 $this->
ctrl->forwardCommand($process_gui);
209 case strtolower(ilBookBulkCreationGUI::class):
210 $this->
ctrl->setReturn($this,
"");
211 $this->
ctrl->forwardCommand($this->bulk_creation_gui);
215 $cmd = $ilCtrl->getCmd(
"render");
223 $this->pool_gui->showNoScheduleMessage();
228 $this->
ctrl->redirectByClass(
"ilBookingPreferencesGUI");
247 $bar->addButton($lng->
txt(
'book_add_object'), $ilCtrl->getLinkTarget($this,
'create'));
250 $this->bulk_creation_gui->modifyToolbar(
$bar);
253 $bar->addSeparator();
254 $list_link = $this->
ctrl->getLinkTarget($this,
"");
255 $week_link = $this->
ctrl->getLinkTargetByClass(
"ilBookingProcessWithScheduleGUI",
"week");
256 $mode_control = $this->gui->ui()->factory()->viewControl()->mode([
257 $this->
lng->txt(
"book_list") => $list_link,
258 $this->
lng->txt(
"book_week") => $week_link
259 ], $this->
lng->txt(
"book_view"));
260 $bar->addComponent($mode_control);
274 $table->resetOffset();
275 $table->writeFilterToSession();
282 $table->resetOffset();
283 $table->resetFilter();
292 if (!$this->
access->canManageObjects($this->ref_id)) {
302 $ilTabs->setBackTarget($lng->
txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
317 if (!$this->
access->canManageObjects($this->ref_id)) {
326 $ilTabs->clearTargets();
327 $ilTabs->setBackTarget($lng->
txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
332 $a_form = $this->
initForm(
'edit', $this->object_id);
339 $this->
help->setHelpId($a_id);
346 string $a_mode =
"create",
356 $title->setRequired(
true);
358 $title->setMaxLength(120);
359 $form_gui->addItem($title);
364 $desc->setMaxNumOfChars(1000);
365 $form_gui->addItem($desc);
369 $form_gui->addItem($file);
374 $nr->setMaxLength(3);
375 $nr->setSuffix($lng->
txt(
"book_booking_objects"));
376 $form_gui->addItem($nr);
380 foreach ($this->schedule_manager->getScheduleList() as $schedule_id => $schedule_title) {
381 $options[$schedule_id] = $schedule_title;
385 $schedule->setOptions($options);
386 $form_gui->addItem($schedule);
390 $post->setTitle($lng->
txt(
"book_post_booking_information"));
391 $form_gui->addItem(
$post);
396 $pdesc->setInfo($lng->
txt(
"book_post_booking_text_info"));
397 $form_gui->addItem($pdesc);
401 $form_gui->addItem($pfile);
411 $this->record_gui->setPropertyForm($form_gui);
412 $this->record_gui->parse();
414 if ($a_mode ===
"edit") {
415 $form_gui->setTitle($lng->
txt(
"book_edit_object"));
418 $item->setValue($id);
419 $form_gui->addItem($item);
422 $title->setValue($obj->getTitle());
423 $desc->setValue($obj->getDescription());
424 $nr->setValue($obj->getNrOfItems());
425 $pdesc->setValue($obj->getPostText());
426 $file->setValue($this->objects_manager->getObjectInfoFilename($id));
427 $pfile->setValue($this->objects_manager->getBookingInfoFilename($id));
429 if (isset($schedule)) {
430 $schedule->setValue($obj->getScheduleId());
433 $form_gui->addCommandButton(
"update", $lng->
txt(
"save"));
435 $form_gui->setTitle($lng->
txt(
"book_add_object"));
436 $form_gui->addCommandButton(
"save", $lng->
txt(
"save"));
437 $form_gui->addCommandButton(
"render", $lng->
txt(
"cancel"));
439 $form_gui->setFormAction($ilCtrl->getFormAction($this));
446 if (!$this->
access->canManageObjects($this->ref_id)) {
454 if ($form->checkInput()) {
456 if ($this->record_gui &&
457 !$this->record_gui->importEditFormPostValues()) {
463 $obj->setTitle($form->getInput(
"title"));
464 $obj->setDescription($form->getInput(
"desc"));
465 $obj->setNrOfItems($form->getInput(
"items"));
466 $obj->setPostText($form->getInput(
"post_text"));
469 $obj->setScheduleId($form->getInput(
"schedule"));
474 $file = $form->getItemByPostVar(
"file");
475 if ($_FILES[
"file"][
"tmp_name"]) {
476 $this->objects_manager->importObjectInfoFromLegacyUpload($obj->getId(), $_FILES[
"file"]);
477 } elseif ($file !==
null && $file->getDeletionFlag()) {
478 $this->objects_manager->deleteObjectInfo($obj->getId());
481 $pfile = $form->getItemByPostVar(
"post_file");
482 if ($_FILES[
"post_file"][
"tmp_name"]) {
483 $this->objects_manager->importBookingInfoFromLegacyUpload($obj->getId(), $_FILES[
"post_file"]);
484 } elseif ($pfile !==
null && $pfile->getDeletionFlag()) {
485 $this->objects_manager->deleteBookingInfo($obj->getId());
490 if ($this->record_gui) {
491 $this->record_gui->writeEditForm(
null, $obj->getId());
494 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"book_object_added"),
true);
495 $ilCtrl->redirect($this,
"render");
499 $form->setValuesByPost();
505 if (!$this->
access->canManageObjects($this->ref_id)) {
512 $form = $this->
initForm(
'edit', $this->object_id);
513 if ($form->checkInput()) {
515 if ($this->record_gui &&
516 !$this->record_gui->importEditFormPostValues()) {
522 $obj->setTitle($form->getInput(
"title"));
523 $obj->setDescription($form->getInput(
"desc"));
524 $obj->setNrOfItems($form->getInput(
"items"));
525 $obj->setPostText($form->getInput(
"post_text"));
527 $file = $form->getItemByPostVar(
"file");
528 if ($_FILES[
"file"][
"tmp_name"]) {
529 $this->objects_manager->importObjectInfoFromLegacyUpload($obj->getId(), $_FILES[
"file"]);
530 } elseif ($file !==
null && $file->getDeletionFlag()) {
531 $this->objects_manager->deleteObjectInfo($obj->getId());
534 $pfile = $form->getItemByPostVar(
"post_file");
535 if ($_FILES[
"post_file"][
"tmp_name"]) {
536 $this->objects_manager->importBookingInfoFromLegacyUpload($obj->getId(), $_FILES[
"post_file"]);
537 } elseif ($pfile !==
null && $pfile->getDeletionFlag()) {
538 $this->objects_manager->deleteBookingInfo($obj->getId());
542 $obj->setScheduleId($form->getInput(
"schedule"));
547 if ($this->record_gui) {
548 $this->record_gui->writeEditForm();
551 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"book_object_updated"),
true);
552 $ilCtrl->redirect($this,
"edit");
556 $form->setValuesByPost();
562 if (!$this->
access->canManageObjects($this->ref_id)) {
572 $ilTabs->setBackTarget($lng->
txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
575 $conf->setFormAction($ilCtrl->getFormAction($this));
576 $conf->setHeaderText($lng->
txt(
'book_confirm_delete'));
579 $conf->addItem(
'object_id', $this->object_id, $type->getTitle());
580 $conf->setConfirm($lng->
txt(
'delete'),
'delete');
581 $conf->setCancel($lng->
txt(
'cancel'),
'render');
586 public function delete():
void 588 if (!$this->
access->canManageObjects($this->ref_id)) {
596 $obj->deleteReservationsAndCalEntries($this->object_id);
599 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
'book_object_deleted'),
true);
600 $ilCtrl->setParameter($this,
'object_id',
"");
601 $ilCtrl->redirect($this,
'render');
612 $this->objects_manager->deliverObjectInfo(
$id);
ilObjBookingPoolGUI: ilPermissionGUI, ilBookingObjectGUI ilObjBookingPoolGUI: ilBookingScheduleGUI, ilInfoScreenGUI, ilPublicUserProfileGUI ilObjBookingPoolGUI: ilCommonActionDispatcherGUI, ilObjectCopyGUI, ilObjectMetaDataGUI ilObjBookingPoolGUI: ilBookingParticipantGUI, ilBookingReservationsGUI, ilBookingPreferencesGUI ilObjBookingPoolGUI: ILIAS ilObjBookingPoolGUI: ilRepositoryGUI, ilAdministrationGUI
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
hasPoolSchedule()
Has booking pool a schedule?
ILIAS BookingManager InternalGUIService $gui
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getPoolOverallLimit()
Get booking pool overall limit.
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
isManagementActivated()
Is management activated?
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilBookBulkCreationGUI $bulk_creation_gui
getNextClass($a_gui_class=null)
create(?ilPropertyFormGUI $a_form=null)
Render creation form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
edit(?ilPropertyFormGUI $a_form=null)
Render edit form.
ilObjectDataCache $obj_data_cache
activateManagement(bool $a_val)
clearTargets()
clear all targets
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
render()
Render list of booking objects uses ilBookingObjectsTableGUI.
ILIAS BookingManager Schedule ScheduleManager $schedule_manager
setPermanentLink(string $a_type, ?int $a_id, string $a_append="", string $a_target="", string $a_title="")
Generates and sets a permanent ilias link.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
__construct(Container $dic, ilPlugin $plugin)
This class represents a text area property in a property form.
initForm(string $a_mode="create", ?int $id=null)
Build property form.
ILIAS BookingManager StandardGUIRequest $book_request
const TYPE_NO_SCHEDULE_PREFERENCES
ilObjBookingPoolGUI $pool_gui
ilAdvancedMDRecordGUI $record_gui
ilBookingHelpAdapter $help
ILIAS BookingManager Objects ObjectsManager $objects_manager
ILIAS BookingManager Access AccessManager $access
bool $pool_uses_preferences