ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilBookingInfoScreenAdapter Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilBookingInfoScreenAdapter:

Public Member Functions

 __construct (ilInfoScreenGUI $info_screen_gui)
 
 add ()
 Add info to info screen. More...
 

Protected Member Functions

 getPoolIds ()
 Get pool ids. More...
 
 getList ()
 Get reservation list. More...
 

Protected Attributes

ilInfoScreenGUI $info_screen_gui
 
int $context_obj_id
 
ilObjUseBookDBRepository $use_book_repo
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Embeds booking information into info screen

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 23 of file class.ilBookingInfoScreenAdapter.php.

Constructor & Destructor Documentation

◆ __construct()

ilBookingInfoScreenAdapter::__construct ( ilInfoScreenGUI  $info_screen_gui)

Definition at line 29 of file class.ilBookingInfoScreenAdapter.php.

References $DIC, $info_screen_gui, and ilInfoScreenGUI\getContextObjId().

31  {
32  global $DIC;
33  $this->info_screen_gui = $info_screen_gui;
34  $this->context_obj_id = $this->info_screen_gui->getContextObjId();
35 
36  $this->use_book_repo = new ilObjUseBookDBRepository($DIC->database());
37  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ add()

ilBookingInfoScreenAdapter::add ( )

Add info to info screen.

Definition at line 72 of file class.ilBookingInfoScreenAdapter.php.

References $info_screen_gui, ilObject\_lookupTitle(), ilInfoScreenGUI\addSection(), ilDatePresentation\formatDate(), getList(), and IL_CAL_DATE.

72  : void
73  {
74  $info = $this->info_screen_gui;
75  $current_pool_id = 0;
76 
77  foreach ($this->getList() as $item) {
78  // headings (pool title)
79  if ($current_pool_id != $item["pool_id"]) {
80  $info->addSection(ilObject::_lookupTitle($item["pool_id"]));
81  }
82  // booking object
83  $info->addProperty(
84  $item["title"] . " (" . $item["counter"] . ")",
85  ilDatePresentation::formatDate(new ilDate($item["date"], IL_CAL_DATE)) . ", " . $item["slot"]
86  );
87  $current_pool_id = $item["pool_id"];
88  }
89  }
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static _lookupTitle(int $obj_id)
addSection(string $a_title)
const IL_CAL_DATE
+ Here is the call graph for this function:

◆ getList()

ilBookingInfoScreenAdapter::getList ( )
protected

Get reservation list.

Returns
array[]

Definition at line 54 of file class.ilBookingInfoScreenAdapter.php.

References $context_obj_id, Vendor\Package\$f, getPoolIds(), ilArrayUtil\sortArray(), ilArrayUtil\stableSortArray(), and ilBookingReservation\STATUS_CANCELLED.

Referenced by add().

54  : array
55  {
56  $filter = ["context_obj_ids" => [$this->context_obj_id]];
57  $filter['past'] = true;
58  $filter['status'] = -ilBookingReservation::STATUS_CANCELLED;
60  $repo = $f->getRepo();
61  $list = $repo->getListByDate(true, null, $filter, $this->getPoolIds());
62  $list = ilArrayUtil::sortArray($list, "slot", "asc", true);
63  $list = ilArrayUtil::stableSortArray($list, "date", "asc", true);
64  $list = ilArrayUtil::stableSortArray($list, "pool_id", "asc", true);
65  return $list;
66  }
static stableSortArray(array $array, string $a_array_sortby, string $a_array_sortorder="asc", bool $a_numeric=false)
Sort an aray using a stable sort algorithm, which preveserves the sequence of array elements which ha...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPoolIds()

ilBookingInfoScreenAdapter::getPoolIds ( )
protected

Get pool ids.

Returns
int[]

Definition at line 43 of file class.ilBookingInfoScreenAdapter.php.

References $ref_id, and ilObject\_lookupObjId().

Referenced by getList().

43  : array
44  {
45  return array_map(static function ($ref_id) {
47  }, $this->use_book_repo->getUsedBookingPools($this->context_obj_id, false));
48  }
static _lookupObjId(int $ref_id)
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $context_obj_id

int ilBookingInfoScreenAdapter::$context_obj_id
protected

Definition at line 26 of file class.ilBookingInfoScreenAdapter.php.

Referenced by getList().

◆ $info_screen_gui

ilInfoScreenGUI ilBookingInfoScreenAdapter::$info_screen_gui
protected

Definition at line 25 of file class.ilBookingInfoScreenAdapter.php.

Referenced by __construct(), and add().

◆ $use_book_repo

ilObjUseBookDBRepository ilBookingInfoScreenAdapter::$use_book_repo
protected

Definition at line 27 of file class.ilBookingInfoScreenAdapter.php.


The documentation for this class was generated from the following file: