ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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)
 Should this field be sorted numeric? More...
 
 getSelectableColumns ()
 Get selectable columns. More...
 
- 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)
 Set table data. More...
 
 getData ()
 
 dataExists ()
 
 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...
 
 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 ()
 get the name of the parent form More...
 
 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 ()
 
 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)
 set max. More...
 
- 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)
 Standard Version of Fill Row. More...
 
- 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 BookingManager Access AccessManager $access
 
ILIAS UI Renderer $ui_renderer
 
ILIAS UI Factory $ui_factory
 
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_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_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.

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->bookingManager()->internal()->domain()->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 $this->access->canManageObjects($this->ref_id));
73 $this->may_assign = ($this->active_management &&
74 $this->access->canManageAllReservations($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", "components/ILIAS/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 }
getSelectableColumns()
Get selectable columns.
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...
static getAdvancedMDFields(int $a_ref_id)
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
setFormAction(string $a_form_action, bool $a_multipart=false)
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)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
ilLanguage $lng
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $active_management, $DIC, ilTableGUI\$lng, ILIAS\GlobalScreen\Provider\__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().

+ Here is the call graph for this function:

Member Function Documentation

◆ fillRow()

ilBookingObjectsTableGUI::fillRow ( array  $a_set)
protected

Standard Version of Fill Row.

Most likely to be overwritten by derived class.

Parameters
array<string,mixed>$a_set data array

Reimplemented from ilTable2GUI.

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

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

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

+ 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.

◆ getItems()

ilBookingObjectsTableGUI::getItems ( )

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

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

References ilTableGUI\$data, ilTableGUI\$limit, $user, ILIAS\Repository\filter(), ilDatePresentation\formatDate(), ilBookingReservation\getList(), ilBookingObject\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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelectableColumns()

ilBookingObjectsTableGUI::getSelectableColumns ( )

Get selectable columns.

Returns
array key: column id, val: true/false -> default on/off

Reimplemented from ilTable2GUI.

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

267 : array
268 {
269 $cols = array();
270
271 $cols["description"] = array(
272 "txt" => $this->lng->txt("description"),
273 "default" => true
274 );
275
276 foreach ($this->advmd as $field) {
277 $cols["advmd" . $field["id"]] = array(
278 "txt" => $field["title"],
279 "default" => false
280 );
281 }
282
283 return $cols;
284 }

References ILIAS\Repository\lng().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFilter()

ilBookingObjectsTableGUI::initFilter ( )

Reimplemented from ilTable2GUI.

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

121 : void
122 {
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 }
addFilterItemByMetaType(string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
Add filter by standard type.

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

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ numericOrdering()

ilBookingObjectsTableGUI::numericOrdering ( string  $a_field)

Should this field be sorted numeric?

Reimplemented from ilTable2GUI.

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

256 : bool
257 {
258 if (str_starts_with($a_field, "md_")) {
259 $md_id = (int) substr($a_field, 3);
260 if ($this->advmd[$md_id]["type"] === ilAdvancedMDFieldDefinition::TYPE_DATE) {
261 return true;
262 }
263 }
264 return false;
265 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $access

ILIAS BookingManager Access AccessManager ilBookingObjectsTableGUI::$access
protected

Definition at line 26 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 28 of file class.ilBookingObjectsTableGUI.php.

◆ $ui_renderer

ILIAS UI Renderer ilBookingObjectsTableGUI::$ui_renderer
protected

Definition at line 27 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: