54 int $context_obj_id = 0
58 $this->
ctrl = $DIC->ctrl();
59 $this->tpl = $DIC[
"tpl"];
60 $this->
lng = $DIC->language();
61 $this->
access = $DIC->access();
62 $this->
tabs = $DIC->tabs();
64 $this->obj_data_cache = $DIC[
"ilObjDataCache"];
65 $this->
user = $DIC->user();
67 $this->book_request = $DIC->bookingManager()
78 $this->pool_gui = $a_parent_obj;
79 $this->pool_has_schedule =
81 $this->pool_uses_preferences =
83 $this->pool_overall_limit = $this->pool_has_schedule
85 : $a_parent_obj->
getObject()->getOverallLimit();
87 $this->object_id = $this->book_request->getObjectId();
88 $this->ref_id = $this->book_request->getRefId();
89 $this->
ctrl->saveParameter($this,
"object_id");
95 $this->rsv_ids = array_map(
'intval', $this->book_request->getReservationIdsFromString());
100 $this->management = $a_val;
113 return $this->pool_gui->getRefId();
118 return $this->pool_gui->getObject()->getId();
136 : $this->pool_gui->getObject()->getOverallLimit();
142 public function executeCommand():
void 148 switch ($next_class) {
150 case "ilpropertyformgui":
153 $this->
ctrl->forwardCommand($form);
156 case "ilbookingprocessgui":
157 if (!$this->pool_uses_preferences) {
158 $ilCtrl->setReturn($this,
"render");
160 $ilCtrl->setReturn($this,
"returnToPreferences");
163 $pool = $this->pool_gui->getObject();
170 $this->context_obj_id
172 $this->
ctrl->forwardCommand($process_gui);
176 $cmd = $ilCtrl->getCmd(
"render");
184 $this->pool_gui->showNoScheduleMessage();
189 $this->
ctrl->redirectByClass(
"ilBookingPreferencesGUI");
209 $bar->addButton($lng->
txt(
'book_add_object'), $ilCtrl->getLinkTarget($this,
'create'));
222 $table->resetOffset();
223 $table->writeFilterToSession();
230 $table->resetOffset();
231 $table->resetFilter();
240 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
250 $ilTabs->setBackTarget($lng->
txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
265 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
274 $ilTabs->clearTargets();
275 $ilTabs->setBackTarget($lng->
txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
280 $a_form = $this->
initForm(
'edit', $this->object_id);
287 $this->
help->setHelpId($a_id);
294 string $a_mode =
"create",
304 $title->setRequired(
true);
306 $title->setMaxLength(120);
307 $form_gui->addItem($title);
312 $desc->setMaxNumOfChars(1000);
313 $form_gui->addItem($desc);
317 $form_gui->addItem($file);
322 $nr->setMaxLength(3);
323 $nr->setSuffix($lng->
txt(
"book_booking_objects"));
324 $form_gui->addItem($nr);
329 $options[$schedule[
"booking_schedule_id"]] = $schedule[
"title"];
332 $schedule->setRequired(
true);
333 $schedule->setOptions($options);
334 $form_gui->addItem($schedule);
338 $post->setTitle($lng->
txt(
"book_post_booking_information"));
339 $form_gui->addItem(
$post);
344 $pdesc->setInfo($lng->
txt(
"book_post_booking_text_info"));
345 $form_gui->addItem($pdesc);
349 $form_gui->addItem($pfile);
359 $this->record_gui->setPropertyForm($form_gui);
360 $this->record_gui->parse();
362 if ($a_mode ===
"edit") {
363 $form_gui->setTitle($lng->
txt(
"book_edit_object"));
366 $item->setValue($id);
367 $form_gui->addItem($item);
370 $title->setValue($obj->getTitle());
371 $desc->setValue($obj->getDescription());
372 $nr->setValue($obj->getNrOfItems());
373 $pdesc->setValue($obj->getPostText());
374 $file->setValue($obj->getFile());
375 $pfile->setValue($obj->getPostFile());
377 if (isset($schedule)) {
378 $schedule->setValue($obj->getScheduleId());
381 $form_gui->addCommandButton(
"update", $lng->
txt(
"save"));
383 $form_gui->setTitle($lng->
txt(
"book_add_object"));
384 $form_gui->addCommandButton(
"save", $lng->
txt(
"save"));
385 $form_gui->addCommandButton(
"render", $lng->
txt(
"cancel"));
387 $form_gui->setFormAction($ilCtrl->getFormAction($this));
394 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
402 if ($form->checkInput()) {
404 if ($this->record_gui &&
405 !$this->record_gui->importEditFormPostValues()) {
411 $obj->setTitle($form->getInput(
"title"));
412 $obj->setDescription($form->getInput(
"desc"));
413 $obj->setNrOfItems($form->getInput(
"items"));
414 $obj->setPostText($form->getInput(
"post_text"));
417 $obj->setScheduleId($form->getInput(
"schedule"));
422 $file = $form->getItemByPostVar(
"file");
423 if ($_FILES[
"file"][
"tmp_name"]) {
424 $obj->uploadFile($_FILES[
"file"]);
425 } elseif ($file !== null && $file->getDeletionFlag()) {
429 $pfile = $form->getItemByPostVar(
"post_file");
430 if ($_FILES[
"post_file"][
"tmp_name"]) {
431 $obj->uploadPostFile($_FILES[
"post_file"]);
432 } elseif ($pfile !== null && $pfile->getDeletionFlag()) {
433 $obj->deletePostFile();
438 if ($this->record_gui) {
439 $this->record_gui->writeEditForm(null, $obj->getId());
442 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"book_object_added"),
true);
443 $ilCtrl->redirect($this,
"render");
447 $form->setValuesByPost();
453 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
460 $form = $this->
initForm(
'edit', $this->object_id);
461 if ($form->checkInput()) {
463 if ($this->record_gui &&
464 !$this->record_gui->importEditFormPostValues()) {
470 $obj->setTitle($form->getInput(
"title"));
471 $obj->setDescription($form->getInput(
"desc"));
472 $obj->setNrOfItems($form->getInput(
"items"));
473 $obj->setPostText($form->getInput(
"post_text"));
475 $file = $form->getItemByPostVar(
"file");
476 if ($_FILES[
"file"][
"tmp_name"]) {
477 $obj->uploadFile($_FILES[
"file"]);
478 } elseif ($file !== null && $file->getDeletionFlag()) {
482 $pfile = $form->getItemByPostVar(
"post_file");
483 if ($_FILES[
"post_file"][
"tmp_name"]) {
484 $obj->uploadPostFile($_FILES[
"post_file"]);
485 } elseif ($pfile !== null && $pfile->getDeletionFlag()) {
486 $obj->deletePostFile();
490 $obj->setScheduleId($form->getInput(
"schedule"));
495 if ($this->record_gui) {
496 $this->record_gui->writeEditForm();
499 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"book_object_updated"),
true);
500 $ilCtrl->redirect($this,
"render");
504 $form->setValuesByPost();
510 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
520 $ilTabs->setBackTarget($lng->
txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
523 $conf->setFormAction($ilCtrl->getFormAction($this));
524 $conf->setHeaderText($lng->
txt(
'book_confirm_delete'));
527 $conf->addItem(
'object_id', $this->object_id,
$type->getTitle());
528 $conf->setConfirm($lng->
txt(
'delete'),
'delete');
529 $conf->setCancel($lng->
txt(
'cancel'),
'render');
534 public function delete():
void 536 if (!$this->
access->checkAccess(
'write',
'', $this->ref_id)) {
544 $obj->deleteReservationsAndCalEntries($this->object_id);
547 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
'book_object_deleted'),
true);
548 $ilCtrl->setParameter($this,
'object_id',
"");
549 $ilCtrl->redirect($this,
'render');
561 $file = $obj->getFileFullPath();
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilObjBookingPoolGUI $a_parent_obj, string $seed, string $sseed, ilBookingHelpAdapter $help, int $context_obj_id=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
hasPoolSchedule()
Has booking pool a schedule?
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.
static getList(int $a_pool_id)
Get list of booking objects for given pool.
ilGlobalTemplateInterface $tpl
isManagementActivated()
Is management activated?
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...