26 protected \ILIAS\BookingManager\Access\AccessManager
$access;
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->bookingManager()->internal()->domain()->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 $this->
access->canManageObjects($this->ref_id));
73 $this->may_assign = ($this->active_management &&
74 $this->
access->canManageAllReservations($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",
"components/ILIAS/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();
157 if ($this->has_schedule) {
159 $limit = strtotime(
"+1year");
160 foreach (
$data as $idx => $item) {
162 $av_from = ($schedule->getAvailabilityFrom() && !$schedule->getAvailabilityFrom()->isNull())
163 ? $schedule->getAvailabilityFrom()->get(
IL_CAL_UNIX)
165 $av_to = ($schedule->getAvailabilityTo() && !$schedule->getAvailabilityTo()->isNull())
166 ? strtotime($schedule->getAvailabilityTo()->get(
IL_CAL_DATE) .
" 23:59:59")
168 if (($av_from && $av_from >
$limit)) {
171 if ($av_from > $now) {
177 $this->
lng->loadLanguageModule(
"dateplaner");
178 $data[$idx][
"full_up"] = $this->
lng->txt(
"cal_booked_out");
184 foreach (
$data as $idx => $item) {
185 $item_id = $item[
"booking_object_id"];
188 if (isset($this->
filter[
"period"][
"from"]) ||
189 isset($this->
filter[
"period"][
"to"])) {
190 $from = is_object($this->
filter[
"period"][
"from"])
193 $to = is_object($this->
filter[
"period"][
"to"])
208 $this->reservations[$item_id] = $item_rsv[
"data"];
211 if (!$this->has_schedule &&
212 $this->overall_limit) {
213 $this->current_bookings = 0;
214 foreach ($this->reservations as $obj_rsv) {
215 foreach ($obj_rsv as $item) {
217 if ($item[
"user_id"] == $ilUser->getId()) {
218 $this->current_bookings++;
224 if ($this->current_bookings >= $this->overall_limit) {
225 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"book_overall_limit_warning"));
236 $this->record_gui->setTableGUI($this);
237 $this->record_gui->parse();
248 $this->record_gui->getFilterElements()
258 if (str_starts_with($a_field,
"md_")) {
259 $md_id = (
int) substr($a_field, 3);
271 $cols[
"description"] = array(
272 "txt" => $this->
lng->txt(
"description"),
276 foreach ($this->advmd as $field) {
277 $cols[
"advmd" . $field[
"id"]] = array(
278 "txt" => $field[
"title"],
286 protected function fillRow(array $a_set): void
292 $has_booking =
false;
293 $booking_possible = $this->
access->canManageOwnReservations($this->ref_id);
294 $assign_possible =
true;
295 $has_reservations =
false;
299 $this->tpl->setVariable(
"TXT_TITLE", $a_set[
"title"]);
301 if (in_array(
"description", $selected,
true)) {
302 $this->tpl->setVariable(
"TXT_DESC", nl2br($a_set[
"description"] ??
""));
305 if (isset($a_set[
"full_up"])) {
306 $this->tpl->setVariable(
"NOT_YET", $a_set[
"full_up"]);
307 $booking_possible =
false;
308 $assign_possible =
false;
309 } elseif (isset($a_set[
"not_yet"])) {
310 $this->tpl->setVariable(
"NOT_YET", $a_set[
"not_yet"]);
313 if (!$this->has_schedule) {
315 foreach ($this->reservations[$a_set[
"booking_object_id"]] as $item) {
319 if ($item[
"user_id"] == $ilUser->getId()) {
323 $has_reservations =
true;
327 $this->tpl->setVariable(
"VALUE_AVAIL", $a_set[
"nr_items"] - $cnt);
328 $this->tpl->setVariable(
"VALUE_AVAIL_ALL", $a_set[
"nr_items"]);
330 if ($a_set[
"nr_items"] <= $cnt || ($this->overall_limit && $this->current_bookings && $this->current_bookings >= $this->overall_limit)) {
331 $booking_possible =
false;
334 $booking_possible =
false;
336 if ($a_set[
"nr_items"] <= $cnt) {
337 $assign_possible =
false;
339 } elseif (!$this->may_edit) {
340 foreach ($this->reservations[$a_set[
"booking_object_id"]] as $item) {
342 $item[
"user_id"] == $ilUser->getId()) {
351 $ilCtrl->setParameter($this->parent_obj,
'object_id', $a_set[
'booking_object_id']);
353 if ($booking_possible) {
354 if (isset($this->
filter[
'period'][
'from'])) {
355 $ilCtrl->setParameter($this->parent_obj,
'sseed', $this->
filter[
'period'][
'from']->
get(
IL_CAL_DATE));
358 $items[] = $this->ui_factory->button()->shy(
360 $ilCtrl->getLinkTargetByClass($this->process_class,
'book')
363 $ilCtrl->setParameter($this->parent_obj,
'sseed',
'');
366 if ($has_booking || $this->may_edit) {
367 if (trim($a_set[
'post_text'] ??
"") || $a_set[
'post_file']) {
368 $items[] = $this->ui_factory->button()->shy(
369 $lng->
txt(
'book_post_booking_information'),
370 $ilCtrl->getLinkTargetByClass($this->process_class,
'displayPostInfo')
376 if (!$this->has_schedule && $has_booking) {
377 $ilCtrl->setParameterByClass(
"ilbookingreservationsgui",
'object_id', $a_set[
'booking_object_id']);
378 $items[] = $this->ui_factory->button()->shy(
$lng->
txt(
'book_set_cancel'), $ilCtrl->getLinkTargetByClass(
"ilbookingreservationsgui",
'rsvConfirmCancelUser'));
379 $ilCtrl->setParameterByClass(
"ilbookingreservationsgui",
'object_id',
"");
382 if ($this->may_edit || $has_booking) {
383 $ilCtrl->setParameterByClass(
'ilBookingReservationsGUI',
'object_id', $a_set[
'booking_object_id']);
384 $items[] = $this->ui_factory->button()->shy(
386 $ilCtrl->getLinkTargetByClass(
'ilBookingReservationsGUI',
'log')
388 $ilCtrl->setParameterByClass(
'ilBookingReservationsGUI',
'object_id',
'');
391 if ($this->may_assign && $assign_possible) {
397 if (isset($this->
filter[
'period'][
'from'])) {
398 $ilCtrl->setParameterByClass(
399 $this->process_class,
405 $items[] = $this->ui_factory->button()->shy(
406 $lng->
txt(
'book_assign_participant'),
407 $ilCtrl->getLinkTargetByClass($this->process_class,
'assignParticipants')
410 $ilCtrl->setParameterByClass($this->process_class,
'sseed',
'');
414 if ($a_set[
'obj_info_rid']) {
415 $items[] = $this->ui_factory->button()->shy(
$lng->
txt(
'book_download_info'), $ilCtrl->getLinkTarget($this->parent_obj,
'deliverInfo'));
418 if ($this->may_edit) {
419 $items[] = $this->ui_factory->button()->shy(
$lng->
txt(
'edit'), $ilCtrl->getLinkTarget($this->parent_obj,
'edit'));
422 if (!$has_reservations) {
423 $items[] = $this->ui_factory->button()->shy(
$lng->
txt(
'delete'), $ilCtrl->getLinkTarget($this->parent_obj,
'confirmDelete'));
428 foreach ($this->advmd as $item) {
429 $advmd_id = (
int) $item[
"id"];
431 if (!in_array(
"advmd" . $advmd_id, $selected)) {
436 $key =
"md_" . $advmd_id .
"_presentation";
437 if (isset($a_set[$key])) {
438 $pb = $a_set[$key]->getList();
444 $this->tpl->setCurrentBlock(
"advmd_bl");
445 $this->tpl->setVariable(
"ADVMD_VAL", $val);
446 $this->tpl->parseCurrentBlock();
451 $actions_dropdown = $this->ui_factory->dropdown()->standard($items)->withLabel($this->
lng->txt(
'actions'));
452 $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 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
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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.
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)
ILIAS BookingManager Access AccessManager $access
ilGlobalTemplateInterface $main_tpl
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
static getList(int $a_pool_id, ?string $a_title=null)
Get list of booking objects.
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="")
__construct(Container $dic, ilPlugin $plugin)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=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)
setEnableHeader(bool $a_enableheader)
setMaxCount(int $a_max_count)
set max.
ILIAS UI Factory $ui_factory