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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 __construct (object $a_parent_obj, string $a_parent_cmd, int $a_ref_id, int $a_pool_id, bool $a_pool_has_schedule, ?int $a_pool_overall_limit, bool $active_management=true)
 
 initFilter ()
 
 getItems ()
 
 numericOrdering (string $a_field)
 
 getSelectableColumns ()
 
- 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

 getAdvMDRecordGUI ()
 needed for advmd filter handling More...
 
 fillRow (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

string $process_class
 
ILIAS UI Renderer $ui_renderer
 
ILIAS UI Factory $ui_factory
 
ilAccessHandler $access
 
ilObjUser $user
 
int $ref_id
 
int $pool_id
 
bool $has_schedule
 
bool $may_edit
 
bool $may_assign
 
int $overall_limit = null
 
array $reservations = array()
 
int $current_bookings
 
array $advmd
 
array $filter
 
ilAdvancedMDRecordGUI $record_gui = null
 
bool $active_management
 
ilGlobalTemplateInterface $main_tpl
 
- 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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning List booking objects (for booking type)

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

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

Constructor & Destructor Documentation

◆ __construct()

ilBookingObjectsTableGUI::__construct ( object  $a_parent_obj,
string  $a_parent_cmd,
int  $a_ref_id,
int  $a_pool_id,
bool  $a_pool_has_schedule,
?int  $a_pool_overall_limit,
bool  $active_management = true 
)

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

References $active_management, $DIC, ilTableGUI\$lng, ILIAS\MetaData\Repository\Validation\Data\__construct(), ILIAS\Repository\access(), ilTable2GUI\addColumn(), ILIAS\Repository\ctrl(), ilObjBookingPool\getAdvancedMDFields(), getItems(), getSelectableColumns(), ilTable2GUI\getSelectedColumns(), initFilter(), ILIAS\Repository\lng(), ilTable2GUI\setEnableHeader(), ilTable2GUI\setFormAction(), ilTable2GUI\setId(), ilTable2GUI\setRowTemplate(), ilTable2GUI\setTitle(), ilLanguage\txt(), and ILIAS\Repository\user().

52  {
53  global $DIC;
54  $this->main_tpl = $DIC->ui()->mainTemplate();
55 
56  $this->ctrl = $DIC->ctrl();
57  $this->lng = $DIC->language();
58  $this->access = $DIC->access();
59  $this->user = $DIC->user();
60  $ilCtrl = $DIC->ctrl();
61  $lng = $DIC->language();
62  $ilAccess = $DIC->access();
63  $this->ui_factory = $DIC->ui()->factory();
64  $this->ui_renderer = $DIC->ui()->renderer();
65 
66  $this->ref_id = $a_ref_id;
67  $this->pool_id = $a_pool_id;
68  $this->has_schedule = $a_pool_has_schedule;
69  $this->overall_limit = $a_pool_overall_limit;
70  $this->active_management = $active_management;
71  $this->may_edit = ($this->active_management &&
72  $ilAccess->checkAccess('write', '', $this->ref_id));
73  $this->may_assign = ($this->active_management &&
74  $ilAccess->checkAccess('write', '', $this->ref_id));
75 
76  $this->advmd = ilObjBookingPool::getAdvancedMDFields($this->ref_id);
77 
78  $this->setId("bkobj");
79 
80  parent::__construct($a_parent_obj, $a_parent_cmd);
81 
82  $this->setTitle($lng->txt("book_booking_objects"));
83 
84  // $this->setLimit(9999);
85 
86  $this->addColumn($this->lng->txt("title"), "title");
87 
88  $cols = $this->getSelectableColumns();
89  foreach ($this->getSelectedColumns() as $col) {
90  $this->addColumn($cols[$col]["txt"], $col);
91  }
92 
93  if (!$this->has_schedule) {
94  $this->addColumn($this->lng->txt("available"));
95  }
96 
97  $this->addColumn($this->lng->txt("actions"));
98 
99  $this->setEnableHeader(true);
100  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
101  $this->setRowTemplate("tpl.booking_object_row.html", "Modules/BookingManager");
102  $this->process_class = $DIC->bookingManager()
103  ->internal()
104  ->gui()
105  ->process()
106  ->getProcessClass($a_pool_has_schedule);
107 
108  $this->initFilter();
109  $this->getItems();
110  }
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)
static getAdvancedMDFields(int $a_ref_id)
ilLanguage $lng
setId(string $a_val)
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
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)
setEnableHeader(bool $a_enableheader)
+ Here is the call graph for this function:

Member Function Documentation

◆ fillRow()

ilBookingObjectsTableGUI::fillRow ( array  $a_set)
protected

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

References ilTable2GUI\$ctrl, ILIAS\LTI\ToolProvider\$key, ilTableGUI\$lng, $user, ILIAS\Repository\filter(), ilTable2GUI\getSelectedColumns(), IL_CAL_DATE, ILIAS\Repository\int(), ILIAS\Repository\lng(), ilBookingReservation\STATUS_CANCELLED, and ilLanguage\txt().

288  : void
289  {
290  $lng = $this->lng;
291  $ilCtrl = $this->ctrl;
292  $ilUser = $this->user;
293 
294  $has_booking = false;
295  $booking_possible = true;
296  $assign_possible = true;
297  $has_reservations = false;
298 
299  $selected = $this->getSelectedColumns();
300 
301  $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
302 
303  if (in_array("description", $selected, true)) {
304  $this->tpl->setVariable("TXT_DESC", nl2br($a_set["description"] ?? ""));
305  }
306 
307  if (isset($a_set["full_up"])) {
308  $this->tpl->setVariable("NOT_YET", $a_set["full_up"]);
309  $booking_possible = false;
310  $assign_possible = false;
311  } elseif (isset($a_set["not_yet"])) {
312  $this->tpl->setVariable("NOT_YET", $a_set["not_yet"]);
313  }
314 
315  if (!$this->has_schedule) {
316  $cnt = 0;
317  foreach ($this->reservations[$a_set["booking_object_id"]] as $item) {
318  if ($item["status"] != ilBookingReservation::STATUS_CANCELLED) {
319  $cnt++;
320 
321  if ($item["user_id"] == $ilUser->getId()) {
322  $has_booking = true;
323  }
324 
325  $has_reservations = true;
326  }
327  }
328 
329  $this->tpl->setVariable("VALUE_AVAIL", $a_set["nr_items"] - $cnt);
330  $this->tpl->setVariable("VALUE_AVAIL_ALL", $a_set["nr_items"]);
331 
332  if ($a_set["nr_items"] <= $cnt || ($this->overall_limit && $this->current_bookings && $this->current_bookings >= $this->overall_limit)) {
333  $booking_possible = false;
334  }
335  if ($has_booking) {
336  $booking_possible = false;
337  }
338  if ($a_set["nr_items"] <= $cnt) {
339  $assign_possible = false;
340  }
341  } elseif (!$this->may_edit) {
342  foreach ($this->reservations[$a_set["booking_object_id"]] as $item) {
343  if ($item["status"] != ilBookingReservation::STATUS_CANCELLED &&
344  $item["user_id"] == $ilUser->getId()) {
345  $has_booking = true;
346  }
347  }
348  }
349 
350  //Actions
351  $items = array();
352 
353  $ilCtrl->setParameter($this->parent_obj, 'object_id', $a_set['booking_object_id']);
354 
355  if ($booking_possible) {
356  if (isset($this->filter['period']['from'])) {
357  $ilCtrl->setParameter($this->parent_obj, 'sseed', $this->filter['period']['from']->get(IL_CAL_DATE));
358  }
359 
360  $items[] = $this->ui_factory->button()->shy(
361  $lng->txt('book_book'),
362  $ilCtrl->getLinkTargetByClass($this->process_class, 'book')
363  );
364 
365  $ilCtrl->setParameter($this->parent_obj, 'sseed', '');
366  }
367 
368  if ($has_booking || $this->may_edit) {
369  if (trim($a_set['post_text'] ?? "") || $a_set['post_file']) {
370  $items[] = $this->ui_factory->button()->shy(
371  $lng->txt('book_post_booking_information'),
372  $ilCtrl->getLinkTargetByClass($this->process_class, 'displayPostInfo')
373  );
374  }
375  }
376 
377  // #16663
378  if (!$this->has_schedule && $has_booking) {
379  $ilCtrl->setParameterByClass("ilbookingreservationsgui", 'object_id', $a_set['booking_object_id']);
380  $items[] = $this->ui_factory->button()->shy($lng->txt('book_set_cancel'), $ilCtrl->getLinkTargetByClass("ilbookingreservationsgui", 'rsvConfirmCancelUser'));
381  $ilCtrl->setParameterByClass("ilbookingreservationsgui", 'object_id', "");
382  }
383 
384  if ($this->may_edit || $has_booking) {
385  $ilCtrl->setParameterByClass('ilBookingReservationsGUI', 'object_id', $a_set['booking_object_id']);
386  $items[] = $this->ui_factory->button()->shy(
387  $lng->txt('book_log'),
388  $ilCtrl->getLinkTargetByClass('ilBookingReservationsGUI', 'log')
389  );
390  $ilCtrl->setParameterByClass('ilBookingReservationsGUI', 'object_id', '');
391  }
392 
393  if ($this->may_assign && $assign_possible) {
394  // note: this call is currently super expensive
395  // see #26388, it has been performed even for users without edit permissions before
396  // now the call has been moved here, but still this needs improvement
397  // EDIT: deactivated for now due to performance reasons
398  //if (!empty(ilBookingParticipant::getAssignableParticipants($a_set["booking_object_id"]))) {
399  if (isset($this->filter['period']['from'])) {
400  $ilCtrl->setParameterByClass(
401  $this->process_class,
402  'sseed',
403  $this->filter['period']['from']->get(IL_CAL_DATE)
404  );
405  }
406 
407  $items[] = $this->ui_factory->button()->shy(
408  $lng->txt('book_assign_participant'),
409  $ilCtrl->getLinkTargetByClass($this->process_class, 'assignParticipants')
410  );
411 
412  $ilCtrl->setParameterByClass($this->process_class, 'sseed', '');
413  //}
414  }
415 
416  if ($a_set['info_file']) {
417  $items[] = $this->ui_factory->button()->shy($lng->txt('book_download_info'), $ilCtrl->getLinkTarget($this->parent_obj, 'deliverInfo'));
418  }
419 
420  if ($this->may_edit) {
421  $items[] = $this->ui_factory->button()->shy($lng->txt('edit'), $ilCtrl->getLinkTarget($this->parent_obj, 'edit'));
422 
423  // #10890
424  if (!$has_reservations) {
425  $items[] = $this->ui_factory->button()->shy($lng->txt('delete'), $ilCtrl->getLinkTarget($this->parent_obj, 'confirmDelete'));
426  }
427  }
428 
429  if ($this->advmd) {
430  foreach ($this->advmd as $item) {
431  $advmd_id = (int) $item["id"];
432 
433  if (!in_array("advmd" . $advmd_id, $selected)) {
434  continue;
435  }
436 
437  $val = " ";
438  $key = "md_" . $advmd_id . "_presentation";
439  if (isset($a_set[$key])) {
440  $pb = $a_set[$key]->getList();
441  if ($pb) {
442  $val = $pb;
443  }
444  }
445 
446  $this->tpl->setCurrentBlock("advmd_bl");
447  $this->tpl->setVariable("ADVMD_VAL", $val);
448  $this->tpl->parseCurrentBlock();
449  }
450  }
451 
452  if (count($items)) {
453  $actions_dropdown = $this->ui_factory->dropdown()->standard($items)->withLabel($this->lng->txt('actions'));
454  $this->tpl->setVariable("ACTION_DROPDOWN", $this->ui_renderer->render($actions_dropdown));
455  }
456  }
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...
ilLanguage $lng
string $key
Consumer key/client ID value.
Definition: System.php:193
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:

◆ getAdvMDRecordGUI()

ilBookingObjectsTableGUI::getAdvMDRecordGUI ( )
protected

needed for advmd filter handling

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

References $record_gui.

116  {
117  // #16827
118  return $this->record_gui;
119  }

◆ getItems()

ilBookingObjectsTableGUI::getItems ( )

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

References ilTableGUI\$data, ilTableGUI\$limit, $user, ILIAS\Repository\filter(), ilDatePresentation\formatDate(), ilBookingObject\getList(), ilBookingReservation\getList(), IL_CAL_DATE, IL_CAL_UNIX, ilBookingReservation\isObjectAvailableInPeriod(), ILIAS\Repository\lng(), ilAdvancedMDRecordGUI\MODE_FILTER, ilAdvancedMDValues\queryForRecords(), ilTable2GUI\setData(), ilTableGUI\setMaxCount(), and ilBookingReservation\STATUS_CANCELLED.

Referenced by __construct().

151  : void
152  {
153  $ilUser = $this->user;
154 
155  $data = ilBookingObject::getList($this->pool_id, $this->filter["title"]);
156 
157 
158  // check schedule availability
159  if ($this->has_schedule) {
160  $now = time();
161  $limit = strtotime("+1year");
162  foreach ($data as $idx => $item) {
163  $schedule = new ilBookingSchedule($item["schedule_id"]);
164  $av_from = ($schedule->getAvailabilityFrom() && !$schedule->getAvailabilityFrom()->isNull())
165  ? $schedule->getAvailabilityFrom()->get(IL_CAL_UNIX)
166  : null;
167  $av_to = ($schedule->getAvailabilityTo() && !$schedule->getAvailabilityTo()->isNull())
168  ? strtotime($schedule->getAvailabilityTo()->get(IL_CAL_DATE) . " 23:59:59")
169  : null;
170  if (($av_from && $av_from > $limit)) {
171  unset($data[$idx]);
172  }
173  if ($av_from > $now) {
174  $data[$idx]["not_yet"] = ilDatePresentation::formatDate(new ilDate($av_from, IL_CAL_UNIX));
175  }
176  if ($av_to) {
177  // #18658
178  if (!ilBookingReservation::isObjectAvailableInPeriod($item["booking_object_id"], $schedule, $av_from, $av_to)) {
179  $this->lng->loadLanguageModule("dateplaner");
180  $data[$idx]["full_up"] = $this->lng->txt("cal_booked_out");
181  }
182  }
183  }
184  }
185 
186  foreach ($data as $idx => $item) {
187  $item_id = $item["booking_object_id"];
188 
189  // available for given period?
190  if (isset($this->filter["period"]["from"]) ||
191  isset($this->filter["period"]["to"])) {
192  $from = is_object($this->filter["period"]["from"])
193  ? strtotime($this->filter["period"]["from"]->get(IL_CAL_DATE) . " 00:00:00")
194  : null;
195  $to = is_object($this->filter["period"]["to"])
196  ? strtotime($this->filter["period"]["to"]->get(IL_CAL_DATE) . " 23:59:59")
197  : null;
198 
199  $bobj = new ilBookingObject($item_id);
200  $schedule = new ilBookingSchedule($bobj->getScheduleId());
201 
202  if (!ilBookingReservation::isObjectAvailableInPeriod($item_id, $schedule, $from, $to)) {
203  unset($data[$idx]);
204  continue;
205  }
206  }
207 
208  // cache reservations
209  $item_rsv = ilBookingReservation::getList(array($item_id), 1000, 0, array());
210  $this->reservations[$item_id] = $item_rsv["data"];
211  }
212 
213  if (!$this->has_schedule &&
214  $this->overall_limit) {
215  $this->current_bookings = 0;
216  foreach ($this->reservations as $obj_rsv) {
217  foreach ($obj_rsv as $item) {
218  if ($item["status"] != ilBookingReservation::STATUS_CANCELLED) {
219  if ($item["user_id"] == $ilUser->getId()) {
220  $this->current_bookings++;
221  }
222  }
223  }
224  }
225 
226  if ($this->current_bookings >= $this->overall_limit) {
227  $this->main_tpl->setOnScreenMessage('info', $this->lng->txt("book_overall_limit_warning"));
228  }
229  }
230  if ($this->advmd) {
231  // advanced metadata
232  $this->record_gui = new ilAdvancedMDRecordGUI(
234  "book",
235  $this->pool_id,
236  "bobj"
237  );
238  $this->record_gui->setTableGUI($this);
239  $this->record_gui->parse();
240 
242  $this->ref_id,
243  "book",
244  "bobj",
245  [$this->pool_id],
246  "bobj",
247  $data,
248  "pool_id",
249  "booking_object_id",
250  $this->record_gui->getFilterElements()
251  );
252  }
253 
254  $this->setMaxCount(count($data));
255  $this->setData($data);
256  }
setData(array $a_data)
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...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
const IL_CAL_UNIX
static getList(array $a_object_ids, int $a_limit=10, int $a_offset=0, array $filter=[])
List all reservations.
const IL_CAL_DATE
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)
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
static isObjectAvailableInPeriod(int $a_obj_id, ilBookingSchedule $a_schedule, ?int $a_from, ?int $a_to)
static getList(int $a_pool_id, string $a_title=null)
Get list of booking objects.
setMaxCount(int $a_max_count)
set max.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelectableColumns()

ilBookingObjectsTableGUI::getSelectableColumns ( )

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

References ILIAS\Repository\lng().

Referenced by __construct().

269  : array
270  {
271  $cols = array();
272 
273  $cols["description"] = array(
274  "txt" => $this->lng->txt("description"),
275  "default" => true
276  );
277 
278  foreach ($this->advmd as $field) {
279  $cols["advmd" . $field["id"]] = array(
280  "txt" => $field["title"],
281  "default" => false
282  );
283  }
284 
285  return $cols;
286  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFilter()

ilBookingObjectsTableGUI::initFilter ( )

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

References ilTableGUI\$lng, ilTableGUI\$title, ilTable2GUI\addFilterItemByMetaType(), ILIAS\Repository\filter(), ilTable2GUI\FILTER_DATE_RANGE, ilTable2GUI\FILTER_TEXT, and ilLanguage\txt().

Referenced by __construct().

121  : void
122  {
123  $lng = $this->lng;
124 
125  // title/description
127  "title",
129  false,
130  $lng->txt("title") . "/" . $lng->txt("description")
131  );
132  if ($title !== null) {
133  $this->filter["title"] = $title->getValue();
134  }
135 
136  // #18651
137  if ($this->has_schedule) {
138  // booking period
139  $period = $this->addFilterItemByMetaType(
140  "period",
142  false,
143  $lng->txt("book_period")
144  );
145  if ($period !== null) {
146  $this->filter["period"] = $period->getValue();
147  }
148  }
149  }
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...
ilLanguage $lng
addFilterItemByMetaType(string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
Add filter by standard type.
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:

◆ numericOrdering()

ilBookingObjectsTableGUI::numericOrdering ( string  $a_field)

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

References ILIAS\Repository\int(), and ilAdvancedMDFieldDefinition\TYPE_DATE.

258  : bool
259  {
260  if (str_starts_with($a_field, "md_")) {
261  $md_id = (int) substr($a_field, 3);
262  if ($this->advmd[$md_id]["type"] === ilAdvancedMDFieldDefinition::TYPE_DATE) {
263  return true;
264  }
265  }
266  return false;
267  }
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilBookingObjectsTableGUI::$access
protected

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

◆ $active_management

bool ilBookingObjectsTableGUI::$active_management
protected

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

Referenced by __construct().

◆ $advmd

array ilBookingObjectsTableGUI::$advmd
protected

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

◆ $current_bookings

int ilBookingObjectsTableGUI::$current_bookings
protected

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

◆ $filter

array ilBookingObjectsTableGUI::$filter
protected

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

◆ $has_schedule

bool ilBookingObjectsTableGUI::$has_schedule
protected

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

◆ $main_tpl

ilGlobalTemplateInterface ilBookingObjectsTableGUI::$main_tpl
protected

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

◆ $may_assign

bool ilBookingObjectsTableGUI::$may_assign
protected

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

◆ $may_edit

bool ilBookingObjectsTableGUI::$may_edit
protected

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

◆ $overall_limit

int ilBookingObjectsTableGUI::$overall_limit = null
protected

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

◆ $pool_id

int ilBookingObjectsTableGUI::$pool_id
protected

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

◆ $process_class

string ilBookingObjectsTableGUI::$process_class
protected

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

◆ $record_gui

ilAdvancedMDRecordGUI ilBookingObjectsTableGUI::$record_gui = null
protected

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

Referenced by getAdvMDRecordGUI().

◆ $ref_id

int ilBookingObjectsTableGUI::$ref_id
protected

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

◆ $reservations

array ilBookingObjectsTableGUI::$reservations = array()
protected

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

◆ $ui_factory

ILIAS UI Factory ilBookingObjectsTableGUI::$ui_factory
protected

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

◆ $ui_renderer

ILIAS UI Renderer ilBookingObjectsTableGUI::$ui_renderer
protected

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

◆ $user

ilObjUser ilBookingObjectsTableGUI::$user
protected

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

Referenced by fillRow(), and getItems().


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