ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilBookingObjectGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilBookingObjectGUI:
+ Collaboration diagram for ilBookingObjectGUI:

Public Member Functions

 __construct (ilObjBookingPoolGUI $a_parent_obj, string $seed, string $sseed, ilBookingHelpAdapter $help, int $context_obj_id=0)
 
 activateManagement (bool $a_val)
 
 isManagementActivated ()
 Is management activated? More...
 
 render ()
 Render list of booking objects uses ilBookingObjectsTableGUI. More...
 
 applyFilter ()
 
 resetFilter ()
 
 create (ilPropertyFormGUI $a_form=null)
 Render creation form. More...
 
 edit (ilPropertyFormGUI $a_form=null)
 Render edit form. More...
 
 initForm (string $a_mode="create", int $id=null)
 Build property form. More...
 
 save ()
 
 update ()
 
 confirmDelete ()
 
 delete ()
 
 deliverInfo ()
 

Protected Member Functions

 getPoolRefId ()
 
 getPoolObjId ()
 
 hasPoolSchedule ()
 Has booking pool a schedule? More...
 
 getPoolOverallLimit ()
 Get booking pool overall limit. More...
 
 showNoScheduleMessage ()
 
 returnToPreferences ()
 
 setHelpId (string $a_id)
 

Protected Attributes

ILIAS BookingManager StandardGUIRequest $book_request
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilAccessHandler $access
 
ilTabsGUI $tabs
 
ilBookingHelpAdapter $help
 
ilObjectDataCache $obj_data_cache
 
ilObjUser $user
 
bool $pool_has_schedule
 
int $pool_overall_limit
 
bool $pool_uses_preferences = false
 
bool $management = true
 
int $context_obj_id
 
int $object_id
 
string $seed
 
string $sseed
 
ilObjBookingPoolGUI $pool_gui
 
array $rsv_ids = []
 
ilAdvancedMDRecordGUI $record_gui
 
int $ref_id
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om ilBookingObjectGUI: ilPropertyFormGUI, ilBookingProcessGUI

Definition at line 23 of file class.ilBookingObjectGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilBookingObjectGUI::__construct ( ilObjBookingPoolGUI  $a_parent_obj,
string  $seed,
string  $sseed,
ilBookingHelpAdapter  $help,
int  $context_obj_id = 0 
)

Definition at line 49 of file class.ilBookingObjectGUI.php.

References $context_obj_id, $DIC, $help, $seed, $sseed, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilObjectGUI\getObject(), ILIAS\Repository\help(), ILIAS\Repository\lng(), ilBookingObject\lookupPoolId(), ILIAS\Repository\tabs(), ilObjBookingPool\TYPE_FIX_SCHEDULE, ilObjBookingPool\TYPE_NO_SCHEDULE_PREFERENCES, and ILIAS\Repository\user().

55  {
56  global $DIC;
57 
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();
63  $this->help = $help;
64  $this->obj_data_cache = $DIC["ilObjDataCache"];
65  $this->user = $DIC->user();
66 
67  $this->book_request = $DIC->bookingManager()
68  ->internal()
69  ->gui()
70  ->standardRequest();
71 
72 
73  $this->seed = $seed;
74  $this->sseed = $sseed;
75 
76  $this->context_obj_id = $context_obj_id;
77 
78  $this->pool_gui = $a_parent_obj;
79  $this->pool_has_schedule =
80  ($a_parent_obj->getObject()->getScheduleType() === ilObjBookingPool::TYPE_FIX_SCHEDULE);
81  $this->pool_uses_preferences =
82  ($a_parent_obj->getObject()->getScheduleType() === ilObjBookingPool::TYPE_NO_SCHEDULE_PREFERENCES);
83  $this->pool_overall_limit = $this->pool_has_schedule
84  ? null
85  : $a_parent_obj->getObject()->getOverallLimit();
86 
87  $this->object_id = $this->book_request->getObjectId();
88  $this->ref_id = $this->book_request->getRefId();
89  $this->ctrl->saveParameter($this, "object_id");
90 
91  if ($this->object_id > 0 && ilBookingObject::lookupPoolId($this->object_id) !== $this->pool_gui->getObject()->getId()) {
92  throw new ilPermissionException("Booking object pool id does not match pool id.");
93  }
94 
95  $this->rsv_ids = array_map('intval', $this->book_request->getReservationIdsFromString());
96  }
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupPoolId(int $object_id)
ilBookingHelpAdapter $help
+ Here is the call graph for this function:

Member Function Documentation

◆ activateManagement()

ilBookingObjectGUI::activateManagement ( bool  $a_val)

Definition at line 98 of file class.ilBookingObjectGUI.php.

Referenced by ilBookingObjectServiceGUI\__construct().

98  : void
99  {
100  $this->management = $a_val;
101  }
+ Here is the caller graph for this function:

◆ applyFilter()

ilBookingObjectGUI::applyFilter ( )

Definition at line 219 of file class.ilBookingObjectGUI.php.

References getPoolObjId(), getPoolOverallLimit(), getPoolRefId(), hasPoolSchedule(), isManagementActivated(), and render().

219  : void
220  {
221  $table = new ilBookingObjectsTableGUI($this, 'render', $this->getPoolRefId(), $this->getPoolObjId(), $this->hasPoolSchedule(), $this->getPoolOverallLimit(), $this->isManagementActivated());
222  $table->resetOffset();
223  $table->writeFilterToSession();
224  $this->render();
225  }
hasPoolSchedule()
Has booking pool a schedule?
getPoolOverallLimit()
Get booking pool overall limit.
isManagementActivated()
Is management activated?
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.
+ Here is the call graph for this function:

◆ confirmDelete()

ilBookingObjectGUI::confirmDelete ( )

Definition at line 508 of file class.ilBookingObjectGUI.php.

References $ctrl, $lng, $tabs, $tpl, $type, ILIAS\Repository\access(), ilTabsGUI\clearTargets(), ilGlobalTemplateInterface\setContent(), and ilLanguage\txt().

508  : void
509  {
510  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
511  return;
512  }
513 
514  $ilCtrl = $this->ctrl;
515  $lng = $this->lng;
516  $tpl = $this->tpl;
517  $ilTabs = $this->tabs;
518 
519  $ilTabs->clearTargets();
520  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
521 
522  $conf = new ilConfirmationGUI();
523  $conf->setFormAction($ilCtrl->getFormAction($this));
524  $conf->setHeaderText($lng->txt('book_confirm_delete'));
525 
526  $type = new ilBookingObject($this->object_id);
527  $conf->addItem('object_id', $this->object_id, $type->getTitle());
528  $conf->setConfirm($lng->txt('delete'), 'delete');
529  $conf->setCancel($lng->txt('cancel'), 'render');
530 
531  $tpl->setContent($conf->getHTML());
532  }
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...
$type
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
clearTargets()
clear all targets
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ create()

ilBookingObjectGUI::create ( ilPropertyFormGUI  $a_form = null)

Render creation form.

Definition at line 238 of file class.ilBookingObjectGUI.php.

References $ctrl, $lng, $tabs, $tpl, ILIAS\Repository\access(), ilTabsGUI\clearTargets(), initForm(), ilGlobalTemplateInterface\setContent(), setHelpId(), and ilLanguage\txt().

Referenced by save().

238  : void
239  {
240  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
241  return;
242  }
243 
244  $ilCtrl = $this->ctrl;
245  $tpl = $this->tpl;
246  $lng = $this->lng;
247  $ilTabs = $this->tabs;
248 
249  $ilTabs->clearTargets();
250  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
251 
252  $this->setHelpId('create');
253 
254  if (!$a_form) {
255  $a_form = $this->initForm();
256  }
257  $tpl->setContent($a_form->getHTML());
258  }
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...
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
clearTargets()
clear all targets
initForm(string $a_mode="create", int $id=null)
Build property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilBookingObjectGUI::delete ( )

Definition at line 534 of file class.ilBookingObjectGUI.php.

References $ctrl, $lng, ILIAS\Repository\access(), and ilLanguage\txt().

534  : void
535  {
536  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
537  return;
538  }
539 
540  $ilCtrl = $this->ctrl;
541  $lng = $this->lng;
542 
543  $obj = new ilBookingObject($this->object_id);
544  $obj->deleteReservationsAndCalEntries($this->object_id);
545  $obj->delete();
546 
547  $this->tpl->setOnScreenMessage('success', $lng->txt('book_object_deleted'), true);
548  $ilCtrl->setParameter($this, 'object_id', "");
549  $ilCtrl->redirect($this, 'render');
550  }
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...
+ Here is the call graph for this function:

◆ deliverInfo()

ilBookingObjectGUI::deliverInfo ( )

Definition at line 553 of file class.ilBookingObjectGUI.php.

References $id, $object_id, and ilFileDelivery\deliverFileLegacy().

553  : void
554  {
556  if (!$id) {
557  return;
558  }
559 
560  $obj = new ilBookingObject($id);
561  $file = $obj->getFileFullPath();
562  if ($file) {
563  ilFileDelivery::deliverFileLegacy($file, $obj->getFile());
564  }
565  }
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)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ edit()

ilBookingObjectGUI::edit ( ilPropertyFormGUI  $a_form = null)

Render edit form.

Definition at line 263 of file class.ilBookingObjectGUI.php.

References $ctrl, $lng, $tabs, $tpl, ILIAS\Repository\access(), initForm(), ilGlobalTemplateInterface\setContent(), setHelpId(), and ilLanguage\txt().

Referenced by update().

263  : void
264  {
265  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
266  return;
267  }
268 
269  $tpl = $this->tpl;
270  $ilCtrl = $this->ctrl;
271  $ilTabs = $this->tabs;
272  $lng = $this->lng;
273 
274  $ilTabs->clearTargets();
275  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
276 
277  $this->setHelpId('edit');
278 
279  if (!$a_form) {
280  $a_form = $this->initForm('edit', $this->object_id);
281  }
282  $tpl->setContent($a_form->getHTML());
283  }
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...
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
initForm(string $a_mode="create", int $id=null)
Build property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPoolObjId()

ilBookingObjectGUI::getPoolObjId ( )
protected

Definition at line 116 of file class.ilBookingObjectGUI.php.

Referenced by applyFilter(), initForm(), render(), resetFilter(), and save().

116  : int
117  {
118  return $this->pool_gui->getObject()->getId();
119  }
+ Here is the caller graph for this function:

◆ getPoolOverallLimit()

ilBookingObjectGUI::getPoolOverallLimit ( )
protected

Get booking pool overall limit.

Definition at line 132 of file class.ilBookingObjectGUI.php.

References $ctrl, ILIAS\Repository\ctrl(), ilCtrl\getNextClass(), hasPoolSchedule(), ILIAS\Repository\help(), and initForm().

Referenced by applyFilter(), render(), and resetFilter().

132  : ?int
133  {
134  return $this->hasPoolSchedule()
135  ? null
136  : $this->pool_gui->getObject()->getOverallLimit();
137  }
hasPoolSchedule()
Has booking pool a schedule?
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPoolRefId()

ilBookingObjectGUI::getPoolRefId ( )
protected

Definition at line 111 of file class.ilBookingObjectGUI.php.

Referenced by applyFilter(), render(), and resetFilter().

111  : int
112  {
113  return $this->pool_gui->getRefId();
114  }
+ Here is the caller graph for this function:

◆ hasPoolSchedule()

ilBookingObjectGUI::hasPoolSchedule ( )
protected

Has booking pool a schedule?

Definition at line 124 of file class.ilBookingObjectGUI.php.

References ilObjBookingPool\TYPE_FIX_SCHEDULE.

Referenced by applyFilter(), getPoolOverallLimit(), initForm(), render(), resetFilter(), save(), and update().

124  : bool
125  {
126  return ($this->pool_gui->getObject()->getScheduleType() === ilObjBookingPool::TYPE_FIX_SCHEDULE);
127  }
+ Here is the caller graph for this function:

◆ initForm()

ilBookingObjectGUI::initForm ( string  $a_mode = "create",
int  $id = null 
)

Build property form.

Definition at line 293 of file class.ilBookingObjectGUI.php.

References $ctrl, $id, $lng, $obj_data_cache, $post, ilBookingSchedule\getList(), getPoolObjId(), hasPoolSchedule(), ilAdvancedMDRecordGUI\MODE_EDITOR, ilFileInputGUI\setAllowDeletion(), ilTextAreaInputGUI\setCols(), ilFormPropertyGUI\setRequired(), and ilLanguage\txt().

Referenced by create(), edit(), getPoolOverallLimit(), save(), and update().

297  $lng = $this->lng;
298  $ilCtrl = $this->ctrl;
299  $ilObjDataCache = $this->obj_data_cache;
300 
301  $form_gui = new ilPropertyFormGUI();
302 
303  $title = new ilTextInputGUI($lng->txt("title"), "title");
304  $title->setRequired(true);
305  $title->setSize(40);
306  $title->setMaxLength(120);
307  $form_gui->addItem($title);
308 
309  $desc = new ilTextAreaInputGUI($lng->txt("description"), "desc");
310  $desc->setCols(70);
311  $desc->setRows(15);
312  $desc->setMaxNumOfChars(1000);
313  $form_gui->addItem($desc);
314 
315  $file = new ilFileInputGUI($lng->txt("book_additional_info_file"), "file");
316  $file->setAllowDeletion(true);
317  $form_gui->addItem($file);
318 
319  $nr = new ilNumberInputGUI($lng->txt("booking_nr_of_items"), "items");
320  $nr->setRequired(true);
321  $nr->setSize(3);
322  $nr->setMaxLength(3);
323  $nr->setSuffix($lng->txt("book_booking_objects"));
324  $form_gui->addItem($nr);
325 
326  if ($this->hasPoolSchedule()) {
327  $options = array();
328  foreach (ilBookingSchedule::getList($ilObjDataCache->lookupObjId($this->getPoolRefId())) as $schedule) {
329  $options[$schedule["booking_schedule_id"]] = $schedule["title"];
330  }
331  $schedule = new ilSelectInputGUI($lng->txt("book_schedule"), "schedule");
332  $schedule->setRequired(true);
333  $schedule->setOptions($options);
334  $form_gui->addItem($schedule);
335  }
336 
338  $post->setTitle($lng->txt("book_post_booking_information"));
339  $form_gui->addItem($post);
340 
341  $pdesc = new ilTextAreaInputGUI($lng->txt("book_post_booking_text"), "post_text");
342  $pdesc->setCols(70);
343  $pdesc->setRows(15);
344  $pdesc->setInfo($lng->txt("book_post_booking_text_info"));
345  $form_gui->addItem($pdesc);
346 
347  $pfile = new ilFileInputGUI($lng->txt("book_post_booking_file"), "post_file");
348  $pfile->setAllowDeletion(true);
349  $form_gui->addItem($pfile);
350 
351  // #18214 - should also work for new objects
352  $this->record_gui = new ilAdvancedMDRecordGUI(
354  "book",
355  $this->getPoolObjId(),
356  "bobj",
357  (int) $id
358  );
359  $this->record_gui->setPropertyForm($form_gui);
360  $this->record_gui->parse();
361 
362  if ($a_mode === "edit") {
363  $form_gui->setTitle($lng->txt("book_edit_object"));
364 
365  $item = new ilHiddenInputGUI('object_id');
366  $item->setValue($id);
367  $form_gui->addItem($item);
368 
369  $obj = new ilBookingObject($id);
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());
376 
377  if (isset($schedule)) {
378  $schedule->setValue($obj->getScheduleId());
379  }
380 
381  $form_gui->addCommandButton("update", $lng->txt("save"));
382  } else {
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"));
386  }
387  $form_gui->setFormAction($ilCtrl->getFormAction($this));
388 
389  return $form_gui;
390  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
hasPoolSchedule()
Has booking pool a schedule?
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...
This class represents a file property in a property form.
static getList(int $a_pool_id)
Get list of booking objects for given pool.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a number property in a property form.
ilObjectDataCache $obj_data_cache
setRequired(bool $a_required)
setAllowDeletion(bool $a_val)
This class represents a text area property in a property form.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$post
Definition: ltitoken.php:49
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isManagementActivated()

ilBookingObjectGUI::isManagementActivated ( )

Is management activated?

Definition at line 106 of file class.ilBookingObjectGUI.php.

References $management.

Referenced by applyFilter(), render(), and resetFilter().

106  : bool
107  {
108  return $this->management;
109  }
+ Here is the caller graph for this function:

◆ render()

ilBookingObjectGUI::render ( )

Render list of booking objects uses ilBookingObjectsTableGUI.

Definition at line 196 of file class.ilBookingObjectGUI.php.

References $access, Vendor\Package\$bar, $ctrl, $lng, $tpl, getPoolObjId(), getPoolOverallLimit(), getPoolRefId(), hasPoolSchedule(), isManagementActivated(), ilGlobalTemplateInterface\setContent(), ilGlobalTemplateInterface\setPermanentLink(), showNoScheduleMessage(), and ilLanguage\txt().

Referenced by applyFilter(), and resetFilter().

196  : void
197  {
198  $this->showNoScheduleMessage();
199 
200  $tpl = $this->tpl;
201  $ilCtrl = $this->ctrl;
202  $lng = $this->lng;
203  $ilAccess = $this->access;
204 
205  $bar = "";
206 
207  if ($this->isManagementActivated() && $ilAccess->checkAccess('write', '', $this->getPoolRefId())) {
208  $bar = new ilToolbarGUI();
209  $bar->addButton($lng->txt('book_add_object'), $ilCtrl->getLinkTarget($this, 'create'));
210  $bar = $bar->getHTML();
211  }
212 
213  $tpl->setPermanentLink('book', $this->getPoolRefId());
214 
215  $table = new ilBookingObjectsTableGUI($this, 'render', $this->getPoolRefId(), $this->getPoolObjId(), $this->hasPoolSchedule(), $this->getPoolOverallLimit(), $this->isManagementActivated());
216  $tpl->setContent($bar . $table->getHTML());
217  }
hasPoolSchedule()
Has booking pool a schedule?
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...
getPoolOverallLimit()
Get booking pool overall limit.
ilGlobalTemplateInterface $tpl
isManagementActivated()
Is management activated?
setContent(string $a_html)
Sets content for standard template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setPermanentLink(string $a_type, ?int $a_id, string $a_append="", string $a_target="", string $a_title="")
Generates and sets a permanent ilias link.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetFilter()

ilBookingObjectGUI::resetFilter ( )

Definition at line 227 of file class.ilBookingObjectGUI.php.

References getPoolObjId(), getPoolOverallLimit(), getPoolRefId(), hasPoolSchedule(), isManagementActivated(), and render().

227  : void
228  {
229  $table = new ilBookingObjectsTableGUI($this, 'render', $this->getPoolRefId(), $this->getPoolObjId(), $this->hasPoolSchedule(), $this->getPoolOverallLimit(), $this->isManagementActivated());
230  $table->resetOffset();
231  $table->resetFilter();
232  $this->render();
233  }
hasPoolSchedule()
Has booking pool a schedule?
getPoolOverallLimit()
Get booking pool overall limit.
isManagementActivated()
Is management activated?
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.
+ Here is the call graph for this function:

◆ returnToPreferences()

ilBookingObjectGUI::returnToPreferences ( )
protected

Definition at line 187 of file class.ilBookingObjectGUI.php.

References ILIAS\Repository\ctrl().

187  : void
188  {
189  $this->ctrl->redirectByClass("ilBookingPreferencesGUI");
190  }
+ Here is the call graph for this function:

◆ save()

ilBookingObjectGUI::save ( )

Definition at line 392 of file class.ilBookingObjectGUI.php.

References $ctrl, $lng, $valid, ILIAS\Repository\access(), create(), getPoolObjId(), hasPoolSchedule(), initForm(), and ilLanguage\txt().

392  : void
393  {
394  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
395  return;
396  }
397 
398  $ilCtrl = $this->ctrl;
399  $lng = $this->lng;
400 
401  $form = $this->initForm();
402  if ($form->checkInput()) {
403  $valid = true;
404  if ($this->record_gui &&
405  !$this->record_gui->importEditFormPostValues()) {
406  $valid = false;
407  }
408  if ($valid) {
409  $obj = new ilBookingObject();
410  $obj->setPoolId($this->getPoolObjId());
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"));
415 
416  if ($this->hasPoolSchedule()) {
417  $obj->setScheduleId($form->getInput("schedule"));
418  }
419 
420  $obj->save();
421 
422  $file = $form->getItemByPostVar("file");
423  if ($_FILES["file"]["tmp_name"]) {
424  $obj->uploadFile($_FILES["file"]);
425  } elseif ($file !== null && $file->getDeletionFlag()) {
426  $obj->deleteFile();
427  }
428 
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();
434  }
435 
436  $obj->update();
437 
438  if ($this->record_gui) {
439  $this->record_gui->writeEditForm(null, $obj->getId());
440  }
441 
442  $this->tpl->setOnScreenMessage('success', $lng->txt("book_object_added"), true);
443  $ilCtrl->redirect($this, "render");
444  }
445  }
446 
447  $form->setValuesByPost();
448  $this->create($form);
449  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
hasPoolSchedule()
Has booking pool a schedule?
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...
$valid
create(ilPropertyFormGUI $a_form=null)
Render creation form.
initForm(string $a_mode="create", int $id=null)
Build property form.
+ Here is the call graph for this function:

◆ setHelpId()

ilBookingObjectGUI::setHelpId ( string  $a_id)
protected

Definition at line 285 of file class.ilBookingObjectGUI.php.

References ILIAS\Repository\help().

Referenced by create(), and edit().

285  : void
286  {
287  $this->help->setHelpId($a_id);
288  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showNoScheduleMessage()

ilBookingObjectGUI::showNoScheduleMessage ( )
protected

Definition at line 182 of file class.ilBookingObjectGUI.php.

Referenced by render().

182  : void
183  {
184  $this->pool_gui->showNoScheduleMessage();
185  }
+ Here is the caller graph for this function:

◆ update()

ilBookingObjectGUI::update ( )

Definition at line 451 of file class.ilBookingObjectGUI.php.

References $ctrl, $lng, $valid, ILIAS\Repository\access(), edit(), hasPoolSchedule(), initForm(), and ilLanguage\txt().

451  : void
452  {
453  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
454  return;
455  }
456 
457  $lng = $this->lng;
458  $ilCtrl = $this->ctrl;
459 
460  $form = $this->initForm('edit', $this->object_id);
461  if ($form->checkInput()) {
462  $valid = true;
463  if ($this->record_gui &&
464  !$this->record_gui->importEditFormPostValues()) {
465  $valid = false;
466  }
467 
468  if ($valid) {
469  $obj = new ilBookingObject($this->object_id);
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"));
474 
475  $file = $form->getItemByPostVar("file");
476  if ($_FILES["file"]["tmp_name"]) {
477  $obj->uploadFile($_FILES["file"]);
478  } elseif ($file !== null && $file->getDeletionFlag()) {
479  $obj->deleteFile();
480  }
481 
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();
487  }
488 
489  if ($this->hasPoolSchedule()) {
490  $obj->setScheduleId($form->getInput("schedule"));
491  }
492 
493  $obj->update();
494 
495  if ($this->record_gui) {
496  $this->record_gui->writeEditForm();
497  }
498 
499  $this->tpl->setOnScreenMessage('success', $lng->txt("book_object_updated"), true);
500  $ilCtrl->redirect($this, "render");
501  }
502  }
503 
504  $form->setValuesByPost();
505  $this->edit($form);
506  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
hasPoolSchedule()
Has booking pool a schedule?
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...
edit(ilPropertyFormGUI $a_form=null)
Render edit form.
$valid
initForm(string $a_mode="create", int $id=null)
Build property form.
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilBookingObjectGUI::$access
protected

Definition at line 29 of file class.ilBookingObjectGUI.php.

Referenced by render().

◆ $book_request

ILIAS BookingManager StandardGUIRequest ilBookingObjectGUI::$book_request
protected

Definition at line 25 of file class.ilBookingObjectGUI.php.

◆ $context_obj_id

int ilBookingObjectGUI::$context_obj_id
protected

Definition at line 40 of file class.ilBookingObjectGUI.php.

Referenced by __construct().

◆ $ctrl

ilCtrl ilBookingObjectGUI::$ctrl
protected

◆ $help

ilBookingHelpAdapter ilBookingObjectGUI::$help
protected

Definition at line 31 of file class.ilBookingObjectGUI.php.

Referenced by __construct().

◆ $lng

ilLanguage ilBookingObjectGUI::$lng
protected

◆ $management

bool ilBookingObjectGUI::$management = true
protected

Definition at line 38 of file class.ilBookingObjectGUI.php.

Referenced by isManagementActivated().

◆ $obj_data_cache

ilObjectDataCache ilBookingObjectGUI::$obj_data_cache
protected

Definition at line 32 of file class.ilBookingObjectGUI.php.

Referenced by initForm().

◆ $object_id

int ilBookingObjectGUI::$object_id
protected

Definition at line 41 of file class.ilBookingObjectGUI.php.

Referenced by deliverInfo().

◆ $pool_gui

ilObjBookingPoolGUI ilBookingObjectGUI::$pool_gui
protected

Definition at line 44 of file class.ilBookingObjectGUI.php.

◆ $pool_has_schedule

bool ilBookingObjectGUI::$pool_has_schedule
protected

Definition at line 34 of file class.ilBookingObjectGUI.php.

◆ $pool_overall_limit

int ilBookingObjectGUI::$pool_overall_limit
protected

Definition at line 35 of file class.ilBookingObjectGUI.php.

◆ $pool_uses_preferences

bool ilBookingObjectGUI::$pool_uses_preferences = false
protected

Definition at line 36 of file class.ilBookingObjectGUI.php.

◆ $record_gui

ilAdvancedMDRecordGUI ilBookingObjectGUI::$record_gui
protected

Definition at line 46 of file class.ilBookingObjectGUI.php.

◆ $ref_id

int ilBookingObjectGUI::$ref_id
protected

Definition at line 47 of file class.ilBookingObjectGUI.php.

◆ $rsv_ids

array ilBookingObjectGUI::$rsv_ids = []
protected

Definition at line 45 of file class.ilBookingObjectGUI.php.

◆ $seed

string ilBookingObjectGUI::$seed
protected

Definition at line 42 of file class.ilBookingObjectGUI.php.

Referenced by __construct().

◆ $sseed

string ilBookingObjectGUI::$sseed
protected

Definition at line 43 of file class.ilBookingObjectGUI.php.

Referenced by __construct().

◆ $tabs

ilTabsGUI ilBookingObjectGUI::$tabs
protected

Definition at line 30 of file class.ilBookingObjectGUI.php.

Referenced by confirmDelete(), create(), and edit().

◆ $tpl

ilGlobalTemplateInterface ilBookingObjectGUI::$tpl
protected

Definition at line 27 of file class.ilBookingObjectGUI.php.

Referenced by confirmDelete(), create(), edit(), and render().

◆ $user

ilObjUser ilBookingObjectGUI::$user
protected

Definition at line 33 of file class.ilBookingObjectGUI.php.


The documentation for this class was generated from the following file: