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"]);
185 $this->objects =
array();
186 include_once
"Modules/BookingManager/classes/class.ilBookingObject.php";
189 $this->objects[$item[
"booking_object_id"]] = $item[
"title"];
192 $item->setOptions(
array(
""=>$this->lng->txt(
'book_all'))+$this->objects);
193 $this->filter[
"object"] = $item->getValue();
199 $this->lng->txt(
"object").
" ".$this->lng->txt(
"title").
"/".$this->lng->txt(
"description")
201 $this->filter[
"title"] =
$title->getValue();
203 if($this->has_schedule)
212 include_once
"Modules/BookingManager/classes/class.ilObjBookingPool.php";
214 $period = $bpool->getReservationFilterPeriod();
222 $to = serialize($to);
226 "from" => serialize($from),
232 $this->filter[
"fromto"] = $item->getDate();
238 $map = array_flip(
array(
'su',
'mo',
'tu',
'we',
'th',
'fr',
'sa'));
243 require_once
"Modules/BookingManager/classes/class.ilBookingSchedule.php";
247 foreach($schedule->getDefinition() as $day => $slots)
251 foreach($slots as $slot)
253 $idx = $map[$day].
"_".$slot;
254 $options[$idx] = $day_caption.
", ".$slot;
263 $this->filter[
"slot"] = $item->getValue();
267 $item =
new ilCheckboxInputGUI($this->lng->txt(
"book_filter_past_reservations"),
"past");
269 $item->readFromSession();
273 if(is_object($this->filter[
"fromto"][
"from"]) &&
276 $item->setChecked(
true);
279 $this->filter[
"past"] = $item->getChecked();
284 if(!$this->has_schedule)
292 foreach($valid_status as $loop)
296 $options[$loop] = $this->lng->txt(
'book_reservation_status_'.$loop);
300 $options[$loop] = $this->lng->txt(
'book_not').
' '.$this->lng->txt(
'book_reservation_status_'.-$loop);
305 $this->filter[
"status"] = $item->getValue();
314 $this->filter[
"user_id"] = $item->getValue();
325 if($this->filter[
"object"])
327 $filter[
"object"] = $this->filter[
"object"];
329 if($this->filter[
"title"])
331 $filter[
"title"] = $this->filter[
"title"];
333 if($this->filter[
"status"])
335 $filter[
"status"] = $this->filter[
"status"];
337 if($this->filter[
"user_id"])
339 $filter[
"user_id"] = $this->filter[
"user_id"];
342 if($this->has_schedule)
349 if($this->filter[
"slot"])
351 $filter[
"slot"] = $this->filter[
"slot"];
354 if($this->filter[
"fromto"][
"from"] || $this->filter[
"fromto"][
"to"])
356 if($this->filter[
"fromto"][
"from"])
360 if($this->filter[
"fromto"][
"to"])
367 $filter[
"past"] = (bool)$this->filter[
"past"];
375 return in_array($a_field,
array(
"counter",
"date",
"week",
"weekday"));
386 if(!$filter[
"object"])
388 $ids = array_keys($this->objects);
392 $ids =
array($filter[
"object"]);
397 $filter[
"user_id"] = $ilUser->getId();
400 include_once
"Modules/BookingManager/classes/class.ilBookingReservation.php";
406 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
408 $this->record_gui->setTableGUI($this);
409 $this->record_gui->parse();
411 foreach(array_keys(
$data) as $idx)
416 include_once(
"./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
425 return $this->record_gui;
430 $field = parent::getOrderField();
433 if(in_array($field,
array(
"date",
"week")))
435 $field =
"_sortdate";
451 $this->tpl->setVariable(
"TXT_TITLE", $a_set[
"title"]);
453 $can_be_cancelled = (($ilAccess->checkAccess(
'write',
'', $this->ref_id) ||
454 $a_set[
'user_id'] == $ilUser->getId()) &&
455 $a_set[
"can_be_cancelled"]);
457 if($can_be_cancelled)
459 $this->tpl->setVariable(
"MULTI_ID", $a_set[
"booking_reservation_id"]);
463 $uname = $a_set[
"user_name"];
466 $uname =
"[".$lng->txt(
"user_deleted").
"]";
473 include_once(
"./Services/User/classes/class.ilUserUtil.php");
476 $this->tpl->setVariable(
"TXT_CURRENT_USER", $uname);
478 if($this->has_schedule)
481 if(in_array(
"week", $selected))
483 $this->tpl->setVariable(
"VALUE_WEEK", $a_set[
"week"]);
485 if(in_array(
"weekday", $selected))
489 $this->tpl->setVariable(
"VALUE_SLOT", $a_set[
"slot"]);
490 $this->tpl->setVariable(
"VALUE_COUNTER", $a_set[
"counter"]);
496 $this->tpl->setVariable(
"TXT_STATUS", $lng->txt(
'book_reservation_status_'.$a_set[
'status']));
500 $this->tpl->setVariable(
"TXT_STATUS",
" ");
506 foreach($this->advmd as $item)
508 $advmd_id = (int)$item[
"id"];
510 if(!in_array(
"advmd".$advmd_id, $selected))
516 if(isset($a_set[
"md_".$advmd_id.
"_presentation"]))
518 $pb = $a_set[
"md_".$advmd_id.
"_presentation"]->getList();
525 $this->tpl->setCurrentBlock(
"advmd_bl");
526 $this->tpl->setVariable(
"VALUE_ADVMD", $val);
527 $this->tpl->parseCurrentBlock();
531 if($can_be_cancelled)
533 $ilCtrl->setParameter($this->parent_obj,
'reservation_id', $a_set[
'booking_reservation_id']);
534 $this->tpl->setVariable(
"URL_ACTION", $ilCtrl->getLinkTarget($this->parent_obj,
'rsvConfirmCancel'));
535 $ilCtrl->setParameter($this->parent_obj,
'reservation_id',
"");
536 $this->tpl->setVariable(
"TXT_ACTION", $lng->txt(
'book_set_cancel'));
598 $a_excel->
setCell($a_row, 0, $this->lng->txt(
"title"));
600 if($this->has_schedule)
602 $a_excel->
setCell($a_row, ++$col, $this->lng->txt(
"date"));
603 $a_excel->
setCell($a_row, ++$col, $this->lng->txt(
"wk_short"));
604 $a_excel->
setCell($a_row, ++$col, $this->lng->txt(
"cal_weekday"));
605 $a_excel->
setCell($a_row, ++$col, $this->lng->txt(
"book_schedule_slot"));
606 $a_excel->
setCell($a_row, ++$col, $this->lng->txt(
"book_no_of_objects"));
610 $a_excel->
setCell($a_row, ++$col, $this->lng->txt(
"status"));
615 $a_excel->
setCell($a_row, ++$col, $advmd_col[
"txt"]);
618 $a_excel->
setCell($a_row, ++$col, $this->lng->txt(
"user"));
625 $a_excel->
setCell($a_row, 0, $a_set[
"title"]);
627 if($this->has_schedule)
630 $a_excel->
setCell($a_row, ++$col, $a_set[
"week"]);
632 $a_excel->
setCell($a_row, ++$col, $a_set[
"slot"]);
633 $a_excel->
setCell($a_row, ++$col, $a_set[
"counter"]);
640 $status = $this->lng->txt(
'book_reservation_status_'.$a_set[
'status']);
642 $a_excel->
setCell($a_row, ++$col, $status);
644 $a_excel->
setCell($a_row, ++$col, $a_set[
'user_name']);
648 foreach($this->advmd as $item)
650 $advmd_id = (int)$item[
"id"];
652 if(isset($a_set[
"md_".$advmd_id.
"_presentation"]))
654 $pb = $a_set[
"md_".$advmd_id.
"_presentation"]->getList();
660 $a_excel->
setCell($a_row, ++$col, $val);
667 $a_csv->addColumn($this->lng->txt(
"title"));
668 if($this->has_schedule)
670 $a_csv->addColumn($this->lng->txt(
"date"));
671 $a_csv->addColumn($this->lng->txt(
"wk_short"));
672 $a_csv->addColumn($this->lng->txt(
"cal_weekday"));
673 $a_csv->addColumn($this->lng->txt(
"book_schedule_slot"));
674 $a_csv->addColumn($this->lng->txt(
"book_no_of_objects"));
678 $a_csv->addColumn($this->lng->txt(
"status"));
683 $a_csv->addColumn($advmd_col[
"txt"]);
686 $a_csv->addColumn($this->lng->txt(
"user"));
692 $a_csv->addColumn($a_set[
"title"]);
693 if($this->has_schedule)
696 $a_csv->addColumn($a_set[
"week"]);
698 $a_csv->addColumn($a_set[
"slot"]);
699 $a_csv->addColumn($a_set[
"counter"]);
706 $status = $this->lng->txt(
'book_reservation_status_'.$a_set[
'status']);
708 $a_csv->addColumn($status);
713 foreach($this->advmd as $item)
715 $advmd_id = (int)$item[
"id"];
717 if(isset($a_set[
"md_".$advmd_id.
"_presentation"]))
719 $pb = $a_set[
"md_".$advmd_id.
"_presentation"]->getList();
725 $a_csv->addColumn($val);
729 $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
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.
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.
getColumnCoord($a_col)
Get column "name" from number.
if(!is_array($argv)) $options
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.
static formatDate(ilDateTime $date)
Format a date public.
getSelectedColumns()
Get selected columns.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
fillRow($a_set)
Fill table row.
setCell($a_row, $a_col, $a_value)
Set cell value.
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.
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)
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.