ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilBookingObjectsTableGUI Class Reference

List booking objects (for booking type) More...

+ Inheritance diagram for ilBookingObjectsTableGUI:
+ Collaboration diagram for ilBookingObjectsTableGUI:

Public Member Functions

 __construct ($a_parent_obj, $a_parent_cmd, $a_ref_id, $a_pool_id, $a_pool_has_schedule, $a_pool_overall_limit)
 Constructor. More...
 
 initFilter ()
 
 getItems ()
 Gather data and build rows. More...
 
 numericOrdering ($a_field)
 
 getSelectableColumns ()
 
- Public Member Functions inherited from ilTable2GUI
 __construct ($a_parent_obj, $a_parent_cmd="", $a_template_context="")
 ilTable2GUI constructor. More...
 
 setOpenFormTag ($a_val)
 Set open form tag. More...
 
 getOpenFormTag ()
 Get open form tag. More...
 
 setCloseFormTag ($a_val)
 Set close form tag. More...
 
 getCloseFormTag ()
 Get close form tag. More...
 
 determineLimit ()
 Determine the limit. More...
 
 getSelectableColumns ()
 Get selectable columns. More...
 
 determineSelectedColumns ()
 Determine selected columns. More...
 
 isColumnSelected ($a_col)
 Is given column selected? More...
 
 getSelectedColumns ()
 Get selected columns. More...
 
 executeCommand ()
 Execute command. More...
 
 resetOffset ($a_in_determination=false)
 Reset offset. More...
 
 initFilter ()
 Init filter. More...
 
 getParentObject ()
 Get parent object. More...
 
 getParentCmd ()
 Get parent command. More...
 
 setTopAnchor ($a_val)
 Set top anchor. More...
 
 getTopAnchor ()
 Get top anchor. More...
 
 setNoEntriesText ($a_text)
 Set text for an empty table. More...
 
 getNoEntriesText ()
 Get text for an empty table. More...
 
 setIsDataTable ($a_val)
 Set is data table. More...
 
 getIsDataTable ()
 Get is data table. More...
 
 setEnableTitle ($a_enabletitle)
 Set Enable Title. More...
 
 getEnableTitle ()
 Get Enable Title. More...
 
 setEnableHeader ($a_enableheader)
 Set Enable Header. More...
 
 getEnableHeader ()
 Get Enable Header. More...
 
 setEnableNumInfo ($a_val)
 Set enable num info. More...
 
 getEnableNumInfo ()
 Get enable num info. More...
 
 setTitle ($a_title, $a_icon=0, $a_icon_alt=0)
 Set title and title icon. More...
 
 setDescription ($a_val)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 setOrderField ($a_order_field)
 set order column More...
 
 getOrderField ()
 
 setData ($a_data)
 
 getData ()
 
 dataExists ()
 
 setPrefix ($a_prefix)
 
 getPrefix ()
 
 addFilterItem ($a_input_item, $a_optional=false)
 Add filter item. More...
 
 addFilterItemByMetaType ($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=null)
 Add filter by standard type. More...
 
 getFilterItems ($a_optionals=false)
 Get filter items. More...
 
 getFilterItemByPostVar ($a_post_var)
 
 setFilterCols ($a_val)
 Set filter columns. More...
 
 getFilterCols ()
 Get filter columns. More...
 
 setDisableFilterHiding ($a_val=true)
 Set disable filter hiding. More...
 
 getDisableFilterHiding ()
 Get disable filter hiding. More...
 
 isFilterSelected ($a_col)
 Is given filter selected? More...
 
 getSelectedFilters ()
 Get selected filters. More...
 
 determineSelectedFilters ()
 Determine selected filters. More...
 
 setCustomPreviousNext ($a_prev_link, $a_next_link)
 Set custom previous/next links. More...
 
 setFormAction ($a_form_action, $a_multipart=false)
 Set Form action parameter. More...
 
 getFormAction ()
 Get Form action parameter. More...
 
 setFormName ($a_formname="")
 Set Form name. More...
 
 getFormName ()
 Get Form name. More...
 
 setId ($a_val)
 Set id. More...
 
 getId ()
 Get element id. More...
 
 setDisplayAsBlock ($a_val)
 Set display as block. More...
 
 getDisplayAsBlock ()
 Get display as block. More...
 
 getSelectAllCheckbox ()
 Get the name of the checkbox that should be toggled with a select all button. More...
 
 setSelectAllCheckbox ($a_select_all_checkbox, $a_select_all_on_top=false)
 Set the name of the checkbox that should be toggled with a select all button. More...
 
 setExternalSorting ($a_val)
 Set external sorting. More...
 
 getExternalSorting ()
 Get external sorting. More...
 
 setFilterCommand ($a_val, $a_caption=null)
 Set filter command. More...
 
 getFilterCommand ()
 Get filter command. More...
 
 setResetCommand ($a_val, $a_caption=null)
 Set reset filter command. More...
 
 getResetCommand ()
 Get reset filter command. More...
 
 setExternalSegmentation ($a_val)
 Set external segmentation. More...
 
 getExternalSegmentation ()
 Get external segmentation. More...
 
 setRowTemplate ($a_template, $a_template_dir="")
 Set row template. More...
 
 setDefaultOrderField ($a_defaultorderfield)
 Set Default order field. More...
 
 getDefaultOrderField ()
 Get Default order field. More...
 
 setDefaultOrderDirection ($a_defaultorderdirection)
 Set Default order direction. More...
 
 getDefaultOrderDirection ()
 Get Default order direction. More...
 
 setDefaultFilterVisiblity ($a_status)
 Set default filter visiblity. More...
 
 getDefaultFilterVisibility ()
 Get default filter visibility. More...
 
 clearCommandButtons ()
 
 addCommandButton ($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
 Add Command button. More...
 
 addCommandButtonInstance (ilButtonBase $a_button)
 Add Command button instance. More...
 
 addSelectionButton ($a_sel_var, $a_options, $a_cmd, $a_text, $a_default_selection='')
 Add Selection List + Command button. More...
 
 addMultiItemSelectionButton ($a_sel_var, $a_options, $a_cmd, $a_text, $a_default_selection='')
 Add Selection List + Command button for selected items. More...
 
 setCloseCommand ($a_link)
 Add command for closing table. More...
 
 addMultiCommand ($a_cmd, $a_text)
 Add Command button. More...
 
 addHiddenInput ($a_name, $a_value)
 Add Hidden Input field. More...
 
 addHeaderCommand ($a_href, $a_text, $a_target="", $a_img="")
 Add Header Command (Link) (Image needed for now) More...
 
 setTopCommands ($a_val)
 Set top commands (display command buttons on top of table, too) More...
 
 getTopCommands ()
 Get top commands (display command buttons on top of table, too) More...
 
 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. More...
 
 getNavParameter ()
 
 setOrderLink ($sort_field, $order_dir)
 
 fillHeader ()
 
 determineOffsetAndOrder ($a_omit_offset=false)
 Determine offset and order. More...
 
 storeNavParameter ()
 
 getHTML ()
 Get HTML. More...
 
 numericOrdering ($a_field)
 Should this field be sorted numeric? More...
 
 render ()
 render table public More...
 
 writeFilterToSession ()
 Write filter values to session. More...
 
 resetFilter ()
 Reset filter. More...
 
 fillFooter ()
 Fill footer row. More...
 
 getLinkbar ($a_num)
 Get previous/next linkbar. More...
 
 fillHiddenRow ()
 
 fillActionRow ()
 Fill Action Row. More...
 
 setHeaderHTML ($html)
 set header html More...
 
 storeProperty ($type, $value)
 Store table property. More...
 
 loadProperty ($type)
 Load table property. More...
 
 getCurrentState ()
 get current settings for order, limit, columns and filter More...
 
 setContext ($id)
 Set context. More...
 
 getContext ()
 Get context. More...
 
 setShowRowsSelector ($a_value)
 Toggle rows-per-page selector. More...
 
 getShowRowsSelector ()
 Get rows-per-page selector state. More...
 
 setShowTemplates ($a_value)
 Toggle templates. More...
 
 getShowTemplates ()
 Get template state. More...
 
 restoreTemplate ($a_name)
 Restore state from template. More...
 
 saveTemplate ($a_name)
 Save current state as template. More...
 
 deleteTemplate ($a_name)
 Delete template. More...
 
 getLimit ()
 Get limit. More...
 
 getOffset ()
 Get offset. More...
 
 setExportFormats (array $formats)
 Set available export formats. More...
 
 setPrintMode ($a_value=false)
 Toogle print mode. More...
 
 getPrintMode ()
 Get print mode. More...
 
 getExportMode ()
 Was export activated? More...
 
 exportData ($format, $send=false)
 Export and optionally send current table data. More...
 
 setEnableAllCommand ($a_value)
 Enable actions for all entries in current result. More...
 
 setRowSelectorLabel ($row_selector_label)
 
 getRowSelectorLabel ()
 
 setPreventDoubleSubmission ($a_val)
 Set prevent double submission. More...
 
 getPreventDoubleSubmission ()
 Get prevent double submission. More...
 
 setLimit ($a_limit=0, $a_default_limit=0)
 
- Public Member Functions inherited from ilTableGUI
 __construct ($a_data=0, $a_global_tpl=true)
 Constructor. More...
 
 setTemplate ($a_tpl)
 set template public More...
 
getTemplateObject ()
 
 setData ($a_data)
 set table data public More...
 
 getData ()
 
 setTitle ($a_title, $a_icon=0, $a_icon_alt=0)
 set table title public More...
 
 setHelp ($a_help_page, $a_help_icon, $a_help_icon_alt=0)
 set table help page public More...
 
 setHeaderNames ($a_header_names)
 set table header names public More...
 
 getColumnCount ()
 Returns the column count based on the number of the header row columns public. More...
 
 setHeaderVars ($a_header_vars, $a_header_params=0)
 set table header vars public More...
 
 setColumnWidth ($a_column_width)
 set table column widths public More...
 
 setOneColumnWidth ($a_column_width, $a_column_number)
 set one table column width public More...
 
 setMaxCount ($a_max_count)
 set max. More...
 
 setLimit ($a_limit=0, $a_default_limit=0)
 set max. More...
 
 getLimit ()
 Get limit. More...
 
 setPrefix ($a_prefix)
 set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort separately) public More...
 
 setOffset ($a_offset)
 set dataset offset public More...
 
 getOffset ()
 Get offset. More...
 
 setOrderColumn ($a_order_column=0, $a_default_column=0)
 set order column public More...
 
 getOrderColumn ()
 Get order column. More...
 
 setOrderDirection ($a_order_direction)
 set order direction public More...
 
 getOrderDirection ()
 Get order direction. More...
 
 setFooter ($a_style, $a_previous=0, $a_next=0)
 set order direction public More...
 
 enable ($a_module_name)
 enables particular modules of table More...
 
 disable ($a_module_name)
 diesables particular modules of table More...
 
 sortData ()
 
 render ()
 render table public More...
 
 renderHeader ()
 
 setOrderLink ($key, $order_dir)
 
 setStyle ($a_element, $a_style)
 
 getStyle ($a_element)
 
 setBase ($a_base)
 Set Base script name (deprecated, only use this for workarounds). More...
 
 getBase ()
 Get Base script name (deprecated, only use this for workarounds). More...
 
 getFormName ()
 
 setFormName ($a_name="cmd")
 
 getSelectAllCheckbox ()
 
 setSelectAllCheckbox ($a_select_all_checkbox)
 
 clearActionButtons ()
 
 addActionButton ($btn_name, $btn_value)
 

Protected Member Functions

 getAdvMDRecordGUI ()
 needed for advmd filter handling More...
 
 fillRow ($a_set)
 Fill table row. More...
 
- Protected Member Functions inherited from ilTable2GUI
 prepareOutput ()
 Anything that must be done before HTML is generated. More...
 
 isFilterVisible ()
 Check if filter is visible: manually shown (session, db) or default value set. More...
 
 isAdvMDFilter (ilAdvancedMDRecordGUI $a_gui, $a_element)
 Check if filter element is based on adv md. More...
 
 fillRow ($a_set)
 Standard Version of Fill Row. More...
 
 getFilterValue (ilFormPropertyGUI $a_item)
 Get current filter value. More...
 
 SetFilterValue (ilFormPropertyGUI $a_item, $a_value)
 Set current filter value. More...
 
 fillMetaExcel (ilExcel $a_excel, &$a_row)
 Add meta information to excel export. More...
 
 fillHeaderExcel (ilExcel $a_excel, &$a_row)
 Excel Version of Fill Header. More...
 
 fillRowExcel (ilExcel $a_excel, &$a_row, $a_set)
 Excel Version of Fill Row. More...
 
 fillMetaCSV ($a_csv)
 Add meta information to csv export. More...
 
 fillHeaderCSV ($a_csv)
 CSV Version of Fill Header. More...
 
 fillRowCSV ($a_csv, $a_set)
 CSV Version of Fill Row. More...
 

Protected Attributes

 $access
 
 $user
 
 $ref_id
 
 $pool_id
 
 $has_schedule
 
 $may_edit
 
 $may_assign
 
 $overall_limit
 
 $reservations = array()
 
 $current_bookings
 
 $advmd
 
 $filter
 
 $ui_factory
 
 $ui_renderer
 
- Protected Attributes inherited from ilTable2GUI
 $ctrl
 
 $tpl
 
 $parent_obj
 
 $parent_cmd
 
 $close_command = ""
 
 $top_anchor = "il_table_top"
 
 $filters = array()
 
 $optional_filters = array()
 
 $filter_cmd = 'applyFilter'
 
 $reset_cmd = 'resetFilter'
 
 $filter_cols = 5
 
 $ext_sort = false
 
 $ext_seg = false
 
 $context = ""
 
 $mi_sel_buttons = []
 
 $disable_filter_hiding = false
 
 $selected_filter = false
 
 $top_commands = true
 
 $selectable_columns = array()
 
 $selected_column = array()
 
 $show_templates = false
 
 $show_rows_selector = true
 
 $rows_selector_off = false
 
 $nav_determined = false
 
 $limit_determined = false
 
 $filters_determined = false
 
 $columns_determined = false
 
 $open_form_tag = true
 
 $close_form_tag = true
 
 $export_formats = []
 
 $export_mode
 
 $print_mode
 
 $enable_command_for_all
 
 $restore_filter
 
 $restore_filter_values
 
 $default_filter_visibility = false
 
 $sortable_fields = array()
 
 $prevent_double_submission = true
 
 $row_selector_label
 
 $select_all_on_top = false
 
 $sel_buttons = []
 
- Protected Attributes inherited from ilTableGUI
 $tpl
 
 $lng
 

Additional Inherited Members

- Static Public Member Functions inherited from ilTable2GUI
static getAllCommandLimit ()
 Get maximum number of entries to enable actions for all. More...
 
- Data Fields inherited from ilTable2GUI
const FILTER_TEXT = 1
 
const FILTER_SELECT = 2
 
const FILTER_DATE = 3
 
const FILTER_LANGUAGE = 4
 
const FILTER_NUMBER_RANGE = 5
 
const FILTER_DATE_RANGE = 6
 
const FILTER_DURATION_RANGE = 7
 
const FILTER_DATETIME_RANGE = 8
 
const FILTER_CHECKBOX = 9
 
const EXPORT_EXCEL = 1
 
const EXPORT_CSV = 2
 
const ACTION_ALL_LIMIT = 1000
 
- Data Fields inherited from ilTableGUI
 $title
 
 $icon
 
 $icon_alt
 
 $help_page
 
 $help_icon
 
 $help_icon_alt
 
 $header_names
 
 $header_vars
 
 $linkbar_vars
 
 $data
 
 $column_count
 
 $column_width
 
 $max_count
 
 $limit
 
 $max_limit = false
 
 $offset
 
 $order_column
 
 $order_direction
 
 $footer_style
 
 $footer_previous
 
 $footer_next
 
 $lang_support = true
 
 $global_tpl
 
 $form_name
 
 $select_all_checkbox
 
 $action_buttons
 
 $prefix
 
 $base = ""
 
 $enabled
 
 $styles
 

Detailed Description

List booking objects (for booking type)

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 14 of file class.ilBookingObjectsTableGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilBookingObjectsTableGUI::__construct (   $a_parent_obj,
  $a_parent_cmd,
  $a_ref_id,
  $a_pool_id,
  $a_pool_has_schedule,
  $a_pool_overall_limit 
)

Constructor.

Parameters
object$a_parent_obj
string$a_parent_cmd
int$a_ref_id
int$a_pool_id
bool$a_pool_has_schedule
int$a_pool_overall_limit

Definition at line 48 of file class.ilBookingObjectsTableGUI.php.

References $cols, $DIC, $ilCtrl, ilTableGUI\$lng, ilTable2GUI\addColumn(), ilObjBookingPool\getAdvancedMDFields(), getItems(), getSelectableColumns(), ilTable2GUI\getSelectedColumns(), initFilter(), ilTable2GUI\setEnableHeader(), ilTable2GUI\setFormAction(), ilTable2GUI\setId(), ilTable2GUI\setRowTemplate(), ilTable2GUI\setTitle(), and user().

49  {
50  global $DIC;
51 
52  $this->ctrl = $DIC->ctrl();
53  $this->lng = $DIC->language();
54  $this->access = $DIC->access();
55  $this->user = $DIC->user();
56  $ilCtrl = $DIC->ctrl();
57  $lng = $DIC->language();
58  $ilAccess = $DIC->access();
59  $this->ui_factory = $DIC->ui()->factory();
60  $this->ui_renderer = $DIC->ui()->renderer();
61 
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);
68 
69  $this->advmd = ilObjBookingPool::getAdvancedMDFields($this->ref_id);
70 
71  $this->setId("bkobj");
72 
73  parent::__construct($a_parent_obj, $a_parent_cmd);
74 
75  $this->setTitle($lng->txt("book_objects_list"));
76 
77  // $this->setLimit(9999);
78 
79  $this->addColumn($this->lng->txt("title"), "title");
80 
81  $cols = $this->getSelectableColumns();
82  foreach ($this->getSelectedColumns() as $col) {
83  $this->addColumn($cols[$col]["txt"], $col);
84  }
85 
86  if (!$this->has_schedule) {
87  $this->addColumn($this->lng->txt("available"));
88  }
89 
90  $this->addColumn($this->lng->txt("actions"));
91 
92  $this->setEnableHeader(true);
93  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
94  $this->setRowTemplate("tpl.booking_object_row.html", "Modules/BookingManager");
95 
96  $this->initFilter();
97  $this->getItems();
98  }
global $DIC
Definition: saml.php:7
setId($a_val)
Set id.
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
getSelectedColumns()
Get selected columns.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
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.
static getAdvancedMDFields($a_ref_id)
$cols
Definition: xhr_table.php:11
+ Here is the call graph for this function:

Member Function Documentation

◆ fillRow()

ilBookingObjectsTableGUI::fillRow (   $a_set)
protected

Fill table row.

Parameters
array$a_set

Definition at line 282 of file class.ilBookingObjectsTableGUI.php.

References ilTable2GUI\$ctrl, $ilCtrl, $ilUser, ilTableGUI\$lng, $user, ilTable2GUI\getSelectedColumns(), IL_CAL_DATE, and ilBookingReservation\STATUS_CANCELLED.

283  {
284  $lng = $this->lng;
287 
288  $has_booking = false;
289  $booking_possible = true;
290  $assign_possible = true;
291  $has_reservations = false;
292 
293  $selected = $this->getSelectedColumns();
294 
295  $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
296 
297  if (in_array("description", $selected)) {
298  $this->tpl->setVariable("TXT_DESC", nl2br($a_set["description"]));
299  }
300 
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"]);
307  }
308 
309  if (!$this->has_schedule) {
310  $cnt = 0;
311  foreach ($this->reservations[$a_set["booking_object_id"]] as $item) {
312  if ($item["status"] != ilBookingReservation::STATUS_CANCELLED) {
313  $cnt++;
314 
315  if ($item["user_id"] == $ilUser->getId()) {
316  $has_booking = true;
317  }
318 
319  $has_reservations = true;
320  }
321  }
322 
323  $this->tpl->setVariable("VALUE_AVAIL", $a_set["nr_items"] - $cnt);
324  $this->tpl->setVariable("VALUE_AVAIL_ALL", $a_set["nr_items"]);
325 
326  if ($a_set["nr_items"] <= $cnt || ($this->overall_limit && $this->current_bookings && $this->current_bookings >= $this->overall_limit)) {
327  $booking_possible = false;
328  }
329  if ($has_booking) {
330  $booking_possible = false;
331  }
332  if ($a_set["nr_items"] <= $cnt) {
333  $assign_possible = false;
334  }
335  } elseif (!$this->may_edit) {
336  foreach ($this->reservations[$a_set["booking_object_id"]] as $item) {
337  if ($item["status"] != ilBookingReservation::STATUS_CANCELLED &&
338  $item["user_id"] == $ilUser->getId()) {
339  $has_booking = true;
340  }
341  }
342  }
343 
344  //Actions
345  $items = array();
346 
347  $ilCtrl->setParameter($this->parent_obj, 'object_id', $a_set['booking_object_id']);
348 
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));
352  }
353 
354  $items[] = $this->ui_factory->button()->shy($lng->txt('book_book'), $ilCtrl->getLinkTarget($this->parent_obj, 'book'));
355 
356  $ilCtrl->setParameter($this->parent_obj, 'sseed', '');
357  }
358 
359  // #16663
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'));
363  }
364  $items[] = $this->ui_factory->button()->shy($lng->txt('book_set_cancel'), $ilCtrl->getLinkTarget($this->parent_obj, 'rsvConfirmCancelUser'));
365  }
366 
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', '');
371  }
372 
373  // tutors (may_assign) make reservations for members (e.g. of a course)
374  if ($this->may_assign && $assign_possible) {
375 
376  // note: this call is currently super expensive
377  // see #26388, it has been performed even for users without edit permissions before
378  // now the call has been moved here, but still this needs improvement
379  // EDIT: deactivated for now due to performance reasons
380  // if (!empty(ilBookingParticipant::getAssignableParticipants($a_set["booking_object_id"]))) {
381  if (is_object($this->filter['period']['from'])) {
382  $ilCtrl->setParameter(
383  $this->parent_obj,
384  'sseed',
385  $this->filter['period']['from']->get(IL_CAL_DATE)
386  );
387  }
388 
389  $items[] = $this->ui_factory->button()->shy(
390  $lng->txt('book_assign_participant'),
391  $ilCtrl->getLinkTarget($this->parent_obj, 'assignParticipants')
392  );
393 
394  $ilCtrl->setParameter($this->parent_obj, 'sseed', '');
395  //}
396  }
397 
398  if ($a_set['info_file']) {
399  $items[] = $this->ui_factory->button()->shy($lng->txt('book_download_info'), $ilCtrl->getLinkTarget($this->parent_obj, 'deliverInfo'));
400  }
401 
402  if ($this->may_edit) {
403  $items[] = $this->ui_factory->button()->shy($lng->txt('edit'), $ilCtrl->getLinkTarget($this->parent_obj, 'edit'));
404 
405  // #10890
406  if (!$has_reservations) {
407  $items[] = $this->ui_factory->button()->shy($lng->txt('delete'), $ilCtrl->getLinkTarget($this->parent_obj, 'confirmDelete'));
408  }
409  }
410 
411  if ($this->advmd) {
412  foreach ($this->advmd as $item) {
413  $advmd_id = (int) $item["id"];
414 
415  if (!in_array("advmd" . $advmd_id, $selected)) {
416  continue;
417  }
418 
419  $val = " ";
420  if (isset($a_set["md_" . $advmd_id . "_presentation"])) {
421  $pb = $a_set["md_" . $advmd_id . "_presentation"]->getList();
422  if ($pb) {
423  $val = $pb;
424  }
425  }
426 
427  $this->tpl->setCurrentBlock("advmd_bl");
428  $this->tpl->setVariable("ADVMD_VAL", $val);
429  $this->tpl->parseCurrentBlock();
430  }
431  }
432 
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));
436  }
437  }
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
getSelectedColumns()
Get selected columns.
const IL_CAL_DATE
+ Here is the call graph for this function:

◆ getAdvMDRecordGUI()

ilBookingObjectsTableGUI::getAdvMDRecordGUI ( )
protected

needed for advmd filter handling

Returns
ilAdvancedMDRecordGUI

Definition at line 105 of file class.ilBookingObjectsTableGUI.php.

106  {
107  // #16827
108  return $this->record_gui;
109  }

◆ getItems()

ilBookingObjectsTableGUI::getItems ( )

Gather data and build rows.

Definition at line 140 of file class.ilBookingObjectsTableGUI.php.

References ilTableGUI\$data, $from, $ilUser, ilTableGUI\$limit, $user, ilDatePresentation\formatDate(), ilBookingObject\getList(), ilBookingReservation\getList(), IL_CAL_DATE, IL_CAL_UNIX, ilBookingReservation\isObjectAvailableInPeriod(), ilAdvancedMDRecordGUI\MODE_FILTER, ilAdvancedMDValues\queryForRecords(), ilUtil\sendInfo(), ilTable2GUI\setData(), ilTableGUI\setMaxCount(), and ilBookingReservation\STATUS_CANCELLED.

Referenced by __construct().

141  {
143 
144  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
145  $data = ilBookingObject::getList($this->pool_id, $this->filter["title"]);
146 
147  include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
148  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
149 
150  // check schedule availability
151  if ($this->has_schedule) {
152  $now = time();
153  $limit = strtotime("+1year");
154  foreach ($data as $idx => $item) {
155  $schedule = new ilBookingSchedule($item["schedule_id"]);
156  $av_from = ($schedule->getAvailabilityFrom() && !$schedule->getAvailabilityFrom()->isNull())
157  ? $schedule->getAvailabilityFrom()->get(IL_CAL_UNIX)
158  : null;
159  $av_to = ($schedule->getAvailabilityTo() && !$schedule->getAvailabilityTo()->isNull())
160  ? strtotime($schedule->getAvailabilityTo()->get(IL_CAL_DATE) . " 23:59:59")
161  : null;
162  if (($av_from && $av_from > $limit)) {
163  unset($data[$idx]);
164  }
165  if ($av_from > $now) {
166  $data[$idx]["not_yet"] = ilDatePresentation::formatDate(new ilDate($av_from, IL_CAL_UNIX));
167  }
168  if ($av_to) {
169  // #18658
170  if (!ilBookingReservation::isObjectAvailableInPeriod($item["booking_object_id"], $schedule, $av_from, $av_to)) {
171  $this->lng->loadLanguageModule("dateplaner");
172  $data[$idx]["full_up"] = $this->lng->txt("cal_booked_out");
173  }
174  }
175  }
176  }
177 
178  foreach ($data as $item) {
179  $item_id = $item["booking_object_id"];
180 
181  // available for given period?
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")
186  : null;
187  $to = is_object($this->filter["period"]["to"])
188  ? strtotime($this->filter["period"]["to"]->get(IL_CAL_DATE) . " 23:59:59")
189  : null;
190 
191  $bobj = new ilBookingObject($item_id);
192  $schedule = new ilBookingSchedule($bobj->getScheduleId());
193 
194  if (!ilBookingReservation::isObjectAvailableInPeriod($item_id, $schedule, $from, $to)) {
195  unset($data[$idx]);
196  continue;
197  }
198  }
199 
200  // cache reservations
201  $item_rsv = ilBookingReservation::getList(array($item_id), 1000, 0, array());
202  $this->reservations[$item_id] = $item_rsv["data"];
203  }
204 
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) {
210  if ($item["status"] != ilBookingReservation::STATUS_CANCELLED) {
211  if ($item["user_id"] == $ilUser->getId()) {
212  $this->current_bookings++;
213  }
214  }
215  }
216  }
217 
218  if ($this->current_bookings >= $this->overall_limit) {
219  ilUtil::sendInfo($this->lng->txt("book_overall_limit_warning"));
220  }
221  }
222 
223  if ($this->advmd) {
224  // advanced metadata
225  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
226  $this->record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_FILTER, "book", $this->pool_id, "bobj");
227  $this->record_gui->setTableGUI($this);
228  $this->record_gui->parse();
229 
230  include_once("./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
232  $this->ref_id,
233  "book",
234  "bobj",
235  $this->pool_id,
236  "bobj",
237  $data,
238  "pool_id",
239  "booking_object_id",
240  $this->record_gui->getFilterElements()
241  );
242  }
243 
244  $this->setMaxCount(sizeof($data));
245  $this->setData($data);
246  }
a bookable ressource
static getList($a_pool_id, $a_title=null)
Get list of booking objects for given type.
schedule for booking ressource
$from
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Class for single dates.
$ilUser
Definition: imgupload.php:18
const IL_CAL_DATE
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.
setMaxCount($a_max_count)
set max.
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.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelectableColumns()

ilBookingObjectsTableGUI::getSelectableColumns ( )

Definition at line 259 of file class.ilBookingObjectsTableGUI.php.

References $cols.

Referenced by __construct().

260  {
261  $cols = array();
262 
263  $cols["description"] = array(
264  "txt" => $this->lng->txt("description"),
265  "default" => true
266  );
267 
268  foreach ($this->advmd as $field) {
269  $cols["advmd" . $field["id"]] = array(
270  "txt" => $field["title"],
271  "default" => false
272  );
273  }
274 
275  return $cols;
276  }
$cols
Definition: xhr_table.php:11
+ Here is the caller graph for this function:

◆ initFilter()

ilBookingObjectsTableGUI::initFilter ( )

Definition at line 111 of file class.ilBookingObjectsTableGUI.php.

References ilTableGUI\$lng, ilTableGUI\$title, ilTable2GUI\addFilterItemByMetaType(), ilTable2GUI\FILTER_DATE_RANGE, and ilTable2GUI\FILTER_TEXT.

Referenced by __construct().

112  {
113  $lng = $this->lng;
114 
115  // title/description
117  "title",
119  false,
120  $lng->txt("title") . "/" . $lng->txt("description")
121  );
122  $this->filter["title"] = $title->getValue();
123 
124  // #18651
125  if ($this->has_schedule) {
126  // booking period
127  $period = $this->addFilterItemByMetaType(
128  "period",
130  false,
131  $lng->txt("book_period")
132  );
133  $this->filter["period"] = $period->getValue();
134  }
135  }
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=null)
Add filter by standard type.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ numericOrdering()

ilBookingObjectsTableGUI::numericOrdering (   $a_field)

Definition at line 248 of file class.ilBookingObjectsTableGUI.php.

References ilAdvancedMDFieldDefinition\TYPE_DATE.

249  {
250  if (substr($a_field, 0, 3) == "md_") {
251  $md_id = (int) substr($a_field, 3);
252  if ($this->advmd[$md_id]["type"] == ilAdvancedMDFieldDefinition::TYPE_DATE) {
253  return true;
254  }
255  }
256  return false;
257  }

Field Documentation

◆ $access

ilBookingObjectsTableGUI::$access
protected

Definition at line 19 of file class.ilBookingObjectsTableGUI.php.

◆ $advmd

ilBookingObjectsTableGUI::$advmd
protected

Definition at line 34 of file class.ilBookingObjectsTableGUI.php.

◆ $current_bookings

ilBookingObjectsTableGUI::$current_bookings
protected

Definition at line 33 of file class.ilBookingObjectsTableGUI.php.

◆ $filter

ilBookingObjectsTableGUI::$filter
protected

Definition at line 35 of file class.ilBookingObjectsTableGUI.php.

◆ $has_schedule

ilBookingObjectsTableGUI::$has_schedule
protected

Definition at line 28 of file class.ilBookingObjectsTableGUI.php.

◆ $may_assign

ilBookingObjectsTableGUI::$may_assign
protected

Definition at line 30 of file class.ilBookingObjectsTableGUI.php.

◆ $may_edit

ilBookingObjectsTableGUI::$may_edit
protected

Definition at line 29 of file class.ilBookingObjectsTableGUI.php.

◆ $overall_limit

ilBookingObjectsTableGUI::$overall_limit
protected

Definition at line 31 of file class.ilBookingObjectsTableGUI.php.

◆ $pool_id

ilBookingObjectsTableGUI::$pool_id
protected

Definition at line 27 of file class.ilBookingObjectsTableGUI.php.

◆ $ref_id

ilBookingObjectsTableGUI::$ref_id
protected

Definition at line 26 of file class.ilBookingObjectsTableGUI.php.

◆ $reservations

ilBookingObjectsTableGUI::$reservations = array()
protected

Definition at line 32 of file class.ilBookingObjectsTableGUI.php.

◆ $ui_factory

ilBookingObjectsTableGUI::$ui_factory
protected

Definition at line 36 of file class.ilBookingObjectsTableGUI.php.

◆ $ui_renderer

ilBookingObjectsTableGUI::$ui_renderer
protected

Definition at line 37 of file class.ilBookingObjectsTableGUI.php.

◆ $user

ilBookingObjectsTableGUI::$user
protected

Definition at line 24 of file class.ilBookingObjectsTableGUI.php.

Referenced by fillRow(), and getItems().


The documentation for this class was generated from the following file: