ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilBookingObjectGUI Class Reference

Class ilBookingObjectGUI. More...

+ Collaboration diagram for ilBookingObjectGUI:

Public Member Functions

 __construct ($a_parent_obj)
 Constructor. More...
 
 executeCommand ()
 main switch More...
 
 render ()
 Render list of booking objects. More...
 
 applyFilter ()
 
 resetFilter ()
 
 create (ilPropertyFormGUI $a_form=null)
 Render creation form. More...
 
 edit (ilPropertyFormGUI $a_form=null)
 Render edit form. More...
 
 initForm ($a_mode="create", $id=null)
 Build property form. More...
 
 save ()
 Create new object dataset. More...
 
 update ()
 Update object dataset. More...
 
 confirmDelete ()
 Confirm delete. More...
 
 delete ()
 Delete object. More...
 
 rsvConfirmCancelUser ()
 
 rsvCancelUser ()
 
 deliverInfo ()
 
 displayPostInfo ()
 
 deliverPostFile ()
 
 assignParticipants ()
 

Protected Member Functions

 setHelpId ($a_id)
 

Protected Attributes

 $ctrl
 
 $tpl
 
 $lng
 
 $access
 
 $tabs
 
 $help
 
 $obj_data_cache
 
 $user
 
 $ref_id
 
 $pool_id
 
 $pool_has_schedule
 
 $pool_overall_limit
 
 $user_to_deasign
 
 $object_id
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBookingObjectGUI::__construct (   $a_parent_obj)

Constructor.

Parameters
object$a_parent_obj

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

70 {
71 global $DIC;
72
73 $this->ctrl = $DIC->ctrl();
74 $this->tpl = $DIC["tpl"];
75 $this->lng = $DIC->language();
76 $this->access = $DIC->access();
77 $this->tabs = $DIC->tabs();
78 $this->help = $DIC["ilHelp"];
79 $this->obj_data_cache = $DIC["ilObjDataCache"];
80 $this->user = $DIC->user();
81 $this->ref_id = $a_parent_obj->ref_id;
82 $this->pool_id = $a_parent_obj->object->getId();
83 $this->pool_gui = $a_parent_obj;
84 $this->pool_has_schedule =
85 ($a_parent_obj->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE);
86 $this->pool_overall_limit = $this->pool_has_schedule
87 ? null
88 : $a_parent_obj->object->getOverallLimit();
89
90 $this->object_id = (int) $_REQUEST['object_id'];
91 $this->user_to_deasign = (int) $_REQUEST['bkusr'];
92 $this->rsv_ids = array_map('intval', explode(";", $_GET["rsv_ids"]));
93 }
user()
Definition: user.php:4
$_GET["client_id"]
global $DIC
Definition: saml.php:7

References $_GET, $DIC, ilObjBookingPool\TYPE_NO_SCHEDULE, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ applyFilter()

ilBookingObjectGUI::applyFilter ( )

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

149 {
150 include_once 'Modules/BookingManager/classes/class.ilBookingObjectsTableGUI.php';
151 $table = new ilBookingObjectsTableGUI($this, 'render', $this->ref_id, $this->pool_id, $this->pool_has_schedule, $this->pool_overall_limit, $this->repo_parent, $this->repo_parent_call);
152 $table->resetOffset();
153 $table->writeFilterToSession();
154 $this->render();
155 }
render()
Render list of booking objects.
List booking objects (for booking type)
if(empty($password)) $table
Definition: pwgen.php:24

References $table, and render().

+ Here is the call graph for this function:

◆ assignParticipants()

ilBookingObjectGUI::assignParticipants ( )

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

706 {
707 $this->tabs->clearTargets();
708 $this->tabs->setBackTarget($this->lng->txt('book_back_to_list'), $this->ctrl->getLinkTarget($this, 'render'));
709
710 include_once("./Modules/BookingManager/classes/class.ilBookingAssignParticipantsTableGUI.php");
711 $table = new ilBookingAssignParticipantsTableGUI($this, 'assignParticipants', $this->ref_id, $this->pool_id, $this->object_id);
712
713 $this->tpl->setContent($table->getHTML());
714 }

References $table.

◆ confirmDelete()

ilBookingObjectGUI::confirmDelete ( )

Confirm delete.

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

458 {
459 if (!$this->access->checkAccess('write', '', $this->ref_id)) {
460 return;
461 }
462
466 $ilTabs = $this->tabs;
467
468 $ilTabs->clearTargets();
469 $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
470
471 include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
472 $conf = new ilConfirmationGUI();
473 $conf->setFormAction($ilCtrl->getFormAction($this));
474 $conf->setHeaderText($lng->txt('book_confirm_delete'));
475
476 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
477 $type = new ilBookingObject($this->object_id);
478 $conf->addItem('object_id', $this->object_id, $type->getTitle());
479 $conf->setConfirm($lng->txt('delete'), 'delete');
480 $conf->setCancel($lng->txt('cancel'), 'render');
481
482 $tpl->setContent($conf->getHTML());
483 }
a bookable ressource
Confirmation screen class.
global $ilCtrl
Definition: ilias.php:18
$type

References $ctrl, $ilCtrl, $lng, $tabs, $tpl, and $type.

◆ create()

ilBookingObjectGUI::create ( ilPropertyFormGUI  $a_form = null)

Render creation form.

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

170 {
171 if (!$this->access->checkAccess('write', '', $this->ref_id)) {
172 return;
173 }
174
178 $ilTabs = $this->tabs;
179
180 $ilTabs->clearTargets();
181 $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
182
183 $this->setHelpId('create');
184
185 if (!$a_form) {
186 $a_form = $this->initForm();
187 }
188 $tpl->setContent($a_form->getHTML());
189 }
initForm($a_mode="create", $id=null)
Build property form.

References $ctrl, $ilCtrl, $lng, $tabs, $tpl, initForm(), and setHelpId().

Referenced by save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilBookingObjectGUI::delete ( )

Delete object.

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

489 {
490 if (!$this->access->checkAccess('write', '', $this->ref_id)) {
491 return;
492 }
493
496
497 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
498 $obj = new ilBookingObject($this->object_id);
499 $obj->delete();
500
501 ilUtil::sendSuccess($lng->txt('book_object_deleted'), true);
502 $ilCtrl->redirect($this, 'render');
503 }

References $ctrl, $ilCtrl, and $lng.

◆ deliverInfo()

ilBookingObjectGUI::deliverInfo ( )

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

574 {
576 if (!$id) {
577 return;
578 }
579
580 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
581 $obj = new ilBookingObject($id);
582 $file = $obj->getFileFullPath();
583 if ($file) {
584 ilUtil::deliverFile($file, $obj->getFile());
585 }
586 }
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
if(!array_key_exists('StateId', $_REQUEST)) $id

References $id, $object_id, and ilUtil\deliverFile().

+ Here is the call graph for this function:

◆ deliverPostFile()

ilBookingObjectGUI::deliverPostFile ( )

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

680 {
682
684 if (!$id) {
685 return;
686 }
687
688 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
690 $obj = new ilBookingReservation($book_id);
691 if ($obj->getUserId() != $ilUser->getId()) {
692 return;
693 }
694
695 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
696 $obj = new ilBookingObject($id);
697 $file = $obj->getPostFileFullPath();
698 if ($file) {
699 ilUtil::deliverFile($file, $obj->getPostFile());
700 }
701 }
static getObjectReservationForUser($a_object_id, $a_user_id, $a_multi=false)
$ilUser
Definition: imgupload.php:18

References $id, $ilUser, $object_id, $user, ilUtil\deliverFile(), and ilBookingReservation\getObjectReservationForUser().

+ Here is the call graph for this function:

◆ displayPostInfo()

ilBookingObjectGUI::displayPostInfo ( )

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

589 {
594
596 if (!$id) {
597 return;
598 }
599
600
601 // placeholder
602
603 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
605 $tmp = array();
606 foreach ($book_ids as $book_id) {
607 if (in_array($book_id, $this->rsv_ids)) {
608 $obj = new ilBookingReservation($book_id);
609 $from = $obj->getFrom();
610 $to = $obj->getTo();
611 if ($from > time()) {
612 $tmp[$from . "-" . $to]++;
613 }
614 }
615 }
616
619
620 $period = array();
621 ksort($tmp);
622 foreach ($tmp as $time => $counter) {
623 $time = explode("-", $time);
627 );
628 if ($counter > 1) {
629 $time .= " (" . $counter . ")";
630 }
631 $period[] = $time;
632 }
633 $book_id = array_shift($book_ids);
634
636
637
638 /*
639 #23578 since Booking pool participants.
640 $obj = new ilBookingReservation($book_id);
641 if ($obj->getUserId() != $ilUser->getId())
642 {
643 return;
644 }
645 */
646
647 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
648 $obj = new ilBookingObject($id);
649 $pfile = $obj->getPostFile();
650 $ptext = $obj->getPostText();
651
652 $mytpl = new ilTemplate('tpl.booking_reservation_post.html', true, true, 'Modules/BookingManager');
653 $mytpl->setVariable("TITLE", $lng->txt('book_post_booking_information'));
654
655 if ($ptext) {
656 // placeholder
657 $ptext = str_replace("[OBJECT]", $obj->getTitle(), $ptext);
658 $ptext = str_replace("[PERIOD]", implode("<br />", $period), $ptext);
659
660 $mytpl->setVariable("POST_TEXT", nl2br($ptext));
661 }
662
663 if ($pfile) {
664 $ilCtrl->setParameter($this, "object_id", $obj->getId());
665 $url = $ilCtrl->getLinkTarget($this, 'deliverPostFile');
666 $ilCtrl->setParameter($this, "object_id", "");
667
668 $mytpl->setVariable("DOWNLOAD", $lng->txt('download'));
669 $mytpl->setVariable("URL_FILE", $url);
670 $mytpl->setVariable("TXT_FILE", $pfile);
671 }
672
673 $mytpl->setVariable("TXT_SUBMIT", $lng->txt('ok'));
674 $mytpl->setVariable("URL_SUBMIT", $ilCtrl->getLinkTargetByClass('ilobjbookingpoolgui', 'render'));
675
676 $tpl->setContent($mytpl->get());
677 }
const IL_CAL_UNIX
static setUseRelativeDates($a_status)
set use relative dates
static useRelativeDates()
check if relative dates are used
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
@classDescription Date and time handling
special template class to simplify handling of ITX/PEAR
$time
Definition: cron.php:21
$url
$from

References $ctrl, $from, $id, $ilCtrl, $ilUser, $lng, $object_id, $time, $tpl, $url, $user, ilDatePresentation\formatPeriod(), ilBookingReservation\getObjectReservationForUser(), IL_CAL_UNIX, ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().

+ Here is the call graph for this function:

◆ edit()

ilBookingObjectGUI::edit ( ilPropertyFormGUI  $a_form = null)

Render edit form.

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

195 {
196 if (!$this->access->checkAccess('write', '', $this->ref_id)) {
197 return;
198 }
199
202 $ilTabs = $this->tabs;
204
205 $ilTabs->clearTargets();
206 $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
207
208 $this->setHelpId('edit');
209
210 if (!$a_form) {
211 $a_form = $this->initForm('edit', $this->object_id);
212 }
213 $tpl->setContent($a_form->getHTML());
214 }

References $ctrl, $ilCtrl, $lng, $tabs, $tpl, initForm(), and setHelpId().

Referenced by update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilBookingObjectGUI::executeCommand ( )

main switch

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

99 {
101
102 $next_class = $ilCtrl->getNextClass($this);
103
104 switch ($next_class) {
105
106 case "ilpropertyformgui":
107 // only case is currently adv metadata internal link in info settings, see #24497
108 $form = $this->initForm();
109 $this->ctrl->forwardCommand($form);
110 break;
111
112 default:
113 $cmd = $ilCtrl->getCmd("render");
114 $this->$cmd();
115 break;
116 }
117 return true;
118 }
if(isset($_POST['submit'])) $form

References $ctrl, $form, $ilCtrl, and initForm().

+ Here is the call graph for this function:

◆ initForm()

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

Build property form.

Parameters
string$a_mode
int$id
Returns
object

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

236 {
239 $ilObjDataCache = $this->obj_data_cache;
240
241 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
242
243 $form_gui = new ilPropertyFormGUI();
244
245 $title = new ilTextInputGUI($lng->txt("title"), "title");
246 $title->setRequired(true);
247 $title->setSize(40);
248 $title->setMaxLength(120);
249 $form_gui->addItem($title);
250
251 $desc = new ilTextAreaInputGUI($lng->txt("description"), "desc");
252 $desc->setCols(70);
253 $desc->setRows(15);
254 $form_gui->addItem($desc);
255
256 $file = new ilFileInputGUI($lng->txt("book_additional_info_file"), "file");
257 $file->setALlowDeletion(true);
258 $form_gui->addItem($file);
259
260 $nr = new ilNumberInputGUI($lng->txt("booking_nr_of_items"), "items");
261 $nr->setRequired(true);
262 $nr->setSize(3);
263 $nr->setMaxLength(3);
264 $form_gui->addItem($nr);
265
266 if ($this->pool_has_schedule) {
267 $options = array();
268 include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
269 foreach (ilBookingSchedule::getList($ilObjDataCache->lookupObjId($this->ref_id)) as $schedule) {
270 $options[$schedule["booking_schedule_id"]] = $schedule["title"];
271 }
272 $schedule = new ilSelectInputGUI($lng->txt("book_schedule"), "schedule");
273 $schedule->setRequired(true);
274 $schedule->setOptions($options);
275 $form_gui->addItem($schedule);
276 }
277
279 $post->setTitle($lng->txt("book_post_booking_information"));
280 $form_gui->addItem($post);
281
282 $pdesc = new ilTextAreaInputGUI($lng->txt("book_post_booking_text"), "post_text");
283 $pdesc->setCols(70);
284 $pdesc->setRows(15);
285 $pdesc->setInfo($lng->txt("book_post_booking_text_info"));
286 $form_gui->addItem($pdesc);
287
288 $pfile = new ilFileInputGUI($lng->txt("book_post_booking_file"), "post_file");
289 $pfile->setALlowDeletion(true);
290 $form_gui->addItem($pfile);
291
292 // #18214 - should also work for new objects
293 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
294 $this->record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR, "book", $this->pool_id, "bobj", $id);
295 $this->record_gui->setPropertyForm($form_gui);
296 $this->record_gui->parse();
297
298 if ($a_mode == "edit") {
299 $form_gui->setTitle($lng->txt("book_edit_object"));
300
301 $item = new ilHiddenInputGUI('object_id');
302 $item->setValue($id);
303 $form_gui->addItem($item);
304
305 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
306 $obj = new ilBookingObject($id);
307 $title->setValue($obj->getTitle());
308 $desc->setValue($obj->getDescription());
309 $nr->setValue($obj->getNrOfItems());
310 $pdesc->setValue($obj->getPostText());
311 $file->setValue($obj->getFile());
312 $pfile->setValue($obj->getPostFile());
313
314 if (isset($schedule)) {
315 $schedule->setValue($obj->getScheduleId());
316 }
317
318 $form_gui->addCommandButton("update", $lng->txt("save"));
319 } else {
320 $form_gui->setTitle($lng->txt("book_add_object"));
321 $form_gui->addCommandButton("save", $lng->txt("save"));
322 $form_gui->addCommandButton("render", $lng->txt("cancel"));
323 }
324 $form_gui->setFormAction($ilCtrl->getFormAction($this));
325
326 return $form_gui;
327 }
static getList($a_pool_id)
Get list of booking objects for given pool.
This class represents a file property in a property form.
This class represents a section header in a property form.
This class represents a hidden form property in a property form.
This class represents a number property in a property form.
This class represents a property form user interface.
This class represents a selection list property in a property form.
This class represents a text area property in a property form.
This class represents a text property in a property form.
$post
Definition: post.php:34

References $ctrl, $id, $ilCtrl, $lng, $obj_data_cache, PHPMailer\PHPMailer\$options, $post, $title, ilBookingSchedule\getList(), and ilAdvancedMDRecordGUI\MODE_EDITOR.

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ render()

ilBookingObjectGUI::render ( )

Render list of booking objects.

uses ilBookingObjectsTableGUI

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

126 {
127 $this->pool_gui->showNoScheduleMessage();
128
132 $ilAccess = $this->access;
133
134 if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
135 include_once 'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
136 $bar = new ilToolbarGUI;
137 $bar->addButton($lng->txt('book_add_object'), $ilCtrl->getLinkTarget($this, 'create'));
138 $bar = $bar->getHTML();
139 }
140
141 $tpl->setPermanentLink('book', $this->ref_id);
142
143 include_once 'Modules/BookingManager/classes/class.ilBookingObjectsTableGUI.php';
144 $table = new ilBookingObjectsTableGUI($this, 'render', $this->ref_id, $this->pool_id, $this->pool_has_schedule, $this->pool_overall_limit);
145 $tpl->setContent($bar . $table->getHTML());
146 }
addButton( $a_txt, $a_cmd, $a_target="", $a_acc_key="", $a_additional_attrs='', $a_id="", $a_class='submit')
Add button to toolbar.

References $access, $ctrl, $ilCtrl, $lng, $table, $tpl, and ilToolbarGUI\addButton().

Referenced by applyFilter(), and resetFilter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetFilter()

ilBookingObjectGUI::resetFilter ( )

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

158 {
159 include_once 'Modules/BookingManager/classes/class.ilBookingObjectsTableGUI.php';
160 $table = new ilBookingObjectsTableGUI($this, 'render', $this->ref_id, $this->pool_id, $this->pool_has_schedule, $this->pool_overall_limit, $this->repo_parent, $this->repo_parent_call);
161 $table->resetOffset();
162 $table->resetFilter();
163 $this->render();
164 }

References $table, and render().

+ Here is the call graph for this function:

◆ rsvCancelUser()

ilBookingObjectGUI::rsvCancelUser ( )

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

539 {
542
543 if ($this->user_to_deasign) {
544 $user_id = $this->user_to_deasign;
545 } else {
546 $user_id = $this->user->getId();
547 }
548
550 if (!$id || !$user_id) {
551 return;
552 }
553
554 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
556 $obj = new ilBookingReservation($id);
557 if ($obj->getUserId() != $user_id) {
558 ilUtil::sendFailure($lng->txt('permission_denied'), true);
559 $ilCtrl->redirect($this, 'render');
560 }
561
563 $obj->update();
564
565 ilUtil::sendSuccess($lng->txt('settings_saved'));
567 $this->ctrl->redirectByClass('ilbookingparticipantgui', 'render');
568 } else {
569 $ilCtrl->redirect($this, 'render');
570 }
571 }
$_POST["username"]
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References $_POST, $ctrl, $id, $ilCtrl, $lng, $object_id, $user_to_deasign, ilBookingReservation\getObjectReservationForUser(), ilBookingParticipantGUI\PARTICIPANT_VIEW, ilUtil\sendFailure(), ilBookingReservation\STATUS_CANCELLED, and user().

+ Here is the call graph for this function:

◆ rsvConfirmCancelUser()

ilBookingObjectGUI::rsvConfirmCancelUser ( )

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

506 {
510
512 if (!$id) {
513 return;
514 }
515
516 $this->setHelpId("cancel_booking");
517
518 include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
519 $conf = new ilConfirmationGUI();
520 $conf->setFormAction($ilCtrl->getFormAction($this));
521 $conf->setHeaderText($lng->txt('book_confirm_cancel'));
522
523 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
525 $conf->addItem('object_id', $id, $type->getTitle());
526 if ($this->user_to_deasign) {
527 $conf->addHiddenItem('bkusr', $this->user_to_deasign);
528 }
530 $conf->addHiddenItem('part_view', ilBookingParticipantGUI::PARTICIPANT_VIEW);
531 }
532 $conf->setConfirm($lng->txt('book_set_cancel'), 'rsvCancelUser');
533 $conf->setCancel($lng->txt('cancel'), 'render');
534
535 $tpl->setContent($conf->getHTML());
536 }

References $_GET, $ctrl, $id, $ilCtrl, $lng, $object_id, $tpl, $type, ilBookingParticipantGUI\PARTICIPANT_VIEW, and setHelpId().

+ Here is the call graph for this function:

◆ save()

ilBookingObjectGUI::save ( )

Create new object dataset.

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

333 {
334 if (!$this->access->checkAccess('write', '', $this->ref_id)) {
335 return;
336 }
337
340
341 $form = $this->initForm();
342 if ($form->checkInput()) {
343 $valid = true;
344 if ($this->record_gui &&
345 !$this->record_gui->importEditFormPostValues()) {
346 $valid = false;
347 }
348
349 if ($valid) {
350 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
351 $obj = new ilBookingObject;
352 $obj->setPoolId($this->pool_id);
353 $obj->setTitle($form->getInput("title"));
354 $obj->setDescription($form->getInput("desc"));
355 $obj->setNrOfItems($form->getInput("items"));
356 $obj->setPostText($form->getInput("post_text"));
357
358 if ($this->pool_has_schedule) {
359 $obj->setScheduleId($form->getInput("schedule"));
360 }
361
362 $obj->save();
363
364 $file = $form->getItemByPostVar("file");
365 if ($_FILES["file"]["tmp_name"]) {
366 $obj->uploadFile($_FILES["file"]);
367 } elseif ($file->getDeletionFlag()) {
368 $obj->deleteFile();
369 }
370
371 $pfile = $form->getItemByPostVar("post_file");
372 if ($_FILES["post_file"]["tmp_name"]) {
373 $obj->uploadPostFile($_FILES["post_file"]);
374 } elseif ($pfile->getDeletionFlag()) {
375 $obj->deletePostFile();
376 }
377
378 $obj->update();
379
380 if ($this->record_gui) {
381 $this->record_gui->writeEditForm(null, $obj->getId());
382 }
383
384 ilUtil::sendSuccess($lng->txt("book_object_added"), true);
385 $ilCtrl->redirect($this, "render");
386 }
387 }
388
389 $form->setValuesByPost();
390 $this->create($form);
391 }
create(ilPropertyFormGUI $a_form=null)
Render creation form.
setPoolId($a_pool_id)
Set booking pool id.
$valid

References $ctrl, $form, $ilCtrl, $lng, $valid, create(), initForm(), and ilBookingObject\setPoolId().

+ Here is the call graph for this function:

◆ setHelpId()

ilBookingObjectGUI::setHelpId (   $a_id)
protected

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

217 {
218 $ilHelp = $this->help;
219
220 $object_subtype = $this->pool_has_schedule
221 ? '-schedule'
222 : '-nonschedule';
223
224 $ilHelp->setScreenIdComponent('book');
225 $ilHelp->setScreenId('object' . $object_subtype);
226 $ilHelp->setSubScreenId($a_id);
227 }

References $help.

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

+ Here is the caller graph for this function:

◆ update()

ilBookingObjectGUI::update ( )

Update object dataset.

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

397 {
398 if (!$this->access->checkAccess('write', '', $this->ref_id)) {
399 return;
400 }
401
404
405 $form = $this->initForm('edit', $this->object_id);
406 if ($form->checkInput()) {
407 $valid = true;
408 if ($this->record_gui &&
409 !$this->record_gui->importEditFormPostValues()) {
410 $valid = false;
411 }
412
413 if ($valid) {
414 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
415 $obj = new ilBookingObject($this->object_id);
416 $obj->setTitle($form->getInput("title"));
417 $obj->setDescription($form->getInput("desc"));
418 $obj->setNrOfItems($form->getInput("items"));
419 $obj->setPostText($form->getInput("post_text"));
420
421 $file = $form->getItemByPostVar("file");
422 if ($_FILES["file"]["tmp_name"]) {
423 $obj->uploadFile($_FILES["file"]);
424 } elseif ($file->getDeletionFlag()) {
425 $obj->deleteFile();
426 }
427
428 $pfile = $form->getItemByPostVar("post_file");
429 if ($_FILES["post_file"]["tmp_name"]) {
430 $obj->uploadPostFile($_FILES["post_file"]);
431 } elseif ($pfile->getDeletionFlag()) {
432 $obj->deletePostFile();
433 }
434
435 if ($this->pool_has_schedule) {
436 $obj->setScheduleId($form->getInput("schedule"));
437 }
438
439 $obj->update();
440
441 if ($this->record_gui) {
442 $this->record_gui->writeEditForm();
443 }
444
445 ilUtil::sendSuccess($lng->txt("book_object_updated"), true);
446 $ilCtrl->redirect($this, "render");
447 }
448 }
449
450 $form->setValuesByPost();
451 $this->edit($form);
452 }
edit(ilPropertyFormGUI $a_form=null)
Render edit form.

References $ctrl, $form, $ilCtrl, $lng, $valid, edit(), and initForm().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilBookingObjectGUI::$access
protected

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

Referenced by render().

◆ $ctrl

◆ $help

ilBookingObjectGUI::$help
protected

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

Referenced by setHelpId().

◆ $lng

ilBookingObjectGUI::$lng
protected

◆ $obj_data_cache

ilBookingObjectGUI::$obj_data_cache
protected

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

Referenced by initForm().

◆ $object_id

ilBookingObjectGUI::$object_id
protected

◆ $pool_has_schedule

ilBookingObjectGUI::$pool_has_schedule
protected

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

◆ $pool_id

ilBookingObjectGUI::$pool_id
protected

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

◆ $pool_overall_limit

ilBookingObjectGUI::$pool_overall_limit
protected

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

◆ $ref_id

ilBookingObjectGUI::$ref_id
protected

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

◆ $tabs

ilBookingObjectGUI::$tabs
protected

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

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

◆ $tpl

ilBookingObjectGUI::$tpl
protected

◆ $user

ilBookingObjectGUI::$user
protected

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

Referenced by deliverPostFile(), and displayPostInfo().

◆ $user_to_deasign

ilBookingObjectGUI::$user_to_deasign
protected

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

Referenced by rsvCancelUser().


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