ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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

ILIAS BookingManager InternalRepoService $repo
 
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 30 of file class.ilBookingInfoScreenAdapter.php.

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

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

Member Function Documentation

◆ add()

ilBookingInfoScreenAdapter::add ( )

Add info to info screen.

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

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

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

◆ getList()

ilBookingInfoScreenAdapter::getList ( )
protected

Get reservation list.

Returns
array[]

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

References $context_obj_id, getPoolIds(), null, ilArrayUtil\sortArray(), ilArrayUtil\stableSortArray(), and ilBookingReservation\STATUS_CANCELLED.

Referenced by add().

56  : array
57  {
58  $filter = ["context_obj_ids" => [$this->context_obj_id]];
59  $filter['past'] = true;
60  $filter['status'] = -ilBookingReservation::STATUS_CANCELLED;
61  $repo = $this->repo->reservation();
62  $list = $repo->getListByDate(true, null, $filter, $this->getPoolIds());
63  $list = ilArrayUtil::sortArray($list, "slot", "asc", true);
64  $list = ilArrayUtil::stableSortArray($list, "date", "asc", true);
65  $list = ilArrayUtil::stableSortArray($list, "pool_id", "asc", true);
66  return $list;
67  }
ILIAS BookingManager InternalRepoService $repo
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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...
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 45 of file class.ilBookingInfoScreenAdapter.php.

References $ref_id, and ilObject\_lookupObjId().

Referenced by getList().

45  : array
46  {
47  return array_map(static function ($ref_id) {
49  }, $this->use_book_repo->getUsedBookingPools($this->context_obj_id, false));
50  }
static _lookupObjId(int $ref_id)
$ref_id
Definition: ltiauth.php:65
+ 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 27 of file class.ilBookingInfoScreenAdapter.php.

Referenced by getList().

◆ $info_screen_gui

ilInfoScreenGUI ilBookingInfoScreenAdapter::$info_screen_gui
protected

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

Referenced by __construct(), and add().

◆ $repo

ILIAS BookingManager InternalRepoService ilBookingInfoScreenAdapter::$repo
protected

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

◆ $use_book_repo

ilObjUseBookDBRepository ilBookingInfoScreenAdapter::$use_book_repo
protected

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


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