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";
38 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)
42 $this->pool_id = $a_pool_id;
43 $this->ref_id = $a_ref_id;
44 $this->show_all = $a_show_all;
45 $this->has_schedule = (bool)$a_has_schedule;
46 $this->group_id = $a_group_id;
50 $this->
setId(
"bkrsv".$a_ref_id);
52 parent::__construct($a_parent_obj, $a_parent_cmd);
54 $this->
setTitle($lng->txt(
"book_reservations_list"));
57 $this->
addColumn($this->lng->txt(
"title"),
"title");
62 if($this->has_schedule)
64 $this->lng->loadLanguageModule(
"dateplaner");
66 $this->
addColumn($this->lng->txt(
"date"),
"date");
67 if(in_array(
"week", $selected))
69 $this->
addColumn($this->lng->txt(
"wk_short"),
"week");
72 if(in_array(
"weekday", $selected))
74 $this->
addColumn($this->lng->txt(
"cal_weekday"),
"weekday");
75 unset($cols[
"weekday"]);
77 $this->
addColumn($this->lng->txt(
"book_schedule_slot"),
"slot");
78 $this->
addColumn($this->lng->txt(
"book_no_of_objects"),
"counter");
85 $this->
addColumn($this->lng->txt(
"status"),
"status");
93 if(array_key_exists($col, $cols))
95 $this->
addColumn($cols[$col][
"txt"], $col);
99 $this->
addColumn($this->lng->txt(
"user"),
"user_name");
100 $this->
addColumn($this->lng->txt(
"actions"));
103 $this->
setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
104 $this->
setRowTemplate(
"tpl.booking_reservation_row.html",
"Modules/BookingManager");
115 $this->filters = array();
122 if($ilUser->getId() != ANONYMOUS_USER_ID)
132 $this->
addMultiCommand(
'rsvConfirmCancel', $lng->txt(
'book_set_cancel'));
146 if($this->has_schedule &&
147 !(
bool)$a_only_advmd)
149 $this->lng->loadLanguageModule(
"dateplaner");
151 $cols[
"week"] = array(
152 "txt" => $this->lng->txt(
"wk_short"),
156 $cols[
"weekday"] = array(
157 "txt" => $this->lng->txt(
"cal_weekday"),
162 foreach($this->advmd as $field)
164 $cols[
"advmd".$field[
"id"]] = array(
165 "txt" => $field[
"title"],
179 if(is_array($a_filter_pre) &&
180 isset($a_filter_pre[
"object"]))
182 $_SESSION[
"form_".$this->getId()][
"object"] = serialize($a_filter_pre[
"object"]);
183 if($this->has_schedule)
185 $_SESSION[
"form_".$this->getId()][
"fromto"] = serialize(array(
192 $this->objects = array();
193 include_once
"Modules/BookingManager/classes/class.ilBookingObject.php";
196 $this->objects[$item[
"booking_object_id"]] = $item[
"title"];
199 $item->setOptions(array(
""=>$this->lng->txt(
'book_all'))+$this->objects);
200 $this->filter[
"object"] = $item->getValue();
206 $this->lng->txt(
"object").
" ".$this->lng->txt(
"title").
"/".$this->lng->txt(
"description")
208 $this->filter[
"title"] =
$title->getValue();
210 if($this->has_schedule)
215 $_SESSION[
"form_".$this->getId()][
"fromto"] = serialize(array(
222 $this->filter[
"fromto"] = $item->getDate();
228 $map = array_flip(array(
'su',
'mo',
'tu',
'we',
'th',
'fr',
'sa'));
230 $options = array(
""=>$this->lng->txt(
'book_all'));
233 require_once
"Modules/BookingManager/classes/class.ilBookingSchedule.php";
237 foreach($schedule->getDefinition() as $day => $slots)
241 foreach($slots as $slot)
243 $idx = $map[$day].
"_".$slot;
244 $options[$idx] = $day_caption.
", ".$slot;
253 $this->filter[
"slot"] = $item->getValue();
260 if(!$this->has_schedule)
262 $options = array(
""=>$this->lng->txt(
'book_all'));
268 foreach($valid_status as $loop)
272 $options[$loop] = $this->lng->txt(
'book_reservation_status_'.$loop);
276 $options[$loop] = $this->lng->txt(
'book_not').
' '.$this->lng->txt(
'book_reservation_status_'.-$loop);
281 $this->filter[
"status"] = $item->getValue();
286 $options = array(
""=>$this->lng->txt(
'book_all'))+
290 $this->filter[
"user_id"] = $item->getValue();
301 if($this->filter[
"object"])
303 $filter[
"object"] = $this->filter[
"object"];
305 if($this->filter[
"title"])
307 $filter[
"title"] = $this->filter[
"title"];
309 if($this->filter[
"status"])
311 $filter[
"status"] = $this->filter[
"status"];
313 if($this->filter[
"user_id"])
315 $filter[
"user_id"] = $this->filter[
"user_id"];
318 if($this->has_schedule)
325 if($this->filter[
"slot"])
327 $filter[
"slot"] = $this->filter[
"slot"];
330 if($this->filter[
"fromto"][
"from"] || $this->filter[
"fromto"][
"to"])
332 if($this->filter[
"fromto"][
"from"])
336 if($this->filter[
"fromto"][
"to"])
349 return in_array($a_field, array(
"counter",
"date",
"week",
"weekday"));
360 if(!$filter[
"object"])
362 $ids = array_keys($this->objects);
366 $ids = array($filter[
"object"]);
371 $filter[
"user_id"] = $ilUser->getId();
374 include_once
"Modules/BookingManager/classes/class.ilBookingReservation.php";
380 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
382 $this->record_gui->setTableGUI($this);
383 $this->record_gui->parse();
385 foreach(array_keys(
$data) as $idx)
390 include_once(
"./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
399 return $this->record_gui;
404 $field = parent::getOrderField();
407 if(in_array($field, array(
"date",
"week")))
409 $field =
"_sortdate";
425 $this->tpl->setVariable(
"TXT_TITLE", $a_set[
"title"]);
427 $can_be_cancelled = (($ilAccess->checkAccess(
'write',
'', $this->ref_id) ||
428 $a_set[
'user_id'] == $ilUser->getId()) &&
429 $a_set[
"can_be_cancelled"]);
431 if($can_be_cancelled)
433 $this->tpl->setVariable(
"MULTI_ID", $a_set[
"booking_reservation_id"]);
437 $uname = $a_set[
"user_name"];
440 $uname =
"[".$lng->txt(
"user_deleted").
"]";
447 include_once(
"./Services/User/classes/class.ilUserUtil.php");
450 $this->tpl->setVariable(
"TXT_CURRENT_USER", $uname);
452 if($this->has_schedule)
455 if(in_array(
"week", $selected))
457 $this->tpl->setVariable(
"VALUE_WEEK", $a_set[
"week"]);
459 if(in_array(
"weekday", $selected))
463 $this->tpl->setVariable(
"VALUE_SLOT", $a_set[
"slot"]);
464 $this->tpl->setVariable(
"VALUE_COUNTER", $a_set[
"counter"]);
470 $this->tpl->setVariable(
"TXT_STATUS", $lng->txt(
'book_reservation_status_'.$a_set[
'status']));
474 $this->tpl->setVariable(
"TXT_STATUS",
" ");
480 foreach($this->advmd as $item)
482 $advmd_id = (int)$item[
"id"];
484 if(!in_array(
"advmd".$advmd_id, $selected))
490 if(isset($a_set[
"md_".$advmd_id.
"_presentation"]))
492 $pb = $a_set[
"md_".$advmd_id.
"_presentation"]->getList();
499 $this->tpl->setCurrentBlock(
"advmd_bl");
500 $this->tpl->setVariable(
"VALUE_ADVMD", $val);
501 $this->tpl->parseCurrentBlock();
505 if($can_be_cancelled)
507 $ilCtrl->setParameter($this->parent_obj,
'reservation_id', $a_set[
'booking_reservation_id']);
508 $this->tpl->setVariable(
"URL_ACTION", $ilCtrl->getLinkTarget($this->parent_obj,
'rsvConfirmCancel'));
509 $ilCtrl->setParameter($this->parent_obj,
'reservation_id',
"");
510 $this->tpl->setVariable(
"TXT_ACTION", $lng->txt(
'book_set_cancel'));
572 $a_worksheet->write($a_row, 0, $this->lng->txt(
"title"));
574 if($this->has_schedule)
576 $a_worksheet->write($a_row, ++$col, $this->lng->txt(
"date"));
577 $a_worksheet->write($a_row, ++$col, $this->lng->txt(
"wk_short"));
578 $a_worksheet->write($a_row, ++$col, $this->lng->txt(
"cal_weekday"));
579 $a_worksheet->write($a_row, ++$col, $this->lng->txt(
"book_schedule_slot"));
580 $a_worksheet->write($a_row, ++$col, $this->lng->txt(
"book_no_of_objects"));
584 $a_worksheet->write($a_row, ++$col, $this->lng->txt(
"status"));
589 $a_worksheet->write($a_row, ++$col, $advmd_col[
"txt"]);
592 $a_worksheet->write($a_row, ++$col, $this->lng->txt(
"user"));
597 $a_worksheet->write($a_row, 0, $a_set[
"title"]);
599 if($this->has_schedule)
602 $a_worksheet->write($a_row, ++$col, $a_set[
"week"]);
604 $a_worksheet->write($a_row, ++$col, $a_set[
"slot"]);
605 $a_worksheet->write($a_row, ++$col, $a_set[
"counter"]);
612 $status = $this->lng->txt(
'book_reservation_status_'.$a_set[
'status']);
614 $a_worksheet->write($a_row, ++$col, $status);
616 $a_worksheet->write($a_row, ++$col, $a_set[
'user_name']);
620 foreach($this->advmd as $item)
622 $advmd_id = (int)$item[
"id"];
624 if(isset($a_set[
"md_".$advmd_id.
"_presentation"]))
626 $pb = $a_set[
"md_".$advmd_id.
"_presentation"]->getList();
632 $a_worksheet->write($a_row, ++$col, $val);
639 $a_csv->addColumn($this->lng->txt(
"title"));
640 if($this->has_schedule)
642 $a_csv->addColumn($this->lng->txt(
"date"));
643 $a_csv->addColumn($this->lng->txt(
"wk_short"));
644 $a_csv->addColumn($this->lng->txt(
"cal_weekday"));
645 $a_csv->addColumn($this->lng->txt(
"book_schedule_slot"));
646 $a_csv->addColumn($this->lng->txt(
"book_no_of_objects"));
650 $a_csv->addColumn($this->lng->txt(
"status"));
655 $a_csv->addColumn($advmd_col[
"txt"]);
658 $a_csv->addColumn($this->lng->txt(
"user"));
664 $a_csv->addColumn($a_set[
"title"]);
665 if($this->has_schedule)
668 $a_csv->addColumn($a_set[
"week"]);
670 $a_csv->addColumn($a_set[
"slot"]);
671 $a_csv->addColumn($a_set[
"counter"]);
678 $status = $this->lng->txt(
'book_reservation_status_'.$a_set[
'status']);
680 $a_csv->addColumn($status);
685 foreach($this->advmd as $item)
687 $advmd_id = (int)$item[
"id"];
689 if(isset($a_set[
"md_".$advmd_id.
"_presentation"]))
691 $pb = $a_set[
"md_".$advmd_id.
"_presentation"]->getList();
697 $a_csv->addColumn($val);
701 $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.
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=NULL)
Add filter by standard 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.
schedule for booking ressource
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.
static getAdvancedMDFields($a_glossary_id)
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
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)
Default behaviour is:
getSelectableColumns($a_only_advmd=false)
setResetCommand($a_val, $a_caption=null)
Set reset filter command.
if(!is_array($argv)) $options
getCurrentFilter()
Get current filter settings.
setDisableFilterHiding($a_val=true)
Set disable filter hiding.
addMultiCommand($a_cmd, $a_text)
Add Command button.
static formatDate(ilDateTime $date)
Format a date public.
fillRowExcel($a_worksheet, &$a_row, $a_set)
getSelectedColumns()
Get selected columns.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
fillRow($a_set)
Fill table row.
static queryForRecords($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.
fillHeaderExcel($a_worksheet, &$a_row)
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
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.
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.
static getList($a_pool_id)
Get list of booking objects for given pool.
setLimit($a_limit=0, $a_default_limit=0)
setFilterCommand($a_val, $a_caption=null)
Set filter command.