ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilBookingInfoListItemPropertiesAdapter.php
Go to the documentation of this file.
1 <?php
2 
24 {
26 
27  public function __construct(
29  ) {
30  $this->repo = $repo;
31  }
32 
33  public function appendProperties(
34  int $obj_id,
35  array $props
36  ): array {
37  $repo = $this->repo;
38  $info = [];
39  foreach ($repo->getCachedContextObjBookingInfo($obj_id) as $item) {
40  $info[$item["pool_id"]]["title"] = ilObject::_lookupTitle($item["pool_id"]);
41  $info[$item["pool_id"]]["object"][$item["object_id"]]["title"] = $item["title"];
42  $info[$item["pool_id"]]["object"][$item["object_id"]]["bookings"][] =
43  ilDatePresentation::formatDate(new ilDate($item["date"], IL_CAL_DATE)) . ", " . $item["slot"] . " (" . $item["counter"] . ")";
44  }
45  foreach ($info as $pool) {
46  $val = "";
47  foreach ($pool["object"] as $o) {
48  $val .= $o["title"] . ": " . implode(", ", $o["bookings"]);
49  }
50  $props[] = array("alert" => false, "property" => $pool["title"], "value" => $val);
51  }
52  return $props;
53  }
54 }
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static _lookupTitle(int $obj_id)
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...
__construct(ilBookingReservationDBRepository $repo=null)
const IL_CAL_DATE
getCachedContextObjBookingInfo(int $context_obj_id)
Get context object properties info.