ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilBookingReservationsTableGUI Class Reference

List booking objects. More...

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

Public Member Functions

 __construct (object $a_parent_obj, string $a_parent_cmd, int $a_ref_id, ilObjBookingPool $pool, bool $a_show_all, array $a_filter_pre=null, int $a_group_id=null, array $context_obj_ids=null)
 
 getSelectableColumns ()
 
 initFilter (array $a_filter_pre=null)
 
 getCurrentFilter ()
 Get current filter settings. More...
 
 numericOrdering (string $a_field)
 
 getItems (array $filter)
 Gather data and build rows. More...
 
 getAdvMDRecordGUI ()
 
 getOrderField ()
 
- Public Member Functions inherited from ilTable2GUI
 __construct (?object $a_parent_obj, string $a_parent_cmd="", string $a_template_context="")
 
 setOpenFormTag (bool $a_val)
 
 getOpenFormTag ()
 
 setCloseFormTag (bool $a_val)
 
 getCloseFormTag ()
 
 determineLimit ()
 
 getSelectableColumns ()
 Get selectable columns. More...
 
 determineSelectedColumns ()
 
 isColumnSelected (string $col)
 
 getSelectedColumns ()
 
 resetOffset (bool $a_in_determination=false)
 
 initFilter ()
 
 getParentObject ()
 
 getParentCmd ()
 
 setTopAnchor (string $a_val)
 
 getTopAnchor ()
 
 setNoEntriesText (string $a_text)
 
 getNoEntriesText ()
 
 setIsDataTable (bool $a_val)
 
 getIsDataTable ()
 
 setEnableTitle (bool $a_enabletitle)
 
 getEnableTitle ()
 
 setEnableHeader (bool $a_enableheader)
 
 getEnableHeader ()
 
 setEnableNumInfo (bool $a_val)
 
 getEnableNumInfo ()
 
 setTitle (string $a_title, string $a_icon="", string $a_icon_alt="")
 
 setDescription (string $a_val)
 
 getDescription ()
 
 setOrderField (string $a_order_field)
 
 getOrderField ()
 
 setData (array $a_data)
 
 getData ()
 
 dataExists ()
 
 setPrefix (string $a_prefix)
 
 getPrefix ()
 
 addFilterItem (ilTableFilterItem $a_input_item, bool $a_optional=false)
 
 addFilterItemByMetaType (string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
 Add filter by standard type. More...
 
 getFilterItems (bool $a_optionals=false)
 
 getFilterItemByPostVar (string $a_post_var)
 
 setFilterCols (int $a_val)
 
 getFilterCols ()
 
 setDisableFilterHiding (bool $a_val=true)
 
 getDisableFilterHiding ()
 
 isFilterSelected (string $a_col)
 Is given filter selected? More...
 
 getSelectedFilters ()
 
 determineSelectedFilters ()
 
 setCustomPreviousNext (string $a_prev_link, string $a_next_link)
 
 setFormAction (string $a_form_action, bool $a_multipart=false)
 
 getFormAction ()
 
 setFormName (string $a_name="")
 
 getFormName ()
 
 setId (string $a_val)
 
 getId ()
 
 setDisplayAsBlock (bool $a_val)
 
 getDisplayAsBlock ()
 
 setSelectAllCheckbox (string $a_select_all_checkbox, bool $a_select_all_on_top=false)
 
 setExternalSorting (bool $a_val)
 
 getExternalSorting ()
 
 setFilterCommand (string $a_val, string $a_caption="")
 
 getFilterCommand ()
 
 setResetCommand (string $a_val, string $a_caption="")
 
 getResetCommand ()
 
 setExternalSegmentation (bool $a_val)
 
 getExternalSegmentation ()
 
 setRowTemplate (string $a_template, string $a_template_dir="")
 Set row template. More...
 
 setDefaultOrderField (string $a_defaultorderfield)
 
 getDefaultOrderField ()
 
 setDefaultOrderDirection (string $a_defaultorderdirection)
 
 getDefaultOrderDirection ()
 
 setDefaultFilterVisiblity (bool $a_status)
 
 getDefaultFilterVisibility ()
 
 clearCommandButtons ()
 
 addCommandButton (string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
 
 addCommandButtonInstance (ilButtonBase $a_button)
 
 addMultiItemSelectionButton (string $a_sel_var, array $a_options, string $a_cmd, string $a_text, string $a_default_selection='')
 
 setCloseCommand (string $a_link)
 
 addMultiCommand (string $a_cmd, string $a_text)
 
 addHiddenInput (string $a_name, string $a_value)
 
 addHeaderCommand (string $a_href, string $a_text, string $a_target="", string $a_img="")
 
 setTopCommands (bool $a_val)
 
 getTopCommands ()
 
 addColumn (string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
 
 getNavParameter ()
 
 setOrderLink (string $key, string $order_dir)
 
 fillHeader ()
 
 determineOffsetAndOrder (bool $a_omit_offset=false)
 
 storeNavParameter ()
 
 getHTML ()
 Get HTML. More...
 
 numericOrdering (string $a_field)
 Should this field be sorted numeric? More...
 
 render ()
 
 writeFilterToSession ()
 
 resetFilter ()
 
 fillFooter ()
 
 getLinkbar (string $a_num)
 
 fillHiddenRow ()
 
 fillActionRow ()
 
 setHeaderHTML (string $html)
 
 storeProperty (string $type, string $value)
 
 loadProperty (string $type)
 
 getCurrentState ()
 get current settings for order, limit, columns and filter More...
 
 setContext (string $id)
 
 getContext ()
 
 setShowRowsSelector (bool $a_value)
 Toggle rows-per-page selector. More...
 
 getShowRowsSelector ()
 
 setShowTemplates (bool $a_value)
 
 getShowTemplates ()
 
 restoreTemplate (string $a_name)
 Restore state from template. More...
 
 saveTemplate (string $a_name)
 Save current state as template. More...
 
 deleteTemplate (string $a_name)
 
 getLimit ()
 
 getOffset ()
 
 setExportFormats (array $formats)
 Set available export formats. More...
 
 setPrintMode (bool $a_value=false)
 
 getPrintMode ()
 
 getExportMode ()
 
 exportData (int $format, bool $send=false)
 Export and optionally send current table data. More...
 
 setEnableAllCommand (bool $a_value)
 
 setRowSelectorLabel (string $row_selector_label)
 
 getRowSelectorLabel ()
 
 setPreventDoubleSubmission (bool $a_val)
 
 getPreventDoubleSubmission ()
 
 setLimit (int $a_limit=0, int $a_default_limit=0)
 
- Public Member Functions inherited from ilTableGUI
 __construct (array $a_data=[], bool $a_global_tpl=true)
 
 setTemplate (ilTemplate $a_tpl)
 
 getTemplateObject ()
 
 setData (array $a_data)
 Set table data. More...
 
 getData ()
 
 setTitle (string $a_title, string $a_icon="", string $a_icon_alt="")
 
 setHelp (string $a_help_page, string $a_help_icon, string $a_help_icon_alt="")
 
 setHeaderNames (array $a_header_names)
 
 getColumnCount ()
 
 setHeaderVars (array $a_header_vars, array $a_header_params=[])
 
 setColumnWidth (array $a_column_width)
 set table column widths More...
 
 setOneColumnWidth (string $a_column_width, int $a_column_number)
 
 setMaxCount (int $a_max_count)
 set max. More...
 
 setLimit (int $a_limit=0, int $a_default_limit=0)
 set max. More...
 
 getLimit ()
 
 setPrefix (string $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) More...
 
 setOffset (int $a_offset)
 set dataset offset More...
 
 getOffset ()
 
 setOrderColumn (string $a_order_column="", string $a_default_column="")
 
 getOrderColumn ()
 
 setOrderDirection (string $a_order_direction)
 
 getOrderDirection ()
 
 setFooter (string $a_style, string $a_previous="", string $a_next="")
 
 enable (string $a_module_name)
 
 disable (string $a_module_name)
 
 sortData ()
 
 render ()
 
 renderHeader ()
 
 setOrderLink (string $key, string $order_dir)
 
 setStyle (string $a_element, string $a_style)
 
 getStyle (string $a_element)
 
 setBase (string $a_base)
 
 getBase ()
 
 getFormName ()
 get the name of the parent form More...
 
 setFormName (string $a_name="cmd")
 
 getSelectAllCheckbox ()
 get the name of the checkbox that should be toggled with a select all button More...
 
 setSelectAllCheckbox (string $a_select_all_checkbox)
 
 clearActionButtons ()
 
 addActionButton (string $btn_name, string $btn_value)
 

Protected Member Functions

 showMessages ()
 
 getSelectableUserColumns ()
 Get selectable user fields. More...
 
 getSelectedUserColumns ()
 
 getParentGroupCourse ()
 
 fillRow (array $a_set)
 
 getAdditionalExportCols ()
 
 fillHeaderExcel (ilExcel $a_excel, int &$a_row)
 
 fillRowExcel (ilExcel $a_excel, int &$a_row, array $a_set)
 
 fillHeaderCSV (ilCSVWriter $a_csv)
 
 fillRowCSV (ilCSVWriter $a_csv, array $a_set)
 
- Protected Member Functions inherited from ilTable2GUI
 getRequestedValues ()
 
 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, ilTableFilterItem $a_element)
 Check if filter element is based on adv md. More...
 
 fillRow (array $a_set)
 Standard Version of Fill Row. More...
 
 getFilterValue (ilTableFilterItem $a_item)
 Get current filter value. More...
 
 setFilterValue (ilTableFilterItem $a_item, $a_value)
 
 fillMetaExcel (ilExcel $a_excel, int &$a_row)
 Add meta information to excel export. More...
 
 fillHeaderExcel (ilExcel $a_excel, int &$a_row)
 Excel Version of Fill Header. More...
 
 fillRowExcel (ilExcel $a_excel, int &$a_row, array $a_set)
 Excel Version of Fill Row. More...
 
 fillMetaCSV (ilCSVWriter $a_csv)
 Add meta information to csv export. More...
 
 fillHeaderCSV (ilCSVWriter $a_csv)
 CSV Version of Fill Header. More...
 
 fillRowCSV (ilCSVWriter $a_csv, array $a_set)
 CSV Version of Fill Row. More...
 

Protected Attributes

InternalDomainService $domain
 
InternalGUIService $gui
 
ilObjBookingPool $pool
 
ScheduleManager $schedule_manager
 
ReservationDBRepository $reservation_repo
 
ReservationTableSessionRepository $table_repo
 
ilObjUser $user
 
ilAccessHandler $access
 
int $ref_id
 
array $filter
 
int $pool_id
 
bool $show_all
 
bool $has_schedule
 
array $objects
 
int $group_id
 
array $advmd
 
bool $has_items_with_host_context = false
 
ilTree $tree
 
array $context_obj_ids
 
ilAdvancedMDRecordGUI $record_gui = null
 
- Protected Attributes inherited from ilTable2GUI
string $requested_tmpl_delete
 
string $requested_tmpl_create
 
string $requested_nav_par2 = ""
 
string $requested_nav_par = ""
 
string $requested_nav_par1 = ""
 
ILIAS Table TableGUIRequest $table_request = null
 
array $selected_columns = []
 
ilCtrl $ctrl
 
object $parent_obj = null
 
string $parent_cmd = ""
 
string $close_command = ""
 
string $top_anchor = "il_table_top"
 
array $filters = array()
 
array $optional_filters = array()
 
string $filter_cmd = 'applyFilter'
 
string $reset_cmd = 'resetFilter'
 
int $filter_cols = 5
 
bool $ext_sort = false
 
bool $ext_seg = false
 
string $context = ""
 
array $mi_sel_buttons = []
 
bool $disable_filter_hiding = false
 
bool $top_commands = true
 
array $selectable_columns = array()
 
array $selected_column = array()
 
bool $show_templates = false
 
bool $show_rows_selector = true
 
bool $rows_selector_off = false
 
bool $nav_determined = false
 
bool $limit_determined = false
 
bool $filters_determined = false
 
bool $columns_determined = false
 
bool $open_form_tag = true
 
bool $close_form_tag = true
 
array $export_formats = []
 
int $export_mode = 0
 
bool $print_mode = false
 
bool $enable_command_for_all = false
 
bool $restore_filter = false
 
array $restore_filter_values = []
 
bool $default_filter_visibility = false
 
array $sortable_fields = array()
 
bool $prevent_double_submission = true
 
string $row_selector_label = ""
 
bool $select_all_on_top = false
 
array $sel_buttons = []
 
string $nav_value = ''
 
string $noentriestext = ''
 
string $css_row = ''
 
bool $display_as_block = false
 
string $description = ''
 
string $id = ""
 
bool $custom_prev_next = false
 
string $reset_cmd_txt = ""
 
string $defaultorderfield = ""
 
string $defaultorderdirection = ""
 
array $column = []
 
bool $datatable = false
 
bool $num_info = false
 
bool $form_multipart = false
 
array $row_data = []
 
string $order_field = ""
 
array $selected_filter = []
 
string $form_action = ""
 
string $formname = ""
 
string $sort_order = ""
 
array $buttons = []
 
array $multi = []
 
array $hidden_inputs = []
 
array $header_commands = []
 
string $row_template = ""
 
string $row_template_dir = ""
 
string $filter_cmd_txt = ""
 
string $custom_prev = ""
 
string $custom_next = ""
 
array $raw_post_data = null
 
ilGlobalTemplateInterface $main_tpl
 
- Protected Attributes inherited from ilTableGUI
string $sort_order
 
string $link_params
 
array $header_params
 
 $tpl
 
ilLanguage $lng
 

Additional Inherited Members

- Static Public Member Functions inherited from ilTable2GUI
static getAllCommandLimit ()
 
- Static Public Member Functions inherited from ilTableGUI
static linkbar (string $AScript, int $AHits, int $ALimit, int $AOffset, array $AParams=array(), array $ALayout=array(), string $prefix='')
 
- 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
string $title = ""
 
string $icon = ""
 
string $icon_alt = ""
 
string $help_page = ""
 
string $help_icon = ""
 
string $help_icon_alt = ""
 
array $header_names = []
 
array $header_vars = []
 
array $linkbar_vars = []
 
array $data = []
 
int $column_count = 0
 
array $column_width = []
 
int $max_count = 0
 
int $limit = 0
 
bool $max_limit = false
 
int $offset = 0
 
string $order_column = ""
 
string $order_direction = ""
 
string $footer_style = ""
 
string $footer_previous = ""
 
string $footer_next = ""
 
bool $lang_support = true
 
bool $global_tpl = false
 
string $form_name = ""
 
string $select_all_checkbox = ""
 
array $action_buttons = []
 
string $prefix = ""
 
string $base = ""
 
array $enabled
 
array $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

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

Constructor & Destructor Documentation

◆ __construct()

ilBookingReservationsTableGUI::__construct ( object  $a_parent_obj,
string  $a_parent_cmd,
int  $a_ref_id,
ilObjBookingPool  $pool,
bool  $a_show_all,
array  $a_filter_pre = null,
int  $a_group_id = null,
array  $context_obj_ids = null 
)

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

References $context_obj_ids, $DIC, ilTableGUI\$lng, $pool, $service, ILIAS\MetaData\Repository\Validation\Data\__construct(), ILIAS\Repository\access(), ilTable2GUI\addColumn(), ilTable2GUI\addMultiCommand(), ANONYMOUS_USER_ID, ILIAS\Repository\ctrl(), ilTableGUI\disable(), ilObjBookingPool\getAdvancedMDFields(), getCurrentFilter(), ilObject\getId(), getItems(), ilObjBookingPool\getScheduleType(), getSelectableColumns(), getSelectableUserColumns(), ilTable2GUI\getSelectedColumns(), ilTable2GUI\initFilter(), ILIAS\Repository\lng(), 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(), showMessages(), ilLanguage\txt(), ilObjBookingPool\TYPE_FIX_SCHEDULE, and ILIAS\Repository\user().

62  {
63  global $DIC;
64 
65  $service = $DIC->bookingManager()->internal();
66  $this->gui = $service->gui();
67  $this->domain = $service->domain();
68  $this->pool = $pool;
69  $a_pool_id = $pool->getId();
70  $a_has_schedule = ($pool->getScheduleType() === ilObjBookingPool::TYPE_FIX_SCHEDULE);
71  $this->ctrl = $DIC->ctrl();
72  $this->lng = $DIC->language();
73  $this->user = $DIC->user();
74  $this->access = $DIC->access();
75  $ilCtrl = $DIC->ctrl();
76  $lng = $DIC->language();
77  $ilUser = $DIC->user();
78  $this->tree = $DIC->repositoryTree();
79  $this->reservation_repo = $DIC->bookingManager()
80  ->internal()
81  ->repo()
82  ->reservation();
83  $this->schedule_manager = $DIC
84  ->bookingManager()
85  ->internal()
86  ->domain()
87  ->schedules($a_pool_id);
88 
89  $this->context_obj_ids = $context_obj_ids;
90  $this->pool_id = $a_pool_id;
91  $this->ref_id = $a_ref_id;
92  $this->show_all = $a_show_all;
93  $this->has_schedule = $a_has_schedule;
94  $this->group_id = $a_group_id;
95 
96  $this->table_repo = $DIC->bookingManager()
97  ->internal()
98  ->repo()
99  ->reservationTable();
100 
101  $this->advmd = ilObjBookingPool::getAdvancedMDFields($a_ref_id);
102 
103  $this->setId("bkrsv" . $a_ref_id);
104 
105  parent::__construct($a_parent_obj, $a_parent_cmd);
106 
107  $this->setTitle($lng->txt("book_reservations_list"));
108 
109  $this->addColumn("", "", 1);
110  $this->addColumn($this->lng->txt("title"), "title");
111 
112  $this->lng->loadLanguageModule("crs");
113 
114  $selected = $this->getSelectedColumns();
115  $cols = $this->getSelectableColumns();
116 
117  if ($this->has_schedule) {
118  $this->lng->loadLanguageModule("dateplaner");
119 
120  $this->addColumn($this->lng->txt("date"), "date");
121  if (in_array("week", $selected, true)) {
122  $this->addColumn($this->lng->txt("wk_short"), "week");
123  unset($cols["week"]);
124  }
125  if (in_array("weekday", $selected, true)) {
126  $this->addColumn($this->lng->txt("cal_weekday"), "weekday");
127  unset($cols["weekday"]);
128  }
129  $this->addColumn($this->lng->txt("book_schedule_slot"), "slot");
130  $this->addColumn($this->lng->txt("book_no_of_objects"), "counter");
131 
132  $this->setDefaultOrderField("date");
133  } else {
134  $this->addColumn($this->lng->txt("status"), "status");
135 
136  $this->setDefaultOrderField("title");
137  }
138  if ($this->showMessages()) {
139  $this->addColumn($this->lng->txt("book_message"));
140  }
141 
142  $this->setDefaultOrderDirection("asc");
143 
144  // non-user columns
145  $user_cols = $this->getSelectableUserColumns();
146  foreach ($this->getSelectedColumns() as $col) {
147  if (array_key_exists($col, $cols)) {
148  if (!isset($user_cols[$col])) {
149  $this->addColumn($cols[$col]["txt"], $col);
150  }
151  }
152  }
153 
154 
155 
156  $this->initFilter($a_filter_pre);
157  if ($this->group_id) {
158  $this->setLimit(9999);
159  $this->disable("numinfo");
160  $this->filters = array();
161  } else {
162  $this->setExportFormats(array(self::EXPORT_CSV, self::EXPORT_EXCEL));
163  }
164  $this->getItems($this->getCurrentFilter());
165 
166  if ($this->has_items_with_host_context) {
167  $this->addColumn($this->lng->txt("book_booked_in"), "context_obj_title");
168  }
169 
170  $this->addColumn($this->lng->txt("user"), "user_name");
171 
172  // user columns
173  foreach ($this->getSelectedColumns() as $col) {
174  if (array_key_exists($col, $cols)) {
175  if (isset($user_cols[$col])) {
176  $this->addColumn($cols[$col]["txt"], $col);
177  }
178  }
179  }
180 
181  $this->addColumn($this->lng->txt("actions"));
182 
183  $this->setEnableHeader(true);
184  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
185  $this->setRowTemplate("tpl.booking_reservation_row.html", "Modules/BookingManager/Reservations");
186  $this->setResetCommand("resetLogFilter");
187  $this->setFilterCommand("applyLogFilter");
188  $this->setDisableFilterHiding(true);
189 
190 
191  if ($ilUser->getId() !== ANONYMOUS_USER_ID) {
192  $this->addMultiCommand('rsvConfirmCancel', $lng->txt('book_set_cancel'));
193  if ($this->access->checkAccess('write', '', $this->ref_id)) {
194  $this->addMultiCommand('redirectMailToBooker', $lng->txt('book_mail_to_booker'));
195  $this->addMultiCommand('rsvConfirmDelete', $lng->txt('delete'));
196  }
197  $this->setSelectAllCheckbox('mrsv');
198  }
200  }
setExportFormats(array $formats)
Set available export formats.
const ANONYMOUS_USER_ID
Definition: constants.php:27
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setFormAction(string $a_form_action, bool $a_multipart=false)
setResetCommand(string $a_val, string $a_caption="")
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
getSelectableUserColumns()
Get selectable user fields.
getItems(array $filter)
Gather data and build rows.
setDisableFilterHiding(bool $a_val=true)
static getAdvancedMDFields(int $a_ref_id)
ilLanguage $lng
setId(string $a_val)
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setFilterCommand(string $a_val, string $a_caption="")
setDefaultOrderDirection(string $a_defaultorderdirection)
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
setLimit(int $a_limit=0, int $a_default_limit=0)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
disable(string $a_module_name)
static setUseRelativeDates(bool $a_status)
set use relative dates
addMultiCommand(string $a_cmd, string $a_text)
$service
Definition: ltiservices.php:43
setEnableHeader(bool $a_enableheader)
+ Here is the call graph for this function:

Member Function Documentation

◆ fillHeaderCSV()

ilBookingReservationsTableGUI::fillHeaderCSV ( ilCSVWriter  $a_csv)
protected

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

References $txt, ilCSVWriter\addColumn(), ilCSVWriter\addRow(), getAdditionalExportCols(), ILIAS\Repository\lng(), and showMessages().

878  : void {
879  $a_csv->addColumn($this->lng->txt("title"));
880  if ($this->has_schedule) {
881  $a_csv->addColumn($this->lng->txt("date"));
882  $a_csv->addColumn($this->lng->txt("wk_short"));
883  $a_csv->addColumn($this->lng->txt("cal_weekday"));
884  $a_csv->addColumn($this->lng->txt("book_schedule_slot"));
885  $a_csv->addColumn($this->lng->txt("book_no_of_objects"));
886  } else {
887  $a_csv->addColumn($this->lng->txt("status"));
888  }
889  if ($this->showMessages()) {
890  $a_csv->addColumn($this->lng->txt("book_message"));
891  }
892 
893  foreach ($this->getAdditionalExportCols() as $txt) {
894  $a_csv->addColumn($txt);
895  }
896 
897  $a_csv->addRow();
898  }
addColumn(string $a_col)
$txt
Definition: error.php:14
+ Here is the call graph for this function:

◆ fillHeaderExcel()

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

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

References $txt, getAdditionalExportCols(), ilExcel\getColumnCoord(), ILIAS\Repository\lng(), ilExcel\setBold(), ilExcel\setCell(), and showMessages().

811  : void {
812  $a_excel->setCell($a_row, 0, $this->lng->txt("title"));
813  $col = 0;
814  if ($this->has_schedule) {
815  $a_excel->setCell($a_row, ++$col, $this->lng->txt("date"));
816  $a_excel->setCell($a_row, ++$col, $this->lng->txt("wk_short"));
817  $a_excel->setCell($a_row, ++$col, $this->lng->txt("cal_weekday"));
818  $a_excel->setCell($a_row, ++$col, $this->lng->txt("book_schedule_slot"));
819  $a_excel->setCell($a_row, ++$col, $this->lng->txt("book_no_of_objects"));
820  } else {
821  $a_excel->setCell($a_row, ++$col, $this->lng->txt("status"));
822  }
823  if ($this->showMessages()) {
824  $a_excel->setCell($a_row, ++$col, $this->lng->txt("book_message"));
825  }
826 
827 
828  foreach ($this->getAdditionalExportCols() as $txt) {
829  $a_excel->setCell($a_row, ++$col, $txt);
830  }
831 
832  $a_excel->setBold("A" . $a_row . ":" . $a_excel->getColumnCoord($col) . $a_row);
833  }
getColumnCoord(int $a_col)
Get column "name" from number.
setCell(int $a_row, int $a_col, $a_value, ?string $a_datatype=null)
Set cell value.
setBold(string $a_coords)
Set cell(s) to bold.
$txt
Definition: error.php:14
+ Here is the call graph for this function:

◆ fillRow()

ilBookingReservationsTableGUI::fillRow ( array  $a_set)
protected

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

References $access, Vendor\Package\$c, ilTable2GUI\$ctrl, Vendor\Package\$f, ILIAS\LTI\ToolProvider\$key, ilTableGUI\$lng, $user, ilCalendarUtil\_numericDayToString(), ilDatePresentation\formatDate(), ilUserUtil\getNamePresentation(), getSelectableUserColumns(), ilTable2GUI\getSelectedColumns(), IL_CAL_DATE, ILIAS\Repository\int(), ILIAS\UI\examples\MainControls\Slate\Legacy\legacy(), ILIAS\Repository\lng(), ilStr\shortenTextExtended(), showMessages(), ilBookingReservation\STATUS_CANCELLED, ilBookingReservation\STATUS_IN_USE, and ilLanguage\txt().

623  : void
624  {
625  $lng = $this->lng;
626  $ilAccess = $this->access;
627  $ilCtrl = $this->ctrl;
628  $ilUser = $this->user;
629  $f = $this->gui->ui()->factory();
630 
631  $selected = $this->getSelectedColumns();
632 
633  $dd_items = [];
634 
635  if ($this->has_items_with_host_context) {
636  $this->tpl->setCurrentBlock("context");
637  $this->tpl->setVariable("VALUE_CONTEXT_TITLE", ($a_set["context_obj_title"] ?? "") . " ");
638  $this->tpl->parseCurrentBlock();
639  }
640 
641  $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
642 
643  $can_be_cancelled = (($ilAccess->checkAccess('write', '', $this->ref_id) ||
644  $a_set['user_id'] == $ilUser->getId()) &&
645  $a_set["can_be_cancelled"]);
646 
647  if ($can_be_cancelled) {
648  $this->tpl->setVariable("MULTI_ID", $a_set["booking_reservation_id"]);
649  }
650 
651  // #11995
652  $profile = $this->domain->profile();
653  $user_id = (int) $a_set['user_id'];
654  if (!$profile->exists($user_id)) {
655  $uname = $profile->getDeletedUserNamePresentation();
656  } else {
657  $uname = ilUserUtil::getNamePresentation($a_set['user_id'], false, true, "", true);
658  }
659  $this->tpl->setVariable("TXT_CURRENT_USER", $uname);
660 
661  if ($this->has_schedule) {
662  $this->tpl->setVariable("VALUE_DATE", ilDatePresentation::formatDate(new ilDate($a_set["date"], IL_CAL_DATE)));
663  if (in_array("week", $selected, true)) {
664  $this->tpl->setVariable("VALUE_WEEK", $a_set["week"]);
665  }
666  if (in_array("weekday", $selected, true)) {
667  $this->tpl->setVariable("VALUE_WEEKDAY", ilCalendarUtil::_numericDayToString((int) $a_set["weekday"], false));
668  }
669  $this->tpl->setVariable("VALUE_SLOT", $a_set["slot"]);
670  $this->tpl->setVariable("VALUE_COUNTER", $a_set["counter"]);
671  } elseif (in_array(
672  $a_set['status'],
674  )) {
675  $this->tpl->setVariable("TXT_STATUS", $lng->txt('book_reservation_status_' . $a_set['status']));
676  } else {
677  $this->tpl->setVariable("TXT_STATUS", " ");
678  }
679  if ($this->showMessages()) {
680  $this->tpl->setCurrentBlock("message");
681  $this->tpl->setVariable("MESSAGE", ilStr::shortenTextExtended($a_set["message"] . " ", 20, true));
682  $this->tpl->parseCurrentBlock();
683  }
684 
685  if ($this->advmd) {
686  foreach ($this->advmd as $item) {
687  $advmd_id = (int) $item["id"];
688 
689  if (!in_array("advmd" . $advmd_id, $selected, true)) {
690  continue;
691  }
692 
693  $val = " ";
694  $key = "md_" . $advmd_id . "_presentation";
695  if (isset($a_set[$key])) {
696  $pb = $a_set[$key]->getList();
697  if ($pb) {
698  $val = $pb;
699  }
700  }
701 
702  $this->tpl->setCurrentBlock("advmd_bl");
703  $this->tpl->setVariable("VALUE_ADVMD", $val);
704  $this->tpl->parseCurrentBlock();
705  }
706  }
707 
708  // additional user fields
709  $user_cols = $this->getSelectableUserColumns();
710  foreach ($this->getSelectedColumns() as $col) {
711  if (isset($user_cols[$col])) {
712  $this->tpl->setCurrentBlock("user_col");
713  $this->tpl->setVariable("VALUE_USER_COL", ($a_set[$col] ?? "") . " ");
714  $this->tpl->parseCurrentBlock();
715  }
716  }
717 
718  // reservation information
719  if ($a_set['user_id'] == $ilUser->getId() || $ilAccess->checkAccess('write', '', $this->ref_id)) {
720  if ($a_set['post_text'] !== "" || $a_set['post_file'] !== "") {
721  $ilCtrl->setParameter($this->parent_obj, 'reservation_id', $a_set['booking_reservation_id']);
722  $ilCtrl->setParameter($this->parent_obj, 'object_id', $a_set['object_id']);
723  $dd_items[] = $f->button()->shy(
724  $lng->txt('book_post_booking_information'),
725  $ilCtrl->getLinkTarget($this->parent_obj, 'displayPostInfo')
726  );
727  $ilCtrl->setParameter($this->parent_obj, 'object_id', null);
728  $ilCtrl->setParameter($this->parent_obj, 'reservation_id', "");
729  }
730  }
731 
732  if ($can_be_cancelled) {
733  $ilCtrl->setParameter($this->parent_obj, 'reservation_id', $a_set['booking_reservation_id']);
734  $dd_items[] = $f->button()->shy(
735  $lng->txt('book_set_cancel'),
736  $ilCtrl->getLinkTarget($this->parent_obj, 'rsvConfirmCancel')
737  );
738  $ilCtrl->setParameter($this->parent_obj, 'reservation_id', "");
739  }
740 
741 
742  if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
743  $ilCtrl->setParameter($this->parent_obj, 'reservation_id', $a_set['booking_reservation_id']);
744  $dd_items[] = $f->button()->shy(
745  $lng->txt('book_mail_to_booker'),
746  $ilCtrl->getLinkTarget($this->parent_obj, 'redirectMailToBooker')
747  );
748  $dd_items[] = $f->button()->shy(
749  $lng->txt('delete'),
750  $ilCtrl->getLinkTarget($this->parent_obj, 'rsvConfirmDelete')
751  );
752  $ilCtrl->setParameter($this->parent_obj, 'reservation_id', "");
753  }
754 
755  $render_items = [];
756  if ($this->showMessages() && $a_set["message"] !== "") {
757  $c = $this->gui->modal(
758  $this->lng->txt("book_message"),
759  $this->lng->txt("close")
760  )
761  ->legacy(nl2br($a_set["message"]))
762  ->getTriggerButtonComponents(
763  $this->lng->txt("book_show_message"),
764  true
765  );
766  $dd_items[] = $c["button"];
767  $render_items[] = $c["modal"];
768  }
769 
770  if (count($dd_items) > 0) {
771  $render_items[] = $f->dropdown()->standard($dd_items);
772  $this->tpl->setVariable("ACTIONS", $this->gui->ui()->renderer()->render($render_items));
773  }
774  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
getSelectableUserColumns()
Get selectable user fields.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
ilLanguage $lng
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path='ilpublicuserprofilegui')
Default behaviour is:
string $key
Consumer key/client ID value.
Definition: System.php:193
static _numericDayToString(int $a_day, bool $a_long=true)
const IL_CAL_DATE
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
+ Here is the call graph for this function:

◆ fillRowCSV()

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

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

References ILIAS\LTI\ToolProvider\$key, $txt, ilCalendarUtil\_numericDayToString(), ilCSVWriter\addColumn(), ilCSVWriter\addRow(), ilDatePresentation\formatDate(), getAdditionalExportCols(), IL_CAL_DATE, ILIAS\Repository\int(), ILIAS\Repository\lng(), showMessages(), ilBookingReservation\STATUS_CANCELLED, and ilBookingReservation\STATUS_IN_USE.

903  : void {
904  $a_csv->addColumn($a_set["title"]);
905  if ($this->has_schedule) {
906  $a_csv->addColumn(ilDatePresentation::formatDate(new ilDate($a_set["date"], IL_CAL_DATE)));
907  $a_csv->addColumn($a_set["week"]);
908  $a_csv->addColumn(ilCalendarUtil::_numericDayToString((int) $a_set["weekday"], false));
909  $a_csv->addColumn($a_set["slot"]);
910  $a_csv->addColumn($a_set["counter"]);
911  } else {
912  $status = "";
913  if (in_array($a_set['status'], array(ilBookingReservation::STATUS_CANCELLED, ilBookingReservation::STATUS_IN_USE))) {
914  $status = $this->lng->txt('book_reservation_status_' . $a_set['status']);
915  }
916  $a_csv->addColumn($status);
917  }
918  if ($this->showMessages()) {
919  $a_csv->addColumn($a_set["message"]);
920  }
921 
922  foreach ($this->getAdditionalExportCols() as $colid => $txt) {
923  if (str_starts_with($colid, "advmd")) {
924  $val = " ";
925  $key = "md_" . (int) substr($colid, 5) . "_presentation";
926  if (isset($a_set[$key])) {
927  $pb = $a_set[$key]->getList();
928  if ($pb) {
929  $val = $pb;
930  }
931  }
932  $a_csv->addColumn($val);
933  } else {
934  $a_csv->addColumn($a_set[$colid]);
935  }
936  }
937 
938  $a_csv->addRow();
939  }
addColumn(string $a_col)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
string $key
Consumer key/client ID value.
Definition: System.php:193
static _numericDayToString(int $a_day, bool $a_long=true)
$txt
Definition: error.php:14
const IL_CAL_DATE
+ Here is the call graph for this function:

◆ fillRowExcel()

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

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

References ILIAS\LTI\ToolProvider\$key, $txt, ilCalendarUtil\_numericDayToString(), getAdditionalExportCols(), IL_CAL_DATE, ILIAS\Repository\int(), ILIAS\Repository\lng(), ilExcel\setCell(), showMessages(), ilBookingReservation\STATUS_CANCELLED, and ilBookingReservation\STATUS_IN_USE.

839  : void {
840  $a_excel->setCell($a_row, 0, $a_set["title"]);
841  $col = 0;
842  if ($this->has_schedule) {
843  $a_excel->setCell($a_row, ++$col, new ilDate($a_set["date"], IL_CAL_DATE));
844  $a_excel->setCell($a_row, ++$col, $a_set["week"]);
845  $a_excel->setCell($a_row, ++$col, ilCalendarUtil::_numericDayToString((int) $a_set["weekday"], false));
846  $a_excel->setCell($a_row, ++$col, $a_set["slot"]);
847  $a_excel->setCell($a_row, ++$col, $a_set["counter"]);
848  } else {
849  $status = "";
850  if (in_array($a_set['status'], array(ilBookingReservation::STATUS_CANCELLED, ilBookingReservation::STATUS_IN_USE))) {
851  $status = $this->lng->txt('book_reservation_status_' . $a_set['status']);
852  }
853  $a_excel->setCell($a_row, ++$col, $status);
854  }
855  if ($this->showMessages()) {
856  $a_excel->setCell($a_row, ++$col, $a_set["message"]);
857  }
858 
859  foreach ($this->getAdditionalExportCols() as $colid => $txt) {
860  if (str_starts_with($colid, "advmd")) {
861  $val = " ";
862  $key = "md_" . (int) substr($colid, 5) . "_presentation";
863  if (isset($a_set[$key])) {
864  $pb = $a_set[$key]->getList();
865  if ($pb) {
866  $val = $pb;
867  }
868  }
869  $a_excel->setCell($a_row, ++$col, $val);
870  } else {
871  $a_excel->setCell($a_row, ++$col, $a_set[$colid]);
872  }
873  }
874  }
setCell(int $a_row, int $a_col, $a_value, ?string $a_datatype=null)
Set cell value.
string $key
Consumer key/client ID value.
Definition: System.php:193
static _numericDayToString(int $a_day, bool $a_long=true)
$txt
Definition: error.php:14
const IL_CAL_DATE
+ Here is the call graph for this function:

◆ getAdditionalExportCols()

ilBookingReservationsTableGUI::getAdditionalExportCols ( )
protected

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

References getSelectableColumns(), getSelectableUserColumns(), ilTable2GUI\getSelectedColumns(), and ILIAS\Repository\lng().

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

776  : array
777  {
778  $add_cols = [];
779  $cols = $this->getSelectableColumns();
780 
781  unset($cols["week"], $cols["weekday"]);
782 
783  // non-user columns
784  $user_cols = $this->getSelectableUserColumns();
785  foreach ($this->getSelectedColumns() as $col) {
786  if (array_key_exists($col, $cols)) {
787  if (!isset($user_cols[$col])) {
788  $add_cols[$col] = $cols[$col]["txt"];
789  }
790  }
791  }
792 
793  $add_cols["user_name"] = $this->lng->txt("user");
794  $add_cols["login"] = $this->lng->txt("login");
795 
796  // user columns
797  foreach ($this->getSelectedColumns() as $col) {
798  if (array_key_exists($col, $cols)) {
799  if (isset($user_cols[$col])) {
800  $add_cols[$col] = $cols[$col]["txt"];
801  }
802  }
803  }
804 
805  return $add_cols;
806  }
getSelectableUserColumns()
Get selectable user fields.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdvMDRecordGUI()

ilBookingReservationsTableGUI::getAdvMDRecordGUI ( )

◆ getCurrentFilter()

ilBookingReservationsTableGUI::getCurrentFilter ( )

Get current filter settings.

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

References $context_obj_ids, $filter, ILIAS\Repository\filter(), IL_CAL_DATE, IL_CAL_DATETIME, IL_CAL_UNIX, and ilBookingReservation\STATUS_CANCELLED.

Referenced by __construct().

424  : array
425  {
426  $filter = array();
427  if ($this->filter["object"]) {
428  $filter["object"] = $this->filter["object"];
429  }
430  if ($this->filter["title"]) {
431  $filter["title"] = $this->filter["title"];
432  }
433  if ($this->filter["status"]) {
434  $filter["status"] = $this->filter["status"];
435  }
436  if (isset($this->filter["user_id"])) {
437  $filter["user_id"] = $this->filter["user_id"];
438  }
439  if (!is_null($this->context_obj_ids)) {
440  $filter["context_obj_ids"] = $this->context_obj_ids;
441  }
442 
443  if ($this->has_schedule) {
444  if (!isset($filter["status"])) {
445  // needs distinct status because of aggregation
447  }
448  if (isset($this->filter["slot"])) {
449  $filter["slot"] = $this->filter["slot"];
450  }
451 
452  if ($this->filter["fromto"]["from"] || $this->filter["fromto"]["to"]) {
453  if ($this->filter["fromto"]["from"]) {
454  $filter["from"] = $this->filter["fromto"]["from"]->get(IL_CAL_UNIX);
455  }
456  if ($this->filter["fromto"]["to"]) {
457  $day_end = new ilDateTime($this->filter["fromto"]["to"]->get(IL_CAL_DATE) . " 23:59:59", IL_CAL_DATETIME);
458  $filter["to"] = $day_end->get(IL_CAL_UNIX);
459  }
460  }
461 
462  $filter["past"] = (bool) $this->filter["past"];
463  }
464  return $filter;
465  }
const IL_CAL_DATETIME
const IL_CAL_UNIX
const IL_CAL_DATE
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getItems()

ilBookingReservationsTableGUI::getItems ( array  $filter)

Gather data and build rows.

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

References Vendor\Package\$c, Vendor\Package\$d, ilTableGUI\$data, ILIAS\LTI\ToolProvider\$key, $pool_id, $reservation_repo, $user, ilCourseUserData\_getValuesByObjId(), ilObject\_lookupObjectId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilPrivacySettings\getInstance(), getParentGroupCourse(), getSelectedUserColumns(), ilMemberAgreement\lookupAcceptedAgreements(), ilAdvancedMDRecordGUI\MODE_FILTER, ilAdvancedMDValues\queryForRecords(), and ilTable2GUI\setData().

Referenced by __construct().

475  : void
476  {
477  $ilUser = $this->user;
478 
479  $this->has_items_with_host_context = false;
480 
481  if (!isset($filter["object"])) {
482  $ids = array_keys($this->objects);
483  } else {
484  $ids = array($filter["object"]);
485  }
486 
487  if (!$this->show_all) {
488  $filter["user_id"] = $ilUser->getId();
489  }
490 
491  $repo = $this->reservation_repo;
492  $data = $repo->getListByDate($this->has_schedule, $ids, $filter);
493 
494  if ($this->advmd) {
495  // advanced metadata
496  $this->record_gui = new ilAdvancedMDRecordGUI(
498  "book",
499  $this->pool_id,
500  "bobj"
501  );
502  $this->record_gui->setTableGUI($this);
503  $this->record_gui->parse();
504 
505  foreach (array_keys($data) as $idx) {
506  $data[$idx]["pool_id"] = $this->pool_id;
507  }
508 
510  $this->ref_id,
511  "book",
512  "bobj",
513  [$this->pool_id],
514  "bobj",
515  $data,
516  "pool_id",
517  "object_id",
518  $this->record_gui->getFilterElements()
519  );
520  }
521 
522  if (count($this->getSelectedUserColumns()) > 0) {
523  // get additional user data
524  $user_ids = array_unique(array_map(static function ($d) {
525  return $d['user_id'];
526  }, $data));
527 
528  $user_columns = [];
529  $odf_ids = [];
530  foreach ($this->getSelectedUserColumns() as $field) {
531  if (strpos($field, 'odf') === 0) {
532  $odf_ids[] = substr($field, 4);
533  } else {
534  $user_columns[] = $field;
535  }
536  }
537 
538  // see ilCourseParticipantsTableGUI
539  $user_columns = array_diff(
540  $user_columns,
541  ['consultation_hour', 'prtf', 'roles', 'org_units']
542  );
543 
544  // user data fields
545  $query = new ilUserQuery();
546  $query->setLimit(9999);
547  $query->setAdditionalFields($user_columns);
548  $query->setUserFilter($user_ids);
549  $ud = $query->query();
550  $usr_data = [];
551  foreach ($ud["set"] as $v) {
552  foreach ($user_columns as $c) {
553  $usr_data[$v["usr_id"]][$c] = $v[$c];
554  }
555  }
556  foreach ($data as $key => $v) {
557  if (isset($usr_data[$v["user_id"]])) {
558  $data[$key] = array_merge($v, $usr_data[$v["user_id"]]);
559  }
560  }
561 
562  // object specific user data fields of parent course or group
563  if ($odf_ids) {
564  $parent = $this->getParentGroupCourse();
565  $parent_obj_id = ilObject::_lookupObjectId($parent['ref_id']);
566  $parent_obj_type = ilObject::_lookupType($parent_obj_id);
567 
568  $confirmation_required = ($parent_obj_type === 'crs')
569  ? ilPrivacySettings::getInstance()->courseConfirmationRequired()
570  : ilPrivacySettings::getInstance()->groupConfirmationRequired();
571  if ($confirmation_required) {
572  $user_ids = array_diff($user_ids, ilMemberAgreement::lookupAcceptedAgreements($parent_obj_id));
573  }
574  $odf_data = ilCourseUserData::_getValuesByObjId($parent_obj_id);
575  $usr_data = [];
576  foreach ($odf_data as $usr_id => $fields) {
577  // this currently does not with strict mode, since
578  // $user_ids holds strings
579  if (in_array($usr_id, $user_ids)) {
580  foreach ($fields as $field_id => $value) {
581  if (in_array($field_id, $odf_ids, true)) {
582  $usr_data[$usr_id]['odf_' . $field_id] = $value;
583  }
584  }
585  }
586  }
587 
588  foreach ($data as $key => $v) {
589  if (isset($usr_data[$v["user_id"]])) {
590  $data[$key] = array_merge($v, $usr_data[$v["user_id"]]);
591  }
592  }
593  }
594  }
595 
596  foreach ($data as $k => $d) {
597  if ($d["context_obj_id"] > 0) {
598  $this->has_items_with_host_context = true;
599  $data[$k]["context_obj_title"] = ilObject::_lookupTitle($d["context_obj_id"]);
600  }
601  }
602 
603  $this->setData($data);
604  }
setData(array $a_data)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getValuesByObjId(int $a_obj_id)
static _lookupTitle(int $obj_id)
string $key
Consumer key/client ID value.
Definition: System.php:193
static _lookupObjectId(int $ref_id)
static queryForRecords(int $adv_rec_obj_ref_id, string $adv_rec_obj_type, string $adv_rec_obj_subtype, array $a_obj_id, string $a_subtype, array $a_records, string $a_obj_id_key, string $a_obj_subid_key, array $a_amet_filter=null)
static lookupAcceptedAgreements(int $a_obj_id)
Lookup users who have accepted the agreement.
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOrderField()

ilBookingReservationsTableGUI::getOrderField ( )

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

611  : string
612  {
613  $field = parent::getOrderField();
614 
615  // #16560 - this will enable matchting slot sorting to date/week
616  if (in_array($field, array("date", "week"))) {
617  $field = "_sortdate";
618  }
619 
620  return $field;
621  }

◆ getParentGroupCourse()

ilBookingReservationsTableGUI::getParentGroupCourse ( )
protected

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

References $tree, and ilTree\checkForParentType().

Referenced by getItems(), and getSelectableUserColumns().

270  : ?array
271  {
272  $tree = $this->tree;
273  if (($par_ref_id = $tree->checkForParentType($this->ref_id, "grp")) > 0) {
274  return [
275  "ref_id" => $par_ref_id,
276  "type" => "grp"
277  ];
278  }
279  if (($par_ref_id = $tree->checkForParentType($this->ref_id, "crs")) > 0) {
280  return [
281  "ref_id" => $par_ref_id,
282  "type" => "crs"
283  ];
284  }
285  return null;
286  }
checkForParentType(int $a_ref_id, string $a_type, bool $a_exclude_source_check=false)
Check for parent type e.g check if a folder (ref_id 3) is in a parent course obj => checkForParentTyp...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelectableColumns()

ilBookingReservationsTableGUI::getSelectableColumns ( )

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

References getSelectableUserColumns(), and ILIAS\Repository\lng().

Referenced by __construct(), and getAdditionalExportCols().

208  : array
209  {
210  $cols = array();
211 
212  if ($this->has_schedule) {
213  $this->lng->loadLanguageModule("dateplaner");
214 
215  $cols["week"] = array(
216  "txt" => $this->lng->txt("wk_short"),
217  "default" => true
218  );
219 
220  $cols["weekday"] = array(
221  "txt" => $this->lng->txt("cal_weekday"),
222  "default" => true
223  );
224  }
225 
226  foreach ($this->advmd as $field) {
227  $cols["advmd" . $field["id"]] = array(
228  "txt" => $field["title"],
229  "default" => false
230  );
231  }
232 
233  $cols = array_merge($cols, $this->getSelectableUserColumns());
234 
235  return $cols;
236  }
getSelectableUserColumns()
Get selectable user fields.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelectableUserColumns()

ilBookingReservationsTableGUI::getSelectableUserColumns ( )
protected

Get selectable user fields.

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

References ilExportFieldsInfo\_getInstanceByType(), ilObject\_lookupObjectId(), ILIAS\Repository\access(), and getParentGroupCourse().

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

241  : array
242  {
243  $cols = [];
244  // additional user fields
245  if (($parent = $this->getParentGroupCourse()) !== null) {
246  if ($this->access->checkAccess("manage_members", "", $parent["ref_id"])) {
247  $ef = ilExportFieldsInfo::_getInstanceByType($parent["type"]);
248  foreach ($ef->getSelectableFieldsInfo(ilObject::_lookupObjectId($parent["ref_id"])) as $k => $v) {
249  if ($k !== "login") {
250  $cols[$k] = $v;
251  }
252  }
253  }
254  }
255  return $cols;
256  }
static _lookupObjectId(int $ref_id)
static _getInstanceByType(string $a_type)
Get Singleton Instance.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelectedUserColumns()

ilBookingReservationsTableGUI::getSelectedUserColumns ( )
protected

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

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

Referenced by getItems().

258  : array
259  {
260  $user_cols = $this->getSelectableUserColumns();
261  $sel = [];
262  foreach ($this->getSelectedColumns() as $col) {
263  if (isset($user_cols[$col])) {
264  $sel[] = $col;
265  }
266  }
267  return $sel;
268  }
getSelectableUserColumns()
Get selectable user fields.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFilter()

ilBookingReservationsTableGUI::initFilter ( array  $a_filter_pre = null)

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

References ilTable2GUI\$id, ilTableGUI\$title, ilCalendarUtil\_numericDayToString(), ilTable2GUI\addFilterItem(), ilTable2GUI\addFilterItemByMetaType(), ilDateTime\DAY, ILIAS\Repository\filter(), ilTable2GUI\FILTER_DATE_RANGE, ilTable2GUI\FILTER_SELECT, ilTable2GUI\FILTER_TEXT, ilTable2GUI\getId(), ilBookingObject\getList(), ilBookingReservation\getUserFilter(), IL_CAL_DATE, ILIAS\Repository\lng(), and ilBookingReservation\STATUS_CANCELLED.

290  : void {
291  if (is_array($a_filter_pre) &&
292  isset($a_filter_pre["object"])) {
293  $this->table_repo->setObjectFilter(
294  $this->getId(),
295  serialize($a_filter_pre["object"])
296  );
297  }
298 
299  $this->objects = array();
300  foreach (ilBookingObject::getList($this->pool_id) as $item) {
301  $this->objects[$item["booking_object_id"]] = $item["title"];
302  }
303  $item = $this->addFilterItemByMetaType("object", ilTable2GUI::FILTER_SELECT);
304  if ($item !== null) {
305  $item->setOptions(array("" => $this->lng->txt('book_all')) + $this->objects);
306  $this->filter["object"] = $item->getValue();
308  "title",
310  false,
311  $this->lng->txt("object") . " " . $this->lng->txt("title") . "/" . $this->lng->txt("description")
312  );
313  if ($title !== null) {
314  $this->filter["title"] = $title->getValue();
315  }
316 
317  if ($this->has_schedule) {
318  // default period: from:today [ to:(today + n days) ]
319  if (!$this->table_repo->hasFromToFilter($this->getId())) {
320  $from = new ilDateTime(date("Y-m-d"), IL_CAL_DATE); // today
321  $to = null;
322 
323  // add period end from pool settings?
324  $bpool = new ilObjBookingPool($this->pool_id, false);
325  $period = $bpool->getReservationFilterPeriod();
326  if ($period !== null) {
327  $to = clone $from;
328  if ($period) {
329  $to->increment(ilDateTime::DAY, $period);
330  }
331  $to = serialize($to);
332  }
333 
334  $this->table_repo->setFromToFilter(
335  $this->getId(),
336  serialize(array(
337  "from" => serialize($from),
338  "to" => $to
339  ))
340  );
341  }
342  $item = $this->addFilterItemByMetaType("fromto", ilTable2GUI::FILTER_DATE_RANGE, false, $this->lng->txt('book_fromto'));
343  $this->filter["fromto"] = $item->getDate();
344 
345  // only needed for full log
346  if ($this->show_all) {
347  // see ilObjBookingPoolGUI::buildDatesBySchedule()
348  $map = array_flip(array('su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'));
349 
350  $options = array("" => $this->lng->txt('book_all'));
351 
352  // schedule to slot
353  foreach ($this->schedule_manager->getScheduleList() as $id => $title) {
354  $schedule = new ilBookingSchedule($id);
355  foreach ($schedule->getDefinition() as $day => $slots) {
356  $day_caption = ilCalendarUtil::_numericDayToString((int) $map[$day], false);
357 
358  foreach ($slots as $slot) {
359  $idx = $map[$day] . "_" . $slot;
360  $options[$idx] = $day_caption . ", " . $slot;
361  }
362  }
363  }
364 
365  ksort($options);
366 
367  $item = $this->addFilterItemByMetaType("book_schedule_slot", ilTable2GUI::FILTER_SELECT);
368  $item->setOptions($options);
369  $this->filter["slot"] = $item->getValue();
370  }
371  }
372 
373  $item = new ilCheckboxInputGUI($this->lng->txt("book_filter_past_reservations"), "past");
374  $this->addFilterItem($item);
375  $item->readFromSession();
376 
377  // if period starts in the past we have to include past reservations
378  // :TODO: to be discussed
379  if (isset($this->filter["fromto"]["from"]) &&
380  $this->filter["fromto"]["from"]->get(IL_CAL_DATE) < date("Y-m-d")) {
381  $item->setChecked(true);
382  }
383 
384  $this->filter["past"] = $item->getChecked();
385 
386  // status
387  $valid_status = array(-ilBookingReservation::STATUS_CANCELLED,
389  if (!$this->has_schedule) {
390  $options = array("" => $this->lng->txt('book_all'));
391  } else {
392  $options = array();
393  }
394  foreach ($valid_status as $loop) {
395  if ($loop > 0) {
396  $options[$loop] = $this->lng->txt('book_reservation_status_' . $loop);
397  } else {
398  $options[$loop] = $this->lng->txt('book_not') . ' ' . $this->lng->txt('book_reservation_status_' . -$loop);
399  }
400  }
401  $item = $this->addFilterItemByMetaType("status", ilTable2GUI::FILTER_SELECT);
402  $item->setOptions($options);
403  $this->filter["status"] = $item->getValue();
404 
405  // only needed for full log
406  if ($this->show_all) {
407  $options = array("" => $this->lng->txt('book_all')) +
408  ilBookingReservation::getUserFilter(array_keys($this->objects));
409  $item = $this->addFilterItemByMetaType("user", ilTable2GUI::FILTER_SELECT);
410  $item->setOptions($options);
411  if (is_array($a_filter_pre) && isset($a_filter_pre["user_id"])) {
412  $item->setValue($a_filter_pre["user_id"]);
413  $this->filter["user_id"] = $a_filter_pre["user_id"];
414  } else {
415  $this->filter["user_id"] = $item->getValue();
416  }
417  }
418  }
419  }
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
static getUserFilter(array $a_object_ids)
Get all users who have reservations for object(s)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addFilterItemByMetaType(string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
Add filter by standard type.
static _numericDayToString(int $a_day, bool $a_long=true)
const IL_CAL_DATE
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
static getList(int $a_pool_id, string $a_title=null)
Get list of booking objects.
+ Here is the call graph for this function:

◆ numericOrdering()

ilBookingReservationsTableGUI::numericOrdering ( string  $a_field)

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

467  : bool
468  {
469  return in_array($a_field, array("counter", "date", "week", "weekday"));
470  }

◆ showMessages()

ilBookingReservationsTableGUI::showMessages ( )
protected

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

References ILIAS\Repository\access().

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

202  : bool
203  {
204  return $this->pool->usesMessages() &&
205  $this->access->checkAccess('write', '', $this->ref_id);
206  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilBookingReservationsTableGUI::$access
protected

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

Referenced by fillRow().

◆ $advmd

array ilBookingReservationsTableGUI::$advmd
protected

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

◆ $context_obj_ids

array ilBookingReservationsTableGUI::$context_obj_ids
protected

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

Referenced by __construct(), and getCurrentFilter().

◆ $domain

InternalDomainService ilBookingReservationsTableGUI::$domain
protected

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

◆ $filter

array ilBookingReservationsTableGUI::$filter
protected

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

Referenced by getCurrentFilter().

◆ $group_id

int ilBookingReservationsTableGUI::$group_id
protected

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

◆ $gui

InternalGUIService ilBookingReservationsTableGUI::$gui
protected

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

◆ $has_items_with_host_context

bool ilBookingReservationsTableGUI::$has_items_with_host_context = false
protected

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

◆ $has_schedule

bool ilBookingReservationsTableGUI::$has_schedule
protected

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

◆ $objects

array ilBookingReservationsTableGUI::$objects
protected

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

◆ $pool

ilObjBookingPool ilBookingReservationsTableGUI::$pool
protected

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

Referenced by __construct().

◆ $pool_id

int ilBookingReservationsTableGUI::$pool_id
protected

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

Referenced by getItems().

◆ $record_gui

ilAdvancedMDRecordGUI ilBookingReservationsTableGUI::$record_gui = null
protected

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

Referenced by getAdvMDRecordGUI().

◆ $ref_id

int ilBookingReservationsTableGUI::$ref_id
protected

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

◆ $reservation_repo

ReservationDBRepository ilBookingReservationsTableGUI::$reservation_repo
protected

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

Referenced by getItems().

◆ $schedule_manager

ScheduleManager ilBookingReservationsTableGUI::$schedule_manager
protected

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

◆ $show_all

bool ilBookingReservationsTableGUI::$show_all
protected

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

◆ $table_repo

ReservationTableSessionRepository ilBookingReservationsTableGUI::$table_repo
protected

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

◆ $tree

ilTree ilBookingReservationsTableGUI::$tree
protected

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

Referenced by getParentGroupCourse().

◆ $user

ilObjUser ilBookingReservationsTableGUI::$user
protected

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

Referenced by fillRow(), and getItems().


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