4require_once
"./Services/Object/classes/class.ilObjectGUI.php";
23 function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output =
true)
26 parent::__construct($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
27 $this->lng->loadLanguageModule(
"book");
29 include_once(
"./Modules/BookingManager/classes/class.ilBookingObject.php");
32 throw new ilException(
"Booking Object ID does not match Booking Pool.");
43 global
$tpl, $ilTabs, $ilNavigationHistory,
$ilUser;
45 $next_class = $this->ctrl->getNextClass($this);
46 $cmd = $this->ctrl->getCmd();
48 if(!$next_class &&
$cmd ==
'render')
50 if(
$ilUser->getId() != ANONYMOUS_USER_ID)
52 $this->ctrl->setCmdClass(
'ilBookingObjectGUI');
53 $next_class = $this->ctrl->getNextClass($this);
57 $this->ctrl->redirect($this,
"infoscreen");
61 if(substr(
$cmd, 0, 4) ==
'book')
66 $ilNavigationHistory->addItem($this->ref_id,
67 "./goto.php?target=book_".$this->ref_id,
"book");
73 case 'ilpermissiongui':
75 $this->tabs_gui->setTabActive(
'perm_settings');
76 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
78 $ret =& $this->ctrl->forwardCommand($perm_gui);
81 case 'ilbookingobjectgui':
83 $this->ctrl->redirect($this,
"infoScreen");
86 $this->tabs_gui->setTabActive(
'render');
87 include_once(
"Modules/BookingManager/classes/class.ilBookingObjectGUI.php");
89 $ret =& $this->ctrl->forwardCommand($object_gui);
92 case 'ilbookingschedulegui':
94 $this->tabs_gui->setTabActive(
'schedules');
95 include_once(
"Modules/BookingManager/classes/class.ilBookingScheduleGUI.php");
97 $ret =& $this->ctrl->forwardCommand($schedule_gui);
100 case 'ilpublicuserprofilegui':
102 $ilTabs->clearTargets();
103 include_once(
"Services/User/classes/class.ilPublicUserProfileGUI.php");
105 $profile->setBackUrl($this->ctrl->getLinkTarget($this,
'log'));
106 $ret = $this->ctrl->forwardCommand($profile);
110 case 'ilinfoscreengui':
115 case "ilcommonactiondispatchergui":
117 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
119 $this->ctrl->forwardCommand($gui);
122 case "ilobjectcopygui":
124 include_once
"./Services/Object/classes/class.ilObjectCopyGUI.php";
126 $cp->setType(
"book");
127 $this->ctrl->forwardCommand($cp);
130 case 'ilobjectmetadatagui';
132 $this->tabs_gui->setTabActive(
'meta_data');
133 include_once
'Services/Object/classes/class.ilObjectMetaDataGUI.php';
135 $this->ctrl->forwardCommand($md_gui);
139 if (!in_array(
$cmd, [
"create",
"save",
"infoScreen"])) {
142 $cmd = $this->ctrl->getCmd();
154 $forms = parent::initCreationForms($a_new_type);
155 unset($forms[self::CFORM_IMPORT]);
162 $a_new_object->setOffline(
true);
167 $this->ctrl->setParameter($this,
"ref_id", $a_new_object->
getRefId());
168 $this->ctrl->redirect($this,
"edit");
174 include_once
"Modules/BookingManager/classes/class.ilBookingSchedule.php";
181 return parent::editObject();
190 $type->setRequired(
true);
194 include_once
"Modules/BookingManager/classes/class.ilBookingObject.php";
197 $type->setDisabled(
true);
201 $fixed->setInfo($this->lng->txt(
"book_schedule_type_fixed_info"));
202 $type->addOption($fixed);
205 $none->setInfo($this->lng->txt(
"book_schedule_type_none_info"));
206 $type->addOption($none);
208 $limit =
new ilNumberInputGUI($this->lng->txt(
"book_overall_limit"),
"limit");
210 $limit->setMinValue(1);
211 $limit->setInfo($this->lng->txt(
"book_overall_limit_info"));
212 $none->addSubItem($limit);
215 $public->setInfo($this->lng->txt(
"book_public_log_info"));
218 $period =
new ilNumberInputGUI($this->lng->txt(
"book_reservation_filter_period"),
"period");
219 $period->setInfo($this->lng->txt(
"book_reservation_filter_period_info"));
220 $period->setSuffix($this->lng->txt(
"days"));
222 $period->setMinValue(0);
227 $feat->setTitle($this->lng->txt(
'obj_features'));
234 $a_values[
"online"] = !$this->
object->isOffline();
235 $a_values[
"public"] = $this->
object->hasPublicLog();
236 $a_values[
"stype"] = $this->
object->getScheduleType();
237 $a_values[
"limit"] = $this->
object->getOverallLimit();
238 $a_values[
"period"] = $this->
object->getReservationFilterPeriod();
243 $this->
object->setOffline(!$a_form->
getInput(
'online'));
244 $this->
object->setPublicLog($a_form->
getInput(
'public'));
245 $this->
object->setScheduleType($a_form->
getInput(
'stype'));
246 $this->
object->setOverallLimit($a_form->
getInput(
'limit') ? $a_form->
getInput(
'limit') :
null);
247 $this->
object->setReservationFilterPeriod(strlen($a_form->
getInput(
'period')) ? (
int)$a_form->
getInput(
'period') :
null);
249 include_once
'./Services/Container/classes/class.ilContainer.php';
250 include_once
'./Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
252 $this->object->getId(),
260 include_once
'./Services/Container/classes/class.ilContainer.php';
261 include_once
'./Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
263 $this->object->getId(),
276 if (in_array($this->ctrl->getCmd(), array(
"create",
"save")) && !$this->ctrl->getNextClass())
281 $ilHelp->setScreenIdComponent(
"book");
285 if($ilUser->getId() != ANONYMOUS_USER_ID)
287 $this->tabs_gui->addTab(
"render",
288 $this->lng->txt(
"book_booking_types"),
289 $this->ctrl->getLinkTarget($this,
"render"));
292 $this->tabs_gui->addTab(
"info",
293 $this->lng->txt(
"info_short"),
294 $this->ctrl->getLinkTarget($this,
"infoscreen"));
296 if(
$ilUser->getId() != ANONYMOUS_USER_ID || $this->object->hasPublicLog())
298 $this->tabs_gui->addTab(
"log",
299 $this->lng->txt(
"book_log"),
300 $this->ctrl->getLinkTarget($this,
"log"));
308 $this->tabs_gui->addTab(
"schedules",
309 $this->lng->txt(
"book_schedules"),
310 $this->ctrl->getLinkTargetByClass(
"ilbookingschedulegui",
"render"));
313 $this->tabs_gui->addTab(
"settings",
314 $this->lng->txt(
"settings"),
315 $this->ctrl->getLinkTarget($this,
"edit"));
318 include_once
"Services/Object/classes/class.ilObjectMetaDataGUI.php";
320 $mdtab = $mdgui->getTab();
323 $this->tabs_gui->addTarget(
"meta_data",
326 "ilobjectmetadatagui");
332 $this->tabs_gui->addTab(
"perm_settings",
333 $this->lng->txt(
"perm_settings"),
334 $this->ctrl->getLinkTargetByClass(
"ilpermissiongui",
"perm"));
346 $ilHelp->setScreenIdComponent(
'book');
347 $ilHelp->setScreenId(
'object'.$object_subtype);
348 $ilHelp->setSubScreenId($a_id);
358 $this->tabs_gui->clearTargets();
359 $this->tabs_gui->setBackTarget($this->lng->txt(
'book_back_to_list'), $this->ctrl->getLinkTarget($this,
'render'));
363 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
366 $this->lng->loadLanguageModule(
"dateplaner");
367 $this->ctrl->setParameter($this,
'object_id', $obj->getId());
371 include_once
'Modules/BookingManager/classes/class.ilBookingSchedule.php';
374 $tpl->setContent($this->
renderSlots($schedule, array($obj->getId()), $obj->getTitle()));
378 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
380 $cgui->setHeaderText($this->lng->txt(
"book_confirm_booking_no_schedule"));
382 $cgui->setFormAction($this->ctrl->getFormAction($this));
383 $cgui->setCancel($this->lng->txt(
"cancel"),
"render");
384 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmedBooking");
386 $cgui->addItem(
"object_id", $obj->getId(), $obj->getTitle());
388 $tpl->setContent($cgui->getHTML());
399 $mytpl =
new ilTemplate(
'tpl.booking_reservation_fix.html',
true,
true,
'Modules/BookingManager');
401 $mytpl->setVariable(
'FORM_ACTION', $this->ctrl->getFormAction($this));
402 $mytpl->setVariable(
'TXT_TITLE', $this->lng->txt(
'book_reservation_title'));
403 $mytpl->setVariable(
'TXT_INFO', $this->lng->txt(
'book_reservation_fix_info'));
404 $mytpl->setVariable(
'TXT_OBJECT',
$title);
405 $mytpl->setVariable(
'TXT_CMD_BOOK', $this->lng->txt(
'book_confirm_booking'));
406 $mytpl->setVariable(
'TXT_CMD_CANCEL', $this->lng->txt(
'cancel'));
408 include_once
'Services/Calendar/classes/class.ilCalendarUserSettings.php';
412 $morning_aggr = $user_settings->getDayStart();
413 $evening_aggr = $user_settings->getDayEnd();
415 for($i = $morning_aggr;$i <= $evening_aggr;$i++)
417 switch($user_settings->getTimeFormat())
420 if ($morning_aggr > 0 && $i == $morning_aggr)
422 $hours[$i] =
sprintf(
'%02d:00',0).
"-";
424 $hours[$i].=
sprintf(
'%02d:00',$i);
425 if ($evening_aggr < 23 && $i == $evening_aggr)
427 $hours[$i].=
"-".sprintf(
'%02d:00',23);
432 if ($morning_aggr > 0 && $i == $morning_aggr)
434 $hours[$i] =
date(
'h a',mktime(0,0,0,1,1,2000)).
"-";
436 $hours[$i].=
date(
'h a',mktime($i,0,0,1,1,2000));
437 if ($evening_aggr < 23 && $i == $evening_aggr)
439 $hours[$i].=
"-".date(
'h a',mktime(23,0,0,1,1,2000));
445 if(isset(
$_GET[
'seed']))
447 $find_first_open =
false;
452 $find_first_open =
true;
453 $seed = isset(
$_GET[
'sseed'])
458 include_once
'Services/Calendar/classes/class.ilCalendarUtil.php';
459 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
460 $week_start = $user_settings->getWeekStart();
462 if(!$find_first_open)
472 $has_open_slot = $this->
buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
478 $limit = clone($seed);
482 while(!$has_open_slot && $seed->get(
IL_CAL_UNIX) < $limit)
487 $has_open_slot = $this->
buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
492 include_once
'Services/Calendar/classes/class.ilCalendarHeaderNavigationGUI.php';
494 $mytpl->setVariable(
'NAVIGATION', $navigation->getHTML());
500 $mytpl->setCurrentBlock(
'weekdays');
503 $mytpl->parseCurrentBlock();
506 include_once
'Services/Calendar/classes/class.ilCalendarAppointmentColors.php';
507 include_once
'Services/Calendar/classes/class.ilCalendarUtil.php';
510 for($loop = 0; $loop < 7; $loop++)
514 $color[$loop+1] =
'border-bottom: 1px solid '.$col.
'; background-color: '.$col.
'; color: '.$fnt;
518 foreach($dates as $hour => $days)
521 $caption = array_shift($caption);
523 for($loop = 1; $loop < 8; $loop++)
525 if(!isset($days[$loop]))
527 $mytpl->setCurrentBlock(
'dates');
528 $mytpl->setVariable(
'DUMMY',
' ');
529 $mytpl->parseCurrentBlock();
533 if(isset($days[$loop][
'captions']))
535 foreach($days[$loop][
'captions'] as $slot_id => $slot_caption)
537 $mytpl->setCurrentBlock(
'choice');
538 $mytpl->setVariable(
'TXT_DATE', $slot_caption);
539 $mytpl->setVariable(
'VALUE_DATE', $slot_id);
540 $mytpl->setVariable(
'DATE_COLOR', $color[$loop]);
541 $mytpl->setVariable(
'TXT_AVAILABLE',
542 sprintf($this->lng->txt(
'book_reservation_available'),
543 $days[$loop][
'available'][$slot_id]));
544 $mytpl->parseCurrentBlock();
547 $mytpl->setCurrentBlock(
'dates');
548 $mytpl->setVariable(
'DUMMY',
'');
549 $mytpl->parseCurrentBlock();
551 else if(isset($days[$loop][
'in_slot']))
553 $mytpl->setCurrentBlock(
'dates');
554 $mytpl->setVariable(
'DATE_COLOR', $color[$loop]);
555 $mytpl->parseCurrentBlock();
559 $mytpl->setCurrentBlock(
'dates');
560 $mytpl->setVariable(
'DUMMY',
' ');
561 $mytpl->parseCurrentBlock();
566 $mytpl->setCurrentBlock(
'slots');
567 $mytpl->setVariable(
'TXT_HOUR', $caption);
570 $mytpl->setVariable(
'CSS_ROW',
'tblrow1');
574 $mytpl->setVariable(
'CSS_ROW',
'tblrow2');
576 $mytpl->parseCurrentBlock();
587 return $mytpl->get();
590 protected function buildDatesBySchedule($week_start, array $hours, $schedule, array $object_ids, $seed, array &$dates)
594 include_once
'Services/Calendar/classes/class.ilCalendarUserSettings.php';
597 $map = array(
'mo',
'tu',
'we',
'th',
'fr',
'sa',
'su');
598 $definition = $schedule->getDefinition();
600 $av_from = ($schedule->getAvailabilityFrom() && !$schedule->getAvailabilityFrom()->isNull())
601 ? $schedule->getAvailabilityFrom()->get(
IL_CAL_DATE)
603 $av_to = ($schedule->getAvailabilityTo() && !$schedule->getAvailabilityTo()->isNull())
607 $has_open_slot =
false;
613 if($av_from || $av_to)
617 if ($av_from && $av_from > $today)
622 if($av_to && $av_to < $today)
629 if(isset($definition[$map[$date_info[
'isoday']-1]]))
632 foreach($definition[$map[$date_info[
'isoday']-1]] as $slot)
634 $slot = explode(
'-', $slot);
635 $slots[] = array(
'from'=>str_replace(
':',
'', $slot[0]),
636 'to'=>str_replace(
':',
'', $slot[1]));
640 $last = array_pop(array_keys($hours));
641 $slot_captions = array();
642 foreach($hours as $hour => $period)
644 $dates[$hour][0] = $period;
646 $period = explode(
"-", $period);
651 $period[0] =
date(
"H", strtotime($period[0]));
652 if(
sizeof($period) == 2)
654 $period[1] =
date(
"H", strtotime($period[1]));
658 if(
sizeof($period) == 1)
660 $period_from = (int)substr($period[0], 0, 2).
"00";
661 $period_to = (int)substr($period[0], 0, 2).
"59";
665 $period_from = (int)substr($period[0], 0, 2).
"00";
666 $period_to = (int)substr($period[1], 0, 2).
"59";
669 $column = $date_info[
'isoday'];
685 foreach($slots as $slot)
687 $slot_from = mktime(substr($slot[
'from'], 0, 2), substr($slot[
'from'], 2, 2), 0, $date_info[
"mon"], $date_info[
"mday"], $date_info[
"year"]);
688 $slot_to = mktime(substr($slot[
'to'], 0, 2), substr($slot[
'to'], 2, 2), 0, $date_info[
"mon"], $date_info[
"mday"], $date_info[
"year"]);
694 if(!array_sum($nr_available))
700 if($schedule->getDeadline() >= 0)
703 if($slot_from < (time()+$schedule->getDeadline()*60*60))
711 if($slot_to < time())
718 if((
int)$slot[
'from'] < $period_to && (int)$slot[
'to'] > $period_from)
721 $from = array_pop(explode(
' ', $from));
723 $to = array_pop(explode(
' ', $to));
726 $id = $slot_from.
'_'.$slot_to;
727 if(!in_array($id, $slot_captions))
729 $dates[$hour][
$column][
'captions'][$id] = $from.
'-'.$to;
730 $dates[$hour][
$column][
'available'][$id] = array_sum($nr_available);
731 $slot_captions[] = $id;
740 $has_open_slot =
true;
747 return $has_open_slot;
757 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
758 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
767 $object_id =
$_POST[
'object_id'];
780 $this->ctrl->redirect($this,
'render');
787 if(!isset(
$_POST[
'date']))
794 if(isset(
$_GET[
'object_id']))
798 $object_id = (int)
$_GET[
'object_id'];
808 foreach(
$_POST[
'date'] as $date)
810 $fromto = explode(
'_', $date);
820 $confirm[$object_id.
"_".$fromto[0].
"_".($fromto[1]+1)] =
$counter;
824 $rsv_ids[] = $this->
processBooking($object_id, $fromto[0], $fromto[1], $group_id);
895 $this->ctrl->redirect($this,
'book');
904 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
906 $pfile = $obj->getPostFile();
907 $ptext = $obj->getPostText();
908 if(trim($ptext) || $pfile)
910 if(
sizeof($a_rsv_ids))
912 $this->ctrl->setParameterByClass(
'ilbookingobjectgui',
'rsv_ids', implode(
";", $a_rsv_ids));
914 $this->ctrl->setParameterByClass(
'ilbookingobjectgui',
'object_id', $obj->getId());
915 $this->ctrl->redirectByClass(
'ilbookingobjectgui',
'displayPostInfo');
919 $this->ctrl->redirect($this,
'render');
925 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
927 $form->setFormAction($this->ctrl->getFormAction($this,
"confirmedBooking"));
928 $form->setTitle($this->lng->txt(
"book_confirm_booking_schedule_number_of_objects"));
929 $form->setDescription($this->lng->txt(
"book_confirm_booking_schedule_number_of_objects_info"));
931 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
934 foreach($a_objects_counter as $id =>
$counter)
936 $id = explode(
"_", $id);
937 $book_id = $id[0].
"_".$id[1].
"_".$id[2].
"_".
$counter;
944 $section->setTitle($obj->getTitle());
956 $nr_field->setValue(1);
957 $nr_field->setSize(3);
959 $nr_field->setMinValue(
$counter ? 1 : 0);
960 $nr_field->setRequired(
true);
961 $form->addItem($nr_field);
963 if(!$min_date || $id[1] < $min_date)
970 $this->lng->loadLanguageModule(
"dateplaner");
971 $rec_mode =
new ilSelectInputGUI($this->lng->txt(
"cal_recurrences"),
"recm");
972 $rec_mode->setRequired(
true);
973 $rec_mode->setOptions(array(
974 "-1" => $this->lng->txt(
"cal_no_recurrence"),
975 1 => $this->lng->txt(
"cal_weekly"),
976 2 => $this->lng->txt(
"r_14"),
977 4 => $this->lng->txt(
"r_4_weeks")
979 $form->addItem($rec_mode);
982 $rec_end->setRequired(
true);
983 $rec_mode->addSubItem($rec_end);
988 $rec_mode->setHideSubForm(
true,
'>= 1');
998 $rec_mode->setDisabled(
true);
999 $rec_end->setDisabled(
true);
1005 $grp->setValue($a_group_id);
1006 $form->addItem($grp);
1009 $form->addCommandButton(
"confirmedBookingNumbers", $this->lng->txt(
"confirm"));
1010 $form->addCommandButton(
"render", $this->lng->txt(
"cancel"));
1019 $this->tabs_gui->clearTargets();
1020 $this->tabs_gui->setBackTarget($this->lng->txt(
'book_back_to_list'), $this->ctrl->getLinkTarget($this,
'render'));
1027 $tpl->setContent($a_form->getHTML());
1032 $date = date_parse($a_date);
1033 $stamp = mktime(0, 0, 1, $date[
"month"], $date[
"day"]+$a_days, $date[
"year"]);
1034 return date(
"Y-m-d", $stamp);
1039 $date = getDate($a_stamp);
1040 return mktime($date[
"hours"], $date[
"minutes"], $date[
"seconds"],
1041 $date[
"mon"], $date[
"mday"]+$a_days, $date[
"year"]);
1046 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1047 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
1051 $current_first =
$obj_id =
null;
1052 foreach(array_keys(
$_POST) as $id)
1054 if(substr($id, 0, 9) ==
"conf_nr__")
1056 $id = explode(
"_", substr($id, 9));
1057 $counter[$id[0].
"_".$id[1].
"_".$id[2]] = (int)$id[3];
1060 $current_first =
date(
"Y-m-d", $id[1]);
1068 include_once
'Services/Calendar/classes/class.ilCalendarUtil.php';
1071 if((
int)
$_POST[
"recm"] > 0 && $end && $current_first)
1075 $cycle = (int)
$_POST[
"recm"]*7;
1078 while($cut < 1000 && $this->
addDaysDate($current_first, $cycle) <= $end)
1081 $current_first =
null;
1082 foreach($org as $item_id => $max)
1084 $parts = explode(
"_", $item_id);
1090 $new_item_id =
$obj_id.
"_".$from.
"_".$to;
1093 if(!isset(
$counter[$new_item_id]) &&
date(
"Y-m-d", $to) <= $end)
1097 $new_max = (int)$new_max[
$obj_id];
1103 $current_first =
date(
"Y-m-d", $from);
1107 $_POST[
"conf_nr__".$new_item_id.
"_".$new_max] =
$_POST[
"conf_nr__".$item_id.
"_".$max];
1113 $group_id =
$_POST[
"grp_id"];
1116 if($form->checkInput())
1120 foreach(
$counter as $id => $all_nr)
1122 $book_nr = $form->getInput(
"conf_nr__".$id.
"_".$all_nr);
1123 $parts = explode(
"_", $id);
1134 $book_nr = min($book_nr,
$counter);
1135 for($loop = 0; $loop < $book_nr; $loop++)
1149 $this->ctrl->redirect($this,
'render');
1156 $rece_array = explode(
".",
$_POST[
'rece']);
1158 $rece_day = str_pad($rece_array[0], 2,
"0", STR_PAD_LEFT);
1159 $rece_month = str_pad($rece_array[1], 2,
"0", STR_PAD_LEFT);
1160 $rece_year = $rece_array[2];
1165 $form->setValuesByPost();
1169 $form->getItemByPostVar(
"rece")->setDate($rece_date);
1170 $form->getItemByPostVar(
"recm")->setHideSubForm(
$_POST[
"recm"] < 1);
1173 $hidden_date->setValue($rece_date);
1174 $form->addItem($hidden_date);
1189 function processBooking($a_object_id, $a_from =
null, $a_to =
null, $a_group_id =
null)
1196 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1198 $reservation->setObjectId($a_object_id);
1199 $reservation->setUserId(
$ilUser->getID());
1200 $reservation->setFrom($a_from);
1201 $reservation->setTo($a_to);
1202 $reservation->setGroupId($a_group_id);
1203 $reservation->save();
1207 $this->lng->loadLanguageModule(
'dateplaner');
1208 include_once
'Services/Calendar/classes/class.ilCalendarUtil.php';
1209 include_once
'Services/Calendar/classes/class.ilCalendarCategory.php';
1212 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
1215 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
1219 $entry->setTitle($this->lng->txt(
'book_cal_entry').
' '.
$object->getTitle());
1220 $entry->setContextId($reservation->getId());
1223 include_once
'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1225 $assignment->addAssignment($def_cat->getCategoryId());
1228 return $reservation->getId();
1238 $this->tabs_gui->setTabActive(
'log');
1243 if(
$_GET[
"object_id"])
1245 $filter[
"object"] = (int)
$_GET[
"object_id"];
1248 include_once
'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1250 $this->object->getId(), $show_all,
1253 $tpl->setContent($table->getHTML());
1260 $this->tabs_gui->clearTargets();
1261 $this->tabs_gui->setBackTarget($this->lng->txt(
"back"),
1262 $this->ctrl->getLinkTarget($this,
"log"));
1267 if(
$_GET[
"object_id"])
1269 $filter[
"object"] = (int)
$_GET[
"object_id"];
1272 include_once
'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1274 $this->object->getId(), $show_all,
1276 $filter,
$_GET[
"reservation_id"]);
1277 $tpl->setContent($table->getHTML());
1285 $this->tabs_gui->setTabActive(
'log');
1287 if(!
$_POST[
'reservation_id'])
1295 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1300 return $this->ctrl->redirect($this,
'log');
1310 include_once
'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1312 $this->object->getId(), $show_all,
1314 $table->resetOffset();
1315 $table->writeFilterToSession();
1326 include_once
'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1328 $this->object->getId(), $show_all,
1330 $table->resetOffset();
1331 $table->resetFilter();
1337 global $ilAccess,
$lng;
1339 if ($ilAccess->checkAccess(
"read",
"", $a_target))
1343 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
1358 $this->ctrl->setCmd(
"showSummary");
1359 $this->ctrl->setCmdClass(
"ilinfoscreengui");
1367 $this->tabs_gui->setTabActive(
'info');
1371 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1374 $info->enablePrivateNotes();
1378 $info->enableNews();
1382 $info->enableNewsEditing(
false);
1386 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
1388 if ($enable_internal_rss)
1390 $info->setBlockProperty(
"news",
"settings",
true);
1391 $info->setBlockProperty(
"news",
"public_notifications_option",
true);
1396 if (
$ilCtrl->getNextClass() ==
"ilinfoscreengui")
1412 else if(
$_GET[
"reservation_id"])
1414 return array(
$_GET[
"reservation_id"]);
1425 $this->ctrl->redirect($this,
'log');
1428 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
1429 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1432 foreach($ids as $idx => $id)
1434 if(!is_numeric($id))
1436 list(
$obj_id, $user_id, $from, $to) = explode(
"_", $id);
1438 $valid_ids = array();
1441 $valid_ids[$item[
"booking_object_id"]] = $item[
"title"];
1446 in_array(
$obj_id, array_keys($valid_ids)))
1449 if(!
sizeof($rsv_ids))
1453 if(
sizeof($rsv_ids) > 1)
1455 $max[$id] =
sizeof($rsv_ids);
1456 $ids[$idx] = $rsv_ids;
1461 $ids[$idx] = array_shift($rsv_ids);
1473 $this->ctrl->redirect($this,
'log');
1477 if(
sizeof($max) && max($max) > 1)
1482 $this->tabs_gui->clearTargets();
1483 $this->tabs_gui->setBackTarget(
$lng->txt(
"back"),
1484 $ilCtrl->getLinkTarget($this,
"log"));
1488 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
1490 $conf->setFormAction(
$ilCtrl->getFormAction($this,
'rsvCancel'));
1491 $conf->setHeaderText(
$lng->txt(
'book_confirm_cancel'));
1492 $conf->setConfirm(
$lng->txt(
'book_set_cancel'),
'rsvCancel');
1493 $conf->setCancel(
$lng->txt(
'cancel'),
'log');
1495 foreach($ids as $id)
1500 $details = $obj->getTitle();
1503 $details .=
", ".ilDatePresentation::formatPeriod(
1508 $conf->addItem(
'rsv_id[]', $id, $details);
1511 $tpl->setContent($conf->getHTML());
1516 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
1518 $form->setFormAction($this->ctrl->getFormAction($this,
"rsvCancel"));
1519 $form->setTitle($this->lng->txt(
"book_confirm_cancel_aggregation"));
1521 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
1522 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1526 foreach($a_ids as $idx => $ids)
1531 $first = array_shift($first);
1548 $caption .=
" (".sizeof($ids).
")";
1552 $item->setRequired(
true);
1553 $item->setMinValue(0);
1555 $form->addItem($item);
1559 $item->setMaxValue(
sizeof($ids));
1561 foreach($ids as $id)
1564 $hidden->setValue($id);
1565 $form->addItem($hidden);
1570 $item->setMaxValue(1);
1573 $hidden->setValue($ids);
1574 $form->addItem($hidden);
1577 if(
$_POST[
"rsv_id_".$idx])
1579 $item->setValue((
int)
$_POST[
"rsv_id_".$idx]);
1583 $form->addCommandButton(
"rsvCancel", $this->lng->txt(
"confirm"));
1584 $form->addCommandButton(
"log", $this->lng->txt(
"cancel"));
1593 $this->tabs_gui->clearTargets();
1594 $this->tabs_gui->setBackTarget(
$lng->txt(
"back"),
1595 $ilCtrl->getLinkTarget($this,
"log"));
1604 $tpl->setContent($form->getHTML());
1617 if(!$form->checkInput())
1619 $this->tabs_gui->clearTargets();
1620 $this->tabs_gui->setBackTarget(
$lng->txt(
"back"),
1621 $ilCtrl->getLinkTarget($this,
"log"));
1623 return $tpl->setContent($form->getHTML());
1627 foreach(
$_POST[
"rsv_aggr"] as $idx => $aggr_ids)
1629 $max = (int)
$_POST[
"rsv_id_".$idx];
1632 if(!is_array($aggr_ids))
1638 $aggr_ids = array_slice($aggr_ids, 0, $max);
1639 $ids = array_merge($ids, $aggr_ids);
1647 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1648 foreach($ids as $id)
1655 $this->ctrl->redirect($this,
'log');
1664 $cal_entry_id = $obj->getCalendarEntry();
1667 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
1686 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1687 foreach($ids as $id)
1706 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1707 foreach($ids as $id)
1710 $obj->setStatus(NULL);
1723 $this->tabs_gui->clearTargets();
1725 $user_id = (int)
$_GET[
'user_id'];
1727 include_once
'Services/User/classes/class.ilPublicUserProfileGUI.php';
1729 $profile->setBackUrl($this->ctrl->getLinkTarget($this,
'log'));
1737 if (is_object($this->
object))
1739 $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 formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
static setUseRelativeDates($a_status)
set use relative dates
static formatDate(ilDateTime $date)
Format a date @access public.
@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.
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.