ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilBookingSchedulesTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Table/classes/class.ilTable2GUI.php");
5 
15 {
19  protected $access;
20 
24  protected $obj_data_cache;
25 
32  public function __construct($a_parent_obj, $a_parent_cmd, $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  $lng = $DIC->language();
42  $ilAccess = $DIC->access();
43  $lng = $DIC->language();
44  $ilObjDataCache = $DIC["ilObjDataCache"];
45 
46  $this->ref_id = $a_ref_id;
47  $this->setId("bksd");
48 
49  parent::__construct($a_parent_obj, $a_parent_cmd);
50 
51  $this->addColumn($this->lng->txt("title"), "title");
52  $this->addColumn($this->lng->txt("book_is_used"));
53  $this->addColumn($this->lng->txt("actions"));
54 
55  $this->setEnableHeader(true);
56  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
57  $this->setRowTemplate("tpl.booking_schedule_row.html", "Modules/BookingManager");
58 
59  $this->getItems($ilObjDataCache->lookupObjId($this->ref_id));
60  }
61 
67  public function getItems($a_pool_id)
68  {
69  include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
70  $data = ilBookingSchedule::getList($a_pool_id);
71 
72  $this->setMaxCount(sizeof($data));
73  $this->setData($data);
74  }
75 
80  protected function fillRow($a_set)
81  {
82  $lng = $this->lng;
83  $ilAccess = $this->access;
85 
86  $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
87 
88  if ($a_set["is_used"]) {
89  $this->tpl->setVariable("TXT_IS_USED", $lng->txt("yes"));
90  } else {
91  $this->tpl->setVariable("TXT_IS_USED", $lng->txt("no"));
92  }
93 
94  $ilCtrl->setParameter($this->parent_obj, 'schedule_id', $a_set['booking_schedule_id']);
95 
96  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
97  $alist = new ilAdvancedSelectionListGUI();
98  $alist->setId($a_set['booking_schedule_id']);
99  $alist->setListTitle($lng->txt("actions"));
100 
101  if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
102  $alist->addItem($lng->txt('edit'), 'edit', $ilCtrl->getLinkTarget($this->parent_obj, 'edit')); // #12306
103 
104  if (!$a_set["is_used"]) {
105  $alist->addItem($lng->txt('delete'), 'delete', $ilCtrl->getLinkTarget($this->parent_obj, 'confirmDelete'));
106  }
107  }
108 
109  $this->tpl->setVariable("LAYER", $alist->getHTML());
110  }
111 }
global $DIC
Definition: saml.php:7
getItems($a_pool_id)
Build summary item rows for given object and filter(s)
setId($a_val)
Set id.
List booking schedules (for booking pool)
global $ilCtrl
Definition: ilias.php:18
Class ilTable2GUI.
__construct($a_parent_obj, $a_parent_cmd, $a_ref_id)
Constructor.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
User interface class for advanced drop-down selection lists.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setEnableHeader($a_enableheader)
Set Enable Header.
setMaxCount($a_max_count)
set max.
static getList($a_pool_id)
Get list of booking objects for given pool.