4require_once
"./Services/Object/classes/class.ilObjectGUI.php";
49 public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output =
true)
53 $this->tpl =
$DIC[
"tpl"];
54 $this->tabs =
$DIC->tabs();
55 $this->nav_history =
$DIC[
"ilNavigationHistory"];
56 $this->help =
$DIC[
"ilHelp"];
57 $this->ctrl =
$DIC->ctrl();
58 $this->lng =
$DIC->language();
60 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
61 $this->lng->loadLanguageModule(
"book");
63 $this->user_profile_id = (int)
$_GET[
"user_id"];
64 $this->book_obj_id = (int) $_REQUEST[
'object_id'];
68 $this->profile_user_id = (int)
$_GET[
'user_id'];
70 $this->user_id_assigner = $this->
user->getId();
72 $this->user_id_to_book = (int)
$_GET[
'bkusr'];
78 throw new ilException(
"Booking Object ID does not match Booking Pool.");
94 $next_class = $this->ctrl->getNextClass($this);
95 $cmd = $this->ctrl->getCmd();
97 if (!$next_class && $cmd ==
'render') {
98 if (
$ilUser->getId() != ANONYMOUS_USER_ID) {
99 $this->ctrl->setCmdClass(
'ilBookingObjectGUI');
100 $next_class = $this->ctrl->getNextClass($this);
102 $this->ctrl->redirect($this,
"infoscreen");
106 if (substr($cmd, 0, 4) ==
'book') {
110 $ilNavigationHistory->addItem(
112 "./goto.php?target=book_" . $this->ref_id,
118 switch ($next_class) {
119 case 'ilpermissiongui':
121 $this->tabs_gui->setTabActive(
'perm_settings');
122 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
124 $ret = &$this->ctrl->forwardCommand($perm_gui);
127 case 'ilbookingobjectgui':
129 $this->ctrl->redirect($this,
"infoScreen");
132 $this->tabs_gui->setTabActive(
'render');
133 include_once(
"Modules/BookingManager/classes/class.ilBookingObjectGUI.php");
135 $ret = &$this->ctrl->forwardCommand($object_gui);
138 case 'ilbookingschedulegui':
140 $this->tabs_gui->setTabActive(
'schedules');
141 include_once(
"Modules/BookingManager/classes/class.ilBookingScheduleGUI.php");
143 $ret = &$this->ctrl->forwardCommand($schedule_gui);
146 case 'ilpublicuserprofilegui':
148 $ilTabs->clearTargets();
149 include_once(
"Services/User/classes/class.ilPublicUserProfileGUI.php");
151 $profile->setBackUrl($this->ctrl->getLinkTarget($this,
'log'));
152 $ret = $this->ctrl->forwardCommand($profile);
156 case 'ilinfoscreengui':
161 case "ilcommonactiondispatchergui":
163 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
165 $this->ctrl->forwardCommand($gui);
168 case "ilobjectcopygui":
170 include_once
"./Services/Object/classes/class.ilObjectCopyGUI.php";
172 $cp->setType(
"book");
173 $this->ctrl->forwardCommand($cp);
176 case 'ilobjectmetadatagui':
178 $this->tabs_gui->setTabActive(
'meta_data');
179 include_once
'Services/Object/classes/class.ilObjectMetaDataGUI.php';
181 $this->ctrl->forwardCommand($md_gui);
184 case 'ilbookingparticipantgui':
186 $this->tabs_gui->setTabActive(
'participants');
187 include_once(
"Modules/BookingManager/classes/class.ilBookingParticipantGUI.php");
189 $this->ctrl->forwardCommand($object_gui);
193 if (!in_array($cmd, [
"create",
"save",
"infoScreen"])) {
196 $cmd = $this->ctrl->getCmd();
208 $forms = parent::initCreationForms($a_new_type);
209 unset($forms[self::CFORM_IMPORT]);
216 $a_new_object->setOffline(
true);
220 ilUtil::sendSuccess($this->lng->txt(
"book_pool_added"),
true);
221 $this->ctrl->setParameter($this,
"ref_id", $a_new_object->
getRefId());
222 $this->ctrl->redirect($this,
"edit");
228 return parent::editObject();
240 include_once
"Modules/BookingManager/classes/class.ilBookingSchedule.php";
256 $type->setRequired(
true);
260 include_once
"Modules/BookingManager/classes/class.ilBookingObject.php";
262 $type->setDisabled(
true);
266 $fixed->setInfo($this->lng->txt(
"book_schedule_type_fixed_info"));
267 $type->addOption($fixed);
271 $period =
new ilNumberInputGUI($this->lng->txt(
"book_reservation_filter_period"),
"period");
272 $period->setInfo($this->lng->txt(
"book_reservation_filter_period_info"));
273 $period->setSuffix($this->lng->txt(
"days"));
275 $period->setMinValue(0);
276 $fixed->addSubItem($period);
280 $rmd->setChecked($this->object->getReminderStatus());
281 $fixed->addSubItem($rmd);
283 $rmd_day =
new ilNumberInputGUI($this->lng->txt(
"book_reminder_day"),
"rmd_day");
284 $rmd_day->setRequired(
true);
285 $rmd_day->setInfo($this->lng->txt(
"book_reminder_day_info"));
286 $rmd_day->setSize(3);
287 $rmd_day->setSuffix($this->lng->txt(
"book_reminder_days"));
288 $rmd_day->setValue(max($this->object->getReminderDay(), 1));
289 $rmd_day->setMinValue(1);
290 $rmd->addSubItem($rmd_day);
293 $none->setInfo($this->lng->txt(
"book_schedule_type_none_info"));
294 $type->addOption($none);
296 $limit =
new ilNumberInputGUI($this->lng->txt(
"book_overall_limit"),
"limit");
298 $limit->setMinValue(1);
299 $limit->setInfo($this->lng->txt(
"book_overall_limit_info"));
300 $none->addSubItem($limit);
303 $public->setInfo($this->lng->txt(
"book_public_log_info"));
308 $pres->setTitle($this->lng->txt(
'obj_presentation'));
312 $obj_service->commonSettings()->legacyForm($a_form, $this->
object)->addTileImage();
316 $feat->setTitle($this->lng->txt(
'obj_features'));
322 $a_values[
"online"] = !$this->
object->isOffline();
323 $a_values[
"public"] = $this->
object->hasPublicLog();
324 $a_values[
"stype"] = $this->
object->getScheduleType();
325 $a_values[
"limit"] = $this->
object->getOverallLimit();
326 $a_values[
"period"] = $this->
object->getReservationFilterPeriod();
327 $a_values[
"rmd"] = $this->
object->getReminderStatus();
328 $a_values[
"rmd_day"] = $this->
object->getReminderDay();
335 $this->
object->setOffline(!$a_form->
getInput(
'online'));
336 $this->
object->setReminderStatus($a_form->
getInput(
'rmd'));
337 $this->
object->setReminderDay($a_form->
getInput(
'rmd_day'));
338 $this->
object->setPublicLog($a_form->
getInput(
'public'));
339 $this->
object->setScheduleType($a_form->
getInput(
'stype'));
340 $this->
object->setOverallLimit($a_form->
getInput(
'limit') ? $a_form->
getInput(
'limit') :
null);
341 $this->
object->setReservationFilterPeriod(strlen($a_form->
getInput(
'period')) ? (
int) $a_form->
getInput(
'period') :
null);
344 $obj_service->commonSettings()->legacyForm($a_form, $this->
object)->saveTileImage();
346 include_once
'./Services/Container/classes/class.ilContainer.php';
347 include_once
'./Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
349 $this->object->getId(),
357 include_once
'./Services/Container/classes/class.ilContainer.php';
358 include_once
'./Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
360 $this->object->getId(),
374 if (in_array($this->ctrl->getCmd(), array(
"create",
"save")) && !$this->ctrl->getNextClass()) {
378 $ilHelp->setScreenIdComponent(
"book");
381 if (
$ilUser->getId() != ANONYMOUS_USER_ID) {
382 $this->tabs_gui->addTab(
384 $this->lng->txt(
"book_booking_types"),
385 $this->ctrl->getLinkTarget($this,
"render")
389 $this->tabs_gui->addTab(
391 $this->lng->txt(
"info_short"),
392 $this->ctrl->getLinkTarget($this,
"infoscreen")
395 if (
$ilUser->getId() != ANONYMOUS_USER_ID || $this->object->hasPublicLog()) {
396 $this->tabs_gui->addTab(
398 $this->lng->txt(
"book_log"),
399 $this->ctrl->getLinkTarget($this,
"log")
406 $this->tabs_gui->addTab(
408 $this->lng->txt(
"book_schedules"),
409 $this->ctrl->getLinkTargetByClass(
"ilbookingschedulegui",
"render")
413 $this->tabs_gui->addTab(
415 $this->lng->txt(
"settings"),
416 $this->ctrl->getLinkTarget($this,
"edit")
420 include_once
"Services/Object/classes/class.ilObjectMetaDataGUI.php";
422 $mdtab = $mdgui->getTab();
424 $this->tabs_gui->addTarget(
428 "ilobjectmetadatagui"
434 $this->tabs_gui->addTab(
436 $this->lng->txt(
"participants"),
437 $this->ctrl->getLinkTargetByClass(
"ilbookingparticipantgui",
"render")
442 $this->tabs_gui->addTab(
444 $this->lng->txt(
"perm_settings"),
445 $this->ctrl->getLinkTargetByClass(
"ilpermissiongui",
"perm")
458 $ilHelp->setScreenIdComponent(
'book');
459 $ilHelp->setScreenId(
'object' . $object_subtype);
460 $ilHelp->setSubScreenId($a_id);
470 $this->tabs_gui->clearTargets();
471 $this->tabs_gui->setBackTarget($this->lng->txt(
'book_back_to_list'), $this->ctrl->getLinkTarget($this,
'render'));
475 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
478 $this->lng->loadLanguageModule(
"dateplaner");
479 $this->ctrl->setParameter($this,
'object_id', $obj->getId());
481 if ($this->user_id_to_book != $this->user_id_assigner) {
482 $this->ctrl->setParameter($this,
'bkusr', $this->user_id_to_book);
486 include_once
'Modules/BookingManager/classes/class.ilBookingSchedule.php';
489 $tpl->setContent($this->
renderSlots($schedule, array($obj->getId()), $obj->getTitle()));
491 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
493 $cgui->setHeaderText($this->lng->txt(
"book_confirm_booking_no_schedule"));
495 $cgui->setFormAction($this->ctrl->getFormAction($this));
496 $cgui->setCancel($this->lng->txt(
"cancel"),
"render");
497 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmedBooking");
499 $cgui->addItem(
"object_id", $obj->getId(), $obj->getTitle());
505 $tpl->setContent($cgui->getHTML());
515 $mytpl =
new ilTemplate(
'tpl.booking_reservation_fix.html',
true,
true,
'Modules/BookingManager');
517 $mytpl->setVariable(
'FORM_ACTION', $this->ctrl->getFormAction($this));
518 $mytpl->setVariable(
'TXT_TITLE', $this->lng->txt(
'book_reservation_title'));
519 $mytpl->setVariable(
'TXT_INFO', $this->lng->txt(
'book_reservation_fix_info'));
520 $mytpl->setVariable(
'TXT_OBJECT',
$title);
521 $mytpl->setVariable(
'TXT_CMD_BOOK', $this->lng->txt(
'book_confirm_booking'));
522 $mytpl->setVariable(
'TXT_CMD_CANCEL', $this->lng->txt(
'cancel'));
524 include_once
'Services/Calendar/classes/class.ilCalendarUserSettings.php';
528 $morning_aggr = $user_settings->getDayStart();
529 $evening_aggr = $user_settings->getDayEnd();
531 for (
$i = $morning_aggr;
$i <= $evening_aggr;
$i++) {
532 switch ($user_settings->getTimeFormat()) {
534 if ($morning_aggr > 0 &&
$i == $morning_aggr) {
535 $hours[
$i] = sprintf(
'%02d:00', 0) .
"-";
537 $hours[
$i] .= sprintf(
'%02d:00',
$i);
538 if ($evening_aggr < 23 &&
$i == $evening_aggr) {
539 $hours[
$i] .=
"-" . sprintf(
'%02d:00', 23);
544 if ($morning_aggr > 0 &&
$i == $morning_aggr) {
545 $hours[
$i] = date(
'h a', mktime(0, 0, 0, 1, 1, 2000)) .
"-";
547 $hours[
$i] .= date(
'h a', mktime(
$i, 0, 0, 1, 1, 2000));
548 if ($evening_aggr < 23 &&
$i == $evening_aggr) {
549 $hours[
$i] .=
"-" . date(
'h a', mktime(23, 0, 0, 1, 1, 2000));
555 if ($this->seed !=
"") {
556 $find_first_open =
false;
559 $find_first_open =
true;
560 $seed = ($this->sseed !=
"")
565 include_once
'Services/Calendar/classes/class.ilCalendarUtil.php';
566 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
567 $week_start = $user_settings->getWeekStart();
569 if (!$find_first_open) {
576 $has_open_slot = $this->
buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
579 if (!$has_open_slot) {
581 $limit = clone($seed);
585 while (!$has_open_slot && $seed->get(
IL_CAL_UNIX) < $limit) {
589 $has_open_slot = $this->
buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
594 include_once
'Services/Calendar/classes/class.ilCalendarHeaderNavigationGUI.php';
596 $mytpl->setVariable(
'NAVIGATION', $navigation->getHTML());
601 $mytpl->setCurrentBlock(
'weekdays');
604 $mytpl->parseCurrentBlock();
607 include_once
'Services/Calendar/classes/class.ilCalendarAppointmentColors.php';
608 include_once
'Services/Calendar/classes/class.ilCalendarUtil.php';
611 for ($loop = 0; $loop < 7; $loop++) {
614 $color[$loop + 1] =
'border-bottom: 1px solid ' . $col .
'; background-color: ' . $col .
'; color: ' . $fnt;
618 foreach ($dates as $hour => $days) {
620 $caption = array_shift($caption);
622 for ($loop = 1; $loop < 8; $loop++) {
623 if (!isset($days[$loop])) {
624 $mytpl->setCurrentBlock(
'dates');
625 $mytpl->setVariable(
'DUMMY',
' ');
626 $mytpl->parseCurrentBlock();
628 if (isset($days[$loop][
'captions'])) {
629 foreach ($days[$loop][
'captions'] as $slot_id => $slot_caption) {
630 $mytpl->setCurrentBlock(
'choice');
631 $mytpl->setVariable(
'TXT_DATE', $slot_caption);
632 $mytpl->setVariable(
'VALUE_DATE', $slot_id);
633 $mytpl->setVariable(
'DATE_COLOR', $color[$loop]);
637 $this->lng->txt(
'book_reservation_available'),
638 $days[$loop][
'available'][$slot_id]
641 $mytpl->parseCurrentBlock();
644 $mytpl->setCurrentBlock(
'dates');
645 $mytpl->setVariable(
'DUMMY',
'');
646 $mytpl->parseCurrentBlock();
647 } elseif (isset($days[$loop][
'in_slot'])) {
648 $mytpl->setCurrentBlock(
'dates');
649 $mytpl->setVariable(
'DATE_COLOR', $color[$loop]);
650 $mytpl->parseCurrentBlock();
652 $mytpl->setCurrentBlock(
'dates');
653 $mytpl->setVariable(
'DUMMY',
' ');
654 $mytpl->parseCurrentBlock();
659 $mytpl->setCurrentBlock(
'slots');
660 $mytpl->setVariable(
'TXT_HOUR', $caption);
662 $mytpl->setVariable(
'CSS_ROW',
'tblrow1');
664 $mytpl->setVariable(
'CSS_ROW',
'tblrow2');
666 $mytpl->parseCurrentBlock();
676 return $mytpl->get();
679 protected function buildDatesBySchedule($week_start, array $hours, $schedule, array $object_ids, $seed, array &$dates)
683 include_once
'Services/Calendar/classes/class.ilCalendarUserSettings.php';
686 $map = array(
'mo',
'tu',
'we',
'th',
'fr',
'sa',
'su');
687 $definition = $schedule->getDefinition();
689 $av_from = ($schedule->getAvailabilityFrom() && !$schedule->getAvailabilityFrom()->isNull())
690 ? $schedule->getAvailabilityFrom()->get(
IL_CAL_DATE)
692 $av_to = ($schedule->getAvailabilityTo() && !$schedule->getAvailabilityTo()->isNull())
696 $has_open_slot =
false;
701 if ($av_from || $av_to) {
704 if ($av_from && $av_from > $today) {
708 if ($av_to && $av_to < $today) {
714 if (isset($definition[
$map[$date_info[
'isoday'] - 1]])) {
716 foreach ($definition[
$map[$date_info[
'isoday'] - 1]] as $slot) {
717 $slot = explode(
'-', $slot);
718 $slots[] = array(
'from' => str_replace(
':',
'', $slot[0]),
719 'to' => str_replace(
':',
'', $slot[1]));
723 $last = array_pop(array_keys($hours));
724 $slot_captions = array();
725 foreach ($hours as $hour => $period) {
726 $dates[$hour][0] = $period;
728 $period = explode(
"-", $period);
732 $period[0] = date(
"H", strtotime($period[0]));
733 if (
sizeof($period) == 2) {
734 $period[1] = date(
"H", strtotime($period[1]));
738 if (
sizeof($period) == 1) {
739 $period_from = (int) substr($period[0], 0, 2) .
"00";
740 $period_to = (int) substr($period[0], 0, 2) .
"59";
742 $period_from = (int) substr($period[0], 0, 2) .
"00";
743 $period_to = (int) substr($period[1], 0, 2) .
"59";
746 $column = $date_info[
'isoday'];
755 if (
sizeof($slots)) {
757 foreach ($slots as $slot) {
758 $slot_from = mktime(substr($slot[
'from'], 0, 2), substr($slot[
'from'], 2, 2), 0, $date_info[
"mon"], $date_info[
"mday"], $date_info[
"year"]);
759 $slot_to = mktime(substr($slot[
'to'], 0, 2), substr($slot[
'to'], 2, 2), 0, $date_info[
"mon"], $date_info[
"mday"], $date_info[
"year"]);
765 if (!array_sum($nr_available)) {
770 if ($schedule->getDeadline() >= 0) {
772 if ($slot_from < (time() + $schedule->getDeadline() * 60 * 60)) {
777 if ($slot_to < time()) {
783 if ((
int) $slot[
'from'] < $period_to && (int) $slot[
'to'] > $period_from) {
787 $to = array_pop(explode(
' ', $to));
790 $id = $slot_from .
'_' . $slot_to;
791 if (!in_array(
$id, $slot_captions)) {
792 $dates[$hour][$column][
'captions'][
$id] =
$from .
'-' . $to;
793 $dates[$hour][$column][
'available'][
$id] = array_sum($nr_available);
794 $slot_captions[] =
$id;
802 $has_open_slot =
true;
803 $dates[$hour][$column][
'in_slot'] =
$in;
809 return $has_open_slot;
819 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
820 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
826 if ($this->book_obj_id > 0) {
827 $object_id = $this->book_obj_id;
836 $this->ctrl->redirect($this,
'render');
841 if (!isset(
$_POST[
'date'])) {
847 if ($this->book_obj_id > 0) {
850 $object_id = $this->book_obj_id;
856 foreach (
$_POST[
'date'] as $date) {
857 $fromto = explode(
'_', $date);
861 $counter = $counter[$object_id];
864 $confirm[$object_id .
"_" . $fromto[0] .
"_" . ($fromto[1] + 1)] = $counter;
869 if (
sizeof($confirm)) {
880 $this->ctrl->redirect($this,
'book');
886 ilUtil::sendSuccess($this->lng->txt(
'book_reservation_confirmed'),
true);
889 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
891 $pfile = $obj->getPostFile();
892 $ptext = $obj->getPostText();
893 if (trim($ptext) || $pfile) {
894 if (
sizeof($a_rsv_ids)) {
895 $this->ctrl->setParameterByClass(
'ilbookingobjectgui',
'rsv_ids', implode(
";", $a_rsv_ids));
897 $this->ctrl->setParameterByClass(
'ilbookingobjectgui',
'object_id', $obj->getId());
898 $this->ctrl->redirectByClass(
'ilbookingobjectgui',
'displayPostInfo');
901 $this->ctrl->redirectByClass(
'ilbookingparticipantgui',
'render');
903 $this->ctrl->redirect($this,
'render');
910 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
912 $form->setFormAction($this->ctrl->getFormAction($this,
"confirmedBooking"));
913 $form->setTitle($this->lng->txt(
"book_confirm_booking_schedule_number_of_objects"));
914 $form->setDescription($this->lng->txt(
"book_confirm_booking_schedule_number_of_objects_info"));
916 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
919 foreach ($a_objects_counter as
$id => $counter) {
921 $book_id =
$id[0] .
"_" .
$id[1] .
"_" .
$id[2] .
"_" . $counter;
927 $section->setTitle($obj->getTitle());
940 $nr_field->setValue(1);
941 $nr_field->setSize(3);
942 $nr_field->setMaxValue($counter);
943 $nr_field->setMinValue($counter ? 1 : 0);
944 $nr_field->setRequired(
true);
945 $form->addItem($nr_field);
947 if (!$min_date ||
$id[1] < $min_date) {
953 $this->lng->loadLanguageModule(
"dateplaner");
954 $rec_mode =
new ilSelectInputGUI($this->lng->txt(
"cal_recurrences"),
"recm");
955 $rec_mode->setRequired(
true);
956 $rec_mode->setOptions(array(
957 "-1" => $this->lng->txt(
"cal_no_recurrence"),
958 1 => $this->lng->txt(
"cal_weekly"),
959 2 => $this->lng->txt(
"r_14"),
960 4 => $this->lng->txt(
"r_4_weeks")
962 $form->addItem($rec_mode);
965 $rec_end->setRequired(
true);
966 $rec_mode->addSubItem($rec_end);
970 $rec_mode->setHideSubForm(
true,
'>= 1');
977 $rec_mode->setDisabled(
true);
978 $rec_end->setDisabled(
true);
983 $grp->setValue($a_group_id);
984 $form->addItem($grp);
987 if ($this->user_id_assigner != $this->user_id_to_book) {
989 $usr->setValue($this->user_id_to_book);
990 $form->addItem($usr);
993 $form->addCommandButton(
"confirmedBookingNumbers", $this->lng->txt(
"confirm"));
994 $form->addCommandButton(
"render", $this->lng->txt(
"cancel"));
1003 $this->tabs_gui->clearTargets();
1004 $this->tabs_gui->setBackTarget($this->lng->txt(
'book_back_to_list'), $this->ctrl->getLinkTarget($this,
'render'));
1010 $tpl->setContent($a_form->getHTML());
1015 $date = date_parse($a_date);
1016 $stamp = mktime(0, 0, 1, $date[
"month"], $date[
"day"] + $a_days, $date[
"year"]);
1017 return date(
"Y-m-d", $stamp);
1022 $date = getDate($a_stamp);
1028 $date[
"mday"] + $a_days,
1035 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1036 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
1040 $this->user_id_to_book = (int)
$_POST[
'bkusr'];
1045 $current_first =
$obj_id =
null;
1047 if (substr(
$id, 0, 9) ==
"conf_nr__") {
1048 $id = explode(
"_", substr(
$id, 9));
1049 $counter[
$id[0] .
"_" .
$id[1] .
"_" .
$id[2]] = (int)
$id[3];
1050 if (!$current_first) {
1051 $current_first = date(
"Y-m-d",
$id[1]);
1059 include_once
'Services/Calendar/classes/class.ilCalendarUtil.php';
1062 if ((
int)
$_POST[
"recm"] > 0 &&
$end && $current_first) {
1065 $cycle = (int)
$_POST[
"recm"] * 7;
1068 while ($cut < 1000 && $this->
addDaysDate($current_first, $cycle) <=
$end) {
1070 $current_first =
null;
1071 foreach ($org as $item_id => $max) {
1072 $parts = explode(
"_", $item_id);
1081 if (!isset($counter[$new_item_id]) && date(
"Y-m-d", $to) <=
$end) {
1084 $new_max = (int) $new_max[
$obj_id];
1086 $counter[$new_item_id] = $new_max;
1088 if (!$current_first) {
1089 $current_first = date(
"Y-m-d",
$from);
1093 $_POST[
"conf_nr__" . $new_item_id .
"_" . $new_max] =
$_POST[
"conf_nr__" . $item_id .
"_" . $max];
1099 $group_id =
$_POST[
"grp_id"];
1102 if (
$form->checkInput()) {
1105 foreach ($counter as
$id => $all_nr) {
1106 $book_nr =
$form->getInput(
"conf_nr__" .
$id .
"_" . $all_nr);
1107 $parts = explode(
"_",
$id);
1110 $to = $parts[2] - 1;
1117 $book_nr = min($book_nr, $counter);
1118 for ($loop = 0; $loop < $book_nr; $loop++) {
1129 $this->ctrl->redirect($this,
'render');
1134 $rece_array = explode(
".",
$_POST[
'rece']);
1136 $rece_day = str_pad($rece_array[0], 2,
"0", STR_PAD_LEFT);
1137 $rece_month = str_pad($rece_array[1], 2,
"0", STR_PAD_LEFT);
1138 $rece_year = $rece_array[2];
1143 $form->setValuesByPost();
1145 $rece_date =
new ilDate($rece_year .
"-" . $rece_month .
"-" . $rece_day,
IL_CAL_DATE);
1147 $form->getItemByPostVar(
"rece")->setDate($rece_date);
1148 $form->getItemByPostVar(
"recm")->setHideSubForm(
$_POST[
"recm"] < 1);
1151 $hidden_date->setValue($rece_date);
1152 $form->addItem($hidden_date);
1167 public function processBooking($a_object_id, $a_from =
null, $a_to =
null, $a_group_id =
null)
1172 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1174 $reservation->setObjectId($a_object_id);
1175 $reservation->setUserId($this->user_id_to_book);
1176 $reservation->setAssignerId($this->user_id_assigner);
1177 $reservation->setFrom($a_from);
1178 $reservation->setTo($a_to);
1179 $reservation->setGroupId($a_group_id);
1180 $reservation->save();
1183 $this->lng->loadLanguageModule(
'dateplaner');
1184 include_once
'Services/Calendar/classes/class.ilCalendarUtil.php';
1185 include_once
'Services/Calendar/classes/class.ilCalendarCategory.php';
1188 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
1191 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
1195 $entry->setTitle($this->lng->txt(
'book_cal_entry') .
' ' .
$object->getTitle());
1196 $entry->setContextId($reservation->getId());
1199 include_once
'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1201 $assignment->addAssignment($def_cat->getCategoryId());
1204 return $reservation->getId();
1214 $this->tabs_gui->setTabActive(
'log');
1219 if ($this->book_obj_id > 0) {
1220 $filter[
"object"] = $this->book_obj_id;
1224 if (
$_GET[
'user_id']) {
1225 $filter[
"user_id"] = (int)
$_GET[
'user_id'];
1228 include_once
'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1233 $this->object->getId(),
1245 $this->tabs_gui->clearTargets();
1246 $this->tabs_gui->setBackTarget(
1247 $this->lng->txt(
"back"),
1248 $this->ctrl->getLinkTarget($this,
"log")
1254 if ($this->book_obj_id > 0) {
1255 $filter[
"object"] = $this->book_obj_id;
1258 include_once
'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1263 $this->object->getId(),
1267 $this->reservation_id
1277 $this->tabs_gui->setTabActive(
'log');
1279 if (!
$_POST[
'reservation_id']) {
1285 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1289 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
1290 return $this->ctrl->redirect($this,
'log');
1300 include_once
'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1305 $this->object->getId(),
1310 $table->writeFilterToSession();
1321 include_once
'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1326 $this->object->getId(),
1339 $ilAccess =
$DIC->access();
1342 if ($ilAccess->checkAccess(
"read",
"", $a_target)) {
1344 } elseif ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID)) {
1346 $lng->txt(
"msg_no_perm_read_item"),
1360 $this->ctrl->setCmd(
"showSummary");
1361 $this->ctrl->setCmdClass(
"ilinfoscreengui");
1369 $this->tabs_gui->setTabActive(
'info');
1373 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1376 $info->enablePrivateNotes();
1379 $info->enableNews();
1383 $info->enableNewsEditing(
false);
1386 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
1388 if ($enable_internal_rss) {
1389 $info->setBlockProperty(
"news",
"settings",
true);
1390 $info->setBlockProperty(
"news",
"public_notifications_option",
true);
1395 if (
$ilCtrl->getNextClass() ==
"ilinfoscreengui") {
1406 } elseif ($this->reservation_id > 0) {
1407 return array($this->reservation_id);
1419 if (!is_array($ids) || !
sizeof($ids)) {
1420 $this->ctrl->redirect($this,
'log');
1423 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
1424 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1427 foreach ($ids as $idx =>
$id) {
1428 if (!is_numeric(
$id)) {
1431 $valid_ids = array();
1433 $valid_ids[$item[
"booking_object_id"]] = $item[
"title"];
1438 in_array(
$obj_id, array_keys($valid_ids))) {
1440 if (!
sizeof($rsv_ids)) {
1443 if (
sizeof($rsv_ids) > 1) {
1444 $max[
$id] =
sizeof($rsv_ids);
1445 $ids[$idx] = $rsv_ids;
1448 $ids[$idx] = array_shift($rsv_ids);
1456 if (!is_array($ids) || !
sizeof($ids)) {
1457 $this->ctrl->redirect($this,
'log');
1461 if (
sizeof($max) && max($max) > 1) {
1465 $this->tabs_gui->clearTargets();
1466 $this->tabs_gui->setBackTarget(
1468 $ilCtrl->getLinkTarget($this,
"log")
1473 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
1475 $conf->setFormAction(
$ilCtrl->getFormAction($this,
'rsvCancel'));
1476 $conf->setHeaderText(
$lng->txt(
'book_confirm_cancel'));
1477 $conf->setConfirm(
$lng->txt(
'book_set_cancel'),
'rsvCancel');
1478 $conf->setCancel(
$lng->txt(
'cancel'),
'log');
1480 foreach ($ids as
$id) {
1484 $details = $obj->getTitle();
1492 $conf->addItem(
'rsv_id[]',
$id, $details);
1495 $tpl->setContent($conf->getHTML());
1500 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
1502 $form->setFormAction($this->ctrl->getFormAction($this,
"rsvCancel"));
1503 $form->setTitle($this->lng->txt(
"book_confirm_cancel_aggregation"));
1505 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
1506 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1510 foreach ($a_ids as $idx => $ids) {
1511 if (is_array($ids)) {
1513 $first = array_shift($first);
1527 if (is_array($ids)) {
1528 $caption .=
" (" .
sizeof($ids) .
")";
1532 $item->setRequired(
true);
1533 $item->setMinValue(0);
1535 $form->addItem($item);
1537 if (is_array($ids)) {
1538 $item->setMaxValue(
sizeof($ids));
1540 foreach ($ids as
$id) {
1542 $hidden->setValue(
$id);
1543 $form->addItem($hidden);
1546 $item->setMaxValue(1);
1549 $hidden->setValue($ids);
1550 $form->addItem($hidden);
1553 if (
$_POST[
"rsv_id_" . $idx]) {
1554 $item->setValue((
int)
$_POST[
"rsv_id_" . $idx]);
1558 $form->addCommandButton(
"rsvCancel", $this->lng->txt(
"confirm"));
1559 $form->addCommandButton(
"log", $this->lng->txt(
"cancel"));
1570 $this->tabs_gui->clearTargets();
1571 $this->tabs_gui->setBackTarget(
1573 $ilCtrl->getLinkTarget($this,
"log")
1596 if (
$_POST[
"rsv_aggr"]) {
1598 if (!
$form->checkInput()) {
1599 $this->tabs_gui->clearTargets();
1600 $this->tabs_gui->setBackTarget(
1602 $ilCtrl->getLinkTarget($this,
"log")
1605 return $tpl->setContent(
$form->getHTML());
1609 foreach (
$_POST[
"rsv_aggr"] as $idx => $aggr_ids) {
1610 $max = (int)
$_POST[
"rsv_id_" . $idx];
1612 if (!is_array($aggr_ids)) {
1615 $aggr_ids = array_slice($aggr_ids, 0, $max);
1616 $ids = array_merge($ids, $aggr_ids);
1623 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1624 foreach ($ids as
$id) {
1629 $this->ctrl->redirect($this,
'log');
1637 $cal_entry_id = $obj->getCalendarEntry();
1638 if ($cal_entry_id) {
1639 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
1647 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'));
1656 $this->ctrl->redirect($this,
'log');
1659 $this->tabs_gui->clearTargets();
1660 $this->tabs_gui->setBackTarget(
1661 $this->lng->txt(
"back"),
1662 $this->ctrl->getLinkTarget($this,
"log")
1665 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
1667 $conf->setFormAction($this->ctrl->getFormAction($this,
'rsvDelete'));
1668 $conf->setHeaderText($this->lng->txt(
'book_confirm_delete'));
1669 $conf->setConfirm($this->lng->txt(
'book_set_delete'),
'rsvDelete');
1670 $conf->setCancel($this->lng->txt(
'cancel'),
'log');
1672 list(
$obj_id, $user_id,
$from, $to) = explode(
"_",
$DIC->http()->request()->getQueryParams()[
'reservation_id']);
1677 $details = sprintf($this->lng->txt(
'X_reservations_of'), count($ids)) .
' ' . $obj->getTitle();
1685 $conf->addItem(
'rsv_ids', implode(
',', $ids), $details);
1686 $this->tpl->setContent($conf->getHTML());
1692 $get =
$DIC->http()->request()->getParsedBody()[
'rsv_ids'];
1694 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1695 foreach (explode(
',', $get) as
$id) {
1698 if ($obj->getPoolId() != $this->object->getId() || !$this->checkPermissionBool(
"write")) {
1700 $this->ctrl->redirect($this,
'log');
1703 $cal_entry_id =
$res->getCalendarEntry();
1704 if ($cal_entry_id) {
1705 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
1714 ilUtil::sendSuccess($this->lng->txt(
'reservation_deleted'));
1724 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1725 foreach ($ids as
$id) {
1732 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'));
1742 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1743 foreach ($ids as
$id) {
1745 $obj->setStatus(
null);
1750 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'));
1759 $this->tabs_gui->clearTargets();
1761 $user_id = $this->profile_user_id;
1763 include_once
'Services/User/classes/class.ilPublicUserProfileGUI.php';
1765 $profile->setBackUrl($this->ctrl->getLinkTarget($this,
'log'));
1773 if (is_object($this->
object)) {
1774 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
"render"),
"", $this->object->getRefId());
1788 $lng->loadLanguageModule(
"noti");
1790 $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
1792 if (
$lg &&
$access->checkAccess(
"read",
"", $this->ref_id)) {
1799 $lng->txt(
"noti_notification_deactivated")
1802 $ctrl->setParameter($this,
"ntf", 1);
1803 $caption =
"noti_activate_notification";
1808 $lng->txt(
"noti_notification_activated")
1811 $ctrl->setParameter($this,
"ntf", 0);
1812 $caption =
"noti_deactivate_notification";
1815 $lg->addCustomCommand(
1816 $ctrl->getLinkTarget($this,
"saveNotification"),
1820 $ctrl->setParameter($this,
"ntf",
"");
1836 switch (
$_GET[
"ntf"]) {
1845 $ctrl->redirect($this,
"render");
1852 include_once(
"./Modules/BookingManager/classes/class.ilBookingParticipant.php");
1862 $participants =
$_POST[
"mass"];
1864 $this->ctrl->redirectByClass(
'ilbookingobjectgui',
'render');
1867 $this->tabs->clearTargets();
1868 $this->ctrl->setParameterByClass(
'ilbookingobjectgui',
'object_id', $this->book_obj_id);
1869 $this->tabs->setBackTarget($this->lng->txt(
"back"), $this->ctrl->getLinkTargetByClass(
'ilbookingobjectgui',
'assignparticipants'));
1870 $this->ctrl->setParameterByClass(
'ilbookingobjectgui',
'object_id',
'');
1873 $conf->setFormAction($this->ctrl->getFormAction($this));
1876 foreach ($participants as
$id) {
1878 $conf->addItem(
"participants[]",
$id,
$name);
1882 if (
sizeof($participants) > $available) {
1884 $conf->setHeaderText(
1886 $this->lng->txt(
'book_limit_objects_available'),
1887 sizeof($participants),
1893 $conf->setHeaderText($this->lng->txt(
'book_confirm_booking_no_schedule'));
1894 $conf->addHiddenItem(
"object_id", $this->book_obj_id);
1895 $conf->setConfirm($this->lng->txt(
"assign"),
"saveMultipleBookings");
1898 $conf->setCancel($this->lng->txt(
"cancel"),
'redirectToList');
1899 $this->tpl->setContent($conf->getHTML());
1904 $this->ctrl->setParameterByClass(
'ilbookingobjectgui',
'object_id', $this->book_obj_id);
1905 $this->ctrl->redirectByClass(
'ilbookingobjectgui',
'assignParticipants');
1915 $participants =
$_POST[
"participants"];
1916 $this->book_obj_id =
$_POST[
'object_id'];
1918 $this->ctrl->redirectByClass(
'ilbookingobjectgui',
'render');
1921 foreach ($participants as
$id) {
1922 $this->user_id_to_book =
$id;
1926 if (
sizeof($rsv_ids)) {
1927 ilUtil::sendSuccess(
"booking_multiple_succesfully");
1928 $this->ctrl->redirectByClass(
'ilbookingobjectgui',
'render');
1931 $this->ctrl->redirect($this,
'render');
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.
Class ilBookingParticipantGUI.
Class ilBookingParticipant.
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 numAvailableFromObjectNoSchedule($a_obj_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, $include_seconds=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.
static setNotification($type, $user_id, $id, $status=true)
Set notification status for object and user.
static hasNotification($type, $user_id, $id)
Check notification status for object and user.
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.
saveNotificationObject()
Save notification.
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.
saveMultipleBookingsObject()
Save multiple users reservations for one booking pool object.
initHeaderAction($a_sub_type=null, $a_sub_id=null)
Add header action menu.ilObjectListGUI
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.
bookMultipleParticipantsObject()
Create reservations for a bunch of booking pool participants.
showNoScheduleMessage()
Show no schedule message.
static _lookupFullname($a_user_id)
Lookup Full Name.
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.
getObjectService()
Get object service.
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 sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
if(!array_key_exists('StateId', $_REQUEST)) $id
if(empty($password)) $table
if(isset($_POST['submit'])) $form
foreach($_POST as $key=> $value) $res