ILIAS  release_8 Revision v8.24
ilBookingProcessGUI Class Reference

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

+ Collaboration diagram for ilBookingProcessGUI:

Public Member Functions

 executeCommand ()
 
 book ()
 First step in booking process. More...
 
 assignParticipants ()
 
 bookMultipleParticipants ()
 Create reservations for a bunch of booking pool participants. More...
 
 redirectToList ()
 
 saveMultipleBookings ()
 Save multiple users reservations for one booking pool object. More...
 
 confirmedBooking ()
 
 processBooking (int $a_object_id, int $a_from=null, int $a_to=null, int $a_group_id=null)
 Book object for date. More...
 
 confirmBookingNumbers (array $a_objects_counter, int $a_group_id, ilPropertyFormGUI $a_form=null)
 
 confirmedBookingNumbers ()
 
 displayPostInfo ()
 Display post booking informations. More...
 
 deliverPostFile ()
 Deliver post booking file. More...
 

Protected Member Functions

 back ()
 
 setHelpId (string $a_id)
 
 checkPermissionBool (string $a_perm)
 
 checkPermission (string $a_perm)
 
 saveParticipant ()
 save booking participant More...
 
 initBookingNumbersForm (array $a_objects_counter, int $a_group_id, bool $a_reload=false, ?array $new_values=null)
 
 addDaysDate (string $a_date, int $a_days)
 
 addDaysStamp (int $a_stamp, int $a_days)
 
 handleBookingSuccess (int $a_obj_id, array $a_rsv_ids=null)
 

Protected Attributes

array $raw_post_data
 
ILIAS BookingManager StandardGUIRequest $book_request
 
ilObjBookingPool $pool
 
int $booking_object_id
 
int $user_id_to_book
 
int $user_id_assigner
 
string $seed
 
string $sseed
 
ilBookingHelpAdapter $help
 
int $context_obj_id
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilAccessHandler $access
 
ilTabsGUI $tabs_gui
 
ilObjUser $user
 
int $book_obj_id
 
array $rsv_ids = []
 

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 Booking process ui class

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Member Function Documentation

◆ addDaysDate()

ilBookingProcessGUI::addDaysDate ( string  $a_date,
int  $a_days 
)
protected

Definition at line 961 of file class.ilBookingProcessGUI.php.

964 : string {
965 $date = date_parse($a_date);
966 $stamp = mktime(0, 0, 1, $date["month"], $date["day"] + $a_days, $date["year"]);
967 return date("Y-m-d", $stamp);
968 }

◆ addDaysStamp()

ilBookingProcessGUI::addDaysStamp ( int  $a_stamp,
int  $a_days 
)
protected

Definition at line 970 of file class.ilBookingProcessGUI.php.

973 : int {
974 $date = getdate($a_stamp);
975 return mktime(
976 $date["hours"],
977 $date["minutes"],
978 $date["seconds"],
979 $date["mon"],
980 $date["mday"] + $a_days,
981 $date["year"]
982 );
983 }

◆ assignParticipants()

ilBookingProcessGUI::assignParticipants ( )

Definition at line 487 of file class.ilBookingProcessGUI.php.

487 : void
488 {
489 $this->tabs_gui->clearTargets();
490 $this->tabs_gui->setBackTarget($this->lng->txt('book_back_to_list'), $this->ctrl->getLinkTarget($this, 'back'));
491
492 $table = new ilBookingAssignParticipantsTableGUI($this, 'assignParticipants', $this->pool->getRefId(), $this->pool->getId(), $this->book_obj_id);
493
494 $this->tpl->setContent($table->getHTML());
495 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ back()

ilBookingProcessGUI::back ( )
protected

Definition at line 113 of file class.ilBookingProcessGUI.php.

113 : void
114 {
115 $this->ctrl->returnToParent($this);
116 }

References ILIAS\Repository\ctrl().

Referenced by checkPermission().

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

◆ book()

ilBookingProcessGUI::book ( )

First step in booking process.

Definition at line 149 of file class.ilBookingProcessGUI.php.

149 : void // ok
150 {
152
153 $this->tabs_gui->clearTargets();
154 $this->tabs_gui->setBackTarget($this->lng->txt('book_back_to_list'), $this->ctrl->getLinkTarget($this, 'back'));
155
156 $this->setHelpId("book");
157
158 $obj = new ilBookingObject($this->book_obj_id);
159
160 $this->lng->loadLanguageModule("dateplaner");
161 $this->ctrl->setParameter($this, 'object_id', $obj->getId());
162
163 if ($this->user_id_to_book !== $this->user_id_assigner) {
164 $this->ctrl->setParameter($this, 'bkusr', $this->user_id_to_book);
165 }
166
167 if ($this->pool->getScheduleType() === ilObjBookingPool::TYPE_FIX_SCHEDULE) {
168 $schedule = new ilBookingSchedule($obj->getScheduleId());
169
170 $tpl->setContent($this->renderSlots($schedule, array($obj->getId()), $obj->getTitle()));
171 } else {
172 $cgui = new ilConfirmationGUI();
173 $cgui->setHeaderText($this->lng->txt("book_confirm_booking_no_schedule"));
174
175 $cgui->setFormAction($this->ctrl->getFormAction($this));
176 $cgui->setCancel($this->lng->txt("cancel"), "back");
177 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedBooking");
178
179 $cgui->addItem("object_id", $obj->getId(), $obj->getTitle());
180
181 $tpl->setContent($cgui->getHTML());
182 }
183 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilGlobalTemplateInterface $tpl
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...
setContent(string $a_html)
Sets content for standard template.

References $tpl, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilGlobalTemplateInterface\setContent(), setHelpId(), and ilObjBookingPool\TYPE_FIX_SCHEDULE.

+ Here is the call graph for this function:

◆ bookMultipleParticipants()

ilBookingProcessGUI::bookMultipleParticipants ( )

Create reservations for a bunch of booking pool participants.

Definition at line 500 of file class.ilBookingProcessGUI.php.

500 : void
501 {
502 $participants = $this->book_request->getParticipants();
503 if (count($participants) === 0) {
504 $this->back();
505 return;
506 }
507
508 $this->tabs_gui->clearTargets();
509 $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this, 'assignparticipants'));
510
511 $conf = new ilConfirmationGUI();
512 $conf->setFormAction($this->ctrl->getFormAction($this));
513
514 //add user list as items.
515 foreach ($participants as $id) {
517 $conf->addItem("participants[]", $id, $name);
518 }
519
520 $available = ilBookingReservation::numAvailableFromObjectNoSchedule($this->book_obj_id);
521 if (count($participants) > $available) {
522 $obj = new ilBookingObject($this->book_obj_id);
523 $conf->setHeaderText(
524 sprintf(
525 $this->lng->txt('book_limit_objects_available'),
526 count($participants),
527 $obj->getTitle(),
528 $available
529 )
530 );
531 } else {
532 $conf->setHeaderText($this->lng->txt('book_confirm_booking_no_schedule'));
533 $conf->addHiddenItem("object_id", $this->book_obj_id);
534 $conf->setConfirm($this->lng->txt("assign"), "saveMultipleBookings");
535 }
536
537 $conf->setCancel($this->lng->txt("cancel"), 'redirectToList');
538 $this->tpl->setContent($conf->getHTML());
539 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static numAvailableFromObjectNoSchedule(int $a_obj_id)
static _lookupFullname(int $a_user_id)
if($format !==null) $name
Definition: metadata.php:247

References $id, $name, ilObjUser\_lookupFullname(), ILIAS\UI\examples\Symbol\Glyph\Back\back(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilBookingReservation\numAvailableFromObjectNoSchedule().

+ Here is the call graph for this function:

◆ checkPermission()

ilBookingProcessGUI::checkPermission ( string  $a_perm)
protected

Definition at line 133 of file class.ilBookingProcessGUI.php.

133 : void
134 {
135 if (!$this->checkPermissionBool($a_perm)) {
136 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_permission"), true);
137 $this->back();
138 }
139 }

References back(), checkPermissionBool(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ checkPermissionBool()

ilBookingProcessGUI::checkPermissionBool ( string  $a_perm)
protected

Definition at line 123 of file class.ilBookingProcessGUI.php.

123 : bool
124 {
125 $ilAccess = $this->access;
126
127 if (!$ilAccess->checkAccess($a_perm, "", $this->pool->getRefId())) {
128 return false;
129 }
130 return true;
131 }

References $access.

Referenced by checkPermission().

+ Here is the caller graph for this function:

◆ confirmBookingNumbers()

ilBookingProcessGUI::confirmBookingNumbers ( array  $a_objects_counter,
int  $a_group_id,
ilPropertyFormGUI  $a_form = null 
)

Definition at line 708 of file class.ilBookingProcessGUI.php.

712 : void {
714
715 $this->tabs_gui->clearTargets();
716 $this->tabs_gui->setBackTarget($this->lng->txt('book_back_to_list'), $this->ctrl->getLinkTarget($this, 'back'));
717
718 if (!$a_form) {
719 $a_form = $this->initBookingNumbersForm($a_objects_counter, $a_group_id);
720 }
721
722 $tpl->setContent($a_form->getHTML());
723 }
initBookingNumbersForm(array $a_objects_counter, int $a_group_id, bool $a_reload=false, ?array $new_values=null)

◆ confirmedBooking()

ilBookingProcessGUI::confirmedBooking ( )

Definition at line 579 of file class.ilBookingProcessGUI.php.

579 : bool
580 {
581 $success = false;
582 $rsv_ids = array();
583
584 if ($this->pool->getScheduleType() !== ilObjBookingPool::TYPE_FIX_SCHEDULE) {
585 if ($this->book_obj_id > 0) {
586 $object_id = $this->book_obj_id;
587 if ($object_id) {
589 count(ilBookingReservation::getObjectReservationForUser($object_id, $this->user_id_to_book)) === 0) { // #18304
590 $rsv_ids[] = $this->processBooking($object_id);
591 $success = $object_id;
592 } else {
593 // #11852
594 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('book_reservation_failed_overbooked'), true);
595 $this->ctrl->redirect($this, 'back');
596 }
597 }
598 }
599 } else {
600 $dates = $this->book_request->getDates();
601 if (count($dates) === 0) {
602 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
603 $this->book();
604 return false;
605 }
606
607 // single object reservation(s)
608 if ($this->book_obj_id > 0) {
609 $confirm = array();
610
611 $object_id = $this->book_obj_id;
612 $group_id = null;
613 if ($object_id) {
614 $nr = ilBookingObject::getNrOfItemsForObjects(array($object_id));
615 // needed for recurrence
617 $repo = $f->getRepo();
618 $group_id = $repo->getNewGroupId();
619 foreach ($dates as $date) {
620 $fromto = explode('_', $date);
621 $from = (int) $fromto[0];
622 $to = (int) $fromto[1] - 1;
623
624 $counter = ilBookingReservation::getAvailableObject(array($object_id), $from, $to, false, true);
625 $counter = $counter[$object_id];
626 if ($counter) {
627 // needed for recurrence
628 $confirm[$object_id . "_" . $from . "_" . ($to + 1)] = $counter;
629 }
630 }
631 }
632
633 if (count($confirm)) {
634 $this->confirmBookingNumbers($confirm, $group_id);
635 return false;
636 }
637 }
638 }
639
640 if ($success) {
641 $this->saveParticipant();
642 $this->handleBookingSuccess($success, $rsv_ids);
643 } else {
644 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('book_reservation_failed'), true);
645 $this->ctrl->redirect($this, 'book');
646 }
647 return true;
648 }
static getNrOfItemsForObjects(array $a_obj_ids)
Get nr of available items for a set of object ids.
confirmBookingNumbers(array $a_objects_counter, int $a_group_id, ilPropertyFormGUI $a_form=null)
book()
First step in booking process.
handleBookingSuccess(int $a_obj_id, array $a_rsv_ids=null)
processBooking(int $a_object_id, int $a_from=null, int $a_to=null, int $a_group_id=null)
Book object for date.
saveParticipant()
save booking participant
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getObjectReservationForUser(int $a_object_id, int $a_user_id)
static isObjectAvailableNoSchedule(int $a_obj_id)
static getAvailableObject(array $a_ids, int $a_from, int $a_to, bool $a_return_single=true, bool $a_return_counter=false)
Check if any of given objects are bookable.

References Vendor\Package\$f, ILIAS\Repository\ctrl(), ilBookingReservation\getAvailableObject(), ilBookingObject\getNrOfItemsForObjects(), ilBookingReservation\getObjectReservationForUser(), ILIAS\Repository\int(), ilBookingReservation\isObjectAvailableNoSchedule(), ILIAS\Repository\lng(), and ilObjBookingPool\TYPE_FIX_SCHEDULE.

+ Here is the call graph for this function:

◆ confirmedBookingNumbers()

ilBookingProcessGUI::confirmedBookingNumbers ( )

Definition at line 828 of file class.ilBookingProcessGUI.php.

828 : void
829 {
830
831 //get the user who will get the booking.
832 if ($this->book_request->getBookedUser() > 0) {
833 $this->user_id_to_book = $this->book_request->getBookedUser();
834 }
835
836 // convert post data to initial form config
837 $counter = array();
838 $current_first = $obj_id = null;
839 foreach (array_keys($this->raw_post_data) as $id) {
840 if (str_starts_with($id, "conf_nr__")) {
841 $id = explode("_", substr($id, 9));
842 $counter[$id[0] . "_" . $id[1] . "_" . $id[2]] = (int) $id[3];
843 if (!$current_first) {
844 $current_first = date("Y-m-d", $id[1]);
845 }
846 }
847 }
848
849 // recurrence
850
851 // checkInput() has not been called yet, so we have to improvise
852 $rece = $this->book_request->getRece();
853 $recm = $this->book_request->getRecm();
854 $end = ilCalendarUtil::parseIncomingDate($rece, false);
855
856 $new_values = [];
857
858 if ((int) $recm > 0 && $end && $current_first) {
859 ksort($counter);
860 $end = $end->get(IL_CAL_DATE);
861 $cycle = (int) $recm * 7;
862 $cut = 0;
863 $org = $counter;
864 while ($cut < 1000 && $this->addDaysDate($current_first, $cycle) <= $end) {
865 $cut++;
866 $current_first = null;
867 foreach ($org as $item_id => $max) {
868 $parts = explode("_", $item_id);
869 $obj_id = $parts[0];
870
871 $from = $this->addDaysStamp($parts[1], $cycle * $cut);
872 $to = $this->addDaysStamp($parts[2], $cycle * $cut);
873
874 $new_item_id = $obj_id . "_" . $from . "_" . $to;
875
876 // form reload because of validation errors
877 if (!isset($counter[$new_item_id]) && date("Y-m-d", $to) <= $end) {
878 // get max available for added dates
879 $new_max = ilBookingReservation::getAvailableObject(array($obj_id), $from, $to - 1, false, true);
880 $new_max = (int) $new_max[$obj_id];
881
882 $counter[$new_item_id] = $new_max;
883
884 if (!$current_first) {
885 $current_first = date("Y-m-d", $from);
886 }
887
888 // clone input
889 $new_values["conf_nr__" . $new_item_id . "_" . $new_max] =
890 $_POST["conf_nr__" . $item_id . "_" . $max];
891 }
892 }
893 }
894 }
895
896 $group_id = $this->book_request->getGroupId();
897
898 $form = $this->initBookingNumbersForm($counter, $group_id, true, $new_values);
899 if ($form->checkInput()) {
900 $success = false;
901 $rsv_ids = array();
902 foreach ($counter as $id => $all_nr) {
903 $book_nr = $form->getInput("conf_nr__" . $id . "_" . $all_nr);
904 $parts = explode("_", $id);
905 $obj_id = $parts[0];
906 $from = $parts[1];
907 $to = $parts[2] - 1;
908
909 // get currently available slots
910 $counter = ilBookingReservation::getAvailableObject(array($obj_id), $from, $to, false, true);
911 $counter = $counter[$obj_id];
912 if ($counter) {
913 // we can only book what is left
914 $book_nr = min($book_nr, $counter);
915 for ($loop = 0; $loop < $book_nr; $loop++) {
916 $rsv_ids[] = $this->processBooking($obj_id, $from, $to, $group_id);
917 $success = $obj_id;
918 }
919 }
920 }
921 if ($success) {
922 $this->saveParticipant();
923 $this->handleBookingSuccess($success, $rsv_ids);
924 } else {
925 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('book_reservation_failed'), true);
926 $this->back();
927 }
928 } else {
929 // ilDateTimeInputGUI does NOT add hidden values on disabled!
930
931 $rece_array = explode(".", $rece);
932
933 $rece_day = str_pad($rece_array[0], 2, "0", STR_PAD_LEFT);
934 $rece_month = str_pad($rece_array[1], 2, "0", STR_PAD_LEFT);
935 $rece_year = $rece_array[2];
936
937 // ilDateTimeInputGUI will choke on POST array format
938 //$_POST["rece"] = null;
939
940 $form->setValuesByPost();
941
942 $rece_date = new ilDate($rece_year . "-" . $rece_month . "-" . $rece_day, IL_CAL_DATE);
943
944 $rece = $form->getItemByPostVar("rece");
945 if ($rece !== null) {
946 $rece->setDate($rece_date);
947 }
948 $recm = $form->getItemByPostVar("recm");
949 if ($recm !== null) {
950 $recm->setHideSubForm((int) $form->getInput("recm") < 1);
951 }
952
953 $hidden_date = new ilHiddenInputGUI("rece");
954 $hidden_date->setValue($rece_date);
955 $form->addItem($hidden_date);
956
957 $this->confirmBookingNumbers($counter, $group_id, $form);
958 }
959 }
const IL_CAL_DATE
addDaysDate(string $a_date, int $a_days)
addDaysStamp(int $a_stamp, int $a_days)
static parseIncomingDate($a_value, bool $a_add_time=false)
Try to parse incoming value to date object.
Class for single dates.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:64

References $id, $parts, ILIAS\UI\examples\Symbol\Glyph\Back\back(), ilBookingReservation\getAvailableObject(), IL_CAL_DATE, ILIAS\Repository\int(), ILIAS\Repository\lng(), and ilCalendarUtil\parseIncomingDate().

+ Here is the call graph for this function:

◆ deliverPostFile()

ilBookingProcessGUI::deliverPostFile ( )

Deliver post booking file.

Definition at line 1105 of file class.ilBookingProcessGUI.php.

1105 : void
1106 {
1108 if (!$id) {
1109 return;
1110 }
1111
1112 $book_ids = ilBookingReservation::getObjectReservationForUser($id, $this->user_id_assigner);
1113 $book_id = current($book_ids);
1114 $obj = new ilBookingReservation($book_id);
1115 if ($obj->getUserId() !== $this->user_id_assigner) {
1116 return;
1117 }
1118
1119 $obj = new ilBookingObject($id);
1120 $file = $obj->getPostFileFullPath();
1121 if ($file) {
1122 ilFileDelivery::deliverFileLegacy($file, $obj->getPostFile());
1123 }
1124 }
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)

References $id, ilFileDelivery\deliverFileLegacy(), and ilBookingReservation\getObjectReservationForUser().

+ Here is the call graph for this function:

◆ displayPostInfo()

ilBookingProcessGUI::displayPostInfo ( )

Display post booking informations.

Definition at line 1013 of file class.ilBookingProcessGUI.php.

1013 : void
1014 {
1015 $tpl = $this->tpl;
1016 $lng = $this->lng;
1017 $ilCtrl = $this->ctrl;
1019 if (!$id) {
1020 return;
1021 }
1022 // placeholder
1023 $book_ids = ilBookingReservation::getObjectReservationForUser($id, $this->user_id_assigner);
1024 $tmp = array();
1025 foreach ($book_ids as $book_id) {
1026 if (in_array($book_id, $this->rsv_ids) || count($this->rsv_ids) === 0) {
1027 $obj = new ilBookingReservation($book_id);
1028 $from = $obj->getFrom();
1029 $to = $obj->getTo();
1030 if ($from > time()) {
1031 $key = $from . "-" . $to;
1032 if (!isset($tmp[$key])) {
1033 $tmp[$key] = 0;
1034 }
1035 $tmp[$key]++;
1036 }
1037 }
1038 }
1039
1042
1043 $period = array();
1044 ksort($tmp);
1045 foreach ($tmp as $time => $counter) {
1046 $time = explode("-", $time);
1048 new ilDateTime($time[0], IL_CAL_UNIX),
1049 new ilDateTime($time[1], IL_CAL_UNIX)
1050 );
1051 if ($counter > 1) {
1052 $time .= " (" . $counter . ")";
1053 }
1054 $period[] = $time;
1055 }
1056 $book_id = array_shift($book_ids);
1057
1059
1060
1061 /*
1062 #23578 since Booking pool participants.
1063 $obj = new ilBookingReservation($book_id);
1064 if ($obj->getUserId() != $ilUser->getId())
1065 {
1066 return;
1067 }
1068 */
1069
1070 $obj = new ilBookingObject($id);
1071 $pfile = $obj->getPostFile();
1072 $ptext = $obj->getPostText();
1073
1074 $mytpl = new ilTemplate('tpl.booking_reservation_post.html', true, true, 'Modules/BookingManager/BookingProcess');
1075 $mytpl->setVariable("TITLE", $lng->txt('book_post_booking_information'));
1076
1077 if ($ptext) {
1078 // placeholder
1079 $ptext = str_replace(
1080 ["[OBJECT]", "[PERIOD]"],
1081 [$obj->getTitle(), implode("<br />", $period)],
1082 $ptext
1083 );
1084
1085 $mytpl->setVariable("POST_TEXT", nl2br($ptext));
1086 }
1087
1088 if ($pfile) {
1089 $url = $ilCtrl->getLinkTarget($this, 'deliverPostFile');
1090
1091 $mytpl->setVariable("DOWNLOAD", $lng->txt('download'));
1092 $mytpl->setVariable("URL_FILE", $url);
1093 $mytpl->setVariable("TXT_FILE", $pfile);
1094 }
1095
1096 $mytpl->setVariable("TXT_SUBMIT", $lng->txt('ok'));
1097 $mytpl->setVariable("URL_SUBMIT", $ilCtrl->getLinkTarget($this, "back"));
1098
1099 $tpl->setContent($mytpl->get());
1100 }
const IL_CAL_UNIX
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
static setUseRelativeDates(bool $a_status)
set use relative dates
@classDescription Date and time handling
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...
special template class to simplify handling of ITX/PEAR
string $key
Consumer key/client ID value.
Definition: System.php:193
$url

References $id, ILIAS\LTI\ToolProvider\$key, $lng, $tpl, $url, ilDatePresentation\formatPeriod(), ilBookingReservation\getObjectReservationForUser(), IL_CAL_UNIX, ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().

+ Here is the call graph for this function:

◆ executeCommand()

ilBookingProcessGUI::executeCommand ( )

Definition at line 89 of file class.ilBookingProcessGUI.php.

89 : void
90 {
92
93 $next_class = $ctrl->getNextClass($this);
94 $cmd = $ctrl->getCmd("show");
95 switch ($next_class) {
96 default:
97 if (in_array($cmd, array("book", "back",
98 "assignParticipants",
99 "bookMultipleParticipants",
100 "saveMultipleBookings",
101 "confirmedBooking",
102 "confirmBookingNumbers",
103 "confirmedBookingNumbers",
104 "displayPostInfo",
105 "deliverPostFile"
106 ))) {
107 $this->$cmd();
108 }
109 }
110 }
getNextClass($a_gui_class=null)
@inheritDoc
getCmd(string $fallback_command=null)
@inheritDoc

References $ctrl, ilCtrl\getCmd(), and ilCtrl\getNextClass().

+ Here is the call graph for this function:

◆ handleBookingSuccess()

ilBookingProcessGUI::handleBookingSuccess ( int  $a_obj_id,
array  $a_rsv_ids = null 
)
protected

Definition at line 989 of file class.ilBookingProcessGUI.php.

992 : void {
993 $this->tpl->setOnScreenMessage('success', $this->lng->txt('book_reservation_confirmed'), true);
994
995 // show post booking information?
996 $obj = new ilBookingObject($a_obj_id);
997 $pfile = $obj->getPostFile();
998 $ptext = $obj->getPostText();
999
1000 if (trim($ptext) || $pfile) {
1001 if (count($a_rsv_ids)) {
1002 $this->ctrl->setParameter($this, 'rsv_ids', implode(";", $a_rsv_ids));
1003 }
1004 $this->ctrl->redirect($this, 'displayPostInfo');
1005 } else {
1006 $this->back();
1007 }
1008 }

◆ initBookingNumbersForm()

ilBookingProcessGUI::initBookingNumbersForm ( array  $a_objects_counter,
int  $a_group_id,
bool  $a_reload = false,
?array  $new_values = null 
)
protected
Exceptions
ilCtrlException
ilDateTimeException

Definition at line 729 of file class.ilBookingProcessGUI.php.

735 $form = new ilPropertyFormGUI();
736 $form->setFormAction($this->ctrl->getFormAction($this, "confirmedBooking"));
737 $form->setTitle($this->lng->txt("book_confirm_booking_schedule_number_of_objects"));
738 $form->setDescription($this->lng->txt("book_confirm_booking_schedule_number_of_objects_info"));
739
740 $section = false;
741 $min_date = null;
742 foreach ($a_objects_counter as $id => $counter) {
743 $id = explode("_", $id);
744 $book_id = $id[0] . "_" . $id[1] . "_" . $id[2] . "_" . $counter;
745
746 $obj = new ilBookingObject($id[0]);
747
748 if (!$section) {
749 $section = new ilFormSectionHeaderGUI();
750 $section->setTitle($obj->getTitle());
751 $form->addItem($section);
752
753 $section = true;
754 }
755
756 $period = /* $this->lng->txt("book_period").": ". */
758 new ilDateTime($id[1], IL_CAL_UNIX),
759 new ilDateTime($id[2], IL_CAL_UNIX)
760 );
761
762 $nr_field = new ilNumberInputGUI($period, "conf_nr__" . $book_id);
763 $nr_field->setValue(1);
764 $nr_field->setSize(3);
765 $nr_field->setMaxValue($counter);
766 $nr_field->setMinValue($counter ? 1 : 0);
767 $nr_field->setRequired(true);
768 if (!is_null($new_values) && isset($new_values["conf_nr__" . $book_id])) {
769 $nr_field->setRequestParam(
770 "conf_nr__" . $book_id,
771 $new_values["conf_nr__" . $book_id]
772 );
773 }
774 $form->addItem($nr_field);
775
776 if (!$min_date || $id[1] < $min_date) {
777 $min_date = $id[1];
778 }
779 }
780
781 // recurrence
782 $this->lng->loadLanguageModule("dateplaner");
783 $rec_mode = new ilSelectInputGUI($this->lng->txt("cal_recurrences"), "recm");
784 $rec_mode->setRequired(true);
785 $rec_mode->setOptions(array(
786 "-1" => $this->lng->txt("cal_no_recurrence"),
787 1 => $this->lng->txt("cal_weekly"),
788 2 => $this->lng->txt("r_14"),
789 4 => $this->lng->txt("r_4_weeks")
790 ));
791 $form->addItem($rec_mode);
792
793 $rec_end = new ilDateTimeInputGUI($this->lng->txt("cal_repeat_until"), "rece");
794 $rec_end->setRequired(true);
795 $rec_mode->addSubItem($rec_end);
796
797 if (!$a_reload) {
798 // show date only if active recurrence
799 $rec_mode->setHideSubForm(true, '>= 1');
800
801 if ($min_date) {
802 $rec_end->setDate(new ilDateTime($min_date, IL_CAL_UNIX));
803 }
804 } else {
805 // recurrence may not be changed on reload
806 $rec_mode->setDisabled(true);
807 $rec_end->setDisabled(true);
808 }
809
810 if ($a_group_id) {
811 $grp = new ilHiddenInputGUI("grp_id");
812 $grp->setValue($a_group_id);
813 $form->addItem($grp);
814 }
815
816 if ($this->user_id_assigner !== $this->user_id_to_book) {
817 $usr = new ilHiddenInputGUI("bkusr");
818 $usr->setValue($this->user_id_to_book);
819 $form->addItem($usr);
820 }
821
822 $form->addCommandButton("confirmedBookingNumbers", $this->lng->txt("confirm"));
823 $form->addCommandButton("back", $this->lng->txt("cancel"));
824
825 return $form;
826 }
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...
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.

References $id, ilDatePresentation\formatPeriod(), and IL_CAL_UNIX.

+ Here is the call graph for this function:

◆ processBooking()

ilBookingProcessGUI::processBooking ( int  $a_object_id,
int  $a_from = null,
int  $a_to = null,
int  $a_group_id = null 
)

Book object for date.

Returns
int reservation id
Exceptions
ilDateTimeException

Definition at line 663 of file class.ilBookingProcessGUI.php.

668 : int {
669 // #11995
670 $this->checkPermission('read');
671
672 $reservation = new ilBookingReservation();
673 $reservation->setObjectId($a_object_id);
674 $reservation->setUserId($this->user_id_to_book);
675 $reservation->setAssignerId($this->user_id_assigner);
676 $reservation->setFrom((int) $a_from);
677 $reservation->setTo((int) $a_to);
678 $reservation->setGroupId((int) $a_group_id);
679 $reservation->setContextObjId($this->context_obj_id);
680 $reservation->save();
681
682 if ($a_from) {
683 $this->lng->loadLanguageModule('dateplaner');
684 $def_cat = ilCalendarUtil::initDefaultCalendarByType(ilCalendarCategory::TYPE_BOOK, $this->user_id_to_book, $this->lng->txt('cal_ch_personal_book'), true);
685
686 $object = new ilBookingObject($a_object_id);
687
688 $entry = new ilCalendarEntry();
689 $entry->setStart(new ilDateTime($a_from, IL_CAL_UNIX));
690 $entry->setEnd(new ilDateTime($a_to, IL_CAL_UNIX));
691 $entry->setTitle($this->lng->txt('book_cal_entry') . ' ' . $object->getTitle());
692 $entry->setContextId($reservation->getId());
693 $entry->save();
694
695 $assignment = new ilCalendarCategoryAssignments($entry->getEntryId());
696 if ($def_cat !== null) {
697 $assignment->addAssignment($def_cat->getCategoryID());
698 }
699 }
700
701 return $reservation->getId();
702 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static initDefaultCalendarByType(int $a_type_id, int $a_usr_id, string $a_title, bool $a_create=false)
Init the default calendar for given type and user.

◆ redirectToList()

ilBookingProcessGUI::redirectToList ( )

Definition at line 541 of file class.ilBookingProcessGUI.php.

541 : void
542 {
543 $this->ctrl->redirect($this, 'assignParticipants');
544 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ saveMultipleBookings()

ilBookingProcessGUI::saveMultipleBookings ( )

Save multiple users reservations for one booking pool object.

Todo:
check if object/user exist in the DB,

Definition at line 550 of file class.ilBookingProcessGUI.php.

550 : void
551 {
552 $participants = $this->book_request->getParticipants();
553 $object_id = $this->book_request->getObjectId();
554 if (count($participants) > 0 && $object_id > 0) {
555 $this->book_obj_id = $object_id;
556 } else {
557 $this->back();
558 }
559 $rsv_ids = array();
560 foreach ($participants as $id) {
561 $this->user_id_to_book = $id;
562 $rsv_ids[] = $this->processBooking($this->book_obj_id);
563 }
564
565 if (count($rsv_ids)) {
566 $this->tpl->setOnScreenMessage('success', "booking_multiple_succesfully");
567 } else {
568 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('book_reservation_failed_overbooked'), true);
569 }
570 $this->back();
571 }

References $id, ILIAS\UI\examples\Symbol\Glyph\Back\back(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ saveParticipant()

ilBookingProcessGUI::saveParticipant ( )
protected

save booking participant

Definition at line 653 of file class.ilBookingProcessGUI.php.

653 : void
654 {
655 $participant = new ilBookingParticipant($this->user_id_to_book, $this->pool->getId());
656 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ setHelpId()

ilBookingProcessGUI::setHelpId ( string  $a_id)
protected

Definition at line 118 of file class.ilBookingProcessGUI.php.

118 : void
119 {
120 $this->help->setHelpId($a_id);
121 }

References ILIAS\Repository\help().

Referenced by book().

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

Field Documentation

◆ $access

ilAccessHandler ilBookingProcessGUI::$access
protected

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

Referenced by checkPermissionBool().

◆ $book_obj_id

int ilBookingProcessGUI::$book_obj_id
protected

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

◆ $book_request

ILIAS BookingManager StandardGUIRequest ilBookingProcessGUI::$book_request
protected

Definition at line 26 of file class.ilBookingProcessGUI.php.

◆ $booking_object_id

int ilBookingProcessGUI::$booking_object_id
protected

Definition at line 28 of file class.ilBookingProcessGUI.php.

◆ $context_obj_id

int ilBookingProcessGUI::$context_obj_id
protected

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

◆ $ctrl

ilCtrl ilBookingProcessGUI::$ctrl
protected

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

Referenced by executeCommand().

◆ $help

ilBookingHelpAdapter ilBookingProcessGUI::$help
protected

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

◆ $lng

ilLanguage ilBookingProcessGUI::$lng
protected

Definition at line 37 of file class.ilBookingProcessGUI.php.

◆ $pool

ilObjBookingPool ilBookingProcessGUI::$pool
protected

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

◆ $raw_post_data

array ilBookingProcessGUI::$raw_post_data
protected

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

◆ $rsv_ids

array ilBookingProcessGUI::$rsv_ids = []
protected

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

◆ $seed

string ilBookingProcessGUI::$seed
protected

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

◆ $sseed

string ilBookingProcessGUI::$sseed
protected

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

◆ $tabs_gui

ilTabsGUI ilBookingProcessGUI::$tabs_gui
protected

Definition at line 39 of file class.ilBookingProcessGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilBookingProcessGUI::$tpl
protected

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

Referenced by book().

◆ $user

ilObjUser ilBookingProcessGUI::$user
protected

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

◆ $user_id_assigner

int ilBookingProcessGUI::$user_id_assigner
protected

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

◆ $user_id_to_book

int ilBookingProcessGUI::$user_id_to_book
protected

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


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