ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\BookingManager\Objects\ObjectsDBRepository Class Reference

Repo class for booking objects. More...

+ Collaboration diagram for ILIAS\BookingManager\Objects\ObjectsDBRepository:

Public Member Functions

 __construct (\ilDBInterface $db)
 
 loadDataOfPool (int $pool_id)
 
 getNrOfItemsForObject (int $book_obj_id)
 
 getColorNrForObject (int $book_obj_id)
 
 getObjectDataForPool (int $pool_id)
 

Protected Attributes

const NR_OF_COLORS = 9
 
ilDBInterface $db
 

Static Protected Attributes

static $color_number = []
 
static $pool_objects = []
 
static array $raw_data = []
 
static array $pool_loaded = []
 

Detailed Description

Repo class for booking objects.

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

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

Constructor & Destructor Documentation

◆ __construct()

ILIAS\BookingManager\Objects\ObjectsDBRepository::__construct ( \ilDBInterface  $db)

Member Function Documentation

◆ getColorNrForObject()

ILIAS\BookingManager\Objects\ObjectsDBRepository::getColorNrForObject ( int  $book_obj_id)

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

73  : int
74  {
75  if (!isset(self::$raw_data[$book_obj_id])) {
76  throw new \ilBookingPoolException("Data for booking object $book_obj_id not loaded.");
77  }
78  return (int) self::$color_number[$book_obj_id];
79  }

◆ getNrOfItemsForObject()

ILIAS\BookingManager\Objects\ObjectsDBRepository::getNrOfItemsForObject ( int  $book_obj_id)

Definition at line 65 of file class.ObjectsDBRepository.php.

65  : int
66  {
67  if (!isset(self::$raw_data[$book_obj_id])) {
68  throw new \ilBookingPoolException("Data for booking object $book_obj_id not loaded.");
69  }
70  return (int) self::$raw_data[$book_obj_id]["nr_of_items"];
71  }

◆ getObjectDataForPool()

ILIAS\BookingManager\Objects\ObjectsDBRepository::getObjectDataForPool ( int  $pool_id)

Definition at line 81 of file class.ObjectsDBRepository.php.

References ILIAS\BookingManager\Objects\ObjectsDBRepository\loadDataOfPool().

83  : array {
84  $this->loadDataOfPool($pool_id);
85  return self::$pool_objects[$pool_id] ?? [];
86  }
+ Here is the call graph for this function:

◆ loadDataOfPool()

ILIAS\BookingManager\Objects\ObjectsDBRepository::loadDataOfPool ( int  $pool_id)

Definition at line 40 of file class.ObjectsDBRepository.php.

References ILIAS\BookingManager\Objects\ObjectsDBRepository\$db, and ilDBInterface\queryF().

Referenced by ILIAS\BookingManager\Objects\ObjectsDBRepository\getObjectDataForPool().

40  : void
41  {
42  $db = $this->db;
43 
44  if (isset(self::$pool_loaded[$pool_id]) && self::$pool_loaded[$pool_id]) {
45  return;
46  }
47 
48  $set = $db->queryF(
49  "SELECT * FROM booking_object " .
50  " WHERE pool_id = %s ORDER BY title ASC, booking_object_id ASC",
51  ["integer"],
52  [$pool_id]
53  );
54  self::$pool_objects[$pool_id] = [];
55  $cnt = 0;
56  while ($rec = $db->fetchAssoc($set)) {
57  self::$raw_data[$rec["booking_object_id"]] = $rec;
58  self::$color_number[$rec["booking_object_id"]] = ($cnt % self::NR_OF_COLORS) + 1;
59  self::$pool_objects[$pool_id][] = $rec;
60  $cnt++;
61  }
62  self::$pool_loaded[$pool_id] = true;
63  }
fetchAssoc(ilDBStatement $statement)
queryF(string $query, array $types, array $values)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $color_number

ILIAS\BookingManager\Objects\ObjectsDBRepository::$color_number = []
staticprotected

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

◆ $db

ilDBInterface ILIAS\BookingManager\Objects\ObjectsDBRepository::$db
protected

◆ $pool_loaded

array ILIAS\BookingManager\Objects\ObjectsDBRepository::$pool_loaded = []
staticprotected

Definition at line 32 of file class.ObjectsDBRepository.php.

◆ $pool_objects

ILIAS\BookingManager\Objects\ObjectsDBRepository::$pool_objects = []
staticprotected

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

◆ $raw_data

array ILIAS\BookingManager\Objects\ObjectsDBRepository::$raw_data = []
staticprotected

Definition at line 31 of file class.ObjectsDBRepository.php.

◆ NR_OF_COLORS

const ILIAS\BookingManager\Objects\ObjectsDBRepository::NR_OF_COLORS = 9
protected

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


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