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

List booking objects. More...

+ Inheritance diagram for ilBookingReservationsTableGUI:
+ Collaboration diagram for ilBookingReservationsTableGUI:

Public Member Functions

 __construct ($a_parent_obj, $a_parent_cmd, $a_ref_id, $a_pool_id, $a_show_all, $a_has_schedule, array $a_filter_pre=null, $a_group_id=null)
 Constructor. More...
 
 getSelectableColumns ($a_only_advmd=false, $a_include_user=true)
 
 initFilter (array $a_filter_pre=null)
 Init filter. More...
 
 getCurrentFilter ()
 Get current filter settings. More...
 
 numericOrdering ($a_field)
 
 getItems (array $filter)
 Gather data and build rows. More...
 
 getAdvMDRecordGUI ()
 
 getOrderField ()
 
- 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

 getSelectableUserColumns ()
 Get selectable user fields. More...
 
 getSelectedUserColumns ()
 Get selected user colimns. More...
 
 getParentGroupCourse ()
 Get parent group or course. More...
 
 fillRow ($a_set)
 Fill table row. More...
 
 getAdditionalExportCols ()
 Get additional export columns. More...
 
 fillHeaderExcel (ilExcel $a_excel, &$a_row)
 
 fillRowExcel (ilExcel $a_excel, &$a_row, $a_set)
 
 fillHeaderCSV ($a_csv)
 
 fillRowCSV ($a_csv, $a_set)
 
- 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

 $user
 
 $access
 
 $ref_id
 
 $filter
 
 $pool_id
 
 $show_all
 
 $has_schedule
 
 $objects
 
 $group_id
 
 $advmd
 
 $tree
 
- 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.

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 16 of file class.ilBookingReservationsTableGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilBookingReservationsTableGUI::__construct (   $a_parent_obj,
  $a_parent_cmd,
  $a_ref_id,
  $a_pool_id,
  $a_show_all,
  $a_has_schedule,
array  $a_filter_pre = null,
  $a_group_id = null 
)

Constructor.

Parameters
object$a_parent_obj
string$a_parent_cmd
int$a_ref_id
int$a_pool_id
bool$a_show_all
bool$a_has_schedule
array$a_filter_pre
array$a_group_id

Definition at line 53 of file class.ilBookingReservationsTableGUI.php.

References $cols, $DIC, $ilCtrl, $ilUser, ilTableGUI\$lng, ilTable2GUI\addColumn(), ilTable2GUI\addMultiCommand(), ilTableGUI\disable(), ilObjBookingPool\getAdvancedMDFields(), getCurrentFilter(), getItems(), ilTable2GUI\getSelectableColumns(), getSelectableUserColumns(), ilTable2GUI\getSelectedColumns(), ilTable2GUI\initFilter(), ilTable2GUI\setDefaultOrderDirection(), ilTable2GUI\setDefaultOrderField(), ilTable2GUI\setDisableFilterHiding(), ilTable2GUI\setEnableHeader(), ilTable2GUI\setExportFormats(), ilTable2GUI\setFilterCommand(), ilTable2GUI\setFormAction(), ilTable2GUI\setId(), ilTable2GUI\setLimit(), ilTable2GUI\setResetCommand(), ilTable2GUI\setRowTemplate(), ilTable2GUI\setSelectAllCheckbox(), ilTable2GUI\setTitle(), ilDatePresentation\setUseRelativeDates(), and user().

54  {
55  global $DIC;
56 
57  $this->ctrl = $DIC->ctrl();
58  $this->lng = $DIC->language();
59  $this->user = $DIC->user();
60  $this->access = $DIC->access();
61  $ilCtrl = $DIC->ctrl();
62  $lng = $DIC->language();
63  $ilUser = $DIC->user();
64  $ilAccess = $DIC->access();
65  $this->tree = $DIC->repositoryTree();
66 
67  $this->pool_id = $a_pool_id;
68  $this->ref_id = $a_ref_id;
69  $this->show_all = $a_show_all;
70  $this->has_schedule = (bool) $a_has_schedule;
71  $this->group_id = $a_group_id;
72 
73  $this->advmd = ilObjBookingPool::getAdvancedMDFields($a_ref_id);
74 
75  $this->setId("bkrsv" . $a_ref_id);
76 
77  parent::__construct($a_parent_obj, $a_parent_cmd);
78 
79  $this->setTitle($lng->txt("book_reservations_list"));
80 
81  $this->addColumn("", "", 1);
82  $this->addColumn($this->lng->txt("title"), "title");
83 
84  $selected = $this->getSelectedColumns();
85  $cols = $this->getSelectableColumns();
86 
87  if ($this->has_schedule) {
88  $this->lng->loadLanguageModule("dateplaner");
89 
90  $this->addColumn($this->lng->txt("date"), "date");
91  if (in_array("week", $selected)) {
92  $this->addColumn($this->lng->txt("wk_short"), "week");
93  unset($cols["week"]);
94  }
95  if (in_array("weekday", $selected)) {
96  $this->addColumn($this->lng->txt("cal_weekday"), "weekday");
97  unset($cols["weekday"]);
98  }
99  $this->addColumn($this->lng->txt("book_schedule_slot"), "slot");
100  $this->addColumn($this->lng->txt("book_no_of_objects"), "counter");
101 
102  $this->setDefaultOrderField("date");
103  $this->setDefaultOrderDirection("asc");
104  } else {
105  $this->addColumn($this->lng->txt("status"), "status");
106 
107  $this->setDefaultOrderField("title");
108  $this->setDefaultOrderDirection("asc");
109  }
110 
111  // non-user columns
112  $user_cols = $this->getSelectableUserColumns();
113  foreach ($this->getSelectedColumns() as $col) {
114  if (array_key_exists($col, $cols)) {
115  if (!isset($user_cols[$col])) {
116  $this->addColumn($cols[$col]["txt"], $col);
117  }
118  }
119  }
120 
121  $this->addColumn($this->lng->txt("user"), "user_name");
122 
123  // user columns
124  foreach ($this->getSelectedColumns() as $col) {
125  if (array_key_exists($col, $cols)) {
126  if (isset($user_cols[$col])) {
127  $this->addColumn($cols[$col]["txt"], $col);
128  }
129  }
130  }
131 
132  $this->addColumn($this->lng->txt("actions"));
133 
134  $this->setEnableHeader(true);
135  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
136  $this->setRowTemplate("tpl.booking_reservation_row.html", "Modules/BookingManager");
137  $this->setResetCommand("resetLogFilter");
138  $this->setFilterCommand("applyLogFilter");
139  $this->setDisableFilterHiding(true);
140 
141  $this->initFilter($a_filter_pre);
142 
143  if ($this->group_id) {
144  $this->setLimit(9999);
145  $this->disable("numinfo");
146  $this->filters = array();
147  } else {
148  $this->setExportFormats(array(self::EXPORT_CSV, self::EXPORT_EXCEL));
149  }
150 
151  if ($ilUser->getId() != ANONYMOUS_USER_ID) {
152  /*
153  if($ilAccess->checkAccess('write', '', $this->ref_id))
154  {
155  $this->addMultiCommand('rsvInUse', $lng->txt('book_set_in_use'));
156  $this->addMultiCommand('rsvNotInUse', $lng->txt('book_set_not_in_use'));
157  }
158  */
159 
160  $this->addMultiCommand('rsvConfirmCancel', $lng->txt('book_set_cancel'));
161  // $this->addMultiCommand('rsvUncancel', $lng->txt('book_set_not_cancel'));
162  $this->setSelectAllCheckbox('mrsv');
163  }
164 
165  $this->getItems($this->getCurrentFilter());
166 
168  }
initFilter()
Init filter.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setExportFormats(array $formats)
Set available export formats.
getSelectableColumns()
Get selectable columns.
global $DIC
Definition: saml.php:7
getSelectableUserColumns()
Get selectable user fields.
getItems(array $filter)
Gather data and build rows.
static setUseRelativeDates($a_status)
set use relative dates
setId($a_val)
Set id.
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setResetCommand($a_val, $a_caption=null)
Set reset filter command.
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.
setDisableFilterHiding($a_val=true)
Set disable filter hiding.
addMultiCommand($a_cmd, $a_text)
Add Command button.
$ilUser
Definition: imgupload.php:18
getSelectedColumns()
Get selected columns.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
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.
setEnableHeader($a_enableheader)
Set Enable Header.
static getAdvancedMDFields($a_ref_id)
$cols
Definition: xhr_table.php:11
setLimit($a_limit=0, $a_default_limit=0)
setFilterCommand($a_val, $a_caption=null)
Set filter command.
+ Here is the call graph for this function:

Member Function Documentation

◆ fillHeaderCSV()

ilBookingReservationsTableGUI::fillHeaderCSV (   $a_csv)
protected

Definition at line 840 of file class.ilBookingReservationsTableGUI.php.

References $txt, and getAdditionalExportCols().

841  {
842  $a_csv->addColumn($this->lng->txt("title"));
843  if ($this->has_schedule) {
844  $a_csv->addColumn($this->lng->txt("date"));
845  $a_csv->addColumn($this->lng->txt("wk_short"));
846  $a_csv->addColumn($this->lng->txt("cal_weekday"));
847  $a_csv->addColumn($this->lng->txt("book_schedule_slot"));
848  $a_csv->addColumn($this->lng->txt("book_no_of_objects"));
849  } else {
850  $a_csv->addColumn($this->lng->txt("status"));
851  }
852 
853  foreach ($this->getAdditionalExportCols() as $txt) {
854  $a_csv->addColumn($txt);
855  }
856 
857  $a_csv->addRow();
858  }
getAdditionalExportCols()
Get additional export columns.
$txt
Definition: error.php:11
+ Here is the call graph for this function:

◆ fillHeaderExcel()

ilBookingReservationsTableGUI::fillHeaderExcel ( ilExcel  $a_excel,
$a_row 
)
protected

Definition at line 783 of file class.ilBookingReservationsTableGUI.php.

References $txt, getAdditionalExportCols(), ilExcel\getColumnCoord(), ilExcel\setBold(), and ilExcel\setCell().

784  {
785  $a_excel->setCell($a_row, 0, $this->lng->txt("title"));
786  $col = 0;
787  if ($this->has_schedule) {
788  $a_excel->setCell($a_row, ++$col, $this->lng->txt("date"));
789  $a_excel->setCell($a_row, ++$col, $this->lng->txt("wk_short"));
790  $a_excel->setCell($a_row, ++$col, $this->lng->txt("cal_weekday"));
791  $a_excel->setCell($a_row, ++$col, $this->lng->txt("book_schedule_slot"));
792  $a_excel->setCell($a_row, ++$col, $this->lng->txt("book_no_of_objects"));
793  } else {
794  $a_excel->setCell($a_row, ++$col, $this->lng->txt("status"));
795  }
796 
797  foreach ($this->getAdditionalExportCols() as $txt) {
798  $a_excel->setCell($a_row, ++$col, $txt);
799  }
800 
801  $a_excel->setBold("A" . $a_row . ":" . $a_excel->getColumnCoord($col) . $a_row);
802  }
getAdditionalExportCols()
Get additional export columns.
getColumnCoord($a_col)
Get column "name" from number.
setBold($a_coords)
Set cell(s) to bold.
setCell($a_row, $a_col, $a_value, $a_datatype=null)
Set cell value.
$txt
Definition: error.php:11
+ Here is the call graph for this function:

◆ fillRow()

ilBookingReservationsTableGUI::fillRow (   $a_set)
protected

Fill table row.

Parameters
array$a_set

Definition at line 589 of file class.ilBookingReservationsTableGUI.php.

References $access, ilTable2GUI\$ctrl, $ilCtrl, $ilUser, ilTableGUI\$lng, $user, ilCalendarUtil\_numericDayToString(), ilDatePresentation\formatDate(), ilUserUtil\getNamePresentation(), getSelectableUserColumns(), ilTable2GUI\getSelectedColumns(), IL_CAL_DATE, ilBookingReservation\STATUS_CANCELLED, and ilBookingReservation\STATUS_IN_USE.

590  {
591  $lng = $this->lng;
592  $ilAccess = $this->access;
595 
596  $selected = $this->getSelectedColumns();
597 
598  $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
599 
600  $can_be_cancelled = (($ilAccess->checkAccess('write', '', $this->ref_id) ||
601  $a_set['user_id'] == $ilUser->getId()) &&
602  $a_set["can_be_cancelled"]);
603 
604  if ($can_be_cancelled) {
605  $this->tpl->setVariable("MULTI_ID", $a_set["booking_reservation_id"]);
606  }
607 
608  // #11995
609  $uname = $a_set["user_name"];
610  if (!trim($uname)) {
611  $uname = "[" . $lng->txt("user_deleted") . "]";
612  } else {
613  //$ilCtrl->setParameter($this->parent_obj, 'user_id', $a_set['user_id']);
614  //$this->tpl->setVariable("HREF_PROFILE", $ilCtrl->getLinkTarget($this->parent_obj, 'showprofile'));
615  //$ilCtrl->setParameter($this->parent_obj, 'user_id', '');
616  include_once("./Services/User/classes/class.ilUserUtil.php");
617  $uname = ilUserUtil::getNamePresentation($a_set['user_id'], false, true, "", true);
618  }
619  $this->tpl->setVariable("TXT_CURRENT_USER", $uname);
620 
621  if ($this->has_schedule) {
622  $this->tpl->setVariable("VALUE_DATE", ilDatePresentation::formatDate(new ilDate($a_set["date"], IL_CAL_DATE)));
623  if (in_array("week", $selected)) {
624  $this->tpl->setVariable("VALUE_WEEK", $a_set["week"]);
625  }
626  if (in_array("weekday", $selected)) {
627  $this->tpl->setVariable("VALUE_WEEKDAY", ilCalendarUtil::_numericDayToString($a_set["weekday"], false));
628  }
629  $this->tpl->setVariable("VALUE_SLOT", $a_set["slot"]);
630  $this->tpl->setVariable("VALUE_COUNTER", $a_set["counter"]);
631  } else {
632  if (in_array($a_set['status'], array(ilBookingReservation::STATUS_CANCELLED, ilBookingReservation::STATUS_IN_USE))) {
633  $this->tpl->setVariable("TXT_STATUS", $lng->txt('book_reservation_status_' . $a_set['status']));
634  } else {
635  $this->tpl->setVariable("TXT_STATUS", " ");
636  }
637  }
638 
639  if ($this->advmd) {
640  foreach ($this->advmd as $item) {
641  $advmd_id = (int) $item["id"];
642 
643  if (!in_array("advmd" . $advmd_id, $selected)) {
644  continue;
645  }
646 
647  $val = " ";
648  if (isset($a_set["md_" . $advmd_id . "_presentation"])) {
649  $pb = $a_set["md_" . $advmd_id . "_presentation"]->getList();
650  if ($pb) {
651  $val = $pb;
652  }
653  }
654 
655  $this->tpl->setCurrentBlock("advmd_bl");
656  $this->tpl->setVariable("VALUE_ADVMD", $val);
657  $this->tpl->parseCurrentBlock();
658  }
659  }
660 
661  // additional user fields
662  $user_cols = $this->getSelectableUserColumns();
663  foreach ($this->getSelectedColumns() as $col) {
664  if (isset($user_cols[$col])) {
665  $this->tpl->setCurrentBlock("user_col");
666  $this->tpl->setVariable("VALUE_USER_COL", $a_set[$col] . " ");
667  $this->tpl->parseCurrentBlock();
668  }
669  }
670 
671  if ($can_be_cancelled) {
672  $ilCtrl->setParameter($this->parent_obj, 'reservation_id', $a_set['booking_reservation_id']);
673  $this->tpl->setVariable("URL_ACTION", $ilCtrl->getLinkTarget($this->parent_obj, 'rsvConfirmCancel'));
674  $ilCtrl->setParameter($this->parent_obj, 'reservation_id', "");
675  $this->tpl->setVariable("TXT_ACTION", $lng->txt('book_set_cancel'));
676  $this->tpl->setCurrentBlock("action");
677  $this->tpl->parseCurrentBlock();
678  }
679 
680  if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
681  $ilCtrl->setParameter($this->parent_obj, 'reservation_id', $a_set['booking_reservation_id']);
682  $this->tpl->setVariable("URL_ACTION", $ilCtrl->getLinkTarget($this->parent_obj, 'rsvConfirmDelete'));
683  $ilCtrl->setParameter($this->parent_obj, 'reservation_id', "");
684  $this->tpl->setVariable("TXT_ACTION", $lng->txt('delete'));
685  $this->tpl->setCurrentBlock("action");
686  $this->tpl->parseCurrentBlock();
687  }
688 
689  /* advsellist version
690  if (!$this->has_schedule || $date_to->get(IL_CAL_UNIX) > time())
691  {
692  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
693  $alist = new ilAdvancedSelectionListGUI();
694  $alist->setId($a_set['booking_reservation_id']);
695  $alist->setListTitle($lng->txt("actions"));
696 
697  $ilCtrl->setParameter($this->parent_obj, 'reservation_id', $a_set['booking_reservation_id']);
698 
699  if(!$a_set['group_id'])
700  {
701  if($ilAccess->checkAccess('write', '', $this->ref_id))
702  {
703  if($a_set['status'] == ilBookingReservation::STATUS_CANCELLED)
704  {
705  // can be uncancelled?
706  // if(ilBookingReservation::getAvailableObject(array($a_set['object_id']), $date_from->get(IL_CAL_UNIX), $date_to->get(IL_CAL_UNIX)))
707  // {
708  // $alist->addItem($lng->txt('book_set_not_cancel'), 'not_cancel', $ilCtrl->getLinkTarget($this->parent_obj, 'rsvUncancel'));
709  // }
710  }
711  else if($a_set['status'] != ilBookingReservation::STATUS_IN_USE)
712  {
713  if($this->has_schedule)
714  {
715  $alist->addItem($lng->txt('book_set_in_use'), 'in_use', $ilCtrl->getLinkTarget($this->parent_obj, 'rsvInUse'));
716  }
717  $alist->addItem($lng->txt('book_set_cancel'), 'cancel', $ilCtrl->getLinkTarget($this->parent_obj, 'rsvConfirmCancel'));
718  }
719  else if($this->has_schedule)
720  {
721  $alist->addItem($lng->txt('book_set_not_in_use'), 'not_in_use', $ilCtrl->getLinkTarget($this->parent_obj, 'rsvNotInUse'));
722  }
723  }
724  else if($a_set['user_id'] == $ilUser->getId() && $a_set['status'] != ilBookingReservation::STATUS_CANCELLED)
725  {
726  $alist->addItem($lng->txt('book_set_cancel'), 'cancel', $ilCtrl->getLinkTarget($this->parent_obj, 'rsvConfirmCancel'));
727  }
728  }
729  else if($ilAccess->checkAccess('write', '', $this->ref_id) || $a_set['user_id'] == $ilUser->getId())
730  {
731  $alist->addItem($lng->txt('details'), 'details', $ilCtrl->getLinkTarget($this->parent_obj, 'logDetails'));
732  }
733 
734  if(sizeof($alist->getItems()))
735  {
736  if(!$a_set['group_id'])
737  {
738  $this->tpl->setVariable('MULTI_ID', $a_set['booking_reservation_id']);
739  }
740  $this->tpl->setVariable('LAYER', $alist->getHTML());
741  }
742  }
743  */
744  }
static _numericDayToString($a_day, $a_long=true)
get
getSelectableUserColumns()
Get selectable user fields.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
global $ilCtrl
Definition: ilias.php:18
Class for single dates.
$ilUser
Definition: imgupload.php:18
getSelectedColumns()
Get selected columns.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
const IL_CAL_DATE
+ Here is the call graph for this function:

◆ fillRowCSV()

ilBookingReservationsTableGUI::fillRowCSV (   $a_csv,
  $a_set 
)
protected

Definition at line 860 of file class.ilBookingReservationsTableGUI.php.

References $txt, ilCalendarUtil\_numericDayToString(), ilDatePresentation\formatDate(), getAdditionalExportCols(), IL_CAL_DATE, ilBookingReservation\STATUS_CANCELLED, and ilBookingReservation\STATUS_IN_USE.

861  {
862  $a_csv->addColumn($a_set["title"]);
863  if ($this->has_schedule) {
864  $a_csv->addColumn(ilDatePresentation::formatDate(new ilDate($a_set["date"], IL_CAL_DATE)));
865  $a_csv->addColumn($a_set["week"]);
866  $a_csv->addColumn(ilCalendarUtil::_numericDayToString($a_set["weekday"], false));
867  $a_csv->addColumn($a_set["slot"]);
868  $a_csv->addColumn($a_set["counter"]);
869  } else {
870  $status = "";
871  if (in_array($a_set['status'], array(ilBookingReservation::STATUS_CANCELLED, ilBookingReservation::STATUS_IN_USE))) {
872  $status = $this->lng->txt('book_reservation_status_' . $a_set['status']);
873  }
874  $a_csv->addColumn($status);
875  }
876 
877  foreach ($this->getAdditionalExportCols() as $colid => $txt) {
878  if (substr($colid, 0, 5) == "advmd") {
879  $advmd_id = (int) substr($colid, 5);
880  $val = " ";
881  if (isset($a_set["md_" . $advmd_id . "_presentation"])) {
882  $pb = $a_set["md_" . $advmd_id . "_presentation"]->getList();
883  if ($pb) {
884  $val = $pb;
885  }
886  }
887  $a_csv->addColumn($val);
888  } else {
889  $a_csv->addColumn($a_set[$colid]);
890  }
891  }
892 
893  $a_csv->addRow();
894  }
static _numericDayToString($a_day, $a_long=true)
get
getAdditionalExportCols()
Get additional export columns.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
Class for single dates.
$txt
Definition: error.php:11
const IL_CAL_DATE
+ Here is the call graph for this function:

◆ fillRowExcel()

ilBookingReservationsTableGUI::fillRowExcel ( ilExcel  $a_excel,
$a_row,
  $a_set 
)
protected

Definition at line 804 of file class.ilBookingReservationsTableGUI.php.

References $txt, ilCalendarUtil\_numericDayToString(), getAdditionalExportCols(), IL_CAL_DATE, ilExcel\setCell(), ilBookingReservation\STATUS_CANCELLED, and ilBookingReservation\STATUS_IN_USE.

805  {
806  $a_excel->setCell($a_row, 0, $a_set["title"]);
807  $col = 0;
808  if ($this->has_schedule) {
809  $a_excel->setCell($a_row, ++$col, new ilDate($a_set["date"], IL_CAL_DATE));
810  $a_excel->setCell($a_row, ++$col, $a_set["week"]);
811  $a_excel->setCell($a_row, ++$col, ilCalendarUtil::_numericDayToString($a_set["weekday"], false));
812  $a_excel->setCell($a_row, ++$col, $a_set["slot"]);
813  $a_excel->setCell($a_row, ++$col, $a_set["counter"]);
814  } else {
815  $status = "";
816  if (in_array($a_set['status'], array(ilBookingReservation::STATUS_CANCELLED, ilBookingReservation::STATUS_IN_USE))) {
817  $status = $this->lng->txt('book_reservation_status_' . $a_set['status']);
818  }
819  $a_excel->setCell($a_row, ++$col, $status);
820  }
821 
822 
823  foreach ($this->getAdditionalExportCols() as $colid => $txt) {
824  if (substr($colid, 0, 5) == "advmd") {
825  $advmd_id = (int) substr($colid, 5);
826  $val = " ";
827  if (isset($a_set["md_" . $advmd_id . "_presentation"])) {
828  $pb = $a_set["md_" . $advmd_id . "_presentation"]->getList();
829  if ($pb) {
830  $val = $pb;
831  }
832  }
833  $a_excel->setCell($a_row, ++$col, $val);
834  } else {
835  $a_excel->setCell($a_row, ++$col, $a_set[$colid]);
836  }
837  }
838  }
static _numericDayToString($a_day, $a_long=true)
get
getAdditionalExportCols()
Get additional export columns.
Class for single dates.
setCell($a_row, $a_col, $a_value, $a_datatype=null)
Set cell value.
$txt
Definition: error.php:11
const IL_CAL_DATE
+ Here is the call graph for this function:

◆ getAdditionalExportCols()

ilBookingReservationsTableGUI::getAdditionalExportCols ( )
protected

Get additional export columns.

Parameters

Definition at line 751 of file class.ilBookingReservationsTableGUI.php.

References $cols, ilTable2GUI\getSelectableColumns(), getSelectableUserColumns(), and ilTable2GUI\getSelectedColumns().

Referenced by fillHeaderCSV(), fillHeaderExcel(), fillRowCSV(), and fillRowExcel().

752  {
753  $add_cols = [];
754  $cols = $this->getSelectableColumns();
755 
756  unset($cols["week"]);
757  unset($cols["weekday"]);
758 
759  // non-user columns
760  $user_cols = $this->getSelectableUserColumns();
761  foreach ($this->getSelectedColumns() as $col) {
762  if (array_key_exists($col, $cols)) {
763  if (!isset($user_cols[$col])) {
764  $add_cols[$col] = $cols[$col]["txt"];
765  }
766  }
767  }
768 
769  $add_cols["user_name"] = $this->lng->txt("user");
770 
771  // user columns
772  foreach ($this->getSelectedColumns() as $col) {
773  if (array_key_exists($col, $cols)) {
774  if (isset($user_cols[$col])) {
775  $add_cols[$col] = $cols[$col]["txt"];
776  }
777  }
778  }
779 
780  return $add_cols;
781  }
getSelectableColumns()
Get selectable columns.
getSelectableUserColumns()
Get selectable user fields.
getSelectedColumns()
Get selected columns.
$cols
Definition: xhr_table.php:11
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdvMDRecordGUI()

ilBookingReservationsTableGUI::getAdvMDRecordGUI ( )

Definition at line 568 of file class.ilBookingReservationsTableGUI.php.

569  {
570  return $this->record_gui;
571  }

◆ getCurrentFilter()

ilBookingReservationsTableGUI::getCurrentFilter ( )

Get current filter settings.

Returns
array

Definition at line 405 of file class.ilBookingReservationsTableGUI.php.

References $filter, IL_CAL_DATE, IL_CAL_DATETIME, IL_CAL_UNIX, and ilBookingReservation\STATUS_CANCELLED.

Referenced by __construct().

406  {
407  $filter = array();
408  if ($this->filter["object"]) {
409  $filter["object"] = $this->filter["object"];
410  }
411  if ($this->filter["title"]) {
412  $filter["title"] = $this->filter["title"];
413  }
414  if ($this->filter["status"]) {
415  $filter["status"] = $this->filter["status"];
416  }
417  if ($this->filter["user_id"]) {
418  $filter["user_id"] = $this->filter["user_id"];
419  }
420 
421  if ($this->has_schedule) {
422  if (!$filter["status"]) {
423  // needs distinct status because of aggregation
425  }
426  if ($this->filter["slot"]) {
427  $filter["slot"] = $this->filter["slot"];
428  }
429 
430  if ($this->filter["fromto"]["from"] || $this->filter["fromto"]["to"]) {
431  if ($this->filter["fromto"]["from"]) {
432  $filter["from"] = $this->filter["fromto"]["from"]->get(IL_CAL_UNIX);
433  }
434  if ($this->filter["fromto"]["to"]) {
435  $day_end = new ilDateTime($this->filter["fromto"]["to"]->get(IL_CAL_DATE) . " 23:59:59", IL_CAL_DATETIME);
436  $filter["to"] = $day_end->get(IL_CAL_UNIX);
437  }
438  }
439 
440  $filter["past"] = (bool) $this->filter["past"];
441  }
442 
443  return $filter;
444  }
const IL_CAL_DATETIME
const IL_CAL_UNIX
Date and time handling
const IL_CAL_DATE
+ Here is the caller graph for this function:

◆ getItems()

ilBookingReservationsTableGUI::getItems ( array  $filter)

Gather data and build rows.

Parameters
array$filter

Definition at line 455 of file class.ilBookingReservationsTableGUI.php.

References $c, $d, ilTableGUI\$data, $ilUser, $key, $pool_id, $query, $user, ilPrivacySettings\_getInstance(), ilCourseUserData\_getValuesByObjId(), ilObject\_lookupObjectId(), ilObject\_lookupType(), ilBookingReservation\getListByDate(), getParentGroupCourse(), getSelectedUserColumns(), ilMemberAgreement\lookupAcceptedAgreements(), ilAdvancedMDRecordGUI\MODE_FILTER, ilAdvancedMDValues\queryForRecords(), and ilTable2GUI\setData().

Referenced by __construct().

456  {
458 
459  if (!$filter["object"]) {
460  $ids = array_keys($this->objects);
461  } else {
462  $ids = array($filter["object"]);
463  }
464 
465  if (!$this->show_all) {
466  $filter["user_id"] = $ilUser->getId();
467  }
468 
469  include_once "Modules/BookingManager/classes/class.ilBookingReservation.php";
470  $data = ilBookingReservation::getListByDate($this->has_schedule, $ids, $filter);
471 
472  if ($this->advmd) {
473  // advanced metadata
474  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
475  $this->record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_FILTER, "book", $this->pool_id, "bobj");
476  $this->record_gui->setTableGUI($this);
477  $this->record_gui->parse();
478 
479  foreach (array_keys($data) as $idx) {
480  $data[$idx]["pool_id"] = $this->pool_id;
481  }
482 
483  include_once("./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
485  $this->ref_id,
486  "book",
487  "bobj",
488  $this->pool_id,
489  "bobj",
490  $data,
491  "pool_id",
492  "object_id",
493  $this->record_gui->getFilterElements()
494  );
495  }
496 
497  if (count($this->getSelectedUserColumns()) > 0) {
498  // get additional user data
499  $user_ids = array_unique(array_map(function ($d) {
500  return $d['user_id'];
501  }, $data));
502 
503  $user_columns = [];
504  $odf_ids = [];
505  foreach ($this->getSelectedUserColumns() as $field) {
506  if (substr($field, 0, 3) == 'odf') {
507  $odf_ids[] = substr($field, 4);
508  } else {
509  $user_columns[] = $field;
510  }
511  }
512 
513  // user data fields
514  $query = new ilUserQuery();
515  $query->setLimit(9999);
516  $query->setAdditionalFields($user_columns);
517  $query->setUserFilter($user_ids);
518  $ud = $query->query();
519 
520  $usr_data = [];
521  foreach ($ud["set"] as $v) {
522  foreach ($user_columns as $c) {
523  $usr_data[$v["usr_id"]][$c] = $v[$c];
524  }
525  }
526  foreach ($data as $key => $v) {
527  if (isset($usr_data[$v["user_id"]])) {
528  $data[$key] = array_merge($v, $usr_data[$v["user_id"]]);
529  }
530  }
531 
532  // object specific user data fields of parent course or group
533  if ($odf_ids) {
534  $parent = $this->getParentGroupCourse();
535  $parent_obj_id = ilObject::_lookupObjectId($parent['ref_id']);
536  $parent_obj_type = ilObject::_lookupType($parent_obj_id);
537 
538  $confirmation_required = ($parent_obj_type == 'crs')
539  ? ilPrivacySettings::_getInstance()->courseConfirmationRequired()
540  : ilPrivacySettings::_getInstance()->groupConfirmationRequired();
541  if ($confirmation_required) {
542  $user_ids = array_diff($user_ids, ilMemberAgreement::lookupAcceptedAgreements($parent_obj_id));
543  }
544  $odf_data = ilCourseUserData::_getValuesByObjId($parent_obj_id);
545 
546  $usr_data = [];
547  foreach ($odf_data as $usr_id => $fields) {
548  if (in_array($usr_id, $user_ids)) {
549  foreach ($fields as $field_id => $value) {
550  if (in_array($field_id, $odf_ids)) {
551  $usr_data[$usr_id]['odf_' . $field_id] = $value;
552  }
553  }
554  }
555  }
556 
557  foreach ($data as $key => $v) {
558  if (isset($usr_data[$v["user_id"]])) {
559  $data[$key] = array_merge($v, $usr_data[$v["user_id"]]);
560  }
561  }
562  }
563  }
564 
565  $this->setData($data);
566  }
User query class.
getParentGroupCourse()
Get parent group or course.
static _getValuesByObjId($a_obj_id)
Get values by obj_id (for all users)
static _lookupObjectId($a_ref_id)
lookup object id
static getListByDate( $a_has_schedule, array $a_object_ids=null, array $filter=null, array $a_pool_ids=null)
List all reservations by date.
$ilUser
Definition: imgupload.php:18
$query
static _lookupType($a_id, $a_reference=false)
lookup object type
static _getInstance()
Get instance of ilPrivacySettings.
$key
Definition: croninfo.php:18
static lookupAcceptedAgreements($a_obj_id)
Lookup users who have accepted the agreement.
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.
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOrderField()

ilBookingReservationsTableGUI::getOrderField ( )

Definition at line 573 of file class.ilBookingReservationsTableGUI.php.

574  {
575  $field = parent::getOrderField();
576 
577  // #16560 - this will enable matchting slot sorting to date/week
578  if (in_array($field, array("date", "week"))) {
579  $field = "_sortdate";
580  }
581 
582  return $field;
583  }

◆ getParentGroupCourse()

ilBookingReservationsTableGUI::getParentGroupCourse ( )
protected

Get parent group or course.

Parameters

Definition at line 252 of file class.ilBookingReservationsTableGUI.php.

References $tree.

Referenced by getItems(), and getSelectableUserColumns().

253  {
254  $tree = $this->tree;
255  if (($par_ref_id = $tree->checkForParentType($this->ref_id, "grp")) > 0) {
256  return [
257  "ref_id" => $par_ref_id,
258  "type" => "grp"
259  ];
260  }
261  if (($par_ref_id = $tree->checkForParentType($this->ref_id, "crs")) > 0) {
262  return [
263  "ref_id" => $par_ref_id,
264  "type" => "crs"
265  ];
266  }
267  return false;
268  }
+ Here is the caller graph for this function:

◆ getSelectableColumns()

ilBookingReservationsTableGUI::getSelectableColumns (   $a_only_advmd = false,
  $a_include_user = true 
)

Definition at line 170 of file class.ilBookingReservationsTableGUI.php.

References $cols, and getSelectableUserColumns().

171  {
172  $cols = array();
173 
174  if ($this->has_schedule &&
175  !(bool) $a_only_advmd) {
176  $this->lng->loadLanguageModule("dateplaner");
177 
178  $cols["week"] = array(
179  "txt" => $this->lng->txt("wk_short"),
180  "default" => true
181  );
182 
183  $cols["weekday"] = array(
184  "txt" => $this->lng->txt("cal_weekday"),
185  "default" => true
186  );
187  }
188 
189  foreach ($this->advmd as $field) {
190  $cols["advmd" . $field["id"]] = array(
191  "txt" => $field["title"],
192  "default" => false
193  );
194  }
195 
196  if ($a_include_user) {
197  $cols = array_merge($cols, $this->getSelectableUserColumns());
198  }
199 
200  return $cols;
201  }
getSelectableUserColumns()
Get selectable user fields.
$cols
Definition: xhr_table.php:11
+ Here is the call graph for this function:

◆ getSelectableUserColumns()

ilBookingReservationsTableGUI::getSelectableUserColumns ( )
protected

Get selectable user fields.

Parameters

Definition at line 209 of file class.ilBookingReservationsTableGUI.php.

References $cols, ilExportFieldsInfo\_getInstanceByType(), ilObject\_lookupObjectId(), and getParentGroupCourse().

Referenced by __construct(), fillRow(), getAdditionalExportCols(), getSelectableColumns(), and getSelectedUserColumns().

210  {
211  $cols = [];
212  // additional user fields
213  if (($parent = $this->getParentGroupCourse()) !== false) {
214  if ($this->access->checkAccess("manage_members", "", $parent["ref_id"])) {
215  include_once './Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php';
216  $ef = ilExportFieldsInfo::_getInstanceByType($parent["type"]);
217  foreach ($ef->getSelectableFieldsInfo(ilObject::_lookupObjectId($parent["ref_id"])) as $k => $v) {
218  if (!in_array($k, ["login"])) {
219  $cols[$k] = $v;
220  }
221  }
222  }
223  }
224  return $cols;
225  }
getParentGroupCourse()
Get parent group or course.
static _lookupObjectId($a_ref_id)
lookup object id
static _getInstanceByType($a_type)
Get Singleton Instance.
$cols
Definition: xhr_table.php:11
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelectedUserColumns()

ilBookingReservationsTableGUI::getSelectedUserColumns ( )
protected

Get selected user colimns.

Parameters

Definition at line 233 of file class.ilBookingReservationsTableGUI.php.

References getSelectableUserColumns(), and ilTable2GUI\getSelectedColumns().

Referenced by getItems().

234  {
235  $user_cols = $this->getSelectableUserColumns();
236  $sel = [];
237  foreach ($this->getSelectedColumns() as $col) {
238  if (isset($user_cols[$col])) {
239  $sel[] = $col;
240  }
241  }
242  return $sel;
243  }
getSelectableUserColumns()
Get selectable user fields.
getSelectedColumns()
Get selected columns.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFilter()

ilBookingReservationsTableGUI::initFilter ( array  $a_filter_pre = null)

Init filter.

Definition at line 275 of file class.ilBookingReservationsTableGUI.php.

References $_SESSION, $def, $from, $map, PHPMailer\PHPMailer\$options, ilTableGUI\$title, ilCalendarUtil\_numericDayToString(), ilTable2GUI\addFilterItem(), ilTable2GUI\addFilterItemByMetaType(), ilDateTime\DAY, ilTable2GUI\FILTER_DATE_RANGE, ilTable2GUI\FILTER_SELECT, ilTable2GUI\FILTER_TEXT, ilTable2GUI\getId(), ilBookingSchedule\getList(), ilBookingObject\getList(), ilBookingReservation\getUserFilter(), IL_CAL_DATE, and ilBookingReservation\STATUS_CANCELLED.

276  {
277  if (is_array($a_filter_pre) &&
278  isset($a_filter_pre["object"])) {
279  $_SESSION["form_" . $this->getId()]["object"] = serialize($a_filter_pre["object"]);
280  }
281 
282  $this->objects = array();
283  include_once "Modules/BookingManager/classes/class.ilBookingObject.php";
284  foreach (ilBookingObject::getList($this->pool_id) as $item) {
285  $this->objects[$item["booking_object_id"]] = $item["title"];
286  }
287  $item = $this->addFilterItemByMetaType("object", ilTable2GUI::FILTER_SELECT);
288  $item->setOptions(array("" => $this->lng->txt('book_all')) + $this->objects);
289  $this->filter["object"] = $item->getValue();
290 
292  "title",
294  false,
295  $this->lng->txt("object") . " " . $this->lng->txt("title") . "/" . $this->lng->txt("description")
296  );
297  $this->filter["title"] = $title->getValue();
298 
299  if ($this->has_schedule) {
300  // default period: from:today [ to:(today + n days) ]
301  if (!$_SESSION["form_" . $this->getId()]["fromto"]) {
302  $from = new ilDateTime(date("Y-m-d"), IL_CAL_DATE); // today
303  $to = null;
304 
305  // add period end from pool settings?
306  include_once "Modules/BookingManager/classes/class.ilObjBookingPool.php";
307  $bpool = new ilObjBookingPool($this->pool_id, false);
308  $period = $bpool->getReservationFilterPeriod();
309  if ($period !== null) {
310  $to = clone $from;
311  if ($period) {
312  $to->increment(ilDateTime::DAY, $period);
313  }
314  $to = serialize($to);
315  }
316 
317  $_SESSION["form_" . $this->getId()]["fromto"] = serialize(array(
318  "from" => serialize($from),
319  "to" => $to
320  ));
321  }
322  $item = $this->addFilterItemByMetaType("fromto", ilTable2GUI::FILTER_DATE_RANGE, false, $this->lng->txt('book_fromto'));
323  $this->filter["fromto"] = $item->getDate();
324 
325  // only needed for full log
326  if ($this->show_all) {
327  // see ilObjBookingPoolGUI::buildDatesBySchedule()
328  $map = array_flip(array('su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'));
329 
330  $options = array("" => $this->lng->txt('book_all'));
331 
332  // schedule to slot
333  require_once "Modules/BookingManager/classes/class.ilBookingSchedule.php";
334  foreach (ilBookingSchedule::getList($this->pool_id) as $def) {
335  $schedule = new ilBookingSchedule($def["booking_schedule_id"]);
336  foreach ($schedule->getDefinition() as $day => $slots) {
337  $day_caption = ilCalendarUtil::_numericDayToString($map[$day], false);
338 
339  foreach ($slots as $slot) {
340  $idx = $map[$day] . "_" . $slot;
341  $options[$idx] = $day_caption . ", " . $slot;
342  }
343  }
344  }
345 
346  ksort($options);
347 
348  $item = $this->addFilterItemByMetaType("book_schedule_slot", ilTable2GUI::FILTER_SELECT);
349  $item->setOptions($options);
350  $this->filter["slot"] = $item->getValue();
351  }
352  }
353 
354  $item = new ilCheckboxInputGUI($this->lng->txt("book_filter_past_reservations"), "past");
355  $this->addFilterItem($item);
356  $item->readFromSession();
357 
358  // if period starts in the past we have to include past reservations
359  // :TODO: to be discussed
360  if (is_object($this->filter["fromto"]["from"]) &&
361  $this->filter["fromto"]["from"]->get(IL_CAL_DATE) < date("Y-m-d")) {
362  $item->setChecked(true);
363  }
364 
365  $this->filter["past"] = $item->getChecked();
366 
367  // status
368  $valid_status = array(-ilBookingReservation::STATUS_CANCELLED,
370  if (!$this->has_schedule) {
371  $options = array("" => $this->lng->txt('book_all'));
372  } else {
373  $options = array();
374  }
375  foreach ($valid_status as $loop) {
376  if ($loop > 0) {
377  $options[$loop] = $this->lng->txt('book_reservation_status_' . $loop);
378  } else {
379  $options[$loop] = $this->lng->txt('book_not') . ' ' . $this->lng->txt('book_reservation_status_' . -$loop);
380  }
381  }
382  $item = $this->addFilterItemByMetaType("status", ilTable2GUI::FILTER_SELECT);
383  $item->setOptions($options);
384  $this->filter["status"] = $item->getValue();
385 
386  // only needed for full log
387  if ($this->show_all) {
388  $options = array("" => $this->lng->txt('book_all')) +
389  ilBookingReservation::getUserFilter(array_keys($this->objects));
390  $item = $this->addFilterItemByMetaType("user", ilTable2GUI::FILTER_SELECT);
391  $item->setOptions($options);
392  if (is_array($a_filter_pre) && isset($a_filter_pre["user_id"])) {
393  $item->setValue($a_filter_pre["user_id"]);
394  $this->filter["user_id"] = $a_filter_pre["user_id"];
395  } else {
396  $this->filter["user_id"] = $item->getValue();
397  }
398  }
399  }
$_SESSION["AccountId"]
static getList($a_pool_id, $a_title=null)
Get list of booking objects for given type.
static _numericDayToString($a_day, $a_long=true)
get
static getUserFilter(array $a_object_ids)
Get all users who have reservations for object(s)
schedule for booking ressource
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=null)
Add filter by standard type.
This class represents a checkbox property in a property form.
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
$from
Class ilObjBookingPool.
Date and time handling
const IL_CAL_DATE
$def
Definition: croninfo.php:21
getId()
Get element id.
static getList($a_pool_id)
Get list of booking objects for given pool.
+ Here is the call graph for this function:

◆ numericOrdering()

ilBookingReservationsTableGUI::numericOrdering (   $a_field)

Definition at line 446 of file class.ilBookingReservationsTableGUI.php.

447  {
448  return in_array($a_field, array("counter", "date", "week", "weekday"));
449  }

Field Documentation

◆ $access

ilBookingReservationsTableGUI::$access
protected

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

Referenced by fillRow().

◆ $advmd

ilBookingReservationsTableGUI::$advmd
protected

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

◆ $filter

ilBookingReservationsTableGUI::$filter
protected

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

Referenced by getCurrentFilter().

◆ $group_id

ilBookingReservationsTableGUI::$group_id
protected

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

◆ $has_schedule

ilBookingReservationsTableGUI::$has_schedule
protected

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

◆ $objects

ilBookingReservationsTableGUI::$objects
protected

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

◆ $pool_id

ilBookingReservationsTableGUI::$pool_id
protected

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

Referenced by getItems().

◆ $ref_id

ilBookingReservationsTableGUI::$ref_id
protected

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

◆ $show_all

ilBookingReservationsTableGUI::$show_all
protected

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

◆ $tree

ilBookingReservationsTableGUI::$tree
protected

Definition at line 40 of file class.ilBookingReservationsTableGUI.php.

Referenced by getParentGroupCourse().

◆ $user

ilBookingReservationsTableGUI::$user
protected

Definition at line 21 of file class.ilBookingReservationsTableGUI.php.

Referenced by fillRow(), and getItems().


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