ILIAS  trunk Revision v11.0_alpha-1846-g895b5f47236
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\BookingManager\Objects\ObjectsDBRepository Class Reference

Repo class for booking objects. More...

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

Public Member Functions

 __construct (protected IRSSWrapper $wrapper, protected \ilDBInterface $db)
 
 loadDataOfPool (int $pool_id)
 
 getNrOfItemsForObject (int $book_obj_id)
 
 getColorNrForObject (int $book_obj_id)
 
 getObjectDataForPool (int $pool_id)
 
 hasObjectInfo (int $booking_object_id)
 
 deleteObjectInfo (int $booking_object_id)
 
 getObjectInfoPath (int $booking_object_id)
 
 deliverObjectInfo (int $booking_object_id)
 
 getObjectInfoFilename (int $booking_object_id)
 
 importObjectInfoFromLegacyUpload (int $booking_object_id, array $file_input, ResourceStakeholder $stakeholder)
 
 hasBookingInfo (int $booking_object_id)
 
 deleteBookingInfo (int $booking_object_id)
 
 deliverBookingInfo (int $booking_object_id)
 
 getBookingInfoPath (int $booking_object_id)
 
 getBookingInfoFilename (int $booking_object_id)
 
 importBookingInfoFromLegacyUpload (int $booking_object_id, array $file_input, ResourceStakeholder $stakeholder)
 
 clone (int $from_id, int $to_id)
 

Protected Member Functions

 getObjectInfoRidForBookingObjectId (int $booking_object_id)
 
 getBookingInfoRidForBookingObjectId (int $booking_object_id)
 

Protected Attributes

const NR_OF_COLORS = 9
 

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 28 of file class.ObjectsDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\BookingManager\Objects\ObjectsDBRepository::__construct ( protected IRSSWrapper  $wrapper,
protected \ilDBInterface  $db 
)

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

39  {
40  }

Member Function Documentation

◆ clone()

ILIAS\BookingManager\Objects\ObjectsDBRepository::clone ( int  $from_id,
int  $to_id 
)

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

References ILIAS\BookingManager\Objects\ObjectsDBRepository\getBookingInfoRidForBookingObjectId(), and ILIAS\BookingManager\Objects\ObjectsDBRepository\getObjectInfoRidForBookingObjectId().

241  : void {
242  $from_rid = $this->getObjectInfoRidForBookingObjectId($from_id);
243  $to_rid = $this->wrapper->cloneResource($from_rid);
244  if ($to_rid !== "") {
245  $this->db->update(
246  "booking_object",
247  [
248  "obj_info_rid" => ["text", $to_rid]
249  ],
250  [ // where
251  "booking_object_id" => ["integer", $to_id]
252  ]
253  );
254  }
255  $from_rid = $this->getBookingInfoRidForBookingObjectId($from_id);
256  $to_rid = $this->wrapper->cloneResource($from_rid);
257  if ($to_rid !== "") {
258  $this->db->update(
259  "booking_object",
260  [
261  "book_info_rid" => ["text", $to_rid]
262  ],
263  [ // where
264  "booking_object_id" => ["integer", $to_id]
265  ]
266  );
267  }
268  }
+ Here is the call graph for this function:

◆ deleteBookingInfo()

ILIAS\BookingManager\Objects\ObjectsDBRepository::deleteBookingInfo ( int  $booking_object_id)

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

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

184  : bool
185  {
186  $rid = $this->getBookingInfoRidForBookingObjectId($booking_object_id);
187  if ($rid === "") {
188  $this->wrapper->deleteResource($rid);
189  }
190  }
+ Here is the call graph for this function:

◆ deleteObjectInfo()

ILIAS\BookingManager\Objects\ObjectsDBRepository::deleteObjectInfo ( int  $booking_object_id)

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

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

112  : bool
113  {
114  $rid = $this->getObjectInfoRidForBookingObjectId($booking_object_id);
115  if ($rid === "") {
116  $this->wrapper->deleteResource($rid);
117  }
118  }
+ Here is the call graph for this function:

◆ deliverBookingInfo()

ILIAS\BookingManager\Objects\ObjectsDBRepository::deliverBookingInfo ( int  $booking_object_id)

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

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

192  : void
193  {
194  $rid = $this->getBookingInfoRidForBookingObjectId($booking_object_id);
195  $this->wrapper->deliverFile($rid);
196  }
+ Here is the call graph for this function:

◆ deliverObjectInfo()

ILIAS\BookingManager\Objects\ObjectsDBRepository::deliverObjectInfo ( int  $booking_object_id)

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

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

126  : void
127  {
128  $rid = $this->getObjectInfoRidForBookingObjectId($booking_object_id);
129  $this->wrapper->deliverFile($rid);
130  }
+ Here is the call graph for this function:

◆ getBookingInfoFilename()

ILIAS\BookingManager\Objects\ObjectsDBRepository::getBookingInfoFilename ( int  $booking_object_id)

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

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

204  : string
205  {
206  $rid = $this->getBookingInfoRidForBookingObjectId($booking_object_id);
207  if ($rid !== "") {
208  $info = $this->wrapper->getResourceInfo($rid);
209  return $info->getTitle();
210  }
211  return "";
212  }
+ Here is the call graph for this function:

◆ getBookingInfoPath()

ILIAS\BookingManager\Objects\ObjectsDBRepository::getBookingInfoPath ( int  $booking_object_id)

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

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

198  : void
199  {
200  $rid = $this->getBookingInfoRidForBookingObjectId($booking_object_id);
201  $this->wrapper->getResourcePath($rid);
202  }
+ Here is the call graph for this function:

◆ getBookingInfoRidForBookingObjectId()

ILIAS\BookingManager\Objects\ObjectsDBRepository::getBookingInfoRidForBookingObjectId ( int  $booking_object_id)
protected

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

Referenced by ILIAS\BookingManager\Objects\ObjectsDBRepository\clone(), ILIAS\BookingManager\Objects\ObjectsDBRepository\deleteBookingInfo(), ILIAS\BookingManager\Objects\ObjectsDBRepository\deliverBookingInfo(), ILIAS\BookingManager\Objects\ObjectsDBRepository\getBookingInfoFilename(), ILIAS\BookingManager\Objects\ObjectsDBRepository\getBookingInfoPath(), and ILIAS\BookingManager\Objects\ObjectsDBRepository\hasBookingInfo().

166  : string
167  {
168  $set = $this->db->queryF(
169  "SELECT book_info_rid FROM booking_object " .
170  " WHERE booking_object_id = %s ",
171  ["integer"],
172  [$booking_object_id]
173  );
174  $rec = $this->db->fetchAssoc($set);
175  return ($rec["book_info_rid"] ?? "");
176  }
+ Here is the caller graph for this function:

◆ getColorNrForObject()

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

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

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

◆ getNrOfItemsForObject()

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

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

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

◆ getObjectDataForPool()

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

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

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

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

◆ getObjectInfoFilename()

ILIAS\BookingManager\Objects\ObjectsDBRepository::getObjectInfoFilename ( int  $booking_object_id)

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

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

132  : string
133  {
134  $rid = $this->getObjectInfoRidForBookingObjectId($booking_object_id);
135  if ($rid !== "") {
136  $info = $this->wrapper->getResourceInfo($rid);
137  return $info->getTitle();
138  }
139  return "";
140  }
+ Here is the call graph for this function:

◆ getObjectInfoPath()

ILIAS\BookingManager\Objects\ObjectsDBRepository::getObjectInfoPath ( int  $booking_object_id)

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

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

120  : void
121  {
122  $rid = $this->getObjectInfoRidForBookingObjectId($booking_object_id);
123  $this->wrapper->getResourcePath($rid);
124  }
+ Here is the call graph for this function:

◆ getObjectInfoRidForBookingObjectId()

ILIAS\BookingManager\Objects\ObjectsDBRepository::getObjectInfoRidForBookingObjectId ( int  $booking_object_id)
protected

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

Referenced by ILIAS\BookingManager\Objects\ObjectsDBRepository\clone(), ILIAS\BookingManager\Objects\ObjectsDBRepository\deleteObjectInfo(), ILIAS\BookingManager\Objects\ObjectsDBRepository\deliverObjectInfo(), ILIAS\BookingManager\Objects\ObjectsDBRepository\getObjectInfoFilename(), ILIAS\BookingManager\Objects\ObjectsDBRepository\getObjectInfoPath(), and ILIAS\BookingManager\Objects\ObjectsDBRepository\hasObjectInfo().

94  : string
95  {
96  $set = $this->db->queryF(
97  "SELECT obj_info_rid FROM booking_object " .
98  " WHERE booking_object_id = %s ",
99  ["integer"],
100  [$booking_object_id]
101  );
102  $rec = $this->db->fetchAssoc($set);
103  return ($rec["obj_info_rid"] ?? "");
104  }
+ Here is the caller graph for this function:

◆ hasBookingInfo()

ILIAS\BookingManager\Objects\ObjectsDBRepository::hasBookingInfo ( int  $booking_object_id)

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

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

178  : bool
179  {
180  $rid = $this->getBookingInfoRidForBookingObjectId($booking_object_id);
181  return ($rid !== "");
182  }
+ Here is the call graph for this function:

◆ hasObjectInfo()

ILIAS\BookingManager\Objects\ObjectsDBRepository::hasObjectInfo ( int  $booking_object_id)

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

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

106  : bool
107  {
108  $rid = $this->getObjectInfoRidForBookingObjectId($booking_object_id);
109  return ($rid !== "");
110  }
+ Here is the call graph for this function:

◆ importBookingInfoFromLegacyUpload()

ILIAS\BookingManager\Objects\ObjectsDBRepository::importBookingInfoFromLegacyUpload ( int  $booking_object_id,
array  $file_input,
ResourceStakeholder  $stakeholder 
)

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

219  : string {
220  $rcid = $this->wrapper->importFileFromLegacyUpload(
221  $file_input,
222  $stakeholder
223  );
224  if ($rcid !== "") {
225  $this->db->update(
226  "booking_object",
227  [
228  "book_info_rid" => ["text", $rcid]
229  ],
230  [ // where
231  "booking_object_id" => ["integer", $booking_object_id]
232  ]
233  );
234  }
235  return $rcid;
236  }

◆ importObjectInfoFromLegacyUpload()

ILIAS\BookingManager\Objects\ObjectsDBRepository::importObjectInfoFromLegacyUpload ( int  $booking_object_id,
array  $file_input,
ResourceStakeholder  $stakeholder 
)

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

147  : string {
148  $rcid = $this->wrapper->importFileFromLegacyUpload(
149  $file_input,
150  $stakeholder
151  );
152  if ($rcid !== "") {
153  $this->db->update(
154  "booking_object",
155  [
156  "obj_info_rid" => ["text", $rcid]
157  ],
158  [ // where
159  "booking_object_id" => ["integer", $booking_object_id]
160  ]
161  );
162  }
163  return $rcid;
164  }

◆ loadDataOfPool()

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

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

References ILIAS\$db.

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

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

Field Documentation

◆ $color_number

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

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

◆ $pool_loaded

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

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

◆ $pool_objects

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

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

◆ $raw_data

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

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

◆ NR_OF_COLORS

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

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


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