ILIAS  release_8 Revision v8.24
class.ilConsultationHourBookingTableGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
26{
27 private int $user_id = 0;
28
30
31 public function __construct(object $a_parent_obj, string $a_parent_cmd, int $a_user_id)
32 {
33 $this->user_id = $a_user_id;
34 $this->setId('chboo_' . $this->user_id);
35 parent::__construct($a_parent_obj, $a_parent_cmd);
36
37 $this->initTable();
38 $this->today = new ilDateTime(time(), IL_CAL_UNIX);
39 }
40
44 protected function initTable(): void
45 {
46 $this->setRowTemplate('tpl.ch_booking_row.html', 'Services/Calendar');
47
48 $this->setTitle($this->lng->txt('cal_ch_bookings_tbl'));
49 $this->setFormAction($this->ctrl->getFormAction($this->getParentObject(), $this->getParentCmd()));
50
51 $this->addColumn('', '', '1px');
52 $this->addColumn($this->lng->txt('cal_start'), 'start');
53 $this->addColumn($this->lng->txt('name'), 'name');
54 $this->addColumn($this->lng->txt('cal_ch_booking_message_tbl'), 'comment');
55 $this->addColumn($this->lng->txt('title'), 'title');
56 $this->addColumn($this->lng->txt('actions'), '');
57
58 $this->enable('sort');
59 $this->enable('header');
60 $this->enable('num_info');
61
62 $this->setDefaultOrderField('start');
63 $this->setSelectAllCheckbox('bookuser');
64 $this->setShowRowsSelector(true);
65 $this->addMultiCommand('confirmRejectBooking', $this->lng->txt('cal_ch_reject_booking'));
66 $this->addMultiCommand('confirmDeleteBooking', $this->lng->txt('cal_ch_delete_booking'));
67 }
68
72 protected function fillRow(array $a_set): void
73 {
74 $this->tpl->setVariable('START', $a_set['start_str']);
75 $this->tpl->setVariable('NAME', $a_set['name']);
76 $this->tpl->setVariable('COMMENT', $a_set['comment']);
77 $this->tpl->setVariable('TITLE', $a_set['title']);
78 $this->tpl->setVariable('VAL_ID', $a_set['id']);
79
80 $list = new ilAdvancedSelectionListGUI();
81 $list->setId('act_chboo_' . $a_set['id']);
82 $list->setListTitle($this->lng->txt('actions'));
83
84 $this->ctrl->setParameter($this->getParentObject(), 'bookuser', $a_set['id']);
85
86 $start = new ilDateTime($a_set['start'], IL_CAL_UNIX);
87 if (ilDateTime::_after($start, $this->today, IL_CAL_DAY)) {
88 $list->addItem(
89 $this->lng->txt('cal_ch_reject_booking'),
90 '',
91 $this->ctrl->getLinkTarget($this->getParentObject(), 'confirmRejectBooking')
92 );
93 }
94 $list->addItem(
95 $this->lng->txt('cal_ch_delete_booking'),
96 '',
97 $this->ctrl->getLinkTarget($this->getParentObject(), 'confirmDeleteBooking')
98 );
99 $this->tpl->setVariable('ACTIONS', $list->getHTML());
100 }
101
106 public function parse(array $appointments): void
107 {
108 $rows = array();
109 $counter = 0;
110 foreach ($appointments as $app) {
111 $cal_entry = new ilCalendarEntry($app);
112
114 $rows[$counter]['name'] = ilUserUtil::getNamePresentation(
115 $user_id,
116 true,
117 true,
118 $this->ctrl->getLinkTarget($this->getParentObject(), $this->getParentCmd()),
119 true,
120 true
121 );
122
124 $rows[$counter]['comment'] = '';
125 if (strlen(trim($message))) {
126 $rows[$counter]['comment'] = ('"' . $message . '"');
127 }
128 $rows[$counter]['title'] = $cal_entry->getTitle();
129 $rows[$counter]['start'] = $cal_entry->getStart()->get(IL_CAL_UNIX);
130 $rows[$counter]['start_str'] = ilDatePresentation::formatDate($cal_entry->getStart());
131 $rows[$counter]['id'] = $app . '_' . $user_id;
132 ++$counter;
133 }
134 }
135 $this->setData($rows);
136 }
137}
const IL_CAL_UNIX
const IL_CAL_DAY
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupBookingsForAppointment(int $a_app_id)
Lookup booked users for appointment.
static lookupBookingMessage(int $a_entry_id, int $a_usr_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(object $a_parent_obj, string $a_parent_cmd, int $a_user_id)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
@classDescription Date and time handling
static _after(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addMultiCommand(string $a_cmd, string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
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)
setDefaultOrderField(string $a_defaultorderfield)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setData(array $a_data)
Set table data.
enable(string $a_module_name)
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:
$app
Definition: cli.php:39
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$message
Definition: xapiexit.php:32
$rows
Definition: xhr_table.php:10