ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\BookingManager\Schedule\SchedulesDBRepository Class Reference

Repo class for schedules. More...

+ Collaboration diagram for ILIAS\BookingManager\Schedule\SchedulesDBRepository:

Public Member Functions

 __construct (\ilDBInterface $db)
 
 loadDataOfPool (int $pool_id)
 
 hasSchedules (int $pool_id)
 
 getScheduleList (int $pool_id)
 
 getScheduleData (int $pool_id)
 

Protected Member Functions

 getScheduleDataForPool (int $pool_id)
 

Protected Attributes

ilDBInterface $db
 

Static Protected Attributes

static array $pool_loaded = []
 
static array $pool_schedules = []
 
static array $raw_data = []
 

Detailed Description

Repo class for schedules.

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

Definition at line 22 of file class.SchedulesDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\BookingManager\Schedule\SchedulesDBRepository::__construct ( \ilDBInterface  $db)

Member Function Documentation

◆ getScheduleData()

ILIAS\BookingManager\Schedule\SchedulesDBRepository::getScheduleData ( int  $pool_id)

Definition at line 91 of file class.SchedulesDBRepository.php.

References $data, and ILIAS\BookingManager\Schedule\SchedulesDBRepository\getScheduleDataForPool().

91  : array
92  {
93  $schedules = [];
94  foreach ($this->getScheduleDataForPool($pool_id) as $data) {
95  $schedules[$data["booking_schedule_id"]] = $data;
96  }
97  return $schedules;
98  }
+ Here is the call graph for this function:

◆ getScheduleDataForPool()

ILIAS\BookingManager\Schedule\SchedulesDBRepository::getScheduleDataForPool ( int  $pool_id)
protected

Definition at line 68 of file class.SchedulesDBRepository.php.

References ILIAS\BookingManager\Schedule\SchedulesDBRepository\loadDataOfPool().

Referenced by ILIAS\BookingManager\Schedule\SchedulesDBRepository\getScheduleData(), and ILIAS\BookingManager\Schedule\SchedulesDBRepository\getScheduleList().

70  : array {
71  $this->loadDataOfPool($pool_id);
72  return self::$pool_schedules[$pool_id] ?? [];
73  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getScheduleList()

ILIAS\BookingManager\Schedule\SchedulesDBRepository::getScheduleList ( int  $pool_id)

Definition at line 82 of file class.SchedulesDBRepository.php.

References $data, and ILIAS\BookingManager\Schedule\SchedulesDBRepository\getScheduleDataForPool().

82  : array
83  {
84  $list = [];
85  foreach ($this->getScheduleDataForPool($pool_id) as $data) {
86  $list[$data["booking_schedule_id"]] = $data["title"];
87  }
88  return $list;
89  }
+ Here is the call graph for this function:

◆ hasSchedules()

ILIAS\BookingManager\Schedule\SchedulesDBRepository::hasSchedules ( int  $pool_id)

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

References ILIAS\BookingManager\Schedule\SchedulesDBRepository\loadDataOfPool().

77  : bool {
78  $this->loadDataOfPool($pool_id);
79  return count(self::$pool_schedules[$pool_id] ?? []) > 0;
80  }
+ Here is the call graph for this function:

◆ loadDataOfPool()

ILIAS\BookingManager\Schedule\SchedulesDBRepository::loadDataOfPool ( int  $pool_id)

Definition at line 35 of file class.SchedulesDBRepository.php.

References ILIAS\BookingManager\Schedule\SchedulesDBRepository\$db, and ilDBInterface\query().

Referenced by ILIAS\BookingManager\Schedule\SchedulesDBRepository\getScheduleDataForPool(), and ILIAS\BookingManager\Schedule\SchedulesDBRepository\hasSchedules().

35  : void
36  {
37  $db = $this->db;
38 
39  if (isset(self::$pool_loaded[$pool_id]) && self::$pool_loaded[$pool_id]) {
40  return;
41  }
42 
43  $set = $db->query(
44  'SELECT s.booking_schedule_id,s.title,' .
45  'MAX(o.schedule_id) AS object_has_schedule' .
46  ' FROM booking_schedule s' .
47  ' LEFT JOIN booking_object o ON (s.booking_schedule_id = o.schedule_id)' .
48  ' WHERE s.pool_id = ' . $db->quote($pool_id, 'integer') .
49  ' GROUP BY s.booking_schedule_id,s.title' .
50  ' ORDER BY s.title'
51  );
52 
53  self::$pool_schedules[$pool_id] = [];
54 
55  while ($row = $db->fetchAssoc($set)) {
56  if (!$row['object_has_schedule']) {
57  $row['is_used'] = false;
58  } else {
59  $row['is_used'] = true;
60  }
61  self::$raw_data[$row["booking_schedule_id"]] = $row;
62  self::$pool_schedules[$pool_id][] = $row;
63  }
64 
65  self::$pool_loaded[$pool_id] = true;
66  }
fetchAssoc(ilDBStatement $statement)
quote($value, string $type)
query(string $query)
Run a (read-only) Query on the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ILIAS\BookingManager\Schedule\SchedulesDBRepository::$db
protected

◆ $pool_loaded

array ILIAS\BookingManager\Schedule\SchedulesDBRepository::$pool_loaded = []
staticprotected

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

◆ $pool_schedules

array ILIAS\BookingManager\Schedule\SchedulesDBRepository::$pool_schedules = []
staticprotected

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

◆ $raw_data

array ILIAS\BookingManager\Schedule\SchedulesDBRepository::$raw_data = []
staticprotected

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


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