ILIAS  release_8 Revision v8.24
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 ()
 
 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)
 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

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 43 of file class.ilBookingObjectsTableGUI.php.

51 {
52 global $DIC;
53 $this->main_tpl = $DIC->ui()->mainTemplate();
54
55 $this->ctrl = $DIC->ctrl();
56 $this->lng = $DIC->language();
57 $this->access = $DIC->access();
58 $this->user = $DIC->user();
59 $ilCtrl = $DIC->ctrl();
60 $lng = $DIC->language();
61 $ilAccess = $DIC->access();
62 $this->ui_factory = $DIC->ui()->factory();
63 $this->ui_renderer = $DIC->ui()->renderer();
64
65 $this->ref_id = $a_ref_id;
66 $this->pool_id = $a_pool_id;
67 $this->has_schedule = $a_pool_has_schedule;
68 $this->overall_limit = $a_pool_overall_limit;
69 $this->active_management = $active_management;
70 $this->may_edit = ($this->active_management &&
71 $ilAccess->checkAccess('write', '', $this->ref_id));
72 $this->may_assign = ($this->active_management &&
73 $ilAccess->checkAccess('write', '', $this->ref_id));
74
75 $this->advmd = ilObjBookingPool::getAdvancedMDFields($this->ref_id);
76
77 $this->setId("bkobj");
78
79 parent::__construct($a_parent_obj, $a_parent_cmd);
80
81 $this->setTitle($lng->txt("book_booking_objects"));
82
83 // $this->setLimit(9999);
84
85 $this->addColumn($this->lng->txt("title"), "title");
86
87 $cols = $this->getSelectableColumns();
88 foreach ($this->getSelectedColumns() as $col) {
89 $this->addColumn($cols[$col]["txt"], $col);
90 }
91
92 if (!$this->has_schedule) {
93 $this->addColumn($this->lng->txt("available"));
94 }
95
96 $this->addColumn($this->lng->txt("actions"));
97
98 $this->setEnableHeader(true);
99 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
100 $this->setRowTemplate("tpl.booking_object_row.html", "Modules/BookingManager");
101
102 $this->initFilter();
103 $this->getItems();
104 }
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
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$cols
Definition: xhr_table.php:11

References $active_management, $cols, $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$a_setdata array

Reimplemented from ilTable2GUI.

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

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

References ilTable2GUI\$ctrl, $ilUser, ILIAS\LTI\ToolProvider\$key, ilTableGUI\$lng, $user, ILIAS\UI\examples\Symbol\Glyph\Filter\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 109 of file class.ilBookingObjectsTableGUI.php.

References $record_gui.

◆ getItems()

ilBookingObjectsTableGUI::getItems ( )

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

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

References ilTableGUI\$data, $ilUser, ilTableGUI\$limit, $user, ILIAS\UI\examples\Symbol\Glyph\Filter\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 263 of file class.ilBookingObjectsTableGUI.php.

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

References $cols, and 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 115 of file class.ilBookingObjectsTableGUI.php.

115 : void
116 {
118
119 // title/description
121 "title",
123 false,
124 $lng->txt("title") . "/" . $lng->txt("description")
125 );
126 if ($title !== null) {
127 $this->filter["title"] = $title->getValue();
128 }
129
130 // #18651
131 if ($this->has_schedule) {
132 // booking period
133 $period = $this->addFilterItemByMetaType(
134 "period",
136 false,
137 $lng->txt("book_period")
138 );
139 if ($period !== null) {
140 $this->filter["period"] = $period->getValue();
141 }
142 }
143 }
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\UI\examples\Symbol\Glyph\Filter\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 252 of file class.ilBookingObjectsTableGUI.php.

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

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

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilBookingObjectsTableGUI::$access
protected

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

◆ $active_management

bool ilBookingObjectsTableGUI::$active_management
protected

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

Referenced by __construct().

◆ $advmd

array ilBookingObjectsTableGUI::$advmd
protected

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

◆ $current_bookings

int ilBookingObjectsTableGUI::$current_bookings
protected

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

◆ $filter

array ilBookingObjectsTableGUI::$filter
protected

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

◆ $has_schedule

bool ilBookingObjectsTableGUI::$has_schedule
protected

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

◆ $main_tpl

ilGlobalTemplateInterface ilBookingObjectsTableGUI::$main_tpl
protected

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

◆ $may_assign

bool ilBookingObjectsTableGUI::$may_assign
protected

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

◆ $may_edit

bool ilBookingObjectsTableGUI::$may_edit
protected

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

◆ $overall_limit

int ilBookingObjectsTableGUI::$overall_limit = null
protected

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

◆ $pool_id

int ilBookingObjectsTableGUI::$pool_id
protected

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

◆ $record_gui

ilAdvancedMDRecordGUI ilBookingObjectsTableGUI::$record_gui = null
protected

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

Referenced by getAdvMDRecordGUI().

◆ $ref_id

int ilBookingObjectsTableGUI::$ref_id
protected

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

◆ $reservations

array ilBookingObjectsTableGUI::$reservations = array()
protected

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

◆ $ui_factory

ILIAS UI Factory ilBookingObjectsTableGUI::$ui_factory
protected

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

◆ $ui_renderer

ILIAS UI Renderer ilBookingObjectsTableGUI::$ui_renderer
protected

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

◆ $user

ilObjUser ilBookingObjectsTableGUI::$user
protected

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

Referenced by fillRow(), and getItems().


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