ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilBookingAssignParticipantsTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
13 {
17  protected $access;
18 
22  protected $user;
23 
27  protected $ref_id;
28 
32  protected $pool_id;
33 
37  protected $bp_object_id;
38 
42  protected $bp_object;
43 
47  protected $current_bookings; // [int]
48 
52  protected $filter; // [array]
53 
57  protected $objects; // array
58 
62  protected $pool;
63 
72  public function __construct(ilBookingObjectGUI $a_parent_obj, $a_parent_cmd, $a_ref_id, $a_pool_id, $a_booking_obj_id)
73  {
74  global $DIC;
75 
76  $this->ctrl = $DIC->ctrl();
77  $this->lng = $DIC->language();
78  $this->user = $DIC->user();
79  $this->access = $DIC->access();
80  $this->ref_id = $a_ref_id;
81  $this->bp_object_id = $a_booking_obj_id;
82  $this->pool_id = $a_pool_id;
83  $this->bp_object = new ilBookingObject($a_booking_obj_id);
84  $this->pool = new ilObjBookingPool($this->pool_id, false);
85 
86  $this->setId("bkaprt" . $a_ref_id);
87 
88  parent::__construct($a_parent_obj, $a_parent_cmd);
89 
90  $this->setTitle($this->lng->txt("book_assign_participant") . ": " . $this->bp_object->getTitle());
91 
92  $this->addColumn("", "", 1);
93  $this->addColumn($this->lng->txt("name"), "name");
94  if ($this->pool->getScheduleType() != ilObjBookingPool::TYPE_FIX_SCHEDULE) {
95  $this->addColumn($this->lng->txt("book_bobj"));
96  }
97  $this->addColumn($this->lng->txt("action"));
98 
99  $this->setDefaultOrderField("name");
100  $this->setDefaultOrderDirection("asc");
101 
102  $this->setEnableHeader(true);
103  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
104  $this->setRowTemplate("tpl.booking_assign_participant_row.html", "Modules/BookingManager");
105 
106 
107  $this->addHiddenInput('object_id', $a_booking_obj_id);
108  if ($this->pool->getScheduleType() != ilObjBookingPool::TYPE_FIX_SCHEDULE) {
109  $this->setSelectAllCheckbox('mass');
110  $this->addMultiCommand("bookMultipleParticipants", $this->lng->txt("assign"));
111  }
112  $this->getItems();
113 
114 
115  if ($this->pool->getScheduleType() == ilObjBookingPool::TYPE_NO_SCHEDULE) {
117  sprintf(
118  $this->lng->txt("book_objects_available"),
120  )
121  );
122  }
123  }
124 
128  public function getItems()
129  {
130  include_once "Modules/BookingManager/classes/class.ilBookingParticipant.php";
131  if ($this->pool->getScheduleType() == ilObjBookingPool::TYPE_FIX_SCHEDULE) {
132  $data = ilBookingParticipant::getList($this->pool_id, []);
133  } else {
135  }
136  $this->setMaxCount(sizeof($data));
137  $this->setData($data);
138  }
139 
144  protected function fillRow($a_set)
145  {
146  if ($this->pool->getScheduleType() != ilObjBookingPool::TYPE_FIX_SCHEDULE) {
147  $this->tpl->setCurrentBlock("multi");
148  $this->tpl->setVariable("MULTI_ID", $a_set['user_id']);
149  $this->tpl->parseCurrentBlock();
150  }
151 
152  $this->tpl->setVariable("TXT_NAME", $a_set['name']);
153  $this->tpl->setCurrentBlock('object_titles');
154 
155  if ($this->pool->getScheduleType() != ilObjBookingPool::TYPE_FIX_SCHEDULE) {
156  foreach ($a_set['object_title'] as $obj_title) {
157  $this->tpl->setCurrentBlock("object_title");
158  $this->tpl->setVariable("TXT_OBJECT", $obj_title);
159  $this->tpl->parseCurrentBlock();
160  }
161  $this->tpl->setCurrentBlock("object_titles");
162  $this->tpl->parseCurrentBlock();
163  }
164 
165  $this->ctrl->setParameter($this->parent_obj, 'bkusr', $a_set['user_id']);
166  $this->ctrl->setParameter($this->parent_obj, 'object_id', $this->bp_object_id);
167 
168  $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("book_assign"));
169  $this->tpl->setVariable("URL_ACTION", $this->ctrl->getLinkTarget($this->parent_obj, 'book'));
170 
171  $this->ctrl->setParameter($this->parent_obj, 'bkusr', '');
172  $this->ctrl->setParameter($this->parent_obj, 'object_id', '');
173  }
174 }
a bookable ressource
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
addHiddenInput($a_name, $a_value)
Add Hidden Input field.
static getList($a_booking_pool, array $a_filter=null, $a_object_id=null)
global $DIC
Definition: saml.php:7
Class ilObjBookingPool.
setId($a_val)
Set id.
user()
Definition: user.php:4
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Class ilTable2GUI.
Class ilBookingObjectGUI.
__construct(ilBookingObjectGUI $a_parent_obj, $a_parent_cmd, $a_ref_id, $a_pool_id, $a_booking_obj_id)
Constructor.
List participant / booking pool assignment.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
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.
static numAvailableFromObjectNoSchedule($a_obj_id)
setEnableHeader($a_enableheader)
Set Enable Header.
setMaxCount($a_max_count)
set max.
static getAssignableParticipants($a_bp_object_id)
Get participants who can not have a reservation for this booking pool object id.