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"));
53 $this->
addColumn($this->lng->txt(
"actions"));
56 $this->
setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
57 $this->
setRowTemplate(
"tpl.booking_object_row.html",
"Modules/BookingManager");
67 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
83 $booking_possible =
true;
84 $has_reservations =
false;
86 $this->tpl->setVariable(
"TXT_TITLE", $a_set[
"title"]);
87 $this->tpl->setVariable(
"TXT_DESC", nl2br($a_set[
"description"]));
89 if(!$this->has_schedule)
91 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
94 foreach($reservation[
"data"] as $item)
100 if($item[
"user_id"] == $ilUser->getId())
105 $has_reservations =
true;
109 $this->tpl->setVariable(
"VALUE_AVAIL", $a_set[
"nr_items"]-$cnt);
110 $this->tpl->setVariable(
"VALUE_AVAIL_ALL", $a_set[
"nr_items"]);
112 if($a_set[
"nr_items"] <= $cnt || $has_booking)
114 $booking_possible =
false;
117 else if(!$this->may_edit)
119 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
121 foreach($reservation[
"data"] as $item)
124 $item[
"user_id"] == $ilUser->getId())
133 $ilCtrl->setParameter($this->parent_obj,
'object_id', $a_set[
'booking_object_id']);
135 if($booking_possible)
137 $items[
'book'] = array($lng->txt(
'book_book'), $ilCtrl->getLinkTarget($this->parent_obj,
'book'));
141 if(!$this->has_schedule && $has_booking)
143 if(trim($a_set[
'post_text']) || $a_set[
'post_file'])
145 $items[
'post'] = array($lng->txt(
'book_post_booking_information'), $ilCtrl->getLinkTarget($this->parent_obj,
'displayPostInfo'));
148 $items[
'cancel'] = array($lng->txt(
'book_set_cancel'), $ilCtrl->getLinkTarget($this->parent_obj,
'rsvConfirmCancelUser'));
151 if($this->may_edit || $has_booking)
153 $ilCtrl->setParameterByClass(
'ilObjBookingPoolGUI',
'object_id', $a_set[
'booking_object_id']);
154 $items[
'log'] = array($lng->txt(
'book_log'), $ilCtrl->getLinkTargetByClass(
'ilObjBookingPoolGUI',
'log'));
155 $ilCtrl->setParameterByClass(
'ilObjBookingPoolGUI',
'object_id',
'');
158 if($a_set[
'info_file'])
160 $items[
'info'] = array($lng->txt(
'book_download_info'), $ilCtrl->getLinkTarget($this->parent_obj,
'deliverInfo'));
165 $items[
'edit'] = array($lng->txt(
'edit'), $ilCtrl->getLinkTarget($this->parent_obj,
'edit'));
168 if(!$has_reservations)
170 $items[
'delete'] = array($lng->txt(
'delete'), $ilCtrl->getLinkTarget($this->parent_obj,
'confirmDelete'));
176 $this->tpl->setCurrentBlock(
"actions");
177 foreach($items as $item)
179 $this->tpl->setVariable(
"ACTION_CAPTION", $item[0]);
180 $this->tpl->setVariable(
"ACTION_LINK", $item[1]);
181 $this->tpl->parseCurrentBlock();