49 bool $a_pool_has_schedule,
50 ?
int $a_pool_overall_limit,
51 bool $active_management =
true 54 $this->main_tpl = $DIC->ui()->mainTemplate();
56 $this->
ctrl = $DIC->ctrl();
57 $this->
lng = $DIC->language();
58 $this->
access = $DIC->access();
59 $this->
user = $DIC->user();
60 $ilCtrl = $DIC->ctrl();
61 $lng = $DIC->language();
62 $ilAccess = $DIC->access();
63 $this->ui_factory = $DIC->ui()->factory();
64 $this->ui_renderer = $DIC->ui()->renderer();
66 $this->ref_id = $a_ref_id;
67 $this->pool_id = $a_pool_id;
68 $this->has_schedule = $a_pool_has_schedule;
69 $this->overall_limit = $a_pool_overall_limit;
71 $this->may_edit = ($this->active_management &&
72 $ilAccess->checkAccess(
'write',
'', $this->ref_id));
73 $this->may_assign = ($this->active_management &&
74 $ilAccess->checkAccess(
'write',
'', $this->ref_id));
78 $this->
setId(
"bkobj");
90 $this->
addColumn($cols[$col][
"txt"], $col);
93 if (!$this->has_schedule) {
100 $this->
setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
101 $this->
setRowTemplate(
"tpl.booking_object_row.html",
"Modules/BookingManager");
102 $this->process_class = $DIC->bookingManager()
106 ->getProcessClass($a_pool_has_schedule);
137 if ($this->has_schedule) {
145 if ($period !== null) {
146 $this->
filter[
"period"] = $period->getValue();
159 if ($this->has_schedule) {
161 $limit = strtotime(
"+1year");
162 foreach (
$data as $idx => $item) {
164 $av_from = ($schedule->getAvailabilityFrom() && !$schedule->getAvailabilityFrom()->isNull())
165 ? $schedule->getAvailabilityFrom()->get(
IL_CAL_UNIX)
167 $av_to = ($schedule->getAvailabilityTo() && !$schedule->getAvailabilityTo()->isNull())
168 ? strtotime($schedule->getAvailabilityTo()->get(
IL_CAL_DATE) .
" 23:59:59")
170 if (($av_from && $av_from >
$limit)) {
173 if ($av_from > $now) {
179 $this->
lng->loadLanguageModule(
"dateplaner");
180 $data[$idx][
"full_up"] = $this->
lng->txt(
"cal_booked_out");
186 foreach (
$data as $idx => $item) {
187 $item_id = $item[
"booking_object_id"];
190 if (isset($this->
filter[
"period"][
"from"]) ||
191 isset($this->
filter[
"period"][
"to"])) {
192 $from = is_object($this->
filter[
"period"][
"from"])
195 $to = is_object($this->
filter[
"period"][
"to"])
210 $this->reservations[$item_id] = $item_rsv[
"data"];
213 if (!$this->has_schedule &&
214 $this->overall_limit) {
215 $this->current_bookings = 0;
216 foreach ($this->reservations as $obj_rsv) {
217 foreach ($obj_rsv as $item) {
219 if ($item[
"user_id"] == $ilUser->getId()) {
220 $this->current_bookings++;
226 if ($this->current_bookings >= $this->overall_limit) {
227 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"book_overall_limit_warning"));
238 $this->record_gui->setTableGUI($this);
239 $this->record_gui->parse();
250 $this->record_gui->getFilterElements()
260 if (str_starts_with($a_field,
"md_")) {
261 $md_id = (
int) substr($a_field, 3);
273 $cols[
"description"] = array(
274 "txt" => $this->
lng->txt(
"description"),
278 foreach ($this->advmd as $field) {
279 $cols[
"advmd" . $field[
"id"]] = array(
280 "txt" => $field[
"title"],
288 protected function fillRow(array $a_set): void
294 $has_booking =
false;
295 $booking_possible =
true;
296 $assign_possible =
true;
297 $has_reservations =
false;
301 $this->tpl->setVariable(
"TXT_TITLE", $a_set[
"title"]);
303 if (in_array(
"description", $selected,
true)) {
304 $this->tpl->setVariable(
"TXT_DESC", nl2br($a_set[
"description"] ??
""));
307 if (isset($a_set[
"full_up"])) {
308 $this->tpl->setVariable(
"NOT_YET", $a_set[
"full_up"]);
309 $booking_possible =
false;
310 $assign_possible =
false;
311 } elseif (isset($a_set[
"not_yet"])) {
312 $this->tpl->setVariable(
"NOT_YET", $a_set[
"not_yet"]);
315 if (!$this->has_schedule) {
317 foreach ($this->reservations[$a_set[
"booking_object_id"]] as $item) {
321 if ($item[
"user_id"] == $ilUser->getId()) {
325 $has_reservations =
true;
329 $this->tpl->setVariable(
"VALUE_AVAIL", $a_set[
"nr_items"] - $cnt);
330 $this->tpl->setVariable(
"VALUE_AVAIL_ALL", $a_set[
"nr_items"]);
332 if ($a_set[
"nr_items"] <= $cnt || ($this->overall_limit && $this->current_bookings && $this->current_bookings >= $this->overall_limit)) {
333 $booking_possible =
false;
336 $booking_possible =
false;
338 if ($a_set[
"nr_items"] <= $cnt) {
339 $assign_possible =
false;
341 } elseif (!$this->may_edit) {
342 foreach ($this->reservations[$a_set[
"booking_object_id"]] as $item) {
344 $item[
"user_id"] == $ilUser->getId()) {
353 $ilCtrl->setParameter($this->parent_obj,
'object_id', $a_set[
'booking_object_id']);
355 if ($booking_possible) {
356 if (isset($this->
filter[
'period'][
'from'])) {
357 $ilCtrl->setParameter($this->parent_obj,
'sseed', $this->
filter[
'period'][
'from']->
get(
IL_CAL_DATE));
360 $items[] = $this->ui_factory->button()->shy(
362 $ilCtrl->getLinkTargetByClass($this->process_class,
'book')
365 $ilCtrl->setParameter($this->parent_obj,
'sseed',
'');
368 if ($has_booking || $this->may_edit) {
369 if (trim($a_set[
'post_text'] ??
"") || $a_set[
'post_file']) {
370 $items[] = $this->ui_factory->button()->shy(
371 $lng->
txt(
'book_post_booking_information'),
372 $ilCtrl->getLinkTargetByClass($this->process_class,
'displayPostInfo')
378 if (!$this->has_schedule && $has_booking) {
379 $ilCtrl->setParameterByClass(
"ilbookingreservationsgui",
'object_id', $a_set[
'booking_object_id']);
380 $items[] = $this->ui_factory->button()->shy(
$lng->
txt(
'book_set_cancel'), $ilCtrl->getLinkTargetByClass(
"ilbookingreservationsgui",
'rsvConfirmCancelUser'));
381 $ilCtrl->setParameterByClass(
"ilbookingreservationsgui",
'object_id',
"");
384 if ($this->may_edit || $has_booking) {
385 $ilCtrl->setParameterByClass(
'ilBookingReservationsGUI',
'object_id', $a_set[
'booking_object_id']);
386 $items[] = $this->ui_factory->button()->shy(
388 $ilCtrl->getLinkTargetByClass(
'ilBookingReservationsGUI',
'log')
390 $ilCtrl->setParameterByClass(
'ilBookingReservationsGUI',
'object_id',
'');
393 if ($this->may_assign && $assign_possible) {
399 if (isset($this->
filter[
'period'][
'from'])) {
400 $ilCtrl->setParameterByClass(
401 $this->process_class,
407 $items[] = $this->ui_factory->button()->shy(
408 $lng->
txt(
'book_assign_participant'),
409 $ilCtrl->getLinkTargetByClass($this->process_class,
'assignParticipants')
412 $ilCtrl->setParameterByClass($this->process_class,
'sseed',
'');
416 if ($a_set[
'info_file']) {
417 $items[] = $this->ui_factory->button()->shy(
$lng->
txt(
'book_download_info'), $ilCtrl->getLinkTarget($this->parent_obj,
'deliverInfo'));
420 if ($this->may_edit) {
421 $items[] = $this->ui_factory->button()->shy(
$lng->
txt(
'edit'), $ilCtrl->getLinkTarget($this->parent_obj,
'edit'));
424 if (!$has_reservations) {
425 $items[] = $this->ui_factory->button()->shy(
$lng->
txt(
'delete'), $ilCtrl->getLinkTarget($this->parent_obj,
'confirmDelete'));
430 foreach ($this->advmd as $item) {
431 $advmd_id = (
int) $item[
"id"];
433 if (!in_array(
"advmd" . $advmd_id, $selected)) {
438 $key =
"md_" . $advmd_id .
"_presentation";
439 if (isset($a_set[
$key])) {
440 $pb = $a_set[
$key]->getList();
446 $this->tpl->setCurrentBlock(
"advmd_bl");
447 $this->tpl->setVariable(
"ADVMD_VAL", $val);
448 $this->tpl->parseCurrentBlock();
453 $actions_dropdown = $this->ui_factory->dropdown()->standard($items)->withLabel($this->
lng->txt(
'actions'));
454 $this->tpl->setVariable(
"ACTION_DROPDOWN", $this->ui_renderer->render($actions_dropdown));
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)
__construct(object $a_parent_obj, string $a_parent_cmd, int $a_ref_id, int $a_pool_id, bool $a_pool_has_schedule, ?int $a_pool_overall_limit, bool $active_management=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static getAdvancedMDFields(int $a_ref_id)
ilAdvancedMDRecordGUI $record_gui
static getList(array $a_object_ids, int $a_limit=10, int $a_offset=0, array $filter=[])
List all reservations.
numericOrdering(string $a_field)
ILIAS UI Renderer $ui_renderer
getAdvMDRecordGUI()
needed for advmd filter handling
addFilterItemByMetaType(string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
Add filter by standard type.
ilGlobalTemplateInterface $main_tpl
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
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)
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)
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
static isObjectAvailableInPeriod(int $a_obj_id, ilBookingSchedule $a_schedule, ?int $a_from, ?int $a_to)
static getList(int $a_pool_id, string $a_title=null)
Get list of booking objects.
setEnableHeader(bool $a_enableheader)
setMaxCount(int $a_max_count)
set max.
ILIAS UI Factory $ui_factory