4 include_once(
"./Services/Table/classes/class.ilTable2GUI.php");
45 public function __construct($a_parent_obj, $a_parent_cmd, $a_ref_id, $a_pool_id, $a_pool_has_schedule, $a_pool_overall_limit)
49 $this->ctrl = $DIC->ctrl();
50 $this->lng = $DIC->language();
51 $this->access = $DIC->access();
52 $this->
user = $DIC->user();
54 $lng = $DIC->language();
55 $ilAccess = $DIC->access();
57 $this->ref_id = $a_ref_id;
58 $this->pool_id = $a_pool_id;
59 $this->has_schedule = $a_pool_has_schedule;
60 $this->overall_limit = $a_pool_overall_limit;
61 $this->may_edit = $ilAccess->checkAccess(
'write',
'', $this->ref_id);
65 $this->
setId(
"bkobj");
67 parent::__construct($a_parent_obj, $a_parent_cmd);
73 $this->
addColumn($this->lng->txt(
"title"),
"title");
77 $this->
addColumn($cols[$col][
"txt"], $col);
80 if (!$this->has_schedule) {
81 $this->
addColumn($this->lng->txt(
"available"));
84 $this->
addColumn($this->lng->txt(
"actions"));
88 $this->
setRowTemplate(
"tpl.booking_object_row.html",
"Modules/BookingManager");
102 return $this->record_gui;
131 $lng->txt(
"title") .
"/" .
$lng->txt(
"description")
133 $this->filter[
"title"] =
$title->getValue();
136 if ($this->has_schedule) {
142 $lng->txt(
"book_period")
144 $this->filter[
"period"] = $period->getValue();
155 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
158 include_once
'Modules/BookingManager/classes/class.ilBookingSchedule.php';
159 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
162 if ($this->has_schedule) {
164 $limit = strtotime(
"+1year");
165 foreach (
$data as $idx => $item) {
167 $av_from = ($schedule->getAvailabilityFrom() && !$schedule->getAvailabilityFrom()->isNull())
168 ? $schedule->getAvailabilityFrom()->get(
IL_CAL_UNIX)
170 $av_to = ($schedule->getAvailabilityTo() && !$schedule->getAvailabilityTo()->isNull())
171 ? strtotime($schedule->getAvailabilityTo()->get(
IL_CAL_DATE) .
" 23:59:59")
173 if (($av_from && $av_from >
$limit) ||
174 ($av_to && $av_to < $now)) {
177 if ($av_from > $now) {
183 $this->lng->loadLanguageModule(
"dateplaner");
184 $data[$idx][
"full_up"] = $this->lng->txt(
"cal_booked_out");
190 foreach (
$data as $item) {
191 $item_id = $item[
"booking_object_id"];
194 if (is_object($this->filter[
"period"][
"from"]) ||
195 is_object($this->filter[
"period"][
"to"])) {
196 $from = is_object($this->filter[
"period"][
"from"])
197 ? strtotime($this->filter[
"period"][
"from"]->
get(
IL_CAL_DATE) .
" 00:00:00")
199 $to = is_object($this->filter[
"period"][
"to"])
200 ? strtotime($this->filter[
"period"][
"to"]->
get(
IL_CAL_DATE) .
" 23:59:59")
214 $this->reservations[$item_id] = $item_rsv[
"data"];
217 if (!$this->has_schedule &&
218 $this->overall_limit) {
219 $this->current_bookings = 0;
220 foreach ($this->reservations as $obj_rsv) {
221 foreach ($obj_rsv as $item) {
223 if ($item[
"user_id"] ==
$ilUser->getId()) {
224 $this->current_bookings++;
230 if ($this->current_bookings >= $this->overall_limit) {
237 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
239 $this->record_gui->setTableGUI($this);
240 $this->record_gui->parse();
242 include_once(
"./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
252 $this->record_gui->getFilterElements()
262 if (substr($a_field, 0, 3) ==
"md_") {
263 $md_id = (int) substr($a_field, 3);
276 "txt" => $this->lng->txt(
"description"),
280 foreach ($this->advmd as $field) {
282 "txt" => $field[
"title"],
300 $has_booking =
false;
301 $booking_possible =
true;
302 $has_reservations =
false;
306 $this->tpl->setVariable(
"TXT_TITLE", $a_set[
"title"]);
308 if (in_array(
"description", $selected)) {
309 $this->tpl->setVariable(
"TXT_DESC", nl2br($a_set[
"description"]));
312 if ($a_set[
"full_up"]) {
313 $this->tpl->setVariable(
"NOT_YET", $a_set[
"full_up"]);
314 $booking_possible =
false;
315 } elseif ($a_set[
"not_yet"]) {
316 $this->tpl->setVariable(
"NOT_YET", $a_set[
"not_yet"]);
319 if (!$this->has_schedule) {
321 foreach ($this->reservations[$a_set[
"booking_object_id"]] as $item) {
325 if ($item[
"user_id"] ==
$ilUser->getId()) {
329 $has_reservations =
true;
333 $this->tpl->setVariable(
"VALUE_AVAIL", $a_set[
"nr_items"]-$cnt);
334 $this->tpl->setVariable(
"VALUE_AVAIL_ALL", $a_set[
"nr_items"]);
336 if ($a_set[
"nr_items"] <= $cnt || $has_booking
337 || ($this->overall_limit && $this->current_bookings && $this->current_bookings >= $this->overall_limit)) {
338 $booking_possible =
false;
340 } elseif (!$this->may_edit) {
341 foreach ($this->reservations[$a_set[
"booking_object_id"]] as $item) {
343 $item[
"user_id"] ==
$ilUser->getId()) {
351 $ilCtrl->setParameter($this->parent_obj,
'object_id', $a_set[
'booking_object_id']);
353 if ($booking_possible) {
354 if (is_object($this->filter[
'period'][
'from'])) {
355 $ilCtrl->setParameter($this->parent_obj,
'sseed', $this->filter[
'period'][
'from']->
get(
IL_CAL_DATE));
358 $items[
'book'] =
array(
$lng->txt(
'book_book'),
$ilCtrl->getLinkTarget($this->parent_obj,
'book'));
360 $ilCtrl->setParameter($this->parent_obj,
'sseed',
'');
364 if (!$this->has_schedule && $has_booking) {
365 if (trim($a_set[
'post_text']) || $a_set[
'post_file']) {
366 $items[
'post'] =
array(
$lng->txt(
'book_post_booking_information'),
$ilCtrl->getLinkTarget($this->parent_obj,
'displayPostInfo'));
369 $items[
'cancel'] =
array(
$lng->txt(
'book_set_cancel'),
$ilCtrl->getLinkTarget($this->parent_obj,
'rsvConfirmCancelUser'));
372 if ($this->may_edit || $has_booking) {
373 $ilCtrl->setParameterByClass(
'ilObjBookingPoolGUI',
'object_id', $a_set[
'booking_object_id']);
374 $items[
'log'] =
array(
$lng->txt(
'book_log'),
$ilCtrl->getLinkTargetByClass(
'ilObjBookingPoolGUI',
'log'));
375 $ilCtrl->setParameterByClass(
'ilObjBookingPoolGUI',
'object_id',
'');
378 if ($a_set[
'info_file']) {
379 $items[
'info'] =
array(
$lng->txt(
'book_download_info'),
$ilCtrl->getLinkTarget($this->parent_obj,
'deliverInfo'));
382 if ($this->may_edit) {
383 $items[
'edit'] =
array(
$lng->txt(
'edit'),
$ilCtrl->getLinkTarget($this->parent_obj,
'edit'));
386 if (!$has_reservations) {
387 $items[
'delete'] =
array(
$lng->txt(
'delete'),
$ilCtrl->getLinkTarget($this->parent_obj,
'confirmDelete'));
392 foreach ($this->advmd as $item) {
393 $advmd_id = (int) $item[
"id"];
395 if (!in_array(
"advmd" . $advmd_id, $selected)) {
400 if (isset($a_set[
"md_" . $advmd_id .
"_presentation"])) {
401 $pb = $a_set[
"md_" . $advmd_id .
"_presentation"]->getList();
407 $this->tpl->setCurrentBlock(
"advmd_bl");
408 $this->tpl->setVariable(
"ADVMD_VAL", $val);
409 $this->tpl->parseCurrentBlock();
413 if (
sizeof($items)) {
414 $this->tpl->setCurrentBlock(
"actions");
415 foreach ($items as $item) {
416 $this->tpl->setVariable(
"ACTION_CAPTION", $item[0]);
417 $this->tpl->setVariable(
"ACTION_LINK", $item[1]);
418 $this->tpl->parseCurrentBlock();
static getList($a_pool_id, $a_title=null)
Get list of booking objects for given type.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
schedule for booking ressource
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=null)
Add filter by standard type.
__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.
Create styles array
The data for the language used.
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.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
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)