ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilBookingSchedulesTableGUI.php
Go to the documentation of this file.
1 <?php
2 
24 {
25  protected \ILIAS\BookingManager\InternalGUIService $gui;
26  protected \ILIAS\BookingManager\InternalDomainService $domain;
29  protected int $ref_id;
30 
31  public function __construct(
32  object $a_parent_obj,
33  string $a_parent_cmd,
34  int $a_ref_id
35  ) {
36  global $DIC;
37 
38  $this->ctrl = $DIC->ctrl();
39  $this->lng = $DIC->language();
40  $this->access = $DIC->access();
41  $this->obj_data_cache = $DIC["ilObjDataCache"];
42  $ilCtrl = $DIC->ctrl();
43  $ilObjDataCache = $DIC["ilObjDataCache"];
44 
45  $this->ref_id = $a_ref_id;
46  $this->setId("bksd");
47 
48  parent::__construct($a_parent_obj, $a_parent_cmd);
49 
50  $this->addColumn($this->lng->txt("title"), "title");
51  $this->addColumn($this->lng->txt("book_is_used"));
52  $this->addColumn($this->lng->txt("actions"));
53 
54  $this->setEnableHeader(true);
55  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
56  $this->setRowTemplate("tpl.booking_schedule_row.html", "Modules/BookingManager");
57  $this->domain = $DIC
58  ->bookingManager()
59  ->internal()
60  ->domain();
61  $this->gui = $DIC
62  ->bookingManager()
63  ->internal()
64  ->gui();
65 
66  $this->getItems($ilObjDataCache->lookupObjId($this->ref_id));
67  }
68 
73  public function getItems(int $a_pool_id): void
74  {
75  $data = $this->domain->schedules($a_pool_id)->getScheduleData();
76 
77  $this->setMaxCount(count($data));
78  $this->setData($data);
79  }
80 
81  protected function fillRow(array $a_set): void
82  {
83  $lng = $this->lng;
84  $ilAccess = $this->access;
85  $ilCtrl = $this->ctrl;
86  $ui_factory = $this->gui->ui()->factory();
87  $ui_renderer = $this->gui->ui()->renderer();
88 
89  $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
90 
91  if ($a_set["is_used"]) {
92  $this->tpl->setVariable("TXT_IS_USED", $lng->txt("yes"));
93  } else {
94  $this->tpl->setVariable("TXT_IS_USED", $lng->txt("no"));
95  }
96 
97  $ilCtrl->setParameter($this->parent_obj, 'schedule_id', $a_set['booking_schedule_id']);
98 
99  $actions = [];
100 
101  if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
102  $actions[] = $ui_factory->link()->standard(
103  $lng->txt('edit'),
104  $ilCtrl->getLinkTarget($this->parent_obj, 'edit')
105  );
106 
107  if (!$a_set["is_used"]) {
108  $actions[] = $ui_factory->link()->standard(
109  $lng->txt('delete'),
110  $ilCtrl->getLinkTarget($this->parent_obj, 'confirmDelete')
111  );
112  }
113  }
114 
115  if (count($actions) > 0) {
116  $dd = $ui_factory->dropdown()->standard($actions);
117  $this->tpl->setVariable("LAYER", $ui_renderer->render($dd));
118  }
119  }
120 }
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)
ilLanguage $lng
setId(string $a_val)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
ILIAS BookingManager InternalDomainService $domain
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)
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)
ILIAS BookingManager InternalGUIService $gui
setEnableHeader(bool $a_enableheader)
setMaxCount(int $a_max_count)
set max.