4 include_once(
"./Services/Table/classes/class.ilTable2GUI.php");
5 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
36 function __construct($a_parent_obj, $a_parent_cmd, $a_ref_id, $a_pool_id, $a_show_all, $a_has_schedule, array $a_filter_pre = null, $a_group_id = null)
40 $this->pool_id = $a_pool_id;
41 $this->ref_id = $a_ref_id;
42 $this->show_all = $a_show_all;
43 $this->has_schedule = (bool)$a_has_schedule;
44 $this->group_id = $a_group_id;
46 $this->
setId(
"bkrsv".$a_ref_id);
50 $this->
setTitle($lng->txt(
"book_reservations_list"));
53 $this->
addColumn($this->lng->txt(
"title"));
55 if($this->has_schedule)
57 $this->
addColumn($this->lng->txt(
"book_period"));
60 $this->
addColumn($this->lng->txt(
"user"));
61 $this->
addColumn($this->lng->txt(
"status"));
62 $this->
addColumn($this->lng->txt(
"actions"));
66 $this->
setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
67 $this->
setRowTemplate(
"tpl.booking_reservation_row.html",
"Modules/BookingManager");
78 $this->filters = array();
86 $this->
addMultiCommand(
'rsvNotInUse', $lng->txt(
'book_set_not_in_use'));
87 $this->
addMultiCommand(
'rsvConfirmCancel', $lng->txt(
'book_set_cancel'));
99 if(is_array($a_filter_pre) &&
100 isset($a_filter_pre[
"object"]))
102 $_SESSION[
"form_".$this->getId()][
"object"] = serialize($a_filter_pre[
"object"]);
103 if($this->has_schedule)
105 $_SESSION[
"form_".$this->getId()][
"fromto"] = serialize(array(
112 $this->objects = array();
113 include_once
"Modules/BookingManager/classes/class.ilBookingObject.php";
116 $this->objects[$item[
"booking_object_id"]] = $item[
"title"];
119 $item->setOptions(array(
""=>$this->lng->txt(
'book_all'))+$this->objects);
120 $this->filter[
"object"] = $item->getValue();
122 if($this->hasSchedule)
135 $options = array(
""=>$this->lng->txt(
'book_all'));
136 foreach($valid_status as $loop)
140 $options[$loop] = $this->lng->txt(
'book_reservation_status_'.$loop);
144 $options[$loop] = $this->lng->txt(
'book_not').
' '.$this->lng->txt(
'book_reservation_status_'.-$loop);
149 $this->filter[
"status"] = $item->getValue();
151 if($this->has_schedule)
154 $this->filter[
"fromto"] = $item->getDate();
165 if($this->filter[
"object"])
167 $filter[
"object"] = $this->filter[
"object"];
169 if($this->filter[
"status"])
171 $filter[
"status"] = $this->filter[
"status"];
174 if($this->has_schedule)
176 if($this->filter[
"fromto"][
"from"] || $this->filter[
"fromto"][
"to"])
178 if($this->filter[
"fromto"][
"from"])
182 if($this->filter[
"fromto"][
"to"])
202 if(!$filter[
"object"])
204 $ids = array_keys($this->objects);
208 $ids = array($filter[
"object"]);
211 include_once
"Modules/BookingManager/classes/class.ilBookingReservation.php";
216 foreach(
$data[
'data'] as $idx => $item)
218 if($item[
"user_id"] != $ilUser->getId())
220 unset(
$data[
'data'][$idx]);
226 if(!$this->has_schedule)
243 $this->tpl->setVariable(
"TXT_TITLE", $a_set[
"title"]);
244 $this->tpl->setVariable(
"RESERVATION_ID", $a_set[
"booking_reservation_id"]);
248 $this->tpl->setVariable(
"TXT_STATUS", $lng->txt(
'book_reservation_status_'.$a_set[
'status']));
252 $uname = ilObjUser::_lookupFullName($a_set[
'user_id']);
255 $uname =
"[".$lng->txt(
"user_deleted").
"]";
259 $ilCtrl->setParameter($this->parent_obj,
'user_id', $a_set[
'user_id']);
260 $this->tpl->setVariable(
"HREF_PROFILE", $ilCtrl->getLinkTarget($this->parent_obj,
'showprofile'));
261 $ilCtrl->setParameter($this->parent_obj,
'user_id',
'');
263 $this->tpl->setVariable(
"TXT_CURRENT_USER", $uname);
265 if($this->has_schedule)
272 if (!$this->has_schedule || $date_to->get(
IL_CAL_UNIX) > time())
274 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
276 $alist->setId($a_set[
'booking_reservation_id']);
277 $alist->setListTitle($lng->txt(
"actions"));
279 $ilCtrl->setParameter($this->parent_obj,
'reservation_id', $a_set[
'booking_reservation_id']);
281 if(!$a_set[
'group_id'])
283 if($ilAccess->checkAccess(
'write',
'', $this->ref_id))
297 if($this->has_schedule)
299 $alist->addItem($lng->txt(
'book_set_in_use'),
'in_use', $ilCtrl->getLinkTarget($this->parent_obj,
'rsvInUse'));
301 $alist->addItem($lng->txt(
'book_set_cancel'),
'cancel', $ilCtrl->getLinkTarget($this->parent_obj,
'rsvConfirmCancel'));
303 else if($this->has_schedule)
305 $alist->addItem($lng->txt(
'book_set_not_in_use'),
'not_in_use', $ilCtrl->getLinkTarget($this->parent_obj,
'rsvNotInUse'));
310 $alist->addItem($lng->txt(
'book_set_cancel'),
'cancel', $ilCtrl->getLinkTarget($this->parent_obj,
'rsvConfirmCancel'));
313 else if($ilAccess->checkAccess(
'write',
'', $this->ref_id) || $a_set[
'user_id'] == $ilUser->getId())
315 $alist->addItem($lng->txt(
'details'),
'details', $ilCtrl->getLinkTarget($this->parent_obj,
'logDetails'));
318 if(
sizeof($alist->getItems()))
320 if(!$a_set[
'group_id'])
322 $this->tpl->setVariable(
'MULTI_ID', $a_set[
'booking_reservation_id']);
324 $this->tpl->setVariable(
'LAYER', $alist->getHTML());
331 $a_worksheet->write($a_row, 0, $this->lng->txt(
"title"));
333 if($this->has_schedule)
335 $a_worksheet->write($a_row, ++$col, $this->lng->txt(
"from"));
336 $a_worksheet->write($a_row, ++$col, $this->lng->txt(
"to"));
338 $a_worksheet->write($a_row, ++$col, $this->lng->txt(
"user"));
339 $a_worksheet->write($a_row, ++$col, $this->lng->txt(
"status"));
345 $a_worksheet->write($a_row, 0, $a_set[
"title"]);
347 if($this->has_schedule)
354 $a_worksheet->write($a_row, ++$col, ilObjUser::_lookupFullName($a_set[
'user_id']));
359 $status = $this->lng->txt(
'book_reservation_status_'.$a_set[
'status']);
361 $a_worksheet->write($a_row, ++$col, $status);
368 $a_csv->addColumn($this->lng->txt(
"title"));
369 if($this->has_schedule)
371 $a_csv->addColumn($this->lng->txt(
"from"));
372 $a_csv->addColumn($this->lng->txt(
"to"));
374 $a_csv->addColumn($this->lng->txt(
"user"));
375 $a_csv->addColumn($this->lng->txt(
"status"));
381 $a_csv->addColumn($a_set[
"title"]);
382 if($this->has_schedule)
389 $a_csv->addColumn(ilObjUser::_lookupFullName($a_set[
'user_id']));
394 $status = $this->lng->txt(
'book_reservation_status_'.$a_set[
'status']);
396 $a_csv->addColumn($status);