ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\BookingManager\Objects\ObjectsManager Class Reference
+ Collaboration diagram for ILIAS\BookingManager\Objects\ObjectsManager:

Public Member Functions

 __construct (InternalDataService $data, InternalRepoService $repo, InternalDomainService $domain, int $pool_id)
 
 getNrOfItemsForObject (int $book_obj_id)
 
 getObjectTitles ()
 
 getObjectIds ()
 
 getColorNrForObject (int $book_obj_id)
 
 getDataArrayFromInputString (string $input)
 
 createObjectsFromBulkInputString (string $input, int $schedule_id)
 

Protected Attributes

int $pool_id
 
ObjectsDBRepository $object_repo
 
InternalRepoService $repo
 
InternalDataService $data
 
InternalDomainService $domain
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ __construct()

ILIAS\BookingManager\Objects\ObjectsManager::__construct ( InternalDataService  $data,
InternalRepoService  $repo,
InternalDomainService  $domain,
int  $pool_id 
)

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

References ILIAS\BookingManager\Objects\ObjectsManager\$pool_id, and ILIAS\BookingManager\InternalRepoService\objects().

38  {
39  $this->object_repo = $repo->objects();
40  $this->object_repo->loadDataOfPool($pool_id);
41  $this->pool_id = $pool_id;
42  }
+ Here is the call graph for this function:

Member Function Documentation

◆ createObjectsFromBulkInputString()

ILIAS\BookingManager\Objects\ObjectsManager::createObjectsFromBulkInputString ( string  $input,
int  $schedule_id 
)

Definition at line 88 of file class.ObjectsManager.php.

References ILIAS\BookingManager\Objects\ObjectsManager\getDataArrayFromInputString().

88  : void
89  {
90  foreach ($this->getDataArrayFromInputString($input) as $data) {
91  $object = new \ilBookingObject();
92  $object->setTitle($data["title"]);
93  $object->setDescription($data["description"]);
94  $object->setNrOfItems((int) $data["nr"]);
95  $object->setPoolId($this->pool_id);
96  if ($schedule_id > 0) {
97  $object->setScheduleId($schedule_id);
98  }
99  $object->save();
100  }
101  }
+ Here is the call graph for this function:

◆ getColorNrForObject()

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

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

65  : int
66  {
67  return $this->object_repo->getColorNrForObject($book_obj_id);
68  }

◆ getDataArrayFromInputString()

ILIAS\BookingManager\Objects\ObjectsManager::getDataArrayFromInputString ( string  $input)

Definition at line 70 of file class.ObjectsManager.php.

References ILIAS\BookingManager\Objects\ObjectsManager\$data.

Referenced by ILIAS\BookingManager\Objects\ObjectsManager\createObjectsFromBulkInputString().

70  : array
71  {
72  $rows = explode("\n", $input);
73  $data = [];
74  foreach ($rows as $row) {
75  $cells = explode(";", $row);
76  if (count($cells) === 1) {
77  $cells = explode("\t", $row);
78  }
79  $data[] = [
80  "title" => trim($cells[0] ?? ""),
81  "description" => trim($cells[1] ?? ""),
82  "nr" => trim($cells[2] ?? ""),
83  ];
84  }
85  return $data;
86  }
+ Here is the caller graph for this function:

◆ getNrOfItemsForObject()

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

Definition at line 44 of file class.ObjectsManager.php.

44  : int
45  {
46  return $this->object_repo->getNrOfItemsForObject($book_obj_id);
47  }

◆ getObjectIds()

ILIAS\BookingManager\Objects\ObjectsManager::getObjectIds ( )

Definition at line 58 of file class.ObjectsManager.php.

References Vendor\Package\$d.

58  : array
59  {
60  return array_map(static function ($d) {
61  return (int) $d["booking_object_id"];
62  }, $this->object_repo->getObjectDataForPool($this->pool_id));
63  }

◆ getObjectTitles()

ILIAS\BookingManager\Objects\ObjectsManager::getObjectTitles ( )

Definition at line 49 of file class.ObjectsManager.php.

References Vendor\Package\$d.

49  : array
50  {
51  $titles = [];
52  foreach ($this->object_repo->getObjectDataForPool($this->pool_id) as $d) {
53  $titles[$d["booking_object_id"]] = $d["title"];
54  }
55  return $titles;
56  }

Field Documentation

◆ $data

InternalDataService ILIAS\BookingManager\Objects\ObjectsManager::$data
protected

◆ $domain

InternalDomainService ILIAS\BookingManager\Objects\ObjectsManager::$domain
protected

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

◆ $object_repo

ObjectsDBRepository ILIAS\BookingManager\Objects\ObjectsManager::$object_repo
protected

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

◆ $pool_id

int ILIAS\BookingManager\Objects\ObjectsManager::$pool_id
protected

◆ $repo

InternalRepoService ILIAS\BookingManager\Objects\ObjectsManager::$repo
protected

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


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