4 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
23 function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output =
true)
26 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
27 $this->lng->loadLanguageModule(
"book");
35 global
$tpl, $ilTabs, $ilNavigationHistory,
$ilUser;
37 $next_class = $this->ctrl->getNextClass($this);
38 $cmd = $this->ctrl->getCmd();
40 if(!$next_class &&
$cmd ==
'render')
42 if($ilUser->getId() != ANONYMOUS_USER_ID)
44 $this->ctrl->setCmdClass(
'ilBookingObjectGUI');
45 $next_class = $this->ctrl->getNextClass($this);
49 $this->ctrl->redirect($this,
"infoscreen");
53 if(substr(
$cmd, 0, 4) ==
'book')
58 $ilNavigationHistory->addItem($this->ref_id,
59 "./goto.php?target=book_".$this->ref_id,
"book");
65 case 'ilpermissiongui':
66 $this->tabs_gui->setTabActive(
'perm_settings');
67 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
69 $ret =& $this->ctrl->forwardCommand($perm_gui);
72 case 'ilbookingobjectgui':
73 $this->tabs_gui->setTabActive(
'render');
74 include_once(
"Modules/BookingManager/classes/class.ilBookingObjectGUI.php");
76 $ret =& $this->ctrl->forwardCommand($object_gui);
79 case 'ilbookingschedulegui':
80 $this->tabs_gui->setTabActive(
'schedules');
81 include_once(
"Modules/BookingManager/classes/class.ilBookingScheduleGUI.php");
83 $ret =& $this->ctrl->forwardCommand($schedule_gui);
86 case 'ilpublicuserprofilegui':
87 $ilTabs->clearTargets();
88 include_once(
"Services/User/classes/class.ilPublicUserProfileGUI.php");
90 $profile->setBackUrl($this->ctrl->getLinkTarget($this,
'log'));
91 $ret = $this->ctrl->forwardCommand($profile);
92 $tpl->setContent(
$ret);
95 case 'ilinfoscreengui':
99 case "ilcommonactiondispatchergui":
100 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
102 $this->ctrl->forwardCommand($gui);
105 case "ilobjectcopygui":
106 include_once
"./Services/Object/classes/class.ilObjectCopyGUI.php";
108 $cp->setType(
"book");
109 $this->ctrl->forwardCommand($cp);
113 $cmd = $this->ctrl->getCmd();
126 unset($forms[self::CFORM_IMPORT]);
133 $a_new_object->setOffline(
true);
138 $this->ctrl->setParameter($this,
"ref_id", $a_new_object->
getRefId());
139 $this->ctrl->redirect($this,
"edit");
145 include_once
"Modules/BookingManager/classes/class.ilBookingSchedule.php";
165 include_once
"Modules/BookingManager/classes/class.ilBookingObject.php";
168 $type->setDisabled(
true);
172 $fixed->
setInfo($this->lng->txt(
"book_schedule_type_fixed_info"));
173 $type->addOption($fixed);
176 $none->
setInfo($this->lng->txt(
"book_schedule_type_none_info"));
177 $type->addOption($none);
179 $limit =
new ilNumberInputGUI($this->lng->txt(
"book_overall_limit"),
"limit");
181 $limit->setMinValue(1);
182 $limit->setInfo($this->lng->txt(
"book_overall_limit_info"));
183 $none->addSubItem($limit);
186 $public->
setInfo($this->lng->txt(
"book_public_log_info"));
192 $a_values[
"online"] = !$this->
object->isOffline();
193 $a_values[
"public"] = $this->
object->hasPublicLog();
194 $a_values[
"stype"] = $this->
object->getScheduleType();
195 $a_values[
"limit"] = $this->
object->getOverallLimit();
200 $this->
object->setOffline(!$a_form->
getInput(
'online'));
201 $this->
object->setPublicLog($a_form->
getInput(
'public'));
202 $this->
object->setScheduleType($a_form->
getInput(
'stype'));
203 $this->
object->setOverallLimit($a_form->
getInput(
'limit') ? $a_form->
getInput(
'limit') : null);
211 global $ilAccess, $ilHelp,
$ilUser;
213 if (in_array($this->ctrl->getCmd(), array(
"create",
"save")) && !$this->ctrl->getNextClass())
218 $ilHelp->setScreenIdComponent(
"book");
220 if ($ilAccess->checkAccess(
'read',
'', $this->object->getRefId()))
222 if($ilUser->getId() != ANONYMOUS_USER_ID)
224 $this->tabs_gui->addTab(
"render",
225 $this->lng->txt(
"book_booking_types"),
226 $this->ctrl->getLinkTarget($this,
"render"));
229 $this->tabs_gui->addTab(
"info",
230 $this->lng->txt(
"info_short"),
231 $this->ctrl->getLinkTarget($this,
"infoscreen"));
233 if($ilUser->getId() != ANONYMOUS_USER_ID || $this->
object->hasPublicLog())
235 $this->tabs_gui->addTab(
"log",
236 $this->lng->txt(
"book_log"),
237 $this->ctrl->getLinkTarget($this,
"log"));
241 if ($ilAccess->checkAccess(
'write',
'', $this->object->getRefId()))
245 $this->tabs_gui->addTab(
"schedules",
246 $this->lng->txt(
"book_schedules"),
247 $this->ctrl->getLinkTargetByClass(
"ilbookingschedulegui",
"render"));
250 $this->tabs_gui->addTab(
"settings",
251 $this->lng->txt(
"settings"),
252 $this->ctrl->getLinkTarget($this,
"edit"));
255 if($ilAccess->checkAccess(
'edit_permission',
'', $this->object->getRefId()))
257 $this->tabs_gui->addTab(
"perm_settings",
258 $this->lng->txt(
"perm_settings"),
259 $this->ctrl->getLinkTargetByClass(
"ilpermissiongui",
"perm"));
270 $this->tabs_gui->clearTargets();
271 $this->tabs_gui->setBackTarget($this->lng->txt(
'book_back_to_list'), $this->ctrl->getLinkTarget($this,
'render'));
273 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
276 $this->lng->loadLanguageModule(
"dateplaner");
277 $this->ctrl->setParameter($this,
'object_id', $obj->getId());
281 include_once
'Modules/BookingManager/classes/class.ilBookingSchedule.php';
284 $tpl->setContent($this->
renderSlots($schedule, array($obj->getId()), $obj->getTitle()));
288 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
290 $cgui->setHeaderText($this->lng->txt(
"book_confirm_booking_no_schedule"));
292 $cgui->setFormAction($this->ctrl->getFormAction($this));
293 $cgui->setCancel($this->lng->txt(
"cancel"),
"render");
294 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmedBooking");
296 $cgui->addItem(
"object_id", $obj->getId(), $obj->getTitle());
298 $tpl->setContent($cgui->getHTML());
309 $mytpl =
new ilTemplate(
'tpl.booking_reservation_fix.html',
true,
true,
'Modules/BookingManager');
311 $mytpl->setVariable(
'FORM_ACTION', $this->ctrl->getFormAction($this));
312 $mytpl->setVariable(
'TXT_TITLE', $this->lng->txt(
'book_reservation_title'));
313 $mytpl->setVariable(
'TXT_INFO', $this->lng->txt(
'book_reservation_fix_info'));
314 $mytpl->setVariable(
'TXT_OBJECT', $title);
315 $mytpl->setVariable(
'TXT_CMD_BOOK', $this->lng->txt(
'book_confirm_booking'));
316 $mytpl->setVariable(
'TXT_CMD_CANCEL', $this->lng->txt(
'cancel'));
318 include_once
'Services/Calendar/classes/class.ilCalendarUserSettings.php';
322 $morning_aggr = $user_settings->getDayStart();
323 $evening_aggr = $user_settings->getDayEnd();
325 for($i = $morning_aggr;$i <= $evening_aggr;$i++)
327 switch($user_settings->getTimeFormat())
330 if ($morning_aggr > 0 && $i == $morning_aggr)
332 $hours[$i] = sprintf(
'%02d:00',0).
"-";
334 $hours[$i].= sprintf(
'%02d:00',$i);
335 if ($evening_aggr < 23 && $i == $evening_aggr)
337 $hours[$i].=
"-".sprintf(
'%02d:00',23);
342 if ($morning_aggr > 0 && $i == $morning_aggr)
344 $hours[$i] = date(
'h a',mktime(0,0,0,1,1,2000)).
"-";
346 $hours[$i].= date(
'h a',mktime($i,0,0,1,1,2000));
347 if ($evening_aggr < 23 && $i == $evening_aggr)
349 $hours[$i].=
"-".date(
'h a',mktime(23,0,0,1,1,2000));
355 if(isset(
$_GET[
'seed']))
357 $find_first_open =
false;
362 $find_first_open =
true;
366 include_once
'Services/Calendar/classes/class.ilCalendarUtil.php';
367 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
368 $week_start = $user_settings->getWeekStart();
370 if(!$find_first_open)
378 $has_open_slot = $this->
buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
384 $limit = clone($seed);
388 while(!$has_open_slot && $seed->get(
IL_CAL_UNIX) < $limit)
393 $has_open_slot = $this->
buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
398 include_once
'Services/Calendar/classes/class.ilCalendarHeaderNavigationGUI.php';
400 $mytpl->setVariable(
'NAVIGATION', $navigation->getHTML());
406 $mytpl->setCurrentBlock(
'weekdays');
409 $mytpl->parseCurrentBlock();
412 include_once
'Services/Calendar/classes/class.ilCalendarAppointmentColors.php';
413 include_once
'Services/Calendar/classes/class.ilCalendarUtil.php';
416 for($loop = 0; $loop < 7; $loop++)
420 $color[$loop+1] =
'border-bottom: 1px solid '.$col.
'; background-color: '.$col.
'; color: '.$fnt;
424 foreach($dates as $hour => $days)
427 $caption = array_shift($caption);
429 for($loop = 1; $loop < 8; $loop++)
431 if(!isset($days[$loop]))
433 $mytpl->setCurrentBlock(
'dates');
434 $mytpl->setVariable(
'DUMMY',
' ');
435 $mytpl->parseCurrentBlock();
439 if(isset($days[$loop][
'captions']))
441 foreach($days[$loop][
'captions'] as $slot_id => $slot_caption)
443 $mytpl->setCurrentBlock(
'choice');
444 $mytpl->setVariable(
'TXT_DATE', $slot_caption);
445 $mytpl->setVariable(
'VALUE_DATE', $slot_id);
446 $mytpl->setVariable(
'DATE_COLOR', $color[$loop]);
447 $mytpl->setVariable(
'TXT_AVAILABLE',
448 sprintf($this->lng->txt(
'book_reservation_available'),
449 $days[$loop][
'available'][$slot_id]));
450 $mytpl->parseCurrentBlock();
453 $mytpl->setCurrentBlock(
'dates');
454 $mytpl->setVariable(
'DUMMY',
'');
455 $mytpl->parseCurrentBlock();
457 else if(isset($days[$loop][
'in_slot']))
459 $mytpl->setCurrentBlock(
'dates');
460 $mytpl->setVariable(
'DATE_COLOR', $color[$loop]);
461 $mytpl->parseCurrentBlock();
465 $mytpl->setCurrentBlock(
'dates');
466 $mytpl->setVariable(
'DUMMY',
' ');
467 $mytpl->parseCurrentBlock();
472 $mytpl->setCurrentBlock(
'slots');
473 $mytpl->setVariable(
'TXT_HOUR', $caption);
476 $mytpl->setVariable(
'CSS_ROW',
'tblrow1');
480 $mytpl->setVariable(
'CSS_ROW',
'tblrow2');
482 $mytpl->parseCurrentBlock();
493 return $mytpl->get();
496 protected function buildDatesBySchedule($week_start, array $hours, $schedule, array $object_ids, $seed, array &$dates)
500 include_once
'Services/Calendar/classes/class.ilCalendarUserSettings.php';
503 $map = array(
'mo',
'tu',
'we',
'th',
'fr',
'sa',
'su');
504 $definition = $schedule->getDefinition();
506 $has_open_slot =
false;
512 if(isset($definition[$map[$date_info[
'isoday']-1]]))
515 foreach($definition[$map[$date_info[
'isoday']-1]] as $slot)
517 $slot = explode(
'-', $slot);
518 $slots[] = array(
'from'=>str_replace(
':',
'', $slot[0]),
519 'to'=>str_replace(
':',
'', $slot[1]));
523 $last = array_pop(array_keys($hours));
524 $slot_captions = array();
525 foreach($hours as $hour => $period)
527 $dates[$hour][0] = $period;
529 $period = explode(
"-", $period);
534 if(stristr($period[0],
"pm"))
536 $period[0] = (int)$period[0]+12;
540 $period[0] = (int)$period[0];
546 if(
sizeof($period) == 2)
548 if(stristr($period[1],
"pm"))
550 $period[1] = (int)$period[1]+12;
554 $period[1] = (int)$period[1];
563 if(
sizeof($period) == 1)
565 $period_from = (int)substr($period[0], 0, 2).
"00";
566 $period_to = (int)substr($period[0], 0, 2).
"59";
570 $period_from = (int)substr($period[0], 0, 2).
"00";
571 $period_to = (int)substr($period[1], 0, 2).
"59";
574 $column = $date_info[
'isoday'];
590 foreach($slots as $slot)
592 $slot_from = mktime(substr($slot[
'from'], 0, 2), substr($slot[
'from'], 2, 2), 0, $date_info[
"mon"], $date_info[
"mday"], $date_info[
"year"]);
593 $slot_to = mktime(substr($slot[
'to'], 0, 2), substr($slot[
'to'], 2, 2), 0, $date_info[
"mon"], $date_info[
"mday"], $date_info[
"year"]);
599 if($slot_from < (time()+$schedule->getDeadline()*60*60) || !array_sum($nr_available))
605 if((
int)$slot[
'from'] < $period_to && (int)$slot[
'to'] > $period_from)
608 $from = array_pop(explode(
' ', $from));
610 $to = array_pop(explode(
' ', $to));
613 $id = $slot_from.
'_'.$slot_to;
614 if(!in_array($id, $slot_captions))
616 $dates[$hour][$column][
'captions'][$id] = $from.
'-'.$to;
617 $dates[$hour][$column][
'available'][$id] = array_sum($nr_available);
618 $slot_captions[] = $id;
627 $has_open_slot =
true;
628 $dates[$hour][$column][
'in_slot'] =
$in;
634 return $has_open_slot;
644 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
645 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
654 $object_id =
$_POST[
'object_id'];
667 $this->ctrl->redirect($this,
'render');
674 if(!isset(
$_POST[
'date']))
681 if(isset(
$_GET[
'object_id']))
685 $object_id = (int)
$_GET[
'object_id'];
695 foreach(
$_POST[
'date'] as $date)
697 $fromto = explode(
'_', $date);
701 $counter = $counter[$object_id];
707 $confirm[$object_id.
"_".$fromto[0].
"_".($fromto[1]+1)] = $counter;
711 $rsv_ids[] = $this->
processBooking($object_id, $fromto[0], $fromto[1], $group_id);
782 $this->ctrl->redirect($this,
'book');
791 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
793 $pfile = $obj->getPostFile();
794 $ptext = $obj->getPostText();
795 if(trim($ptext) || $pfile)
797 if(
sizeof($a_rsv_ids))
799 $this->ctrl->setParameterByClass(
'ilbookingobjectgui',
'rsv_ids', implode(
";", $a_rsv_ids));
801 $this->ctrl->setParameterByClass(
'ilbookingobjectgui',
'object_id', $obj->getId());
802 $this->ctrl->redirectByClass(
'ilbookingobjectgui',
'displayPostInfo');
806 $this->ctrl->redirect($this,
'render');
812 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
814 $form->setFormAction($this->ctrl->getFormAction($this,
"confirmedBooking"));
815 $form->setTitle($this->lng->txt(
"book_confirm_booking_schedule_number_of_objects"));
816 $form->setDescription($this->lng->txt(
"book_confirm_booking_schedule_number_of_objects_info"));
818 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
821 foreach($a_objects_counter as $id => $counter)
823 $id = explode(
"_", $id);
824 $book_id = $id[0].
"_".$id[1].
"_".$id[2].
"_".$counter;
831 $section->setTitle($obj->getTitle());
843 $nr_field->setValue(1);
844 $nr_field->setSize(3);
845 $nr_field->setMaxValue($counter);
846 $nr_field->setMinValue($counter ? 1 : 0);
847 $nr_field->setRequired(
true);
848 $form->addItem($nr_field);
850 if(!$min_date || $id[1] < $min_date)
857 $this->lng->loadLanguageModule(
"dateplaner");
858 $rec_mode =
new ilSelectInputGUI($this->lng->txt(
"cal_recurrences"),
"recm");
860 $rec_mode->setOptions(array(
861 "-1" => $this->lng->txt(
"cal_no_recurrence"),
862 1 => $this->lng->txt(
"cal_weekly"),
863 2 => $this->lng->txt(
"r_14"),
864 4 => $this->lng->txt(
"r_4_weeks")
866 $form->addItem($rec_mode);
874 $rec_mode->setHideSubForm(
true,
'>= 1');
884 $rec_mode->setDisabled(
true);
885 $rec_end->setDisabled(
true);
891 $grp->setValue($a_group_id);
892 $form->addItem($grp);
895 $form->addCommandButton(
"confirmedBookingNumbers", $this->lng->txt(
"confirm"));
896 $form->addCommandButton(
"render", $this->lng->txt(
"cancel"));
905 $this->tabs_gui->clearTargets();
906 $this->tabs_gui->setBackTarget($this->lng->txt(
'book_back_to_list'), $this->ctrl->getLinkTarget($this,
'render'));
913 $tpl->setContent($a_form->getHTML());
918 $date = date_parse($a_date);
919 $stamp = mktime(0, 0, 1, $date[
"month"], $date[
"day"]+$a_days, $date[
"year"]);
920 return date(
"Y-m-d", $stamp);
925 $date = getDate($a_stamp);
926 return mktime($date[
"hours"], $date[
"minutes"], $date[
"seconds"],
927 $date[
"mon"], $date[
"mday"]+$a_days, $date[
"year"]);
932 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
933 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
937 $current_first =
$obj_id = null;
938 foreach(array_keys(
$_POST) as $id)
940 if(substr($id, 0, 9) ==
"conf_nr__")
942 $id = explode(
"_", substr($id, 9));
943 $counter[$id[0].
"_".$id[1].
"_".$id[2]] = (int)$id[3];
946 $current_first = date(
"Y-m-d", $id[1]);
952 if((
int)
$_POST[
"recm"] > 0 && $current_first)
955 $end =
$_POST[
"rece"][
"date"];
956 $end = date(
"Y-m-d", mktime(23, 59, 59, $end[
"m"], $end[
"d"], $end[
"y"]));
957 $cycle = (int)
$_POST[
"recm"]*7;
960 while($cut < 1000 && $this->
addDaysDate($current_first, $cycle) <= $end)
963 $current_first = null;
964 foreach($org as $item_id => $max)
966 $parts = explode(
"_", $item_id);
972 $new_item_id =
$obj_id.
"_".$from.
"_".$to;
975 if(!isset($counter[$new_item_id]) && date(
"Y-m-d", $to) <= $end)
979 $new_max = (int)$new_max[
$obj_id];
981 $counter[$new_item_id] = $new_max;
985 $current_first = date(
"Y-m-d", $from);
989 $_POST[
"conf_nr__".$new_item_id.
"_".$new_max] =
$_POST[
"conf_nr__".$item_id.
"_".$max];
995 $group_id =
$_POST[
"grp_id"];
998 if($form->checkInput())
1002 foreach($counter as $id => $all_nr)
1004 $book_nr = $form->getInput(
"conf_nr__".$id.
"_".$all_nr);
1005 $parts = explode(
"_", $id);
1016 $book_nr = min($book_nr, $counter);
1017 for($loop = 0; $loop < $book_nr; $loop++)
1031 $this->ctrl->redirect($this,
'render');
1036 $form->setValuesByPost();
1040 $rece_year =
$_POST[
"rece"][
"date"][
"y"];
1041 $rece_month = str_pad(
$_POST[
"rece"][
"date"][
"m"], 2,
"0", STR_PAD_LEFT);
1042 $rece_day = str_pad(
$_POST[
"rece"][
"date"][
"d"], 2,
"0", STR_PAD_LEFT);
1044 $form->getItemByPostVar(
"rece")->setDate(
new ilDate($rece_year.
"-".$rece_month.
"-".$rece_day,
IL_CAL_DATE));
1045 $form->getItemByPostVar(
"recm")->setHideSubForm(
$_POST[
"recm"] < 1);
1048 $hidden_date->setValue($rece_year);
1049 $form->addItem($hidden_date);
1051 $hidden_date->setValue($rece_month);
1052 $form->addItem($hidden_date);
1054 $hidden_date->setValue($rece_day);
1055 $form->addItem($hidden_date);
1070 function processBooking($a_object_id, $a_from = null, $a_to = null, $a_group_id = null)
1075 if(!$ilAccess->checkAccess(
'read',
'', $this->object->getRefId()))
1077 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
1080 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1082 $reservation->setObjectId($a_object_id);
1083 $reservation->setUserId($ilUser->getID());
1084 $reservation->setFrom($a_from);
1085 $reservation->setTo($a_to);
1086 $reservation->setGroupId($a_group_id);
1087 $reservation->save();
1091 $this->lng->loadLanguageModule(
'dateplaner');
1092 include_once
'Services/Calendar/classes/class.ilCalendarUtil.php';
1093 include_once
'Services/Calendar/classes/class.ilCalendarCategory.php';
1096 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
1099 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
1103 $entry->setTitle($this->lng->txt(
'book_cal_entry').
' '.
$object->getTitle());
1104 $entry->setContextId($reservation->getId());
1107 include_once
'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1112 return $reservation->getId();
1120 global
$tpl, $ilAccess;
1122 $this->tabs_gui->setTabActive(
'log');
1124 $show_all = ($ilAccess->checkAccess(
'write',
'', $this->object->getRefId()) ||
1125 $this->object->hasPublicLog());
1128 if(
$_GET[
"object_id"])
1130 $filter[
"object"] = (int)
$_GET[
"object_id"];
1133 include_once
'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1135 $this->object->getId(), $show_all,
1138 $tpl->setContent($table->getHTML());
1143 global
$tpl, $ilAccess;
1145 $this->tabs_gui->clearTargets();
1146 $this->tabs_gui->setBackTarget($this->lng->txt(
"back"),
1147 $this->ctrl->getLinkTarget($this,
"log"));
1149 $show_all = ($ilAccess->checkAccess(
'write',
'', $this->object->getRefId()) ||
1150 $this->object->hasPublicLog());
1153 if(
$_GET[
"object_id"])
1155 $filter[
"object"] = (int)
$_GET[
"object_id"];
1158 include_once
'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1160 $this->object->getId(), $show_all,
1162 $filter,
$_GET[
"reservation_id"]);
1163 $tpl->setContent($table->getHTML());
1173 $this->tabs_gui->setTabActive(
'log');
1175 if(!
$_POST[
'reservation_id'])
1181 if ($ilAccess->checkAccess(
'write',
'', $this->object->getRefId()))
1183 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1188 return $this->ctrl->redirect($this,
'log');
1198 $show_all = ($ilAccess->checkAccess(
'write',
'', $this->object->getRefId()) ||
1199 $this->object->hasPublicLog());
1201 include_once
'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1203 $this->object->getId(), $show_all,
1205 $table->resetOffset();
1206 $table->writeFilterToSession();
1217 $show_all = ($ilAccess->checkAccess(
'write',
'', $this->object->getRefId()) ||
1218 $this->object->hasPublicLog());
1220 include_once
'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1222 $this->object->getId(), $show_all,
1224 $table->resetOffset();
1225 $table->resetFilter();
1233 if ($ilAccess->checkAccess(
"read",
"", $a_target))
1237 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
1244 $ilErr->raiseError($lng->txt(
"msg_no_perm_read"), $ilErr->FATAL);
1254 $this->ctrl->setCmd(
"showSummary");
1255 $this->ctrl->setCmdClass(
"ilinfoscreengui");
1263 $this->tabs_gui->setTabActive(
'info');
1265 if (!$ilAccess->checkAccess(
"visible",
"", $this->ref_id))
1267 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
1270 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1273 $info->enablePrivateNotes();
1275 if ($ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"]))
1277 $info->enableNews();
1281 $info->enableNewsEditing(
false);
1282 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"]))
1285 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
1287 if ($enable_internal_rss)
1289 $info->setBlockProperty(
"news",
"settings",
true);
1290 $info->setBlockProperty(
"news",
"public_notifications_option",
true);
1295 if ($ilCtrl->getNextClass() ==
"ilinfoscreengui")
1297 $ilCtrl->forwardCommand($info);
1301 return $ilCtrl->getHTML($info);
1311 else if(
$_GET[
"reservation_id"])
1313 return array(
$_GET[
"reservation_id"]);
1324 $this->ctrl->redirect($this,
'log');
1327 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
1328 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1331 foreach($ids as $idx => $id)
1333 if(!is_numeric($id))
1335 list(
$obj_id, $user_id, $from, $to) = explode(
"_", $id);
1337 $valid_ids = array();
1340 $valid_ids[$item[
"booking_object_id"]] = $item[
"title"];
1343 if(($ilAccess->checkAccess(
"write",
"", $this->ref_id) || $user_id == $ilUser->getId()) &&
1345 in_array(
$obj_id, array_keys($valid_ids)))
1348 if(!
sizeof($rsv_ids))
1352 if(
sizeof($rsv_ids) > 1)
1354 $max[$id] =
sizeof($rsv_ids);
1355 $ids[$idx] = $rsv_ids;
1360 $ids[$idx] = array_shift($rsv_ids);
1372 $this->ctrl->redirect($this,
'log');
1376 if(
sizeof($max) && max($max) > 1)
1381 $this->tabs_gui->clearTargets();
1382 $this->tabs_gui->setBackTarget($lng->txt(
"back"),
1383 $ilCtrl->getLinkTarget($this,
"log"));
1385 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
1387 $conf->setFormAction($ilCtrl->getFormAction($this,
'rsvCancel'));
1388 $conf->setHeaderText($lng->txt(
'book_confirm_cancel'));
1389 $conf->setConfirm($lng->txt(
'book_set_cancel'),
'rsvCancel');
1390 $conf->setCancel($lng->txt(
'cancel'),
'log');
1392 foreach($ids as $id)
1400 $details .=
", ".ilDatePresentation::formatPeriod(
1405 $conf->addItem(
'rsv_id[]', $id, $details);
1408 $tpl->setContent($conf->getHTML());
1413 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
1415 $form->setFormAction($this->ctrl->getFormAction($this,
"rsvCancel"));
1416 $form->setTitle($this->lng->txt(
"book_confirm_cancel_aggregation"));
1418 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
1419 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1423 foreach($a_ids as $idx => $ids)
1428 $first = array_shift($first);
1443 $item->setRequired(
true);
1444 $item->setMinValue(0);
1446 $form->addItem($item);
1450 $item->setMaxValue(
sizeof($ids));
1452 foreach($ids as $id)
1455 $hidden->setValue($id);
1456 $form->addItem($hidden);
1461 $item->setMaxValue(1);
1464 $hidden->setValue($ids);
1465 $form->addItem($hidden);
1468 if(
$_POST[
"rsv_id_".$idx])
1470 $item->setValue((
int)
$_POST[
"rsv_id_".$idx]);
1474 $form->addCommandButton(
"rsvCancel", $this->lng->txt(
"confirm"));
1475 $form->addCommandButton(
"log", $this->lng->txt(
"cancel"));
1484 $this->tabs_gui->clearTargets();
1485 $this->tabs_gui->setBackTarget($lng->txt(
"back"),
1486 $ilCtrl->getLinkTarget($this,
"log"));
1493 $tpl->setContent($form->getHTML());
1506 if(!$form->checkInput())
1508 $this->tabs_gui->clearTargets();
1509 $this->tabs_gui->setBackTarget($lng->txt(
"back"),
1510 $ilCtrl->getLinkTarget($this,
"log"));
1512 return $tpl->setContent($form->getHTML());
1516 foreach(
$_POST[
"rsv_aggr"] as $idx => $aggr_ids)
1518 $max = (int)
$_POST[
"rsv_id_".$idx];
1521 if(!is_array($aggr_ids))
1527 $aggr_ids = array_slice($aggr_ids, 0, $max);
1528 $ids = array_merge($ids, $aggr_ids);
1536 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1537 foreach($ids as $id)
1541 if (!$ilAccess->checkAccess(
"write",
"", $this->ref_id) && $obj->getUserId() != $ilUser->getId())
1544 $this->ctrl->redirect($this,
'log');
1553 $cal_entry_id = $obj->getCalendarEntry();
1556 include_once
'Services/Calendar/classes/class.ilCalendarEntry.php';
1600 if(!$ilAccess->checkAccess(
"write",
"", $this->ref_id))
1603 $this->ctrl->redirect($this,
'log');
1609 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1610 foreach($ids as $id)
1626 if(!$ilAccess->checkAccess(
"write",
"", $this->ref_id))
1629 $this->ctrl->redirect($this,
'log');
1635 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
1636 foreach($ids as $id)
1639 $obj->setStatus(NULL);
1652 $this->tabs_gui->clearTargets();
1654 $user_id = (int)
$_GET[
'user_id'];
1656 include_once
'Services/User/classes/class.ilPublicUserProfileGUI.php';
1658 $profile->setBackUrl($this->ctrl->getLinkTarget($this,
'log'));
1659 $tpl->setContent($ilCtrl->getHTML($profile));
1666 if (is_object($this->
object))
1668 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
"render"),
"",
$_GET[
"ref_id"]);