4 include_once(
"./Services/Table/classes/class.ilTable2GUI.php");
28 function __construct($a_parent_obj, $a_parent_cmd, $a_ref_id, $a_pool_id, $a_pool_has_schedule)
32 $this->ref_id = $a_ref_id;
33 $this->pool_id = $a_pool_id;
34 $this->has_schedule = $a_pool_has_schedule;
35 $this->may_edit = $ilAccess->checkAccess(
'write',
'', $this->ref_id);
37 $this->
setId(
"bkobj");
41 $this->
setTitle($lng->txt(
"book_objects_list"));
45 $this->
addColumn($this->lng->txt(
"title"),
"title");
46 $this->
addColumn($this->lng->txt(
"description"),
"description");
48 if(!$this->has_schedule)
50 $this->
addColumn($this->lng->txt(
"available"));
55 $this->
addColumn($this->lng->txt(
"book_current_user"));
57 if($this->has_schedule)
59 $this->
addColumn($this->lng->txt(
"book_period"));
63 $this->
addColumn($this->lng->txt(
"actions"));
66 $this->
setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
67 $this->
setRowTemplate(
"tpl.booking_object_row.html",
"Modules/BookingManager");
77 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
93 $booking_possible =
true;
94 $has_reservations =
false;
96 $this->tpl->setVariable(
"TXT_TITLE", $a_set[
"title"]);
97 $this->tpl->setVariable(
"TXT_DESC", nl2br($a_set[
"description"]));
99 if(!$this->has_schedule)
101 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
105 foreach($reservation[
"data"] as $item)
112 $uname = ilObjUser::_lookupFullName($item[
'user_id']);
115 $uname =
"[".$lng->txt(
"user_deleted").
"]";
117 $user_ids[$item[
"user_id"]] = $uname;
119 if($item[
"user_id"] == $ilUser->getId())
124 $has_reservations =
true;
128 $this->tpl->setVariable(
"VALUE_AVAIL", $a_set[
"nr_items"]-$cnt);
129 $this->tpl->setVariable(
"VALUE_AVAIL_ALL", $a_set[
"nr_items"]);
131 if($a_set[
"nr_items"] <= $cnt)
133 $booking_possible =
false;
140 $this->tpl->setVariable(
"TXT_CURRENT_USER", implode(
"<br />", array_unique($user_ids)));
144 $this->tpl->setVariable(
"TXT_CURRENT_USER",
"");
152 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
161 $uname = ilObjUser::_lookupFullName($reservation[
'user_id']);
164 $uname =
"[".$lng->txt(
"user_deleted").
"]";
166 $this->tpl->setVariable(
"TXT_CURRENT_USER", $uname);
169 $has_reservations =
true;
173 $this->tpl->setVariable(
"TXT_CURRENT_USER",
"");
174 $this->tpl->setVariable(
"VALUE_DATE",
"");
182 $ilCtrl->setParameter($this->parent_obj,
'object_id', $a_set[
'booking_object_id']);
186 if($booking_possible)
188 $items[
'book'] = array($lng->txt(
'book_book'), $ilCtrl->getLinkTarget($this->parent_obj,
'book'));
193 if(trim($a_set[
'post_text']) || $a_set[
'post_file'])
195 $items[
'post'] = array($lng->txt(
'book_post_booking_information'), $ilCtrl->getLinkTarget($this->parent_obj,
'displayPostInfo'));
198 $items[
'cancel'] = array($lng->txt(
'book_set_cancel'), $ilCtrl->getLinkTarget($this->parent_obj,
'rsvConfirmCancelUser'));
201 if($a_set[
'info_file'])
203 $items[
'info'] = array($lng->txt(
'book_download_info'), $ilCtrl->getLinkTarget($this->parent_obj,
'deliverInfo'));
208 $items[
'edit'] = array($lng->txt(
'edit'), $ilCtrl->getLinkTarget($this->parent_obj,
'edit'));
211 if(!$has_reservations)
213 $items[
'delete'] = array($lng->txt(
'delete'), $ilCtrl->getLinkTarget($this->parent_obj,
'confirmDelete'));
219 $this->tpl->setCurrentBlock(
"actions");
220 foreach($items as $item)
222 $this->tpl->setVariable(
"ACTION_CAPTION", $item[0]);
223 $this->tpl->setVariable(
"ACTION_LINK", $item[1]);
224 $this->tpl->parseCurrentBlock();