ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilBookingSchedulesTableGUI.php
Go to the documentation of this file.
1 <?php
2 
24 {
27  protected int $ref_id;
28 
29  public function __construct(
30  object $a_parent_obj,
31  string $a_parent_cmd,
32  int $a_ref_id
33  ) {
34  global $DIC;
35 
36  $this->ctrl = $DIC->ctrl();
37  $this->lng = $DIC->language();
38  $this->access = $DIC->access();
39  $this->obj_data_cache = $DIC["ilObjDataCache"];
40  $ilCtrl = $DIC->ctrl();
41  $ilObjDataCache = $DIC["ilObjDataCache"];
42 
43  $this->ref_id = $a_ref_id;
44  $this->setId("bksd");
45 
46  parent::__construct($a_parent_obj, $a_parent_cmd);
47 
48  $this->addColumn($this->lng->txt("title"), "title");
49  $this->addColumn($this->lng->txt("book_is_used"));
50  $this->addColumn($this->lng->txt("actions"));
51 
52  $this->setEnableHeader(true);
53  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
54  $this->setRowTemplate("tpl.booking_schedule_row.html", "Modules/BookingManager");
55 
56  $this->getItems($ilObjDataCache->lookupObjId($this->ref_id));
57  }
58 
63  public function getItems(int $a_pool_id): void
64  {
65  $data = ilBookingSchedule::getList($a_pool_id);
66 
67  $this->setMaxCount(count($data));
68  $this->setData($data);
69  }
70 
71  protected function fillRow(array $a_set): void
72  {
73  $lng = $this->lng;
74  $ilAccess = $this->access;
75  $ilCtrl = $this->ctrl;
76 
77  $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
78 
79  if ($a_set["is_used"]) {
80  $this->tpl->setVariable("TXT_IS_USED", $lng->txt("yes"));
81  } else {
82  $this->tpl->setVariable("TXT_IS_USED", $lng->txt("no"));
83  }
84 
85  $ilCtrl->setParameter($this->parent_obj, 'schedule_id', $a_set['booking_schedule_id']);
86 
87  $alist = new ilAdvancedSelectionListGUI();
88  $alist->setId($a_set['booking_schedule_id']);
89  $alist->setListTitle($lng->txt("actions"));
90 
91  if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
92  $alist->addItem($lng->txt('edit'), 'edit', $ilCtrl->getLinkTarget($this->parent_obj, 'edit')); // #12306
93 
94  if (!$a_set["is_used"]) {
95  $alist->addItem($lng->txt('delete'), 'delete', $ilCtrl->getLinkTarget($this->parent_obj, 'confirmDelete'));
96  }
97  }
98 
99  $this->tpl->setVariable("LAYER", $alist->getHTML());
100  }
101 }
setData(array $a_data)
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 getList(int $a_pool_id)
Get list of booking objects for given pool.
ilLanguage $lng
setId(string $a_val)
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...
global $DIC
Definition: feed.php:28
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
getItems(int $a_pool_id)
Build summary item rows for given object and filter(s)
__construct(object $a_parent_obj, string $a_parent_cmd, int $a_ref_id)
__construct(Container $dic, ilPlugin $plugin)
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)
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
setEnableHeader(bool $a_enableheader)
setMaxCount(int $a_max_count)
set max.