29 protected \ILIAS\BookingManager\InternalGUIService
$gui;
59 int $context_obj_id = 0
63 $this->
ctrl = $DIC->ctrl();
64 $this->tpl = $DIC[
"tpl"];
65 $this->
lng = $DIC->language();
66 $this->
access = $DIC->access();
67 $this->
tabs = $DIC->tabs();
69 $this->obj_data_cache = $DIC[
"ilObjDataCache"];
70 $this->
user = $DIC->user();
76 $this->book_request = $DIC
81 $this->gui = $DIC->bookingManager()->internal()->gui();
82 $this->schedule_manager = $DIC
86 ->schedules($this->pool->getId());
93 $this->pool_gui = $a_parent_obj;
94 $this->bulk_creation_gui = $this->gui->objects()
95 ->ilBookBulkCreationGUI($this->pool);
97 $this->pool_has_schedule =
99 $this->pool_uses_preferences =
101 $this->pool_overall_limit = $this->pool_has_schedule
103 : $a_parent_obj->
getObject()->getOverallLimit();
105 $this->object_id = $this->book_request->getObjectId();
106 $this->ref_id = $this->book_request->getRefId();
107 $this->
ctrl->saveParameter($this,
"object_id");
113 $this->rsv_ids = array_map(
'intval', $this->book_request->getReservationIdsFromString());
118 $this->management = $a_val;
131 return $this->pool_gui->getRefId();
136 return $this->pool_gui->getObject()->getId();
154 : $this->pool_gui->getObject()->getOverallLimit();
160 public function executeCommand():
void 166 switch ($next_class) {
167 case "ilpropertyformgui":
170 $this->
ctrl->forwardCommand($form);
173 case "ilbookingprocesswithschedulegui":
174 if (!$this->pool_uses_preferences) {
175 $ilCtrl->setReturn($this,
"render");
177 $ilCtrl->setReturn($this,
"returnToPreferences");
180 $pool = $this->pool_gui->getObject();
181 $process_gui = $this->gui->process()->ilBookingProcessWithScheduleGUI(
184 $this->context_obj_id,
185 $this->seed ?? $this->sseed
187 $this->
ctrl->forwardCommand($process_gui);
190 case "ilbookingprocesswithoutschedulegui":
191 if (!$this->pool_uses_preferences) {
192 $ilCtrl->setReturn($this,
"render");
194 $ilCtrl->setReturn($this,
"returnToPreferences");
197 $pool = $this->pool_gui->getObject();
198 $process_gui = $this->gui->process()->ilBookingProcessWithoutScheduleGUI(
201 $this->context_obj_id
203 $this->
ctrl->forwardCommand($process_gui);
206 case strtolower(ilBookBulkCreationGUI::class):
207 $this->
ctrl->setReturn($this,
"");
208 $this->
ctrl->forwardCommand($this->bulk_creation_gui);
212 $cmd = $ilCtrl->getCmd(
"render");
220 $this->pool_gui->showNoScheduleMessage();
225 $this->
ctrl->redirectByClass(
"ilBookingPreferencesGUI");
245 $bar->addButton($lng->
txt(
'book_add_object'), $ilCtrl->getLinkTarget($this,
'create'));
248 $this->bulk_creation_gui->modifyToolbar(
$bar);
251 $bar->addSeparator();
252 $list_link = $this->
ctrl->getLinkTarget($this,
"");
253 $week_link = $this->
ctrl->getLinkTargetByClass(
"ilBookingProcessWithScheduleGUI",
"week");
254 $mode_control = $this->gui->ui()->factory()->viewControl()->mode([
255 $this->
lng->txt(
"book_list") => $list_link,
256 $this->
lng->txt(
"book_week") => $week_link
257 ], $this->
lng->txt(
"book_view"));
258 $bar->addComponent($mode_control);
272 $table->resetOffset();
273 $table->writeFilterToSession();
280 $table->resetOffset();
281 $table->resetFilter();
290 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
300 $ilTabs->setBackTarget($lng->
txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
315 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
324 $ilTabs->clearTargets();
325 $ilTabs->setBackTarget($lng->
txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
330 $a_form = $this->
initForm(
'edit', $this->object_id);
337 $this->
help->setHelpId($a_id);
344 string $a_mode =
"create",
354 $title->setRequired(
true);
356 $title->setMaxLength(120);
357 $form_gui->addItem($title);
362 $desc->setMaxNumOfChars(1000);
363 $form_gui->addItem($desc);
367 $form_gui->addItem($file);
370 $nr->setRequired(
true);
372 $nr->setMaxLength(3);
373 $nr->setSuffix($lng->
txt(
"book_booking_objects"));
374 $form_gui->addItem($nr);
378 foreach ($this->schedule_manager->getScheduleList() as $schedule_id => $schedule_title) {
379 $options[$schedule_id] = $schedule_title;
383 $schedule->setOptions($options);
384 $form_gui->addItem($schedule);
388 $post->setTitle($lng->
txt(
"book_post_booking_information"));
389 $form_gui->addItem(
$post);
394 $pdesc->setInfo($lng->
txt(
"book_post_booking_text_info"));
395 $form_gui->addItem($pdesc);
399 $form_gui->addItem($pfile);
409 $this->record_gui->setPropertyForm($form_gui);
410 $this->record_gui->parse();
412 if ($a_mode ===
"edit") {
413 $form_gui->setTitle($lng->
txt(
"book_edit_object"));
416 $item->setValue($id);
417 $form_gui->addItem($item);
420 $title->setValue($obj->getTitle());
421 $desc->setValue($obj->getDescription());
422 $nr->setValue($obj->getNrOfItems());
423 $pdesc->setValue($obj->getPostText());
424 $file->setValue($obj->getFile());
425 $pfile->setValue($obj->getPostFile());
427 if (isset($schedule)) {
428 $schedule->setValue($obj->getScheduleId());
431 $form_gui->addCommandButton(
"update", $lng->
txt(
"save"));
433 $form_gui->setTitle($lng->
txt(
"book_add_object"));
434 $form_gui->addCommandButton(
"save", $lng->
txt(
"save"));
435 $form_gui->addCommandButton(
"render", $lng->
txt(
"cancel"));
437 $form_gui->setFormAction($ilCtrl->getFormAction($this));
444 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
452 if ($form->checkInput()) {
454 if ($this->record_gui &&
455 !$this->record_gui->importEditFormPostValues()) {
461 $obj->setTitle($form->getInput(
"title"));
462 $obj->setDescription($form->getInput(
"desc"));
463 $obj->setNrOfItems($form->getInput(
"items"));
464 $obj->setPostText($form->getInput(
"post_text"));
467 $obj->setScheduleId($form->getInput(
"schedule"));
472 $file = $form->getItemByPostVar(
"file");
473 if ($_FILES[
"file"][
"tmp_name"]) {
474 $obj->uploadFile($_FILES[
"file"]);
475 } elseif ($file !== null && $file->getDeletionFlag()) {
479 $pfile = $form->getItemByPostVar(
"post_file");
480 if ($_FILES[
"post_file"][
"tmp_name"]) {
481 $obj->uploadPostFile($_FILES[
"post_file"]);
482 } elseif ($pfile !== null && $pfile->getDeletionFlag()) {
483 $obj->deletePostFile();
488 if ($this->record_gui) {
489 $this->record_gui->writeEditForm(null, $obj->getId());
492 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"book_object_added"),
true);
493 $ilCtrl->redirect($this,
"render");
497 $form->setValuesByPost();
503 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
510 $form = $this->
initForm(
'edit', $this->object_id);
511 if ($form->checkInput()) {
513 if ($this->record_gui &&
514 !$this->record_gui->importEditFormPostValues()) {
520 $obj->setTitle($form->getInput(
"title"));
521 $obj->setDescription($form->getInput(
"desc"));
522 $obj->setNrOfItems($form->getInput(
"items"));
523 $obj->setPostText($form->getInput(
"post_text"));
525 $file = $form->getItemByPostVar(
"file");
526 if ($_FILES[
"file"][
"tmp_name"]) {
527 $obj->uploadFile($_FILES[
"file"]);
528 } elseif ($file !== null && $file->getDeletionFlag()) {
532 $pfile = $form->getItemByPostVar(
"post_file");
533 if ($_FILES[
"post_file"][
"tmp_name"]) {
534 $obj->uploadPostFile($_FILES[
"post_file"]);
535 } elseif ($pfile !== null && $pfile->getDeletionFlag()) {
536 $obj->deletePostFile();
540 $obj->setScheduleId($form->getInput(
"schedule"));
545 if ($this->record_gui) {
546 $this->record_gui->writeEditForm();
549 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"book_object_updated"),
true);
550 $ilCtrl->redirect($this,
"render");
554 $form->setValuesByPost();
560 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
570 $ilTabs->setBackTarget($lng->
txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
573 $conf->setFormAction($ilCtrl->getFormAction($this));
574 $conf->setHeaderText($lng->
txt(
'book_confirm_delete'));
577 $conf->addItem(
'object_id', $this->object_id, $type->getTitle());
578 $conf->setConfirm($lng->
txt(
'delete'),
'delete');
579 $conf->setCancel($lng->
txt(
'cancel'),
'render');
584 public function delete():
void 586 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
594 $obj->deleteReservationsAndCalEntries($this->object_id);
597 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
'book_object_deleted'),
true);
598 $ilCtrl->setParameter($this,
'object_id',
"");
599 $ilCtrl->redirect($this,
'render');
611 $file = $obj->getFileFullPath();
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...
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.
edit(ilPropertyFormGUI $a_form=null)
Render edit form.
ilGlobalTemplateInterface $tpl
isManagementActivated()
Is management activated?
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
create(ilPropertyFormGUI $a_form=null)
Render creation form.
ilBookBulkCreationGUI $bulk_creation_gui
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getNextClass($a_gui_class=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContent(string $a_html)
Sets content for standard template.
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.
setPermanentLink(string $a_type, ?int $a_id, string $a_append="", string $a_target="", string $a_title="")
Generates and sets a permanent ilias link.
ILIAS BookingManager Schedule ScheduleManager $schedule_manager
This class represents a text area property in a property form.
initForm(string $a_mode="create", int $id=null)
Build property form.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
ILIAS BookingManager StandardGUIRequest $book_request
static lookupPoolId(int $object_id)
const TYPE_NO_SCHEDULE_PREFERENCES
ilObjBookingPoolGUI $pool_gui
ilAdvancedMDRecordGUI $record_gui
ilBookingHelpAdapter $help
bool $pool_uses_preferences