4 include_once(
"./Services/Table/classes/class.ilTable2GUI.php");
5 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
6 require_once
"Services/Calendar/classes/class.ilCalendarUtil.php";
37 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)
41 $this->pool_id = $a_pool_id;
42 $this->ref_id = $a_ref_id;
43 $this->show_all = $a_show_all;
44 $this->has_schedule = (bool)$a_has_schedule;
45 $this->group_id = $a_group_id;
47 $this->
setId(
"bkrsv".$a_ref_id);
51 $this->
setTitle($lng->txt(
"book_reservations_list"));
54 $this->
addColumn($this->lng->txt(
"title"),
"title");
56 if($this->has_schedule)
58 $this->lng->loadLanguageModule(
"dateplaner");
60 $this->
addColumn($this->lng->txt(
"date"),
"date");
61 $this->
addColumn($this->lng->txt(
"wk_short"),
"week");
62 $this->
addColumn($this->lng->txt(
"cal_weekday"),
"weekday");
63 $this->
addColumn($this->lng->txt(
"book_schedule_slot"),
"slot");
64 $this->
addColumn($this->lng->txt(
"book_no_of_objects"),
"counter");
71 $this->
addColumn($this->lng->txt(
"status"),
"status");
77 $this->
addColumn($this->lng->txt(
"user"),
"user_name");
78 $this->
addColumn($this->lng->txt(
"actions"));
84 $this->
setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
85 $this->
setRowTemplate(
"tpl.booking_reservation_row.html",
"Modules/BookingManager");
96 $this->filters = array();
103 if($ilUser->getId() != ANONYMOUS_USER_ID)
113 $this->
addMultiCommand(
'rsvConfirmCancel', $lng->txt(
'book_set_cancel'));
128 if(is_array($a_filter_pre) &&
129 isset($a_filter_pre[
"object"]))
131 $_SESSION[
"form_".$this->getId()][
"object"] = serialize($a_filter_pre[
"object"]);
132 if($this->has_schedule)
134 $_SESSION[
"form_".$this->getId()][
"fromto"] = serialize(array(
141 $this->objects = array();
142 include_once
"Modules/BookingManager/classes/class.ilBookingObject.php";
145 $this->objects[$item[
"booking_object_id"]] = $item[
"title"];
148 $item->setOptions(array(
""=>$this->lng->txt(
'book_all'))+$this->objects);
149 $this->filter[
"object"] = $item->getValue();
151 if($this->has_schedule)
156 $_SESSION[
"form_".$this->getId()][
"fromto"] = serialize(array(
163 $this->filter[
"fromto"] = $item->getDate();
169 $map = array_flip(array(
'su',
'mo',
'tu',
'we',
'th',
'fr',
'sa'));
171 $options = array(
""=>$this->lng->txt(
'book_all'));
174 require_once
"Modules/BookingManager/classes/class.ilBookingSchedule.php";
178 foreach($schedule->getDefinition() as $day => $slots)
182 foreach($slots as $slot)
184 $idx = $map[$day].
"_".$slot;
185 $options[$idx] = $day_caption.
", ".$slot;
194 $this->filter[
"slot"] = $item->getValue();
201 if(!$this->has_schedule)
203 $options = array(
""=>$this->lng->txt(
'book_all'));
209 foreach($valid_status as $loop)
213 $options[$loop] = $this->lng->txt(
'book_reservation_status_'.$loop);
217 $options[$loop] = $this->lng->txt(
'book_not').
' '.$this->lng->txt(
'book_reservation_status_'.-$loop);
222 $this->filter[
"status"] = $item->getValue();
227 $options = array(
""=>$this->lng->txt(
'book_all'))+
231 $this->filter[
"user_id"] = $item->getValue();
242 if($this->filter[
"object"])
244 $filter[
"object"] = $this->filter[
"object"];
246 if($this->filter[
"status"])
248 $filter[
"status"] = $this->filter[
"status"];
250 if($this->filter[
"user_id"])
252 $filter[
"user_id"] = $this->filter[
"user_id"];
255 if($this->has_schedule)
262 if($this->filter[
"slot"])
264 $filter[
"slot"] = $this->filter[
"slot"];
267 if($this->filter[
"fromto"][
"from"] || $this->filter[
"fromto"][
"to"])
269 if($this->filter[
"fromto"][
"from"])
273 if($this->filter[
"fromto"][
"to"])
294 if(!$filter[
"object"])
296 $ids = array_keys($this->objects);
300 $ids = array($filter[
"object"]);
305 $filter[
"user_id"] = $ilUser->getId();
308 include_once
"Modules/BookingManager/classes/class.ilBookingReservation.php";
323 $this->tpl->setVariable(
"TXT_TITLE", $a_set[
"title"]);
325 $can_be_cancelled = (($ilAccess->checkAccess(
'write',
'', $this->ref_id) ||
326 $a_set[
'user_id'] == $ilUser->getId()) &&
327 $a_set[
"can_be_cancelled"]);
329 if($can_be_cancelled)
331 $this->tpl->setVariable(
"MULTI_ID", $a_set[
"booking_reservation_id"]);
335 $uname = $a_set[
"user_name"];
338 $uname =
"[".$lng->txt(
"user_deleted").
"]";
342 $ilCtrl->setParameter($this->parent_obj,
'user_id', $a_set[
'user_id']);
343 $this->tpl->setVariable(
"HREF_PROFILE", $ilCtrl->getLinkTarget($this->parent_obj,
'showprofile'));
344 $ilCtrl->setParameter($this->parent_obj,
'user_id',
'');
346 $this->tpl->setVariable(
"TXT_CURRENT_USER", $uname);
348 if($this->has_schedule)
351 $this->tpl->setVariable(
"VALUE_WEEK", $a_set[
"week"]);
353 $this->tpl->setVariable(
"VALUE_SLOT", $a_set[
"slot"]);
354 $this->tpl->setVariable(
"VALUE_COUNTER", $a_set[
"counter"]);
360 $this->tpl->setVariable(
"TXT_STATUS", $lng->txt(
'book_reservation_status_'.$a_set[
'status']));
364 $this->tpl->setVariable(
"TXT_STATUS",
" ");
368 if($can_be_cancelled)
370 $ilCtrl->setParameter($this->parent_obj,
'reservation_id', $a_set[
'booking_reservation_id']);
371 $this->tpl->setVariable(
"URL_ACTION", $ilCtrl->getLinkTarget($this->parent_obj,
'rsvConfirmCancel'));
372 $ilCtrl->setParameter($this->parent_obj,
'reservation_id',
"");
373 $this->tpl->setVariable(
"TXT_ACTION", $lng->txt(
'book_set_cancel'));
435 $a_worksheet->write($a_row, 0, $this->lng->txt(
"title"));
437 if($this->has_schedule)
439 $a_worksheet->write($a_row, ++$col, $this->lng->txt(
"date"));
440 $a_worksheet->write($a_row, ++$col, $this->lng->txt(
"book_schedule_weekday"));
441 $a_worksheet->write($a_row, ++$col, $this->lng->txt(
"book_schedule_slot"));
442 $a_worksheet->write($a_row, ++$col, $this->lng->txt(
"book_no_of_objects"));
446 $a_worksheet->write($a_row, ++$col, $this->lng->txt(
"status"));
448 $a_worksheet->write($a_row, ++$col, $this->lng->txt(
"user"));
453 $a_worksheet->write($a_row, 0, $a_set[
"title"]);
455 if($this->has_schedule)
459 $a_worksheet->write($a_row, ++$col, $a_set[
"slot"]);
460 $a_worksheet->write($a_row, ++$col, $a_set[
"counter"]);
467 $status = $this->lng->txt(
'book_reservation_status_'.$a_set[
'status']);
469 $a_worksheet->write($a_row, ++$col, $status);
471 $a_worksheet->write($a_row, ++$col, $a_set[
'user_name']);
476 $a_csv->addColumn($this->lng->txt(
"title"));
477 if($this->has_schedule)
479 $a_csv->addColumn($this->lng->txt(
"date"));
480 $a_csv->addColumn($this->lng->txt(
"book_schedule_weekday"));
481 $a_csv->addColumn($this->lng->txt(
"book_schedule_slot"));
482 $a_csv->addColumn($this->lng->txt(
"book_no_of_objects"));
486 $a_csv->addColumn($this->lng->txt(
"status"));
488 $a_csv->addColumn($this->lng->txt(
"user"));
494 $a_csv->addColumn($a_set[
"title"]);
495 if($this->has_schedule)
499 $a_csv->addColumn($a_set[
"slot"]);
500 $a_csv->addColumn($a_set[
"counter"]);
507 $status = $this->lng->txt(
'book_reservation_status_'.$a_set[
'status']);
509 $a_csv->addColumn($status);
511 $a_csv->addColumn($a_set[
'user_name']);