204 : void
205 {
211
213
214
215 $info_gui->addSection(
$lng->
txt(
"book_your_preferences"));
217 $preferences = $preferences->getPreferences();
218 $cnt = 1;
219 if (isset($preferences[$this->
user->getId()])) {
220 $book_deleted_object = "[{$this->lng->txt("book_deleted_object")}]";
221 foreach ($preferences[$this->
user->getId()] as $book_obj_id) {
223 $info_gui->addProperty((string) $cnt++, $book_obj->getTitle() ?: $book_deleted_object);
224 }
225 } else {
226 $info_gui->addProperty(
"",
$lng->
txt(
"book_no_preferences_for_you"));
227 }
228
229
230 $this->service->domain()->preferences($this->pool)->storeBookings(
231 $this->repo->getPreferences($this->pool->getId())
232 );
233 $bookings = $this->service->domain()->preferences($this->pool)->readBookings();
234 $info_gui->addSection(
$lng->
txt(
"book_your_bookings"));
235 $cnt = 1;
236 if (isset($bookings[$this->
user->getId()])) {
237 foreach ($bookings[$this->
user->getId()] as $book_obj_id) {
239 $post_file = $this->objects_manager->getBookingInfoFilename($book_obj_id);
240
241
242 $post_info_button = "";
243 if ($post_file || $book_obj->getPostText()) {
245 $b =
$ui->factory()->button()->shy(
246 $lng->
txt(
"book_post_booking_information"),
248 );
249 $post_info_button =
"<br>" .
$ui->renderer()->render(
$b);
250 }
251 $info_gui->addProperty((string) $cnt++, $book_obj->getTitle() . $post_info_button);
252 }
253 } else {
254 $info_gui->addProperty(
"",
$lng->
txt(
"book_no_bookings_for_you"));
255 }
256
257
258 if ($this->
access->canManageAllReservations($this->pool->getRefId())) {
259 $info_gui->addSection(
$lng->
txt(
"book_all_users"));
261 $preferences = $preferences->getPreferences();
262 $book_deleted_object = "[{$this->lng->txt("book_deleted_object")}]";
263 $book_deleted_booking = "[{$this->lng->txt("book_deleted_booking")}]";
264
265 $markdown = (new DataFactory())->text()->markdown();
266
267 foreach ($preferences as
$user_id => $obj_ids) {
268 $booking_titles = !isset($bookings[
$user_id])
269 ? [$book_deleted_booking]
270 : array_map(
273 );
274
275 $booking_str = "{$lng->txt("book_log")}: " . implode(", ", $booking_titles);
276
277 $preferences_str = "{$lng->txt("book_preferences")}: " . implode(
278 ", ",
279 array_map(
280 fn(int $obj_id): string
282 $obj_ids
283 )
284 );
285
286 $info_gui->addProperty(
288 (string) $markdown->simpleDocument("{$preferences_str}\n{$booking_str}")->toHTML()
289 );
290 }
291 }
292
294 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getPreferences(int $a_pool_id)
Get booking preferences for a pool id.
ilGlobalTemplateInterface $main_tpl
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc
getLinkTargetByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path=null)
Default behaviour is:
setContent(string $a_html)
Sets content for standard template.