ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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, array $context_obj_ids=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
 
 $has_items_with_host_context = false
 
 $tree
 
 $context_obj_ids
 
- 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 13 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,
array  $context_obj_ids = 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 60 of file class.ilBookingReservationsTableGUI.php.

References $cols, $context_obj_ids, $DIC, $ilCtrl, $ilUser, ilTableGUI\$lng, ILIAS\GlobalScreen\Provider\__construct(), 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().

70  {
71  global $DIC;
72 
73  $this->ctrl = $DIC->ctrl();
74  $this->lng = $DIC->language();
75  $this->user = $DIC->user();
76  $this->access = $DIC->access();
77  $ilCtrl = $DIC->ctrl();
78  $lng = $DIC->language();
79  $ilUser = $DIC->user();
80  $ilAccess = $DIC->access();
81  $this->tree = $DIC->repositoryTree();
82 
83  $this->context_obj_ids = $context_obj_ids;
84  $this->pool_id = $a_pool_id;
85  $this->ref_id = $a_ref_id;
86  $this->show_all = $a_show_all;
87  $this->has_schedule = (bool) $a_has_schedule;
88  $this->group_id = $a_group_id;
89 
90  $this->advmd = ilObjBookingPool::getAdvancedMDFields($a_ref_id);
91 
92  $this->setId("bkrsv" . $a_ref_id);
93 
94  parent::__construct($a_parent_obj, $a_parent_cmd);
95 
96  $this->setTitle($lng->txt("book_reservations_list"));
97 
98  $this->addColumn("", "", 1);
99  $this->addColumn($this->lng->txt("title"), "title");
100 
101  $selected = $this->getSelectedColumns();
102  $cols = $this->getSelectableColumns();
103 
104  if ($this->has_schedule) {
105  $this->lng->loadLanguageModule("dateplaner");
106 
107  $this->addColumn($this->lng->txt("date"), "date");
108  if (in_array("week", $selected)) {
109  $this->addColumn($this->lng->txt("wk_short"), "week");
110  unset($cols["week"]);
111  }
112  if (in_array("weekday", $selected)) {
113  $this->addColumn($this->lng->txt("cal_weekday"), "weekday");
114  unset($cols["weekday"]);
115  }
116  $this->addColumn($this->lng->txt("book_schedule_slot"), "slot");
117  $this->addColumn($this->lng->txt("book_no_of_objects"), "counter");
118 
119  $this->setDefaultOrderField("date");
120  $this->setDefaultOrderDirection("asc");
121  } else {
122  $this->addColumn($this->lng->txt("status"), "status");
123 
124  $this->setDefaultOrderField("title");
125  $this->setDefaultOrderDirection("asc");
126  }
127 
128  // non-user columns
129  $user_cols = $this->getSelectableUserColumns();
130  foreach ($this->getSelectedColumns() as $col) {
131  if (array_key_exists($col, $cols)) {
132  if (!isset($user_cols[$col])) {
133  $this->addColumn($cols[$col]["txt"], $col);
134  }
135  }
136  }
137 
138 
139 
140  $this->initFilter($a_filter_pre);
141  if ($this->group_id) {
142  $this->setLimit(9999);
143  $this->disable("numinfo");
144  $this->filters = array();
145  } else {
146  $this->setExportFormats(array(self::EXPORT_CSV, self::EXPORT_EXCEL));
147  }
148  $this->getItems($this->getCurrentFilter());
149 
150  if ($this->has_items_with_host_context) {
151  $this->addColumn($this->lng->txt("book_booked_in"), "context_obj_title");
152  }
153 
154  $this->addColumn($this->lng->txt("user"), "user_name");
155 
156  // user columns
157  foreach ($this->getSelectedColumns() as $col) {
158  if (array_key_exists($col, $cols)) {
159  if (isset($user_cols[$col])) {
160  $this->addColumn($cols[$col]["txt"], $col);
161  }
162  }
163  }
164 
165  $this->addColumn($this->lng->txt("actions"));
166 
167  $this->setEnableHeader(true);
168  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
169  $this->setRowTemplate("tpl.booking_reservation_row.html", "Modules/BookingManager/Reservations");
170  $this->setResetCommand("resetLogFilter");
171  $this->setFilterCommand("applyLogFilter");
172  $this->setDisableFilterHiding(true);
173 
174 
175  if ($ilUser->getId() != ANONYMOUS_USER_ID) {
176  $this->addMultiCommand('rsvConfirmCancel', $lng->txt('book_set_cancel'));
177  $this->setSelectAllCheckbox('mrsv');
178  }
179 
180 
182  }
initFilter()
Init filter.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setExportFormats(array $formats)
Set available export formats.
getSelectableColumns()
Get selectable columns.
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
__construct(Container $dic, ilPlugin $plugin)
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.
$DIC
Definition: xapitoken.php:46
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 810 of file class.ilBookingReservationsTableGUI.php.

References $txt, and getAdditionalExportCols().

811  {
812  $a_csv->addColumn($this->lng->txt("title"));
813  if ($this->has_schedule) {
814  $a_csv->addColumn($this->lng->txt("date"));
815  $a_csv->addColumn($this->lng->txt("wk_short"));
816  $a_csv->addColumn($this->lng->txt("cal_weekday"));
817  $a_csv->addColumn($this->lng->txt("book_schedule_slot"));
818  $a_csv->addColumn($this->lng->txt("book_no_of_objects"));
819  } else {
820  $a_csv->addColumn($this->lng->txt("status"));
821  }
822 
823  foreach ($this->getAdditionalExportCols() as $txt) {
824  $a_csv->addColumn($txt);
825  }
826 
827  $a_csv->addRow();
828  }
getAdditionalExportCols()
Get additional export columns.
$txt
Definition: error.php:13
+ Here is the call graph for this function:

◆ fillHeaderExcel()

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

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

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

755  {
756  $a_excel->setCell($a_row, 0, $this->lng->txt("title"));
757  $col = 0;
758  if ($this->has_schedule) {
759  $a_excel->setCell($a_row, ++$col, $this->lng->txt("date"));
760  $a_excel->setCell($a_row, ++$col, $this->lng->txt("wk_short"));
761  $a_excel->setCell($a_row, ++$col, $this->lng->txt("cal_weekday"));
762  $a_excel->setCell($a_row, ++$col, $this->lng->txt("book_schedule_slot"));
763  $a_excel->setCell($a_row, ++$col, $this->lng->txt("book_no_of_objects"));
764  } else {
765  $a_excel->setCell($a_row, ++$col, $this->lng->txt("status"));
766  }
767 
768  foreach ($this->getAdditionalExportCols() as $txt) {
769  $a_excel->setCell($a_row, ++$col, $txt);
770  }
771 
772  $a_excel->setBold("A" . $a_row . ":" . $a_excel->getColumnCoord($col) . $a_row);
773  }
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:13
+ Here is the call graph for this function:

◆ fillRow()

ilBookingReservationsTableGUI::fillRow (   $a_set)
protected

Fill table row.

Parameters
array$a_set

Definition at line 613 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.

614  {
615  $lng = $this->lng;
616  $ilAccess = $this->access;
619 
620  $selected = $this->getSelectedColumns();
621 
622 
623 
624  if ($this->has_items_with_host_context) {
625  $this->tpl->setCurrentBlock("context");
626  $this->tpl->setVariable("VALUE_CONTEXT_TITLE", $a_set["context_obj_title"] . " ");
627  $this->tpl->parseCurrentBlock();
628  }
629 
630  $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
631 
632  $can_be_cancelled = (($ilAccess->checkAccess('write', '', $this->ref_id) ||
633  $a_set['user_id'] == $ilUser->getId()) &&
634  $a_set["can_be_cancelled"]);
635 
636  if ($can_be_cancelled) {
637  $this->tpl->setVariable("MULTI_ID", $a_set["booking_reservation_id"]);
638  }
639 
640  // #11995
641  $uname = $a_set["user_name"];
642  if (!trim($uname)) {
643  $uname = "[" . $lng->txt("user_deleted") . "]";
644  } else {
645  $uname = ilUserUtil::getNamePresentation($a_set['user_id'], false, true, "", true);
646  }
647  $this->tpl->setVariable("TXT_CURRENT_USER", $uname);
648 
649  if ($this->has_schedule) {
650  $this->tpl->setVariable("VALUE_DATE", ilDatePresentation::formatDate(new ilDate($a_set["date"], IL_CAL_DATE)));
651  if (in_array("week", $selected)) {
652  $this->tpl->setVariable("VALUE_WEEK", $a_set["week"]);
653  }
654  if (in_array("weekday", $selected)) {
655  $this->tpl->setVariable("VALUE_WEEKDAY", ilCalendarUtil::_numericDayToString($a_set["weekday"], false));
656  }
657  $this->tpl->setVariable("VALUE_SLOT", $a_set["slot"]);
658  $this->tpl->setVariable("VALUE_COUNTER", $a_set["counter"]);
659  } else {
660  if (in_array($a_set['status'], array(ilBookingReservation::STATUS_CANCELLED, ilBookingReservation::STATUS_IN_USE))) {
661  $this->tpl->setVariable("TXT_STATUS", $lng->txt('book_reservation_status_' . $a_set['status']));
662  } else {
663  $this->tpl->setVariable("TXT_STATUS", " ");
664  }
665  }
666 
667  if ($this->advmd) {
668  foreach ($this->advmd as $item) {
669  $advmd_id = (int) $item["id"];
670 
671  if (!in_array("advmd" . $advmd_id, $selected)) {
672  continue;
673  }
674 
675  $val = " ";
676  if (isset($a_set["md_" . $advmd_id . "_presentation"])) {
677  $pb = $a_set["md_" . $advmd_id . "_presentation"]->getList();
678  if ($pb) {
679  $val = $pb;
680  }
681  }
682 
683  $this->tpl->setCurrentBlock("advmd_bl");
684  $this->tpl->setVariable("VALUE_ADVMD", $val);
685  $this->tpl->parseCurrentBlock();
686  }
687  }
688 
689  // additional user fields
690  $user_cols = $this->getSelectableUserColumns();
691  foreach ($this->getSelectedColumns() as $col) {
692  if (isset($user_cols[$col])) {
693  $this->tpl->setCurrentBlock("user_col");
694  $this->tpl->setVariable("VALUE_USER_COL", $a_set[$col] . " ");
695  $this->tpl->parseCurrentBlock();
696  }
697  }
698 
699  if ($can_be_cancelled) {
700  $ilCtrl->setParameter($this->parent_obj, 'reservation_id', $a_set['booking_reservation_id']);
701  $this->tpl->setVariable("URL_ACTION", $ilCtrl->getLinkTarget($this->parent_obj, 'rsvConfirmCancel'));
702  $ilCtrl->setParameter($this->parent_obj, 'reservation_id', "");
703  $this->tpl->setVariable("TXT_ACTION", $lng->txt('book_set_cancel'));
704  $this->tpl->setCurrentBlock("action");
705  $this->tpl->parseCurrentBlock();
706  }
707 
708 
709  if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
710  $ilCtrl->setParameter($this->parent_obj, 'reservation_id', $a_set['booking_reservation_id']);
711  $this->tpl->setVariable("URL_ACTION", $ilCtrl->getLinkTarget($this->parent_obj, 'rsvConfirmDelete'));
712  $ilCtrl->setParameter($this->parent_obj, 'reservation_id', "");
713  $this->tpl->setVariable("TXT_ACTION", $lng->txt('delete'));
714  $this->tpl->setCurrentBlock("action");
715  $this->tpl->parseCurrentBlock();
716  }
717  }
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 830 of file class.ilBookingReservationsTableGUI.php.

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

831  {
832  $a_csv->addColumn($a_set["title"]);
833  if ($this->has_schedule) {
834  $a_csv->addColumn(ilDatePresentation::formatDate(new ilDate($a_set["date"], IL_CAL_DATE)));
835  $a_csv->addColumn($a_set["week"]);
836  $a_csv->addColumn(ilCalendarUtil::_numericDayToString($a_set["weekday"], false));
837  $a_csv->addColumn($a_set["slot"]);
838  $a_csv->addColumn($a_set["counter"]);
839  } else {
840  $status = "";
841  if (in_array($a_set['status'], array(ilBookingReservation::STATUS_CANCELLED, ilBookingReservation::STATUS_IN_USE))) {
842  $status = $this->lng->txt('book_reservation_status_' . $a_set['status']);
843  }
844  $a_csv->addColumn($status);
845  }
846 
847  foreach ($this->getAdditionalExportCols() as $colid => $txt) {
848  if (substr($colid, 0, 5) == "advmd") {
849  $advmd_id = (int) substr($colid, 5);
850  $val = " ";
851  if (isset($a_set["md_" . $advmd_id . "_presentation"])) {
852  $pb = $a_set["md_" . $advmd_id . "_presentation"]->getList();
853  if ($pb) {
854  $val = $pb;
855  }
856  }
857  $a_csv->addColumn($val);
858  } else {
859  $a_csv->addColumn($a_set[$colid]);
860  }
861  }
862 
863  $a_csv->addRow();
864  }
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:13
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 775 of file class.ilBookingReservationsTableGUI.php.

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

776  {
777  $a_excel->setCell($a_row, 0, $a_set["title"]);
778  $col = 0;
779  if ($this->has_schedule) {
780  $a_excel->setCell($a_row, ++$col, new ilDate($a_set["date"], IL_CAL_DATE));
781  $a_excel->setCell($a_row, ++$col, $a_set["week"]);
782  $a_excel->setCell($a_row, ++$col, ilCalendarUtil::_numericDayToString($a_set["weekday"], false));
783  $a_excel->setCell($a_row, ++$col, $a_set["slot"]);
784  $a_excel->setCell($a_row, ++$col, $a_set["counter"]);
785  } else {
786  $status = "";
787  if (in_array($a_set['status'], array(ilBookingReservation::STATUS_CANCELLED, ilBookingReservation::STATUS_IN_USE))) {
788  $status = $this->lng->txt('book_reservation_status_' . $a_set['status']);
789  }
790  $a_excel->setCell($a_row, ++$col, $status);
791  }
792 
793  foreach ($this->getAdditionalExportCols() as $colid => $txt) {
794  if (substr($colid, 0, 5) == "advmd") {
795  $advmd_id = (int) substr($colid, 5);
796  $val = " ";
797  if (isset($a_set["md_" . $advmd_id . "_presentation"])) {
798  $pb = $a_set["md_" . $advmd_id . "_presentation"]->getList();
799  if ($pb) {
800  $val = $pb;
801  }
802  }
803  $a_excel->setCell($a_row, ++$col, $val);
804  } else {
805  $a_excel->setCell($a_row, ++$col, $a_set[$colid]);
806  }
807  }
808  }
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:13
const IL_CAL_DATE
+ Here is the call graph for this function:

◆ getAdditionalExportCols()

ilBookingReservationsTableGUI::getAdditionalExportCols ( )
protected

Get additional export columns.

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

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

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

723  {
724  $add_cols = [];
725  $cols = $this->getSelectableColumns();
726 
727  unset($cols["week"]);
728  unset($cols["weekday"]);
729 
730  // non-user columns
731  $user_cols = $this->getSelectableUserColumns();
732  foreach ($this->getSelectedColumns() as $col) {
733  if (array_key_exists($col, $cols)) {
734  if (!isset($user_cols[$col])) {
735  $add_cols[$col] = $cols[$col]["txt"];
736  }
737  }
738  }
739 
740  $add_cols["user_name"] = $this->lng->txt("user");
741 
742  // user columns
743  foreach ($this->getSelectedColumns() as $col) {
744  if (array_key_exists($col, $cols)) {
745  if (isset($user_cols[$col])) {
746  $add_cols[$col] = $cols[$col]["txt"];
747  }
748  }
749  }
750 
751  return $add_cols;
752  }
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 592 of file class.ilBookingReservationsTableGUI.php.

593  {
594  return $this->record_gui;
595  }

◆ getCurrentFilter()

ilBookingReservationsTableGUI::getCurrentFilter ( )

Get current filter settings.

Returns
array

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

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

Referenced by __construct().

416  {
417  $filter = array();
418  if ($this->filter["object"]) {
419  $filter["object"] = $this->filter["object"];
420  }
421  if ($this->filter["title"]) {
422  $filter["title"] = $this->filter["title"];
423  }
424  if ($this->filter["status"]) {
425  $filter["status"] = $this->filter["status"];
426  }
427  if ($this->filter["user_id"]) {
428  $filter["user_id"] = $this->filter["user_id"];
429  }
430  if (is_array($this->context_obj_ids)) {
431  $filter["context_obj_ids"] = $this->context_obj_ids;
432  }
433 
434  if ($this->has_schedule) {
435  if (!$filter["status"]) {
436  // needs distinct status because of aggregation
438  }
439  if ($this->filter["slot"]) {
440  $filter["slot"] = $this->filter["slot"];
441  }
442 
443  if ($this->filter["fromto"]["from"] || $this->filter["fromto"]["to"]) {
444  if ($this->filter["fromto"]["from"]) {
445  $filter["from"] = $this->filter["fromto"]["from"]->get(IL_CAL_UNIX);
446  }
447  if ($this->filter["fromto"]["to"]) {
448  $day_end = new ilDateTime($this->filter["fromto"]["to"]->get(IL_CAL_DATE) . " 23:59:59", IL_CAL_DATETIME);
449  $filter["to"] = $day_end->get(IL_CAL_UNIX);
450  }
451  }
452 
453  $filter["past"] = (bool) $this->filter["past"];
454  }
455 
456  return $filter;
457  }
const IL_CAL_DATETIME
const IL_CAL_UNIX
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 468 of file class.ilBookingReservationsTableGUI.php.

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

Referenced by __construct().

469  {
471 
472  $this->has_items_with_host_context = false;
473 
474  if (!$filter["object"]) {
475  $ids = array_keys($this->objects);
476  } else {
477  $ids = array($filter["object"]);
478  }
479 
480  if (!$this->show_all) {
481  $filter["user_id"] = $ilUser->getId();
482  }
483 
485  $repo = $f->getRepo();
486  $data = $repo->getListByDate($this->has_schedule, $ids, $filter);
487 
488  if ($this->advmd) {
489  // advanced metadata
490  $this->record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_FILTER, "book", $this->pool_id, "bobj");
491  $this->record_gui->setTableGUI($this);
492  $this->record_gui->parse();
493 
494  foreach (array_keys($data) as $idx) {
495  $data[$idx]["pool_id"] = $this->pool_id;
496  }
497 
499  $this->ref_id,
500  "book",
501  "bobj",
502  $this->pool_id,
503  "bobj",
504  $data,
505  "pool_id",
506  "object_id",
507  $this->record_gui->getFilterElements()
508  );
509  }
510 
511  if (count($this->getSelectedUserColumns()) > 0) {
512  // get additional user data
513  $user_ids = array_unique(array_map(function ($d) {
514  return $d['user_id'];
515  }, $data));
516 
517  $user_columns = [];
518  $odf_ids = [];
519  foreach ($this->getSelectedUserColumns() as $field) {
520  if (substr($field, 0, 3) == 'odf') {
521  $odf_ids[] = substr($field, 4);
522  } else {
523  $user_columns[] = $field;
524  }
525  }
526 
527  // see ilCourseParticipantsTableGUI
528  $user_columns = array_diff($user_columns,
529  ['consultation_hour', 'prtf', 'roles', 'org_units']);
530 
531  // user data fields
532  $query = new ilUserQuery();
533  $query->setLimit(9999);
534  $query->setAdditionalFields($user_columns);
535  $query->setUserFilter($user_ids);
536  $ud = $query->query();
537  $usr_data = [];
538  foreach ($ud["set"] as $v) {
539  foreach ($user_columns as $c) {
540  $usr_data[$v["usr_id"]][$c] = $v[$c];
541  }
542  }
543  foreach ($data as $key => $v) {
544  if (isset($usr_data[$v["user_id"]])) {
545  $data[$key] = array_merge($v, $usr_data[$v["user_id"]]);
546  }
547  }
548 
549  // object specific user data fields of parent course or group
550  if ($odf_ids) {
551  $parent = $this->getParentGroupCourse();
552  $parent_obj_id = ilObject::_lookupObjectId($parent['ref_id']);
553  $parent_obj_type = ilObject::_lookupType($parent_obj_id);
554 
555  $confirmation_required = ($parent_obj_type == 'crs')
556  ? ilPrivacySettings::_getInstance()->courseConfirmationRequired()
557  : ilPrivacySettings::_getInstance()->groupConfirmationRequired();
558  if ($confirmation_required) {
559  $user_ids = array_diff($user_ids, ilMemberAgreement::lookupAcceptedAgreements($parent_obj_id));
560  }
561  $odf_data = ilCourseUserData::_getValuesByObjId($parent_obj_id);
562 
563  $usr_data = [];
564  foreach ($odf_data as $usr_id => $fields) {
565  if (in_array($usr_id, $user_ids)) {
566  foreach ($fields as $field_id => $value) {
567  if (in_array($field_id, $odf_ids)) {
568  $usr_data[$usr_id]['odf_' . $field_id] = $value;
569  }
570  }
571  }
572  }
573 
574  foreach ($data as $key => $v) {
575  if (isset($usr_data[$v["user_id"]])) {
576  $data[$key] = array_merge($v, $usr_data[$v["user_id"]]);
577  }
578  }
579  }
580  }
581 
582  foreach ($data as $k => $d) {
583  if ($d["context_obj_id"] > 0) {
584  $this->has_items_with_host_context = true;
585  $data[$k]["context_obj_title"] = ilObject::_lookupTitle($d["context_obj_id"]);
586  }
587  }
588 
589  $this->setData($data);
590  }
User query class.
getParentGroupCourse()
Get parent group or course.
static _getValuesByObjId($a_obj_id)
Get values by obj_id (for all users)
static _lookupTitle($a_id)
lookup object title
static _lookupObjectId($a_ref_id)
lookup object id
$ilUser
Definition: imgupload.php:18
$query
static _lookupType($a_id, $a_reference=false)
lookup object type
static _getInstance()
Get instance of ilPrivacySettings.
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 597 of file class.ilBookingReservationsTableGUI.php.

598  {
599  $field = parent::getOrderField();
600 
601  // #16560 - this will enable matchting slot sorting to date/week
602  if (in_array($field, array("date", "week"))) {
603  $field = "_sortdate";
604  }
605 
606  return $field;
607  }

◆ getParentGroupCourse()

ilBookingReservationsTableGUI::getParentGroupCourse ( )
protected

Get parent group or course.

Parameters

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

References $tree.

Referenced by getItems(), and getSelectableUserColumns().

266  {
267  $tree = $this->tree;
268  if (($par_ref_id = $tree->checkForParentType($this->ref_id, "grp")) > 0) {
269  return [
270  "ref_id" => $par_ref_id,
271  "type" => "grp"
272  ];
273  }
274  if (($par_ref_id = $tree->checkForParentType($this->ref_id, "crs")) > 0) {
275  return [
276  "ref_id" => $par_ref_id,
277  "type" => "crs"
278  ];
279  }
280  return false;
281  }
+ Here is the caller graph for this function:

◆ getSelectableColumns()

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

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

References $cols, and getSelectableUserColumns().

185  {
186  $cols = array();
187 
188  if ($this->has_schedule &&
189  !(bool) $a_only_advmd) {
190  $this->lng->loadLanguageModule("dateplaner");
191 
192  $cols["week"] = array(
193  "txt" => $this->lng->txt("wk_short"),
194  "default" => true
195  );
196 
197  $cols["weekday"] = array(
198  "txt" => $this->lng->txt("cal_weekday"),
199  "default" => true
200  );
201  }
202 
203  foreach ($this->advmd as $field) {
204  $cols["advmd" . $field["id"]] = array(
205  "txt" => $field["title"],
206  "default" => false
207  );
208  }
209 
210  if ($a_include_user) {
211  $cols = array_merge($cols, $this->getSelectableUserColumns());
212  }
213 
214  return $cols;
215  }
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 223 of file class.ilBookingReservationsTableGUI.php.

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

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

224  {
225  $cols = [];
226  // additional user fields
227  if (($parent = $this->getParentGroupCourse()) !== false) {
228  if ($this->access->checkAccess("manage_members", "", $parent["ref_id"])) {
229  $ef = ilExportFieldsInfo::_getInstanceByType($parent["type"]);
230  foreach ($ef->getSelectableFieldsInfo(ilObject::_lookupObjectId($parent["ref_id"])) as $k => $v) {
231  if (!in_array($k, ["login"])) {
232  $cols[$k] = $v;
233  }
234  }
235  }
236  }
237  return $cols;
238  }
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 246 of file class.ilBookingReservationsTableGUI.php.

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

Referenced by getItems().

247  {
248  $user_cols = $this->getSelectableUserColumns();
249  $sel = [];
250  foreach ($this->getSelectedColumns() as $col) {
251  if (isset($user_cols[$col])) {
252  $sel[] = $col;
253  }
254  }
255  return $sel;
256  }
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 288 of file class.ilBookingReservationsTableGUI.php.

References $_SESSION, 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.

289  {
290  if (is_array($a_filter_pre) &&
291  isset($a_filter_pre["object"])) {
292  $_SESSION["form_" . $this->getId()]["object"] = serialize($a_filter_pre["object"]);
293  }
294 
295  $this->objects = array();
296  foreach (ilBookingObject::getList($this->pool_id) as $item) {
297  $this->objects[$item["booking_object_id"]] = $item["title"];
298  }
299  $item = $this->addFilterItemByMetaType("object", ilTable2GUI::FILTER_SELECT);
300  $item->setOptions(array("" => $this->lng->txt('book_all')) + $this->objects);
301  $this->filter["object"] = $item->getValue();
302 
304  "title",
306  false,
307  $this->lng->txt("object") . " " . $this->lng->txt("title") . "/" . $this->lng->txt("description")
308  );
309  $this->filter["title"] = $title->getValue();
310 
311  if ($this->has_schedule) {
312  // default period: from:today [ to:(today + n days) ]
313  if (!$_SESSION["form_" . $this->getId()]["fromto"]) {
314  $from = new ilDateTime(date("Y-m-d"), IL_CAL_DATE); // today
315  $to = null;
316 
317  // add period end from pool settings?
318  $bpool = new ilObjBookingPool($this->pool_id, false);
319  $period = $bpool->getReservationFilterPeriod();
320  if ($period !== null) {
321  $to = clone $from;
322  if ($period) {
323  $to->increment(ilDateTime::DAY, $period);
324  }
325  $to = serialize($to);
326  }
327 
328  $_SESSION["form_" . $this->getId()]["fromto"] = serialize(array(
329  "from" => serialize($from),
330  "to" => $to
331  ));
332  }
333  $item = $this->addFilterItemByMetaType("fromto", ilTable2GUI::FILTER_DATE_RANGE, false, $this->lng->txt('book_fromto'));
334  $this->filter["fromto"] = $item->getDate();
335 
336  // only needed for full log
337  if ($this->show_all) {
338  // see ilObjBookingPoolGUI::buildDatesBySchedule()
339  $map = array_flip(array('su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'));
340 
341  $options = array("" => $this->lng->txt('book_all'));
342 
343  // schedule to slot
344  foreach (ilBookingSchedule::getList($this->pool_id) as $def) {
345  $schedule = new ilBookingSchedule($def["booking_schedule_id"]);
346  foreach ($schedule->getDefinition() as $day => $slots) {
347  $day_caption = ilCalendarUtil::_numericDayToString($map[$day], false);
348 
349  foreach ($slots as $slot) {
350  $idx = $map[$day] . "_" . $slot;
351  $options[$idx] = $day_caption . ", " . $slot;
352  }
353  }
354  }
355 
356  ksort($options);
357 
358  $item = $this->addFilterItemByMetaType("book_schedule_slot", ilTable2GUI::FILTER_SELECT);
359  $item->setOptions($options);
360  $this->filter["slot"] = $item->getValue();
361  }
362  }
363 
364  $item = new ilCheckboxInputGUI($this->lng->txt("book_filter_past_reservations"), "past");
365  $this->addFilterItem($item);
366  $item->readFromSession();
367 
368  // if period starts in the past we have to include past reservations
369  // :TODO: to be discussed
370  if (is_object($this->filter["fromto"]["from"]) &&
371  $this->filter["fromto"]["from"]->get(IL_CAL_DATE) < date("Y-m-d")) {
372  $item->setChecked(true);
373  }
374 
375  $this->filter["past"] = $item->getChecked();
376 
377  // status
378  $valid_status = array(-ilBookingReservation::STATUS_CANCELLED,
380  if (!$this->has_schedule) {
381  $options = array("" => $this->lng->txt('book_all'));
382  } else {
383  $options = array();
384  }
385  foreach ($valid_status as $loop) {
386  if ($loop > 0) {
387  $options[$loop] = $this->lng->txt('book_reservation_status_' . $loop);
388  } else {
389  $options[$loop] = $this->lng->txt('book_not') . ' ' . $this->lng->txt('book_reservation_status_' . -$loop);
390  }
391  }
392  $item = $this->addFilterItemByMetaType("status", ilTable2GUI::FILTER_SELECT);
393  $item->setOptions($options);
394  $this->filter["status"] = $item->getValue();
395 
396  // only needed for full log
397  if ($this->show_all) {
398  $options = array("" => $this->lng->txt('book_all')) +
399  ilBookingReservation::getUserFilter(array_keys($this->objects));
400  $item = $this->addFilterItemByMetaType("user", ilTable2GUI::FILTER_SELECT);
401  $item->setOptions($options);
402  if (is_array($a_filter_pre) && isset($a_filter_pre["user_id"])) {
403  $item->setValue($a_filter_pre["user_id"]);
404  $this->filter["user_id"] = $a_filter_pre["user_id"];
405  } else {
406  $this->filter["user_id"] = $item->getValue();
407  }
408  }
409  }
$_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.
Class ilObjBookingPool.
const IL_CAL_DATE
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 459 of file class.ilBookingReservationsTableGUI.php.

460  {
461  return in_array($a_field, array("counter", "date", "week", "weekday"));
462  }

Field Documentation

◆ $access

ilBookingReservationsTableGUI::$access
protected

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

Referenced by fillRow().

◆ $advmd

ilBookingReservationsTableGUI::$advmd
protected

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

◆ $context_obj_ids

ilBookingReservationsTableGUI::$context_obj_ids
protected

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

Referenced by __construct(), and getCurrentFilter().

◆ $filter

ilBookingReservationsTableGUI::$filter
protected

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

Referenced by getCurrentFilter().

◆ $group_id

ilBookingReservationsTableGUI::$group_id
protected

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

◆ $has_items_with_host_context

ilBookingReservationsTableGUI::$has_items_with_host_context = false
protected

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

◆ $has_schedule

ilBookingReservationsTableGUI::$has_schedule
protected

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

◆ $objects

ilBookingReservationsTableGUI::$objects
protected

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

◆ $pool_id

ilBookingReservationsTableGUI::$pool_id
protected

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

Referenced by getItems().

◆ $ref_id

ilBookingReservationsTableGUI::$ref_id
protected

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

◆ $show_all

ilBookingReservationsTableGUI::$show_all
protected

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

◆ $tree

ilBookingReservationsTableGUI::$tree
protected

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

Referenced by getParentGroupCourse().

◆ $user

ilBookingReservationsTableGUI::$user
protected

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

Referenced by fillRow(), and getItems().


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