36 protected \ILIAS\BookingManager\Access\AccessManager
$access;
59 ?array $a_filter_pre =
null,
60 ?
int $a_group_id =
null,
61 ?array $context_obj_ids =
null 65 $service = $DIC->bookingManager()->internal();
69 $a_pool_id = $pool->
getId();
71 $this->
ctrl = $DIC->ctrl();
72 $this->
lng = $DIC->language();
73 $this->
user = $DIC->user();
74 $this->
access = $DIC->bookingManager()->internal()->domain()->access();
75 $ilCtrl = $DIC->ctrl();
76 $lng = $DIC->language();
77 $ilUser = $DIC->user();
78 $this->tree = $DIC->repositoryTree();
79 $this->reservation_repo = $DIC->bookingManager()
83 $this->schedule_manager = $DIC
87 ->schedules($a_pool_id);
90 $this->pool_id = $a_pool_id;
91 $this->ref_id = $a_ref_id;
92 $this->show_all = $a_show_all;
93 $this->has_schedule = $a_has_schedule;
94 $this->group_id = $a_group_id;
96 $this->table_repo = $DIC->bookingManager()
103 $this->
setId(
"bkrsv" . $a_ref_id);
112 $this->
lng->loadLanguageModule(
"crs");
117 if ($this->has_schedule) {
118 $this->
lng->loadLanguageModule(
"dateplaner");
121 if (in_array(
"week", $selected,
true)) {
123 unset($cols[
"week"]);
125 if (in_array(
"weekday", $selected,
true)) {
126 $this->
addColumn($this->
lng->txt(
"cal_weekday"),
"weekday");
127 unset($cols[
"weekday"]);
129 $this->
addColumn($this->
lng->txt(
"book_schedule_slot"),
"slot");
130 $this->
addColumn($this->
lng->txt(
"book_no_of_objects"),
"counter");
147 if (array_key_exists($col, $cols)) {
148 if (!isset($user_cols[$col])) {
149 $this->
addColumn($cols[$col][
"txt"], $col);
155 if ($this->group_id) {
158 $this->filters = array();
164 if ($this->has_items_with_host_context) {
165 $this->
addColumn($this->
lng->txt(
"book_booked_in"),
"context_obj_title");
172 if (array_key_exists($col, $cols)) {
173 if (isset($user_cols[$col])) {
174 $this->
addColumn($cols[$col][
"txt"], $col);
182 $this->
setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
183 $this->
setRowTemplate(
"tpl.booking_reservation_row.html",
"components/ILIAS/BookingManager/Reservations");
189 if ($this->
access->canManageAllReservations($this->ref_id) ||
190 $this->
access->canManageOwnReservations($this->ref_id)) {
193 if ($this->
access->canManageAllReservations($this->ref_id)) {
203 return $this->pool->usesMessages() &&
204 $this->
access->canManageAllReservations($this->ref_id);
211 if ($this->has_schedule) {
212 $this->
lng->loadLanguageModule(
"dateplaner");
214 $cols[
"week"] = array(
215 "txt" => $this->
lng->txt(
"wk_short"),
219 $cols[
"weekday"] = array(
220 "txt" => $this->
lng->txt(
"cal_weekday"),
225 foreach ($this->advmd as $field) {
226 $cols[
"advmd" . $field[
"id"]] = array(
227 "txt" => $field[
"title"],
244 if ($this->
access->canManageMembersOfParent($this->ref_id)) {
245 $parent = $this->
access->getParentGroupCourse($this->ref_id);
248 if ($k !==
"login") {
261 if (isset($user_cols[$col])) {
269 ?array $a_filter_pre =
null 271 if (is_array($a_filter_pre) &&
272 isset($a_filter_pre[
"object"])) {
273 $this->table_repo->setObjectFilter(
275 serialize($a_filter_pre[
"object"])
279 $this->objects = array();
281 $this->objects[$item[
"booking_object_id"]] = $item[
"title"];
284 if ($item !==
null) {
285 $item->setOptions(array(
"" => $this->
lng->txt(
'book_all')) + $this->objects);
286 $this->
filter[
"object"] = $item->getValue();
291 $this->
lng->txt(
"object") .
" " . $this->
lng->txt(
"title") .
"/" . $this->
lng->txt(
"description")
297 if ($this->has_schedule) {
299 if (!$this->table_repo->hasFromToFilter($this->getId())) {
305 $period = $bpool->getReservationFilterPeriod();
306 if ($period !==
null) {
311 $to = serialize($to);
314 $this->table_repo->setFromToFilter(
317 "from" => serialize($from),
326 $this->
lng->txt(
'book_fromto')
328 $this->
filter[
"fromto"] = $item->getDate();
331 if ($this->show_all) {
333 $map = array_flip(array(
'su',
'mo',
'tu',
'we',
'th',
'fr',
'sa'));
335 $options = array(
"" => $this->
lng->txt(
'book_all'));
338 foreach ($this->schedule_manager->getScheduleList() as
$id =>
$title) {
340 foreach ($schedule->getDefinition() as $day => $slots) {
343 foreach ($slots as $slot) {
344 $idx = $map[$day] .
"_" . $slot;
345 $options[$idx] = $day_caption .
", " . $slot;
353 $item->setOptions($options);
354 $this->filter[
"slot"] = $item->getValue();
360 $item->readFromSession();
364 if (isset($this->
filter[
"fromto"][
"from"]) &&
366 $item->setChecked(
true);
369 $this->
filter[
"past"] = $item->getChecked();
375 if (!$this->has_schedule) {
376 $options = array(
"" => $this->
lng->txt(
'book_all'));
380 foreach ($valid_status as $loop) {
382 $options[$loop] = $this->
lng->txt(
'book_reservation_status_' . $loop);
384 $options[$loop] = $this->
lng->txt(
'book_not') .
' ' . $this->
lng->txt(
'book_reservation_status_' . -$loop);
388 $item->setOptions($options);
389 $this->
filter[
"status"] = $item->getValue();
392 if ($this->show_all) {
393 $options = array(
"" => $this->
lng->txt(
'book_all')) +
396 $item->setOptions($options);
397 if (is_array($a_filter_pre) && isset($a_filter_pre[
"user_id"])) {
398 $item->setValue($a_filter_pre[
"user_id"]);
399 $this->
filter[
"user_id"] = $a_filter_pre[
"user_id"];
401 $this->
filter[
"user_id"] = $item->getValue();
413 if ($this->
filter[
"object"]) {
414 $filter[
"object"] = $this->
filter[
"object"];
416 if ($this->
filter[
"title"]) {
417 $filter[
"title"] = $this->
filter[
"title"];
419 if ($this->
filter[
"status"]) {
420 $filter[
"status"] = $this->
filter[
"status"];
422 if (isset($this->
filter[
"user_id"])) {
423 $filter[
"user_id"] = $this->
filter[
"user_id"];
425 if (!is_null($this->context_obj_ids)) {
429 if ($this->has_schedule) {
430 if (!isset($filter[
"status"])) {
434 if (isset($this->
filter[
"slot"])) {
435 $filter[
"slot"] = $this->
filter[
"slot"];
438 if ($this->
filter[
"fromto"][
"from"] || $this->
filter[
"fromto"][
"to"]) {
439 if ($this->
filter[
"fromto"][
"from"]) {
442 if ($this->
filter[
"fromto"][
"to"]) {
451 $filter[
"past"] = (bool) $this->
filter[
"past"];
458 return in_array($a_field, array(
"counter",
"date",
"week",
"weekday"));
468 $this->has_items_with_host_context =
false;
470 if (!isset($filter[
"object"])) {
471 $ids = array_keys($this->objects);
473 $ids = array($filter[
"object"]);
476 if (!$this->show_all) {
477 $filter[
"user_id"] = $ilUser->getId();
481 $data = $repo->getListByDate($this->has_schedule, $ids, $filter);
491 $this->record_gui->setTableGUI($this);
492 $this->record_gui->parse();
494 foreach (array_keys(
$data) as $idx) {
507 $this->record_gui->getFilterElements()
513 $user_ids = array_unique(
array_map(
static function (
$d) {
514 return $d[
'user_id'];
520 if (strpos($field,
'odf') === 0) {
521 $odf_ids[] = substr($field, 4);
523 $user_columns[] = $field;
528 $user_columns = array_diff(
530 [
'consultation_hour',
'prtf',
'roles',
'org_units']
535 $query->setLimit(9999);
536 $query->setAdditionalFields($user_columns);
537 $query->setUserFilter($user_ids);
538 $ud = $query->query();
540 foreach ($ud[
"set"] as $v) {
541 foreach ($user_columns as
$c) {
542 $usr_data[$v[
"usr_id"]][
$c] = $v[
$c];
545 foreach (
$data as $key => $v) {
546 if (isset($usr_data[$v[
"user_id"]])) {
547 $data[$key] = array_merge($v, $usr_data[$v[
"user_id"]]);
553 $parent = $this->
access->getParentGroupCourse($this->ref_id);
557 $confirmation_required = ($parent_obj_type ===
'crs')
560 if ($confirmation_required) {
565 foreach ($odf_data as $usr_id => $fields) {
568 if (in_array($usr_id, $user_ids)) {
569 foreach ($fields as $field_id => $value) {
570 if (in_array($field_id, $odf_ids,
true)) {
571 $usr_data[$usr_id][
'odf_' . $field_id] = $value;
577 foreach (
$data as $key => $v) {
578 if (isset($usr_data[$v[
"user_id"]])) {
579 $data[$key] = array_merge($v, $usr_data[$v[
"user_id"]]);
586 if (
$d[
"context_obj_id"] > 0) {
587 $this->has_items_with_host_context =
true;
602 $field = parent::getOrderField();
605 if (in_array($field, array(
"date",
"week"))) {
606 $field =
"_sortdate";
612 protected function fillRow(array $a_set): void
618 $f = $this->gui->ui()->factory();
624 if ($this->has_items_with_host_context) {
625 $this->tpl->setCurrentBlock(
"context");
626 $this->tpl->setVariable(
"VALUE_CONTEXT_TITLE", ($a_set[
"context_obj_title"] ??
"") .
" ");
627 $this->tpl->parseCurrentBlock();
630 $this->tpl->setVariable(
"TXT_TITLE", $a_set[
"title"]);
632 $can_be_cancelled = ($this->
access->canManageReservationForUser($this->ref_id, $a_set[
'user_id']) &&
633 $a_set[
"can_be_cancelled"]);
635 if ($can_be_cancelled) {
636 $this->tpl->setVariable(
"MULTI_ID", $a_set[
"booking_reservation_id"]);
640 $profile = $this->domain->profile();
643 $uname = $profile->getDeletedUserNamePresentation();
647 $this->tpl->setVariable(
"TXT_CURRENT_USER", $uname);
648 if ($this->has_schedule) {
649 $this->tpl->setVariable(
653 if (in_array(
"week", $selected,
true)) {
654 $this->tpl->setVariable(
"VALUE_WEEK", $a_set[
"week"]);
656 if (in_array(
"weekday", $selected,
true)) {
657 $this->tpl->setVariable(
662 $this->tpl->setVariable(
"VALUE_SLOT", $a_set[
"slot"]);
663 $this->tpl->setVariable(
"VALUE_COUNTER", $a_set[
"counter"]);
668 $this->tpl->setVariable(
"TXT_STATUS",
$lng->
txt(
'book_reservation_status_' . $a_set[
'status']));
670 $this->tpl->setVariable(
"TXT_STATUS",
" ");
673 $this->tpl->setCurrentBlock(
"message");
675 $this->tpl->parseCurrentBlock();
679 foreach ($this->advmd as $item) {
680 $advmd_id = (
int) $item[
"id"];
682 if (!in_array(
"advmd" . $advmd_id, $selected,
true)) {
687 $key =
"md_" . $advmd_id .
"_presentation";
688 if (isset($a_set[$key])) {
689 $pb = $a_set[$key]->getList();
695 $this->tpl->setCurrentBlock(
"advmd_bl");
696 $this->tpl->setVariable(
"VALUE_ADVMD", $val);
697 $this->tpl->parseCurrentBlock();
704 if (isset($user_cols[$col])) {
705 $this->tpl->setCurrentBlock(
"user_col");
706 $this->tpl->setVariable(
"VALUE_USER_COL", ($a_set[$col] ??
"") .
" ");
707 $this->tpl->parseCurrentBlock();
712 if ($a_set[
'user_id'] == $ilUser->getId() || $ilAccess->canManageAllReservations($this->ref_id)) {
713 if ($a_set[
'post_text'] !==
"" || $a_set[
'post_file'] !==
"") {
714 $ilCtrl->setParameter($this->parent_obj,
'reservation_id', $a_set[
'booking_reservation_id']);
715 $ilCtrl->setParameter($this->parent_obj,
'object_id', $a_set[
'object_id']);
716 $dd_items[] =
$f->button()->shy(
717 $lng->
txt(
'book_post_booking_information'),
718 $ilCtrl->getLinkTarget($this->parent_obj,
'displayPostInfo')
720 $ilCtrl->setParameter($this->parent_obj,
'object_id',
null);
721 $ilCtrl->setParameter($this->parent_obj,
'reservation_id',
"");
725 if ($can_be_cancelled) {
726 $ilCtrl->setParameter($this->parent_obj,
'reservation_id', $a_set[
'booking_reservation_id']);
727 $dd_items[] =
$f->button()->shy(
729 $ilCtrl->getLinkTarget($this->parent_obj,
'rsvConfirmCancel')
731 $ilCtrl->setParameter($this->parent_obj,
'reservation_id',
"");
734 if ($this->
access->canManageAllReservations($this->ref_id)) {
735 $ilCtrl->setParameter($this->parent_obj,
'reservation_id', $a_set[
'booking_reservation_id']);
736 $dd_items[] =
$f->button()->shy(
737 $lng->
txt(
'book_mail_to_booker'),
738 $ilCtrl->getLinkTarget($this->parent_obj,
'redirectMailToBooker')
740 $dd_items[] =
$f->button()->shy(
742 $ilCtrl->getLinkTarget($this->parent_obj,
'rsvConfirmDelete')
744 $ilCtrl->setParameter($this->parent_obj,
'reservation_id',
"");
748 if ($this->
showMessages() && $a_set[
"message"] !==
"") {
749 $c = $this->gui->modal(
750 $this->
lng->txt(
"book_message"),
751 $this->
lng->txt(
"close")
753 ->
legacy(nl2br($a_set[
"message"]))
754 ->getTriggerButtonComponents(
755 $this->
lng->txt(
"book_show_message"),
758 $dd_items[] =
$c[
"button"];
759 $render_items[] =
$c[
"modal"];
762 if (count($dd_items) > 0) {
763 $render_items[] =
$f->dropdown()->standard($dd_items);
764 $this->tpl->setVariable(
"ACTIONS", $this->gui->ui()->renderer()->render($render_items));
773 unset($cols[
"week"], $cols[
"weekday"]);
778 if (array_key_exists($col, $cols)) {
779 if (!isset($user_cols[$col])) {
780 $add_cols[$col] = $cols[$col][
"txt"];
785 $add_cols[
"user_name"] = $this->
lng->txt(
"user");
786 $add_cols[
"login"] = $this->
lng->txt(
"login");
790 if (array_key_exists($col, $cols)) {
791 if (isset($user_cols[$col])) {
792 $add_cols[$col] = $cols[$col][
"txt"];
804 $a_excel->
setCell($a_row, 0, $this->
lng->txt(
"title"));
806 if ($this->has_schedule) {
807 $a_excel->
setCell($a_row, ++$col, $this->
lng->txt(
"date"));
808 $a_excel->
setCell($a_row, ++$col, $this->
lng->txt(
"wk_short"));
809 $a_excel->
setCell($a_row, ++$col, $this->
lng->txt(
"cal_weekday"));
810 $a_excel->
setCell($a_row, ++$col, $this->
lng->txt(
"book_schedule_slot"));
811 $a_excel->
setCell($a_row, ++$col, $this->
lng->txt(
"book_no_of_objects"));
813 $a_excel->
setCell($a_row, ++$col, $this->
lng->txt(
"status"));
816 $a_excel->
setCell($a_row, ++$col, $this->
lng->txt(
"book_message"));
831 $a_excel->
setCell($a_row, 0, $a_set[
"title"]);
833 if ($this->has_schedule) {
835 $a_excel->
setCell($a_row, ++$col, $a_set[
"week"]);
837 $a_excel->
setCell($a_row, ++$col, $a_set[
"slot"]);
838 $a_excel->
setCell($a_row, ++$col, $a_set[
"counter"]);
845 $status = $this->
lng->txt(
'book_reservation_status_' . $a_set[
'status']);
847 $a_excel->
setCell($a_row, ++$col, $status);
850 $a_excel->
setCell($a_row, ++$col, $a_set[
"message"]);
854 if (str_starts_with($colid,
"advmd")) {
856 $key =
"md_" . (
int) substr($colid, 5) .
"_presentation";
857 if (isset($a_set[$key])) {
858 $pb = $a_set[$key]->getList();
863 $a_excel->
setCell($a_row, ++$col, $val);
865 $a_excel->
setCell($a_row, ++$col, $a_set[$colid]);
874 if ($this->has_schedule) {
878 $a_csv->
addColumn($this->
lng->txt(
"book_schedule_slot"));
879 $a_csv->
addColumn($this->
lng->txt(
"book_no_of_objects"));
899 if ($this->has_schedule) {
911 $status = $this->
lng->txt(
'book_reservation_status_' . $a_set[
'status']);
920 if (str_starts_with($colid,
"advmd")) {
922 $key =
"md_" . (
int) substr($colid, 5) .
"_presentation";
923 if (isset($a_set[$key])) {
924 $pb = $a_set[$key]->getList();
ReservationTableSessionRepository $table_repo
static array static setUseRelativeDates(bool $a_status)
set use relative dates
setExportFormats(array $formats)
Set available export formats.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setFormAction(string $a_form_action, bool $a_multipart=false)
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
initFilter(?array $a_filter_pre=null)
static getUserFilter(array $a_object_ids)
Get all users who have reservations for object(s)
fillRowExcel(ilExcel $a_excel, int &$a_row, array $a_set)
setResetCommand(string $a_val, string $a_caption="")
Repo class for reservations Acts on tables booking_reservation (rw), booking_reservation_group (rw) a...
getSelectableUserColumns()
Get selectable user fields.
getItems(array $filter)
Gather data and build rows.
getColumnCoord(int $a_col)
Get column "name" from number.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
bool $has_items_with_host_context
setDisableFilterHiding(bool $a_val=true)
static _getValuesByObjId(int $a_obj_id)
getAdditionalExportCols()
static getAdvancedMDFields(int $a_ref_id)
fillRowCSV(ilCSVWriter $a_csv, array $a_set)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ScheduleManager $schedule_manager
InternalDomainService $domain
ilAdvancedMDRecordGUI $record_gui
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _numericDayToString(int $a_day, bool $a_long=true, ?ilLanguage $lng=null)
ReservationDBRepository $reservation_repo
setCell(int $a_row, int $col, $value, ?string $datatype=null, bool $disable_strip_tags_for_strings=false)
Set cell value.
Author: Alexander Killing killing@leifos.de
addFilterItemByMetaType(string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
Add filter by standard type.
setBold(string $a_coords)
Set cell(s) to bold.
static queryForRecords(int $adv_rec_obj_ref_id, string $adv_rec_obj_type, string $adv_rec_obj_subtype, array $a_obj_id, string $a_subtype, array $a_records, string $a_obj_id_key, string $a_obj_subid_key, ?array $a_amet_filter=null)
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path='ilpublicuserprofilegui')
Default behaviour is:
fillHeaderExcel(ilExcel $a_excel, int &$a_row)
static _lookupTitle(int $obj_id)
setDefaultOrderField(string $a_defaultorderfield)
getCurrentFilter()
Get current filter settings.
Reservation table related session data.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setFilterCommand(string $a_val, string $a_caption="")
setDefaultOrderDirection(string $a_defaultorderdirection)
static _lookupObjectId(int $ref_id)
fillHeaderCSV(ilCSVWriter $a_csv)
legacy()
expected output: > ILIAS shows the rendered Component.
static getList(int $a_pool_id, ?string $a_title=null)
Get list of booking objects.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
static _getInstanceByType(string $a_type)
Get Singleton Instance.
__construct(Container $dic, ilPlugin $plugin)
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
setLimit(int $a_limit=0, int $a_default_limit=0)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
__construct(object $a_parent_obj, string $a_parent_cmd, int $a_ref_id, ilObjBookingPool $pool, bool $a_show_all, ?array $a_filter_pre=null, ?int $a_group_id=null, ?array $context_obj_ids=null)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
disable(string $a_module_name)
static lookupAcceptedAgreements(int $a_obj_id)
Lookup users who have accepted the agreement.
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
ILIAS BookingManager Access AccessManager $access
static _lookupType(int $id, bool $reference=false)
addMultiCommand(string $a_cmd, string $a_text)
setEnableHeader(bool $a_enableheader)
numericOrdering(string $a_field)