4require_once
"./Services/Object/classes/class.ilObjectGUI.php";
38 public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output =
true)
42 $this->tpl =
$DIC[
"tpl"];
43 $this->tabs =
$DIC->tabs();
44 $this->nav_history =
$DIC[
"ilNavigationHistory"];
45 $this->help =
$DIC[
"ilHelp"];
46 $this->ctrl =
$DIC->ctrl();
47 $this->lng =
$DIC->language();
49 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
50 $this->lng->loadLanguageModule(
"book");
53 throw new ilException(
"Booking Object ID does not match Booking Pool.");
69 $next_class = $this->ctrl->getNextClass($this);
70 $cmd = $this->ctrl->getCmd();
72 if (!$next_class && $cmd ==
'render') {
73 if (
$ilUser->getId() != ANONYMOUS_USER_ID) {
74 $this->ctrl->setCmdClass(
'ilBookingObjectGUI');
75 $next_class = $this->ctrl->getNextClass($this);
77 $this->ctrl->redirect($this,
"infoscreen");
81 if (substr($cmd, 0, 4) ==
'book') {
85 $ilNavigationHistory->addItem(
87 "./goto.php?target=book_" . $this->ref_id,
93 switch ($next_class) {
94 case 'ilpermissiongui':
96 $this->tabs_gui->setTabActive(
'perm_settings');
97 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
99 $ret =&$this->ctrl->forwardCommand($perm_gui);
102 case 'ilbookingobjectgui':
104 $this->ctrl->redirect($this,
"infoScreen");
107 $this->tabs_gui->setTabActive(
'render');
108 include_once(
"Modules/BookingManager/classes/class.ilBookingObjectGUI.php");
110 $ret =&$this->ctrl->forwardCommand($object_gui);
113 case 'ilbookingschedulegui':
115 $this->tabs_gui->setTabActive(
'schedules');
116 include_once(
"Modules/BookingManager/classes/class.ilBookingScheduleGUI.php");
118 $ret =&$this->ctrl->forwardCommand($schedule_gui);
121 case 'ilpublicuserprofilegui':
123 $ilTabs->clearTargets();
124 include_once(
"Services/User/classes/class.ilPublicUserProfileGUI.php");
126 $profile->setBackUrl($this->ctrl->getLinkTarget($this,
'log'));
127 $ret = $this->ctrl->forwardCommand($profile);
131 case 'ilinfoscreengui':
136 case "ilcommonactiondispatchergui":
138 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
140 $this->ctrl->forwardCommand($gui);
143 case "ilobjectcopygui":
145 include_once
"./Services/Object/classes/class.ilObjectCopyGUI.php";
147 $cp->setType(
"book");
148 $this->ctrl->forwardCommand($cp);
151 case 'ilobjectmetadatagui':
153 $this->tabs_gui->setTabActive(
'meta_data');
154 include_once
'Services/Object/classes/class.ilObjectMetaDataGUI.php';
156 $this->ctrl->forwardCommand($md_gui);
160 if (!in_array($cmd, [
"create",
"save",
"infoScreen"])) {
163 $cmd = $this->ctrl->getCmd();
175 $forms = parent::initCreationForms($a_new_type);
176 unset($forms[self::CFORM_IMPORT]);
183 $a_new_object->setOffline(
true);
188 $this->ctrl->setParameter($this,
"ref_id", $a_new_object->
getRefId());
189 $this->ctrl->redirect($this,
"edit");
195 return parent::editObject();
207 include_once
"Modules/BookingManager/classes/class.ilBookingSchedule.php";
221 $type->setRequired(
true);
225 include_once
"Modules/BookingManager/classes/class.ilBookingObject.php";
227 $type->setDisabled(
true);
231 $fixed->setInfo($this->lng->txt(
"book_schedule_type_fixed_info"));
232 $type->addOption($fixed);
235 $none->setInfo($this->lng->txt(
"book_schedule_type_none_info"));
236 $type->addOption($none);
238 $limit =
new ilNumberInputGUI($this->lng->txt(
"book_overall_limit"),
"limit");
240 $limit->setMinValue(1);
241 $limit->setInfo($this->lng->txt(
"book_overall_limit_info"));
242 $none->addSubItem($limit);
245 $public->setInfo($this->lng->txt(
"book_public_log_info"));
248 $period =
new ilNumberInputGUI($this->lng->txt(
"book_reservation_filter_period"),
"period");
249 $period->setInfo($this->lng->txt(
"book_reservation_filter_period_info"));
250 $period->setSuffix($this->lng->txt(
"days"));
252 $period->setMinValue(0);
257 $feat->setTitle($this->lng->txt(
'obj_features'));
263 $a_values[
"online"] = !$this->
object->isOffline();
264 $a_values[
"public"] = $this->
object->hasPublicLog();
265 $a_values[
"stype"] = $this->
object->getScheduleType();
266 $a_values[
"limit"] = $this->
object->getOverallLimit();
267 $a_values[
"period"] = $this->
object->getReservationFilterPeriod();
272 $this->
object->setOffline(!$a_form->
getInput(
'online'));
273 $this->
object->setPublicLog($a_form->
getInput(
'public'));
274 $this->
object->setScheduleType($a_form->
getInput(
'stype'));
275 $this->
object->setOverallLimit($a_form->
getInput(
'limit') ? $a_form->
getInput(
'limit') :
null);
276 $this->
object->setReservationFilterPeriod(strlen($a_form->
getInput(
'period')) ? (
int) $a_form->
getInput(
'period') :
null);
278 include_once
'./Services/Container/classes/class.ilContainer.php';
279 include_once
'./Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
281 $this->object->getId(),
289 include_once
'./Services/Container/classes/class.ilContainer.php';
290 include_once
'./Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
292 $this->object->getId(),
306 if (in_array($this->ctrl->getCmd(), array(
"create",
"save")) && !$this->ctrl->getNextClass()) {
310 $ilHelp->setScreenIdComponent(
"book");
313 if (
$ilUser->getId() != ANONYMOUS_USER_ID) {
314 $this->tabs_gui->addTab(
316 $this->lng->txt(
"book_booking_types"),
317 $this->ctrl->getLinkTarget($this,
"render")
321 $this->tabs_gui->addTab(
323 $this->lng->txt(
"info_short"),
324 $this->ctrl->getLinkTarget($this,
"infoscreen")
327 if (
$ilUser->getId() != ANONYMOUS_USER_ID || $this->object->hasPublicLog()) {
328 $this->tabs_gui->addTab(
330 $this->lng->txt(
"book_log"),
331 $this->ctrl->getLinkTarget($this,
"log")
338 $this->tabs_gui->addTab(
340 $this->lng->txt(
"book_schedules"),
341 $this->ctrl->getLinkTargetByClass(
"ilbookingschedulegui",
"render")
345 $this->tabs_gui->addTab(
347 $this->lng->txt(
"settings"),
348 $this->ctrl->getLinkTarget($this,
"edit")
352 include_once
"Services/Object/classes/class.ilObjectMetaDataGUI.php";
354 $mdtab = $mdgui->getTab();
356 $this->tabs_gui->addTarget(
360 "ilobjectmetadatagui"
366 $this->tabs_gui->addTab(
368 $this->lng->txt(
"perm_settings"),
369 $this->ctrl->getLinkTargetByClass(
"ilpermissiongui",
"perm")
382 $ilHelp->setScreenIdComponent(
'book');
383 $ilHelp->setScreenId(
'object' . $object_subtype);
384 $ilHelp->setSubScreenId($a_id);
394 $this->tabs_gui->clearTargets();
395 $this->tabs_gui->setBackTarget($this->lng->txt(
'book_back_to_list'), $this->ctrl->getLinkTarget($this,
'render'));
399 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
402 $this->lng->loadLanguageModule(
"dateplaner");
403 $this->ctrl->setParameter($this,
'object_id', $obj->getId());
406 include_once
'Modules/BookingManager/classes/class.ilBookingSchedule.php';
409 $tpl->setContent($this->
renderSlots($schedule, array($obj->getId()), $obj->getTitle()));
411 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
413 $cgui->setHeaderText($this->lng->txt(
"book_confirm_booking_no_schedule"));
415 $cgui->setFormAction($this->ctrl->getFormAction($this));
416 $cgui->setCancel($this->lng->txt(
"cancel"),
"render");
417 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmedBooking");
419 $cgui->addItem(
"object_id", $obj->getId(), $obj->getTitle());
421 $tpl->setContent($cgui->getHTML());
431 $mytpl =
new ilTemplate(
'tpl.booking_reservation_fix.html',
true,
true,
'Modules/BookingManager');
433 $mytpl->setVariable(
'FORM_ACTION', $this->ctrl->getFormAction($this));
434 $mytpl->setVariable(
'TXT_TITLE', $this->lng->txt(
'book_reservation_title'));
435 $mytpl->setVariable(
'TXT_INFO', $this->lng->txt(
'book_reservation_fix_info'));
436 $mytpl->setVariable(
'TXT_OBJECT',
$title);
437 $mytpl->setVariable(
'TXT_CMD_BOOK', $this->lng->txt(
'book_confirm_booking'));
438 $mytpl->setVariable(
'TXT_CMD_CANCEL', $this->lng->txt(
'cancel'));
440 include_once
'Services/Calendar/classes/class.ilCalendarUserSettings.php';
444 $morning_aggr = $user_settings->getDayStart();
445 $evening_aggr = $user_settings->getDayEnd();
447 for (
$i = $morning_aggr;
$i <= $evening_aggr;
$i++) {
448 switch ($user_settings->getTimeFormat()) {
450 if ($morning_aggr > 0 &&
$i == $morning_aggr) {
451 $hours[
$i] =
sprintf(
'%02d:00', 0) .
"-";
454 if ($evening_aggr < 23 &&
$i == $evening_aggr) {
455 $hours[
$i].=
"-" .
sprintf(
'%02d:00', 23);
460 if ($morning_aggr > 0 &&
$i == $morning_aggr) {
461 $hours[
$i] =
date(
'h a', mktime(0, 0, 0, 1, 1, 2000)) .
"-";
463 $hours[
$i].=
date(
'h a', mktime(
$i, 0, 0, 1, 1, 2000));
464 if ($evening_aggr < 23 &&
$i == $evening_aggr) {
465 $hours[
$i].=
"-" .
date(
'h a', mktime(23, 0, 0, 1, 1, 2000));
471 if (isset(
$_GET[
'seed'])) {
472 $find_first_open =
false;
475 $find_first_open =
true;
476 $seed = isset(
$_GET[
'sseed'])
481 include_once
'Services/Calendar/classes/class.ilCalendarUtil.php';
482 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
483 $week_start = $user_settings->getWeekStart();
485 if (!$find_first_open) {
492 $has_open_slot = $this->
buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
495 if (!$has_open_slot) {
497 $limit = clone($seed);
501 while (!$has_open_slot && $seed->get(
IL_CAL_UNIX) < $limit) {
505 $has_open_slot = $this->
buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
510 include_once
'Services/Calendar/classes/class.ilCalendarHeaderNavigationGUI.php';
512 $mytpl->setVariable(
'NAVIGATION', $navigation->getHTML());
517 $mytpl->setCurrentBlock(
'weekdays');
520 $mytpl->parseCurrentBlock();
523 include_once
'Services/Calendar/classes/class.ilCalendarAppointmentColors.php';
524 include_once
'Services/Calendar/classes/class.ilCalendarUtil.php';
527 for ($loop = 0; $loop < 7; $loop++) {
530 $color[$loop+1] =
'border-bottom: 1px solid ' . $col .
'; background-color: ' . $col .
'; color: ' . $fnt;
534 foreach ($dates as $hour => $days) {
536 $caption = array_shift($caption);
538 for ($loop = 1; $loop < 8; $loop++) {
539 if (!isset($days[$loop])) {
540 $mytpl->setCurrentBlock(
'dates');
541 $mytpl->setVariable(
'DUMMY',
' ');
542 $mytpl->parseCurrentBlock();
544 if (isset($days[$loop][
'captions'])) {
545 foreach ($days[$loop][
'captions'] as $slot_id => $slot_caption) {
546 $mytpl->setCurrentBlock(
'choice');
547 $mytpl->setVariable(
'TXT_DATE', $slot_caption);
548 $mytpl->setVariable(
'VALUE_DATE', $slot_id);
549 $mytpl->setVariable(
'DATE_COLOR', $color[$loop]);
553 $this->lng->txt(
'book_reservation_available'),
554 $days[$loop][
'available'][$slot_id]
557 $mytpl->parseCurrentBlock();
560 $mytpl->setCurrentBlock(
'dates');
561 $mytpl->setVariable(
'DUMMY',
'');
562 $mytpl->parseCurrentBlock();
563 } elseif (isset($days[$loop][
'in_slot'])) {
564 $mytpl->setCurrentBlock(
'dates');
565 $mytpl->setVariable(
'DATE_COLOR', $color[$loop]);
566 $mytpl->parseCurrentBlock();
568 $mytpl->setCurrentBlock(
'dates');
569 $mytpl->setVariable(
'DUMMY',
' ');
570 $mytpl->parseCurrentBlock();
575 $mytpl->setCurrentBlock(
'slots');
576 $mytpl->setVariable(
'TXT_HOUR', $caption);
578 $mytpl->setVariable(
'CSS_ROW',
'tblrow1');
580 $mytpl->setVariable(
'CSS_ROW',
'tblrow2');
582 $mytpl->parseCurrentBlock();
592 return $mytpl->get();
595 protected function buildDatesBySchedule($week_start, array $hours, $schedule, array $object_ids, $seed, array &$dates)
599 include_once
'Services/Calendar/classes/class.ilCalendarUserSettings.php';
602 $map = array(
'mo',
'tu',
'we',
'th',
'fr',
'sa',
'su');
603 $definition = $schedule->getDefinition();
605 $av_from = ($schedule->getAvailabilityFrom() && !$schedule->getAvailabilityFrom()->isNull())
606 ? $schedule->getAvailabilityFrom()->get(
IL_CAL_DATE)
608 $av_to = ($schedule->getAvailabilityTo() && !$schedule->getAvailabilityTo()->isNull())
612 $has_open_slot =
false;
617 if ($av_from || $av_to) {
620 if ($av_from && $av_from > $today) {
624 if ($av_to && $av_to < $today) {
630 if (isset($definition[$map[$date_info[
'isoday']-1]])) {
632 foreach ($definition[$map[$date_info[
'isoday']-1]] as $slot) {
633 $slot = explode(
'-', $slot);
634 $slots[] = array(
'from'=>str_replace(
':',
'', $slot[0]),
635 'to'=>str_replace(
':',
'', $slot[1]));
639 $last = array_pop(array_keys($hours));
640 $slot_captions = array();
641 foreach ($hours as $hour => $period) {
642 $dates[$hour][0] = $period;
644 $period = explode(
"-", $period);
648 $period[0] =
date(
"H", strtotime($period[0]));
649 if (
sizeof($period) == 2) {
650 $period[1] =
date(
"H", strtotime($period[1]));
654 if (
sizeof($period) == 1) {
655 $period_from = (int) substr($period[0], 0, 2) .
"00";
656 $period_to = (int) substr($period[0], 0, 2) .
"59";
658 $period_from = (int) substr($period[0], 0, 2) .
"00";
659 $period_to = (int) substr($period[1], 0, 2) .
"59";
662 $column = $date_info[
'isoday'];
671 if (
sizeof($slots)) {
673 foreach ($slots as $slot) {
674 $slot_from = mktime(substr($slot[
'from'], 0, 2), substr($slot[
'from'], 2, 2), 0, $date_info[
"mon"], $date_info[
"mday"], $date_info[
"year"]);
675 $slot_to = mktime(substr($slot[
'to'], 0, 2), substr($slot[
'to'], 2, 2), 0, $date_info[
"mon"], $date_info[
"mday"], $date_info[
"year"]);
681 if (!array_sum($nr_available)) {
686 if ($schedule->getDeadline() >= 0) {
688 if ($slot_from < (time()+$schedule->getDeadline()*60*60)) {
693 if ($slot_to < time()) {
699 if ((
int) $slot[
'from'] < $period_to && (int) $slot[
'to'] > $period_from) {
703 $to = array_pop(explode(
' ', $to));
706 $id = $slot_from .
'_' . $slot_to;
707 if (!in_array(
$id, $slot_captions)) {
709 $dates[$hour][
$column][
'available'][
$id] = array_sum($nr_available);
710 $slot_captions[] =
$id;
718 $has_open_slot =
true;
725 return $has_open_slot;
735 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
736 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
742 if (
$_POST[
'object_id']) {
743 $object_id =
$_POST[
'object_id'];
752 $this->ctrl->redirect($this,
'render');
757 if (!isset(
$_POST[
'date'])) {
763 if (isset(
$_GET[
'object_id'])) {
766 $object_id = (int)
$_GET[
'object_id'];
774 foreach (
$_POST[
'date'] as $date) {
775 $fromto = explode(
'_', $date);
783 $confirm[$object_id .
"_" . $fromto[0] .
"_" . ($fromto[1]+1)] =
$counter;
785 $rsv_ids[] = $this->
processBooking($object_id, $fromto[0], $fromto[1], $group_id);
792 if (
sizeof($confirm)) {
852 $this->ctrl->redirect($this,
'book');
861 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
863 $pfile = $obj->getPostFile();
864 $ptext = $obj->getPostText();
865 if (trim($ptext) || $pfile) {
866 if (
sizeof($a_rsv_ids)) {
867 $this->ctrl->setParameterByClass(
'ilbookingobjectgui',
'rsv_ids', implode(
";", $a_rsv_ids));
869 $this->ctrl->setParameterByClass(
'ilbookingobjectgui',
'object_id', $obj->getId());
870 $this->ctrl->redirectByClass(
'ilbookingobjectgui',
'displayPostInfo');
872 $this->ctrl->redirect($this,
'render');
878 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
880 $form->setFormAction($this->ctrl->getFormAction($this,
"confirmedBooking"));
881 $form->setTitle($this->lng->txt(
"book_confirm_booking_schedule_number_of_objects"));
882 $form->setDescription($this->lng->txt(
"book_confirm_booking_schedule_number_of_objects_info"));
884 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
895 $section->setTitle($obj->getTitle());
908 $nr_field->setValue(1);
909 $nr_field->setSize(3);
911 $nr_field->setMinValue(
$counter ? 1 : 0);
912 $nr_field->setRequired(
true);
913 $form->addItem($nr_field);
915 if (!$min_date ||
$id[1] < $min_date) {
921 $this->lng->loadLanguageModule(
"dateplaner");
922 $rec_mode =
new ilSelectInputGUI($this->lng->txt(
"cal_recurrences"),
"recm");
923 $rec_mode->setRequired(
true);
924 $rec_mode->setOptions(array(
925 "-1" => $this->lng->txt(
"cal_no_recurrence"),
926 1 => $this->lng->txt(
"cal_weekly"),
927 2 => $this->lng->txt(
"r_14"),
928 4 => $this->lng->txt(
"r_4_weeks")
930 $form->addItem($rec_mode);
933 $rec_end->setRequired(
true);
934 $rec_mode->addSubItem($rec_end);
938 $rec_mode->setHideSubForm(
true,
'>= 1');
945 $rec_mode->setDisabled(
true);
946 $rec_end->setDisabled(
true);
951 $grp->setValue($a_group_id);
952 $form->addItem($grp);
955 $form->addCommandButton(
"confirmedBookingNumbers", $this->lng->txt(
"confirm"));
956 $form->addCommandButton(
"render", $this->lng->txt(
"cancel"));
965 $this->tabs_gui->clearTargets();
966 $this->tabs_gui->setBackTarget($this->lng->txt(
'book_back_to_list'), $this->ctrl->getLinkTarget($this,
'render'));
972 $tpl->setContent($a_form->getHTML());
977 $date = date_parse($a_date);
978 $stamp = mktime(0, 0, 1, $date[
"month"], $date[
"day"]+$a_days, $date[
"year"]);
979 return date(
"Y-m-d", $stamp);
984 $date = getDate($a_stamp);
990 $date[
"mday"]+$a_days,
997 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
998 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
1002 $current_first =
$obj_id =
null;
1004 if (substr(
$id, 0, 9) ==
"conf_nr__") {
1005 $id = explode(
"_", substr(
$id, 9));
1007 if (!$current_first) {
1008 $current_first =
date(
"Y-m-d",
$id[1]);
1016 include_once
'Services/Calendar/classes/class.ilCalendarUtil.php';
1019 if ((
int)
$_POST[
"recm"] > 0 &&
$end && $current_first) {
1022 $cycle = (int)
$_POST[
"recm"]*7;
1025 while ($cut < 1000 && $this->
addDaysDate($current_first, $cycle) <=
$end) {
1027 $current_first =
null;
1028 foreach ($org as $item_id => $max) {
1029 $parts = explode(
"_", $item_id);
1041 $new_max = (int) $new_max[
$obj_id];
1045 if (!$current_first) {
1050 $_POST[
"conf_nr__" . $new_item_id .
"_" . $new_max] =
$_POST[
"conf_nr__" . $item_id .
"_" . $max];
1056 $group_id =
$_POST[
"grp_id"];
1059 if (
$form->checkInput()) {
1063 $book_nr =
$form->getInput(
"conf_nr__" .
$id .
"_" . $all_nr);
1064 $parts = explode(
"_",
$id);
1074 $book_nr = min($book_nr,
$counter);
1075 for ($loop = 0; $loop < $book_nr; $loop++) {
1085 $this->ctrl->redirect($this,
'render');
1090 $rece_array = explode(
".",
$_POST[
'rece']);
1092 $rece_day = str_pad($rece_array[0], 2,
"0", STR_PAD_LEFT);
1093 $rece_month = str_pad($rece_array[1], 2,
"0", STR_PAD_LEFT);
1094 $rece_year = $rece_array[2];
1099 $form->setValuesByPost();
1101 $rece_date =
new ilDate($rece_year .
"-" . $rece_month .
"-" . $rece_day,
IL_CAL_DATE);
1103 $form->getItemByPostVar(
"rece")->setDate($rece_date);
1104 $form->getItemByPostVar(
"recm")->setHideSubForm(
$_POST[
"recm"] < 1);
1107 $hidden_date->setValue($rece_date);
1108 $form->addItem($hidden_date);
1123 public function processBooking($a_object_id, $a_from =
null, $a_to =
null, $a_group_id =
null)
1130 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1132 $reservation->setObjectId($a_object_id);
1133 $reservation->setUserId(
$ilUser->getID());
1134 $reservation->setFrom($a_from);
1135 $reservation->setTo($a_to);
1136 $reservation->setGroupId($a_group_id);
1137 $reservation->save();
1140 $this->lng->loadLanguageModule(
'dateplaner');
1141 include_once
'Services/Calendar/classes/class.ilCalendarUtil.php';
1142 include_once
'Services/Calendar/classes/class.ilCalendarCategory.php';
1145 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
1148 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
1152 $entry->setTitle($this->lng->txt(
'book_cal_entry') .
' ' .
$object->getTitle());
1153 $entry->setContextId($reservation->getId());
1156 include_once
'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1158 $assignment->addAssignment($def_cat->getCategoryId());
1161 return $reservation->getId();
1171 $this->tabs_gui->setTabActive(
'log');
1176 if (
$_GET[
"object_id"]) {
1177 $filter[
"object"] = (int)
$_GET[
"object_id"];
1180 include_once
'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1185 $this->object->getId(),
1197 $this->tabs_gui->clearTargets();
1198 $this->tabs_gui->setBackTarget(
1199 $this->lng->txt(
"back"),
1200 $this->ctrl->getLinkTarget($this,
"log")
1206 if (
$_GET[
"object_id"]) {
1207 $filter[
"object"] = (int)
$_GET[
"object_id"];
1210 include_once
'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1215 $this->object->getId(),
1219 $_GET[
"reservation_id"]
1229 $this->tabs_gui->setTabActive(
'log');
1231 if (!
$_POST[
'reservation_id']) {
1237 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1242 return $this->ctrl->redirect($this,
'log');
1252 include_once
'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1257 $this->object->getId(),
1262 $table->writeFilterToSession();
1273 include_once
'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1278 $this->object->getId(),
1291 $ilAccess =
$DIC->access();
1294 if ($ilAccess->checkAccess(
"read",
"", $a_target)) {
1296 } elseif ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID)) {
1298 $lng->txt(
"msg_no_perm_read_item"),
1312 $this->ctrl->setCmd(
"showSummary");
1313 $this->ctrl->setCmdClass(
"ilinfoscreengui");
1321 $this->tabs_gui->setTabActive(
'info');
1325 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1328 $info->enablePrivateNotes();
1331 $info->enableNews();
1335 $info->enableNewsEditing(
false);
1338 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
1340 if ($enable_internal_rss) {
1341 $info->setBlockProperty(
"news",
"settings",
true);
1342 $info->setBlockProperty(
"news",
"public_notifications_option",
true);
1347 if (
$ilCtrl->getNextClass() ==
"ilinfoscreengui") {
1358 } elseif (
$_GET[
"reservation_id"]) {
1359 return array(
$_GET[
"reservation_id"]);
1371 if (!is_array($ids) || !
sizeof($ids)) {
1372 $this->ctrl->redirect($this,
'log');
1375 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
1376 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1379 foreach ($ids as $idx =>
$id) {
1380 if (!is_numeric(
$id)) {
1383 $valid_ids = array();
1385 $valid_ids[$item[
"booking_object_id"]] = $item[
"title"];
1390 in_array(
$obj_id, array_keys($valid_ids))) {
1392 if (!
sizeof($rsv_ids)) {
1395 if (
sizeof($rsv_ids) > 1) {
1396 $max[
$id] =
sizeof($rsv_ids);
1397 $ids[$idx] = $rsv_ids;
1400 $ids[$idx] = array_shift($rsv_ids);
1408 if (!is_array($ids) || !
sizeof($ids)) {
1409 $this->ctrl->redirect($this,
'log');
1413 if (
sizeof($max) && max($max) > 1) {
1417 $this->tabs_gui->clearTargets();
1418 $this->tabs_gui->setBackTarget(
1420 $ilCtrl->getLinkTarget($this,
"log")
1425 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
1427 $conf->setFormAction(
$ilCtrl->getFormAction($this,
'rsvCancel'));
1428 $conf->setHeaderText(
$lng->txt(
'book_confirm_cancel'));
1429 $conf->setConfirm(
$lng->txt(
'book_set_cancel'),
'rsvCancel');
1430 $conf->setCancel(
$lng->txt(
'cancel'),
'log');
1432 foreach ($ids as
$id) {
1436 $details = $obj->getTitle();
1444 $conf->addItem(
'rsv_id[]',
$id, $details);
1447 $tpl->setContent($conf->getHTML());
1452 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
1454 $form->setFormAction($this->ctrl->getFormAction($this,
"rsvCancel"));
1455 $form->setTitle($this->lng->txt(
"book_confirm_cancel_aggregation"));
1457 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
1458 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1462 foreach ($a_ids as $idx => $ids) {
1463 if (is_array($ids)) {
1465 $first = array_shift($first);
1479 if (is_array($ids)) {
1480 $caption .=
" (" .
sizeof($ids) .
")";
1484 $item->setRequired(
true);
1485 $item->setMinValue(0);
1487 $form->addItem($item);
1489 if (is_array($ids)) {
1490 $item->setMaxValue(
sizeof($ids));
1492 foreach ($ids as
$id) {
1494 $hidden->setValue(
$id);
1495 $form->addItem($hidden);
1498 $item->setMaxValue(1);
1501 $hidden->setValue($ids);
1502 $form->addItem($hidden);
1505 if (
$_POST[
"rsv_id_" . $idx]) {
1506 $item->setValue((
int)
$_POST[
"rsv_id_" . $idx]);
1510 $form->addCommandButton(
"rsvCancel", $this->lng->txt(
"confirm"));
1511 $form->addCommandButton(
"log", $this->lng->txt(
"cancel"));
1522 $this->tabs_gui->clearTargets();
1523 $this->tabs_gui->setBackTarget(
1525 $ilCtrl->getLinkTarget($this,
"log")
1548 if (
$_POST[
"rsv_aggr"]) {
1550 if (!
$form->checkInput()) {
1551 $this->tabs_gui->clearTargets();
1552 $this->tabs_gui->setBackTarget(
1554 $ilCtrl->getLinkTarget($this,
"log")
1557 return $tpl->setContent(
$form->getHTML());
1561 foreach (
$_POST[
"rsv_aggr"] as $idx => $aggr_ids) {
1562 $max = (int)
$_POST[
"rsv_id_" . $idx];
1564 if (!is_array($aggr_ids)) {
1567 $aggr_ids = array_slice($aggr_ids, 0, $max);
1568 $ids = array_merge($ids, $aggr_ids);
1575 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1576 foreach ($ids as
$id) {
1581 $this->ctrl->redirect($this,
'log');
1589 $cal_entry_id = $obj->getCalendarEntry();
1590 if ($cal_entry_id) {
1591 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
1609 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1610 foreach ($ids as
$id) {
1627 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1628 foreach ($ids as
$id) {
1630 $obj->setStatus(
null);
1644 $this->tabs_gui->clearTargets();
1646 $user_id = (int)
$_GET[
'user_id'];
1648 include_once
'Services/User/classes/class.ilPublicUserProfileGUI.php';
1650 $profile->setBackUrl($this->ctrl->getLinkTarget($this,
'log'));
1658 if (is_object($this->
object)) {
1659 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
"render"),
"",
$_GET[
"ref_id"]);
sprintf('%.4f', $callTime)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
if(php_sapi_name() !='cli') $in
An exception for terminatinating execution or to throw for unit testing.
Class ilBookingObjectGUI.
static lookupPoolId($object_id)
Lookup pool id.
static getNrOfItemsForObjects(array $a_obj_ids)
Get nr of available items.
static getList($a_pool_id, $a_title=null)
Get list of booking objects for given type.
static getObjectReservationForUser($a_object_id, $a_user_id, $a_multi=false)
static changeStatus(array $a_ids, $a_status)
List all reservations.
static getAvailableObject(array $a_ids, $a_from, $a_to, $a_return_single=true, $a_return_counter=false)
Check if any of given objects are bookable.
static getCancelDetails($a_obj_id, $a_user_id, $a_from, $a_to)
Get reservation ids from aggregated id for cancellation.
static getNewGroupId()
Get next group id.
static isObjectAvailableNoSchedule($a_obj_id)
Class ilBookingScheduleGUI.
schedule for booking ressource
getRaster()
Get booking raster.
static getList($a_pool_id)
Get list of booking objects for given pool.
static _getColorsByType($a_type)
get selectable colors
Model for a calendar entry.
setStart($a_start)
@access public
static _getInstanceByUserId($a_user_id)
get singleton instance
static parseIncomingDate($a_value, $a_add_time=null)
Try to parse incoming value to date object.
static _numericDayToString($a_day, $a_long=true)
get
static _buildWeekDayList($a_day, $a_weekstart)
build week day list
static calculateFontColor($a_html_color_code)
Calculate best font color from html hex color code.
static _numericMonthToString($a_month, $a_long=true)
numeric month to string
static initDefaultCalendarByType($a_type_id, $a_usr_id, $a_title, $a_create=false)
Init the default calendar for given type and user.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Confirmation screen class.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
static setUseRelativeDates($a_status)
set use relative dates
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
@classDescription Date and time handling
Base class for ILIAS Exception handling.
Class ilObjBookingPoolGUI.
confirmBookingNumbers(array $a_objects_counter, $a_group_id, ilPropertyFormGUI $a_form=null)
buildDatesBySchedule($week_start, array $hours, $schedule, array $object_ids, $seed, array &$dates)
applyLogFilterObject()
Apply filter from reservations table gui.
addExternalEditFormCustom(ilPropertyFormGUI $a_form)
bookObject()
First step in booking process.
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor.
afterSave(ilObject $a_new_object)
Post (successful) object creation hook.
changeStatusObject()
Change status of given reservations.
getEditFormCustomValues(array &$a_values)
Add values to custom edit fields.
rsvConfirmCancelAggregationForm($a_ids)
processBooking($a_object_id, $a_from=null, $a_to=null, $a_group_id=null)
Book object for date.
initCreationForms($a_new_type)
Init creation froms.
initEditCustomForm(ilPropertyFormGUI $a_form)
Add custom fields to update form.
confirmedBookingNumbersObject()
rsvConfirmCancelAggregationObject(array $a_ids=null)
addDaysDate($a_date, $a_days)
renderSlots(ilBookingSchedule $schedule, array $object_ids, $title)
addDaysStamp($a_stamp, $a_days)
handleBookingSuccess($a_obj_id, array $a_rsv_ids=null)
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
confirmedBookingObject()
Book object - either of type or specific - for given dates.
initBookingNumbersForm(array $a_objects_counter, $a_group_id, $a_reload=false)
updateCustom(ilPropertyFormGUI $a_form)
Insert custom update form values into object.
resetLogFilterObject()
Reset filter in reservations table gui.
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
logObject()
List reservations.
showNoScheduleMessage()
Show no schedule message.
GUI class for the workflow of copying objects.
Class ilObjectGUI Basic methods of all Output classes.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
prepareOutput($a_show_subobjects=true)
prepare output
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
addHeaderAction()
Add header action menu.
static initServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Init service settings form.
static updateServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Update service settings.
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
update()
update object in db
static _lookupTitle($a_id)
lookup object title
getRefId()
get reference id @access public
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
GUI class for public user profile presentation.
This class represents an option in a radio group.
special template class to simplify handling of ITX/PEAR
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(!array_key_exists('StateId', $_REQUEST)) $id
if(empty($password)) $table
if(isset($_POST['submit'])) $form