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";
48 public 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)
52 $this->ctrl = $DIC->ctrl();
53 $this->lng = $DIC->language();
54 $this->
user = $DIC->user();
55 $this->access = $DIC->access();
57 $lng = $DIC->language();
59 $ilAccess = $DIC->access();
61 $this->pool_id = $a_pool_id;
62 $this->ref_id = $a_ref_id;
63 $this->show_all = $a_show_all;
64 $this->has_schedule = (bool) $a_has_schedule;
65 $this->group_id = $a_group_id;
69 $this->
setId(
"bkrsv" . $a_ref_id);
71 parent::__construct($a_parent_obj, $a_parent_cmd);
76 $this->
addColumn($this->lng->txt(
"title"),
"title");
81 if ($this->has_schedule) {
82 $this->lng->loadLanguageModule(
"dateplaner");
84 $this->
addColumn($this->lng->txt(
"date"),
"date");
85 if (in_array(
"week", $selected)) {
86 $this->
addColumn($this->lng->txt(
"wk_short"),
"week");
89 if (in_array(
"weekday", $selected)) {
90 $this->
addColumn($this->lng->txt(
"cal_weekday"),
"weekday");
91 unset(
$cols[
"weekday"]);
93 $this->
addColumn($this->lng->txt(
"book_schedule_slot"),
"slot");
94 $this->
addColumn($this->lng->txt(
"book_no_of_objects"),
"counter");
99 $this->
addColumn($this->lng->txt(
"status"),
"status");
106 if (array_key_exists($col,
$cols)) {
111 $this->
addColumn($this->lng->txt(
"user"),
"user_name");
112 $this->
addColumn($this->lng->txt(
"actions"));
116 $this->
setRowTemplate(
"tpl.booking_reservation_row.html",
"Modules/BookingManager");
123 if ($this->group_id) {
126 $this->filters =
array();
131 if (
$ilUser->getId() != ANONYMOUS_USER_ID) {
154 if ($this->has_schedule &&
155 !(
bool) $a_only_advmd) {
156 $this->lng->loadLanguageModule(
"dateplaner");
159 "txt" => $this->lng->txt(
"wk_short"),
164 "txt" => $this->lng->txt(
"cal_weekday"),
169 foreach ($this->advmd as $field) {
171 "txt" => $field[
"title"],
185 if (is_array($a_filter_pre) &&
186 isset($a_filter_pre[
"object"])) {
187 $_SESSION[
"form_" . $this->
getId()][
"object"] = serialize($a_filter_pre[
"object"]);
190 $this->objects =
array();
191 include_once
"Modules/BookingManager/classes/class.ilBookingObject.php";
193 $this->objects[$item[
"booking_object_id"]] = $item[
"title"];
196 $item->setOptions(
array(
""=>$this->lng->txt(
'book_all'))+$this->objects);
197 $this->filter[
"object"] = $item->getValue();
203 $this->lng->txt(
"object") .
" " . $this->lng->txt(
"title") .
"/" . $this->lng->txt(
"description")
205 $this->filter[
"title"] =
$title->getValue();
207 if ($this->has_schedule) {
214 include_once
"Modules/BookingManager/classes/class.ilObjBookingPool.php";
216 $period = $bpool->getReservationFilterPeriod();
217 if ($period !== null) {
222 $to = serialize($to);
226 "from" => serialize(
$from),
231 $this->filter[
"fromto"] = $item->getDate();
234 if ($this->show_all) {
236 $map = array_flip(
array(
'su',
'mo',
'tu',
'we',
'th',
'fr',
'sa'));
241 require_once
"Modules/BookingManager/classes/class.ilBookingSchedule.php";
244 foreach ($schedule->getDefinition() as $day => $slots) {
247 foreach ($slots as $slot) {
248 $idx = $map[$day] .
"_" . $slot;
249 $options[$idx] = $day_caption .
", " . $slot;
258 $this->filter[
"slot"] = $item->getValue();
262 $item =
new ilCheckboxInputGUI($this->lng->txt(
"book_filter_past_reservations"),
"past");
264 $item->readFromSession();
268 if (is_object($this->filter[
"fromto"][
"from"]) &&
270 $item->setChecked(
true);
273 $this->filter[
"past"] = $item->getChecked();
278 if (!$this->has_schedule) {
283 foreach ($valid_status as $loop) {
285 $options[$loop] = $this->lng->txt(
'book_reservation_status_' . $loop);
287 $options[$loop] = $this->lng->txt(
'book_not') .
' ' . $this->lng->txt(
'book_reservation_status_' . -$loop);
292 $this->filter[
"status"] = $item->getValue();
295 if ($this->show_all) {
300 $this->filter[
"user_id"] = $item->getValue();
311 if ($this->filter[
"object"]) {
312 $filter[
"object"] = $this->filter[
"object"];
314 if ($this->filter[
"title"]) {
315 $filter[
"title"] = $this->filter[
"title"];
317 if ($this->filter[
"status"]) {
318 $filter[
"status"] = $this->filter[
"status"];
320 if ($this->filter[
"user_id"]) {
321 $filter[
"user_id"] = $this->filter[
"user_id"];
324 if ($this->has_schedule) {
329 if ($this->filter[
"slot"]) {
330 $filter[
"slot"] = $this->filter[
"slot"];
333 if ($this->filter[
"fromto"][
"from"] || $this->filter[
"fromto"][
"to"]) {
334 if ($this->filter[
"fromto"][
"from"]) {
337 if ($this->filter[
"fromto"][
"to"]) {
343 $filter[
"past"] = (bool) $this->filter[
"past"];
351 return in_array($a_field,
array(
"counter",
"date",
"week",
"weekday"));
362 if (!$filter[
"object"]) {
363 $ids = array_keys($this->objects);
365 $ids =
array($filter[
"object"]);
368 if (!$this->show_all) {
369 $filter[
"user_id"] =
$ilUser->getId();
372 include_once
"Modules/BookingManager/classes/class.ilBookingReservation.php";
377 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
379 $this->record_gui->setTableGUI($this);
380 $this->record_gui->parse();
382 foreach (array_keys(
$data) as $idx) {
386 include_once(
"./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
396 $this->record_gui->getFilterElements()
405 return $this->record_gui;
410 $field = parent::getOrderField();
413 if (in_array($field,
array(
"date",
"week"))) {
414 $field =
"_sortdate";
433 $this->tpl->setVariable(
"TXT_TITLE", $a_set[
"title"]);
435 $can_be_cancelled = (($ilAccess->checkAccess(
'write',
'', $this->ref_id) ||
436 $a_set[
'user_id'] ==
$ilUser->getId()) &&
437 $a_set[
"can_be_cancelled"]);
439 if ($can_be_cancelled) {
440 $this->tpl->setVariable(
"MULTI_ID", $a_set[
"booking_reservation_id"]);
444 $uname = $a_set[
"user_name"];
446 $uname =
"[" .
$lng->txt(
"user_deleted") .
"]";
451 include_once(
"./Services/User/classes/class.ilUserUtil.php");
454 $this->tpl->setVariable(
"TXT_CURRENT_USER", $uname);
456 if ($this->has_schedule) {
458 if (in_array(
"week", $selected)) {
459 $this->tpl->setVariable(
"VALUE_WEEK", $a_set[
"week"]);
461 if (in_array(
"weekday", $selected)) {
464 $this->tpl->setVariable(
"VALUE_SLOT", $a_set[
"slot"]);
465 $this->tpl->setVariable(
"VALUE_COUNTER", $a_set[
"counter"]);
468 $this->tpl->setVariable(
"TXT_STATUS",
$lng->txt(
'book_reservation_status_' . $a_set[
'status']));
470 $this->tpl->setVariable(
"TXT_STATUS",
" ");
475 foreach ($this->advmd as $item) {
476 $advmd_id = (int) $item[
"id"];
478 if (!in_array(
"advmd" . $advmd_id, $selected)) {
483 if (isset($a_set[
"md_" . $advmd_id .
"_presentation"])) {
484 $pb = $a_set[
"md_" . $advmd_id .
"_presentation"]->getList();
490 $this->tpl->setCurrentBlock(
"advmd_bl");
491 $this->tpl->setVariable(
"VALUE_ADVMD", $val);
492 $this->tpl->parseCurrentBlock();
496 if ($can_be_cancelled) {
497 $ilCtrl->setParameter($this->parent_obj,
'reservation_id', $a_set[
'booking_reservation_id']);
498 $this->tpl->setVariable(
"URL_ACTION",
$ilCtrl->getLinkTarget($this->parent_obj,
'rsvConfirmCancel'));
499 $ilCtrl->setParameter($this->parent_obj,
'reservation_id',
"");
500 $this->tpl->setVariable(
"TXT_ACTION",
$lng->txt(
'book_set_cancel'));
562 $a_excel->
setCell($a_row, 0, $this->lng->txt(
"title"));
564 if ($this->has_schedule) {
565 $a_excel->
setCell($a_row, ++$col, $this->lng->txt(
"date"));
566 $a_excel->
setCell($a_row, ++$col, $this->lng->txt(
"wk_short"));
567 $a_excel->
setCell($a_row, ++$col, $this->lng->txt(
"cal_weekday"));
568 $a_excel->
setCell($a_row, ++$col, $this->lng->txt(
"book_schedule_slot"));
569 $a_excel->
setCell($a_row, ++$col, $this->lng->txt(
"book_no_of_objects"));
571 $a_excel->
setCell($a_row, ++$col, $this->lng->txt(
"status"));
575 $a_excel->
setCell($a_row, ++$col, $advmd_col[
"txt"]);
578 $a_excel->
setCell($a_row, ++$col, $this->lng->txt(
"user"));
585 $a_excel->
setCell($a_row, 0, $a_set[
"title"]);
587 if ($this->has_schedule) {
589 $a_excel->
setCell($a_row, ++$col, $a_set[
"week"]);
591 $a_excel->
setCell($a_row, ++$col, $a_set[
"slot"]);
592 $a_excel->
setCell($a_row, ++$col, $a_set[
"counter"]);
596 $status = $this->lng->txt(
'book_reservation_status_' . $a_set[
'status']);
598 $a_excel->
setCell($a_row, ++$col, $status);
600 $a_excel->
setCell($a_row, ++$col, $a_set[
'user_name']);
603 foreach ($this->advmd as $item) {
604 $advmd_id = (int) $item[
"id"];
606 if (isset($a_set[
"md_" . $advmd_id .
"_presentation"])) {
607 $pb = $a_set[
"md_" . $advmd_id .
"_presentation"]->getList();
612 $a_excel->
setCell($a_row, ++$col, $val);
619 $a_csv->addColumn($this->lng->txt(
"title"));
620 if ($this->has_schedule) {
621 $a_csv->addColumn($this->lng->txt(
"date"));
622 $a_csv->addColumn($this->lng->txt(
"wk_short"));
623 $a_csv->addColumn($this->lng->txt(
"cal_weekday"));
624 $a_csv->addColumn($this->lng->txt(
"book_schedule_slot"));
625 $a_csv->addColumn($this->lng->txt(
"book_no_of_objects"));
627 $a_csv->addColumn($this->lng->txt(
"status"));
631 $a_csv->addColumn($advmd_col[
"txt"]);
634 $a_csv->addColumn($this->lng->txt(
"user"));
640 $a_csv->addColumn($a_set[
"title"]);
641 if ($this->has_schedule) {
643 $a_csv->addColumn($a_set[
"week"]);
645 $a_csv->addColumn($a_set[
"slot"]);
646 $a_csv->addColumn($a_set[
"counter"]);
650 $status = $this->lng->txt(
'book_reservation_status_' . $a_set[
'status']);
652 $a_csv->addColumn($status);
656 foreach ($this->advmd as $item) {
657 $advmd_id = (int) $item[
"id"];
659 if (isset($a_set[
"md_" . $advmd_id .
"_presentation"])) {
660 $pb = $a_set[
"md_" . $advmd_id .
"_presentation"]->getList();
665 $a_csv->addColumn($val);
669 $a_csv->addColumn($a_set[
'user_name']);
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
initFilter(array $a_filter_pre=null)
Init filter.
setExportFormats(array $formats)
Set available export formats.
fillRowCSV($a_csv, $a_set)
numericOrdering($a_field)
static getList($a_pool_id, $a_title=null)
Get list of booking objects for given type.
static _numericDayToString($a_day, $a_long=true)
get
static getUserFilter(array $a_object_ids)
Get all users who have reservations for object(s)
getSelectableColumns()
Get selectable columns.
getItems(array $filter)
Gather data and build rows.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
schedule for booking ressource
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=null)
Add filter by standard type.
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
static setUseRelativeDates($a_status)
set use relative dates
static getListByDate($a_has_schedule, array $a_object_ids, array $filter=null)
List all reservations by date.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
getSelectableColumns($a_only_advmd=false)
setResetCommand($a_val, $a_caption=null)
Set reset filter command.
getColumnCoord($a_col)
Get column "name" from number.
setBold($a_coords)
Set cell(s) to bold.
getCurrentFilter()
Get current filter settings.
fillHeaderExcel(ilExcel $a_excel, &$a_row)
setDisableFilterHiding($a_val=true)
Set disable filter hiding.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
addMultiCommand($a_cmd, $a_text)
Add Command button.
getSelectedColumns()
Get selected columns.
setCell($a_row, $a_col, $a_value, $a_datatype=null)
Set cell value.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
fillRow($a_set)
Fill table row.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
fillRowExcel(ilExcel $a_excel, &$a_row, $a_set)
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setEnableHeader($a_enableheader)
Set Enable Header.
__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)
Constructor.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
static getList($a_pool_id)
Get list of booking objects for given pool.
static getAdvancedMDFields($a_ref_id)
static queryForRecords($adv_rec_obj_ref_id, $adv_rec_obj_type, $adv_rec_obj_subtype, $a_obj_id, $a_subtype, $a_records, $a_obj_id_key, $a_obj_subid_key, array $a_amet_filter=null)
Query data for given object records.
setLimit($a_limit=0, $a_default_limit=0)
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
setFilterCommand($a_val, $a_caption=null)
Set filter command.