4 include_once(
"./Services/Table/classes/class.ilTable2GUI.php");
35 function __construct($a_parent_obj, $a_parent_cmd, $a_ref_id, $a_pool_id, $a_pool_has_schedule, $a_pool_overall_limit)
39 $this->ref_id = $a_ref_id;
40 $this->pool_id = $a_pool_id;
41 $this->has_schedule = $a_pool_has_schedule;
42 $this->overall_limit = $a_pool_overall_limit;
43 $this->may_edit = $ilAccess->checkAccess(
'write',
'', $this->ref_id);
47 $this->
setId(
"bkobj");
49 parent::__construct($a_parent_obj, $a_parent_cmd);
51 $this->
setTitle($lng->txt(
"book_objects_list"));
55 $this->
addColumn($this->lng->txt(
"title"),
"title");
60 $this->
addColumn($cols[$col][
"txt"], $col);
63 if(!$this->has_schedule)
65 $this->
addColumn($this->lng->txt(
"available"));
68 $this->
addColumn($this->lng->txt(
"actions"));
71 $this->
setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
72 $this->
setRowTemplate(
"tpl.booking_object_row.html",
"Modules/BookingManager");
86 return $this->record_gui;
115 $lng->txt(
"title").
"/".$lng->txt(
"description")
117 $this->filter[
"title"] =
$title->getValue();
120 if($this->has_schedule)
127 $lng->txt(
"book_period")
129 $this->filter[
"period"] = $period->getValue();
140 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
143 include_once
'Modules/BookingManager/classes/class.ilBookingSchedule.php';
144 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
147 if($this->has_schedule)
150 $limit = strtotime(
"+1year");
151 foreach(
$data as $idx => $item)
154 $av_from = ($schedule->getAvailabilityFrom() && !$schedule->getAvailabilityFrom()->isNull())
155 ? $schedule->getAvailabilityFrom()->get(
IL_CAL_UNIX)
157 $av_to = ($schedule->getAvailabilityTo() && !$schedule->getAvailabilityTo()->isNull())
158 ? strtotime($schedule->getAvailabilityTo()->get(
IL_CAL_DATE).
" 23:59:59")
160 if(($av_from && $av_from >
$limit) ||
161 ($av_to && $av_to < $now))
174 $this->lng->loadLanguageModule(
"dateplaner");
175 $data[$idx][
"full_up"] = $this->lng->txt(
"cal_booked_out");
181 foreach(
$data as $item)
183 $item_id = $item[
"booking_object_id"];
186 if(is_object($this->filter[
"period"][
"from"]) ||
187 is_object($this->filter[
"period"][
"to"]))
189 $from = is_object($this->filter[
"period"][
"from"])
190 ? strtotime($this->filter[
"period"][
"from"]->
get(
IL_CAL_DATE).
" 00:00:00")
192 $to = is_object($this->filter[
"period"][
"to"])
193 ? strtotime($this->filter[
"period"][
"to"]->
get(
IL_CAL_DATE).
" 23:59:59")
208 $this->reservations[$item_id] = $item_rsv[
"data"];
211 if(!$this->has_schedule &&
212 $this->overall_limit)
214 $this->current_bookings = 0;
215 foreach($this->reservations as $obj_rsv)
217 foreach($obj_rsv as $item)
221 if($item[
"user_id"] == $ilUser->getId())
223 $this->current_bookings++;
229 if($this->current_bookings >= $this->overall_limit)
238 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
240 $this->record_gui->setTableGUI($this);
241 $this->record_gui->parse();
243 include_once(
"./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
253 if (substr($a_field, 0, 3) ==
"md_")
255 $md_id = (int) substr($a_field, 3);
268 $cols[
"description"] =
array(
269 "txt" => $this->lng->txt(
"description"),
273 foreach($this->advmd as $field)
275 $cols[
"advmd".$field[
"id"]] =
array(
276 "txt" => $field[
"title"],
292 $has_booking =
false;
293 $booking_possible =
true;
294 $has_reservations =
false;
298 $this->tpl->setVariable(
"TXT_TITLE", $a_set[
"title"]);
300 if(in_array(
"description", $selected))
302 $this->tpl->setVariable(
"TXT_DESC", nl2br($a_set[
"description"]));
305 if($a_set[
"full_up"])
307 $this->tpl->setVariable(
"NOT_YET", $a_set[
"full_up"]);
308 $booking_possible =
false;
310 else if($a_set[
"not_yet"])
312 $this->tpl->setVariable(
"NOT_YET", $a_set[
"not_yet"]);
315 if(!$this->has_schedule)
318 foreach($this->reservations[$a_set[
"booking_object_id"]] as $item)
324 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))
339 $booking_possible =
false;
342 else if(!$this->may_edit)
344 foreach($this->reservations[$a_set[
"booking_object_id"]] as $item)
347 $item[
"user_id"] == $ilUser->getId())
356 $ilCtrl->setParameter($this->parent_obj,
'object_id', $a_set[
'booking_object_id']);
358 if($booking_possible)
360 if(is_object($this->filter[
'period'][
'from']))
362 $ilCtrl->setParameter($this->parent_obj,
'sseed', $this->filter[
'period'][
'from']->
get(
IL_CAL_DATE));
365 $items[
'book'] =
array($lng->txt(
'book_book'), $ilCtrl->getLinkTarget($this->parent_obj,
'book'));
367 $ilCtrl->setParameter($this->parent_obj,
'sseed',
'');
371 if(!$this->has_schedule && $has_booking)
373 if(trim($a_set[
'post_text']) || $a_set[
'post_file'])
375 $items[
'post'] =
array($lng->txt(
'book_post_booking_information'), $ilCtrl->getLinkTarget($this->parent_obj,
'displayPostInfo'));
378 $items[
'cancel'] =
array($lng->txt(
'book_set_cancel'), $ilCtrl->getLinkTarget($this->parent_obj,
'rsvConfirmCancelUser'));
381 if($this->may_edit || $has_booking)
383 $ilCtrl->setParameterByClass(
'ilObjBookingPoolGUI',
'object_id', $a_set[
'booking_object_id']);
384 $items[
'log'] =
array($lng->txt(
'book_log'), $ilCtrl->getLinkTargetByClass(
'ilObjBookingPoolGUI',
'log'));
385 $ilCtrl->setParameterByClass(
'ilObjBookingPoolGUI',
'object_id',
'');
388 if($a_set[
'info_file'])
390 $items[
'info'] =
array($lng->txt(
'book_download_info'), $ilCtrl->getLinkTarget($this->parent_obj,
'deliverInfo'));
395 $items[
'edit'] =
array($lng->txt(
'edit'), $ilCtrl->getLinkTarget($this->parent_obj,
'edit'));
398 if(!$has_reservations)
400 $items[
'delete'] =
array($lng->txt(
'delete'), $ilCtrl->getLinkTarget($this->parent_obj,
'confirmDelete'));
406 foreach ($this->advmd as $item)
408 $advmd_id = (int)$item[
"id"];
410 if(!in_array(
"advmd".$advmd_id, $selected))
416 if(isset($a_set[
"md_".$advmd_id.
"_presentation"]))
418 $pb = $a_set[
"md_".$advmd_id.
"_presentation"]->getList();
425 $this->tpl->setCurrentBlock(
"advmd_bl");
426 $this->tpl->setVariable(
"ADVMD_VAL", $val);
427 $this->tpl->parseCurrentBlock();
433 $this->tpl->setCurrentBlock(
"actions");
434 foreach($items as $item)
436 $this->tpl->setVariable(
"ACTION_CAPTION", $item[0]);
437 $this->tpl->setVariable(
"ACTION_LINK", $item[1]);
438 $this->tpl->parseCurrentBlock();
static getList($a_pool_id, $a_title=null)
Get list of booking objects for given type.
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=NULL)
Add filter by standard type.
schedule for booking ressource
__construct($a_parent_obj, $a_parent_cmd, $a_ref_id, $a_pool_id, $a_pool_has_schedule, $a_pool_overall_limit)
Constructor.
static getAdvancedMDFields($a_glossary_id)
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.
static formatDate(ilDateTime $date)
Format a date public.
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.
static queryForRecords($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.
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.
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.
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.
numericOrdering($a_field)