4 include_once(
"./Services/Table/classes/class.ilTable2GUI.php");
48 public function __construct($a_parent_obj, $a_parent_cmd, $a_ref_id, $a_pool_id, $a_pool_has_schedule, $a_pool_overall_limit)
52 $this->ctrl = $DIC->ctrl();
53 $this->lng = $DIC->language();
54 $this->access = $DIC->access();
55 $this->
user = $DIC->user();
57 $lng = $DIC->language();
58 $ilAccess = $DIC->access();
59 $this->ui_factory = $DIC->ui()->factory();
60 $this->ui_renderer = $DIC->ui()->renderer();
62 $this->ref_id = $a_ref_id;
63 $this->pool_id = $a_pool_id;
64 $this->has_schedule = $a_pool_has_schedule;
65 $this->overall_limit = $a_pool_overall_limit;
66 $this->may_edit = $ilAccess->checkAccess(
'write',
'', $this->ref_id);
67 $this->may_assign = $ilAccess->checkAccess(
'edit_permission',
'', $this->ref_id);
71 $this->
setId(
"bkobj");
73 parent::__construct($a_parent_obj, $a_parent_cmd);
79 $this->
addColumn($this->lng->txt(
"title"),
"title");
83 $this->
addColumn($cols[$col][
"txt"], $col);
86 if (!$this->has_schedule) {
87 $this->
addColumn($this->lng->txt(
"available"));
90 $this->
addColumn($this->lng->txt(
"actions"));
94 $this->
setRowTemplate(
"tpl.booking_object_row.html",
"Modules/BookingManager");
108 return $this->record_gui;
120 $lng->txt(
"title") .
"/" .
$lng->txt(
"description")
122 $this->filter[
"title"] =
$title->getValue();
125 if ($this->has_schedule) {
131 $lng->txt(
"book_period")
133 $this->filter[
"period"] = $period->getValue();
144 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
147 include_once
'Modules/BookingManager/classes/class.ilBookingSchedule.php';
148 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
151 if ($this->has_schedule) {
153 $limit = strtotime(
"+1year");
154 foreach (
$data as $idx => $item) {
156 $av_from = ($schedule->getAvailabilityFrom() && !$schedule->getAvailabilityFrom()->isNull())
157 ? $schedule->getAvailabilityFrom()->get(
IL_CAL_UNIX)
159 $av_to = ($schedule->getAvailabilityTo() && !$schedule->getAvailabilityTo()->isNull())
160 ? strtotime($schedule->getAvailabilityTo()->get(
IL_CAL_DATE) .
" 23:59:59")
162 if (($av_from && $av_from >
$limit)) {
165 if ($av_from > $now) {
171 $this->lng->loadLanguageModule(
"dateplaner");
172 $data[$idx][
"full_up"] = $this->lng->txt(
"cal_booked_out");
178 foreach (
$data as $item) {
179 $item_id = $item[
"booking_object_id"];
182 if (is_object($this->filter[
"period"][
"from"]) ||
183 is_object($this->filter[
"period"][
"to"])) {
184 $from = is_object($this->filter[
"period"][
"from"])
185 ? strtotime($this->filter[
"period"][
"from"]->
get(
IL_CAL_DATE) .
" 00:00:00")
187 $to = is_object($this->filter[
"period"][
"to"])
188 ? strtotime($this->filter[
"period"][
"to"]->
get(
IL_CAL_DATE) .
" 23:59:59")
202 $this->reservations[$item_id] = $item_rsv[
"data"];
205 if (!$this->has_schedule &&
206 $this->overall_limit) {
207 $this->current_bookings = 0;
208 foreach ($this->reservations as $obj_rsv) {
209 foreach ($obj_rsv as $item) {
211 if ($item[
"user_id"] ==
$ilUser->getId()) {
212 $this->current_bookings++;
218 if ($this->current_bookings >= $this->overall_limit) {
225 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
227 $this->record_gui->setTableGUI($this);
228 $this->record_gui->parse();
230 include_once(
"./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
240 $this->record_gui->getFilterElements()
250 if (substr($a_field, 0, 3) ==
"md_") {
251 $md_id = (int) substr($a_field, 3);
263 $cols[
"description"] = array(
264 "txt" => $this->lng->txt(
"description"),
268 foreach ($this->advmd as $field) {
269 $cols[
"advmd" . $field[
"id"]] = array(
270 "txt" => $field[
"title"],
288 $has_booking =
false;
289 $booking_possible =
true;
290 $assign_possible =
true;
291 $has_reservations =
false;
295 $this->tpl->setVariable(
"TXT_TITLE", $a_set[
"title"]);
297 if (in_array(
"description", $selected)) {
298 $this->tpl->setVariable(
"TXT_DESC", nl2br($a_set[
"description"]));
301 if ($a_set[
"full_up"]) {
302 $this->tpl->setVariable(
"NOT_YET", $a_set[
"full_up"]);
303 $booking_possible =
false;
304 $assign_possible =
false;
305 } elseif ($a_set[
"not_yet"]) {
306 $this->tpl->setVariable(
"NOT_YET", $a_set[
"not_yet"]);
309 if (!$this->has_schedule) {
311 foreach ($this->reservations[$a_set[
"booking_object_id"]] as $item) {
315 if ($item[
"user_id"] ==
$ilUser->getId()) {
319 $has_reservations =
true;
323 $this->tpl->setVariable(
"VALUE_AVAIL", $a_set[
"nr_items"] - $cnt);
324 $this->tpl->setVariable(
"VALUE_AVAIL_ALL", $a_set[
"nr_items"]);
326 if ($a_set[
"nr_items"] <= $cnt || ($this->overall_limit && $this->current_bookings && $this->current_bookings >= $this->overall_limit)) {
327 $booking_possible =
false;
330 $booking_possible =
false;
332 if ($a_set[
"nr_items"] <= $cnt) {
333 $assign_possible =
false;
335 } elseif (!$this->may_edit) {
336 foreach ($this->reservations[$a_set[
"booking_object_id"]] as $item) {
338 $item[
"user_id"] ==
$ilUser->getId()) {
347 $ilCtrl->setParameter($this->parent_obj,
'object_id', $a_set[
'booking_object_id']);
349 if ($booking_possible) {
350 if (is_object($this->filter[
'period'][
'from'])) {
351 $ilCtrl->setParameter($this->parent_obj,
'sseed', $this->filter[
'period'][
'from']->
get(
IL_CAL_DATE));
354 $items[] = $this->ui_factory->button()->shy(
$lng->txt(
'book_book'),
$ilCtrl->getLinkTarget($this->parent_obj,
'book'));
356 $ilCtrl->setParameter($this->parent_obj,
'sseed',
'');
360 if (!$this->has_schedule && $has_booking) {
361 if (trim($a_set[
'post_text']) || $a_set[
'post_file']) {
362 $items[] = $this->ui_factory->button()->shy(
$lng->txt(
'book_post_booking_information'),
$ilCtrl->getLinkTarget($this->parent_obj,
'displayPostInfo'));
364 $items[] = $this->ui_factory->button()->shy(
$lng->txt(
'book_set_cancel'),
$ilCtrl->getLinkTarget($this->parent_obj,
'rsvConfirmCancelUser'));
367 if ($this->may_edit || $has_booking) {
368 $ilCtrl->setParameterByClass(
'ilObjBookingPoolGUI',
'object_id', $a_set[
'booking_object_id']);
369 $items[] = $this->ui_factory->button()->shy(
$lng->txt(
'book_log'),
$ilCtrl->getLinkTargetByClass(
'ilObjBookingPoolGUI',
'log'));
370 $ilCtrl->setParameterByClass(
'ilObjBookingPoolGUI',
'object_id',
'');
374 if ($this->may_assign && $assign_possible) {
381 if (is_object($this->filter[
'period'][
'from'])) {
389 $items[] = $this->ui_factory->button()->shy(
390 $lng->txt(
'book_assign_participant'),
391 $ilCtrl->getLinkTarget($this->parent_obj,
'assignParticipants')
394 $ilCtrl->setParameter($this->parent_obj,
'sseed',
'');
398 if ($a_set[
'info_file']) {
399 $items[] = $this->ui_factory->button()->shy(
$lng->txt(
'book_download_info'),
$ilCtrl->getLinkTarget($this->parent_obj,
'deliverInfo'));
402 if ($this->may_edit) {
403 $items[] = $this->ui_factory->button()->shy(
$lng->txt(
'edit'),
$ilCtrl->getLinkTarget($this->parent_obj,
'edit'));
406 if (!$has_reservations) {
407 $items[] = $this->ui_factory->button()->shy(
$lng->txt(
'delete'),
$ilCtrl->getLinkTarget($this->parent_obj,
'confirmDelete'));
412 foreach ($this->advmd as $item) {
413 $advmd_id = (int) $item[
"id"];
415 if (!in_array(
"advmd" . $advmd_id, $selected)) {
420 if (isset($a_set[
"md_" . $advmd_id .
"_presentation"])) {
421 $pb = $a_set[
"md_" . $advmd_id .
"_presentation"]->getList();
427 $this->tpl->setCurrentBlock(
"advmd_bl");
428 $this->tpl->setVariable(
"ADVMD_VAL", $val);
429 $this->tpl->parseCurrentBlock();
433 if (
sizeof($items)) {
434 $actions_dropdown = $this->ui_factory->dropdown()->standard($items)->withLabel($this->lng->txt(
'actions'));
435 $this->tpl->setVariable(
"ACTION_DROPDOWN", $this->ui_renderer->render($actions_dropdown));
static getList($a_pool_id, $a_title=null)
Get list of booking objects for given type.
schedule for booking ressource
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=null)
Add filter by standard type.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
__construct($a_parent_obj, $a_parent_cmd, $a_ref_id, $a_pool_id, $a_pool_has_schedule, $a_pool_overall_limit)
Constructor.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getAdvMDRecordGUI()
needed for advmd filter handling
fillRow($a_set)
Fill table row.
getSelectedColumns()
Get selected columns.
List booking objects (for booking type)
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
static isObjectAvailableInPeriod($a_obj_id, ilBookingSchedule $a_schedule, $a_from, $a_to)
static getList($a_object_ids, $a_limit=10, $a_offset=0, array $filter)
List all reservations.
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.
getItems()
Gather data and build rows.
setEnableHeader($a_enableheader)
Set Enable Header.
setMaxCount($a_max_count)
set max.
static getAdvancedMDFields($a_ref_id)
static queryForRecords($adv_rec_obj_ref_id, $adv_rec_obj_type, $adv_rec_obj_subtype, $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.
numericOrdering($a_field)