ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 25 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 94 of file class.SchedulesDBRepository.php.

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

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

◆ getScheduleDataForPool()

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

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

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

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

73  : array {
74  $this->loadDataOfPool($pool_id);
75  return self::$pool_schedules[$pool_id] ?? [];
76  }
+ 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 85 of file class.SchedulesDBRepository.php.

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

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

◆ hasSchedules()

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

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

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

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

◆ loadDataOfPool()

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

Definition at line 38 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().

38  : void
39  {
40  $db = $this->db;
41 
42  if (isset(self::$pool_loaded[$pool_id]) && self::$pool_loaded[$pool_id]) {
43  return;
44  }
45 
46  $set = $db->query(
47  'SELECT s.booking_schedule_id,s.title,' .
48  'MAX(o.schedule_id) AS object_has_schedule' .
49  ' FROM booking_schedule s' .
50  ' LEFT JOIN booking_object o ON (s.booking_schedule_id = o.schedule_id)' .
51  ' WHERE s.pool_id = ' . $db->quote($pool_id, 'integer') .
52  ' GROUP BY s.booking_schedule_id,s.title' .
53  ' ORDER BY s.title'
54  );
55 
56  self::$pool_schedules[$pool_id] = [];
57 
58  while ($row = $db->fetchAssoc($set)) {
59  if (!$row['object_has_schedule']) {
60  $row['is_used'] = false;
61  } else {
62  $row['is_used'] = true;
63  }
64  self::$raw_data[$row["booking_schedule_id"]] = $row;
65  self::$pool_schedules[$pool_id][] = $row;
66  }
67 
68  self::$pool_loaded[$pool_id] = true;
69  }
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 28 of file class.SchedulesDBRepository.php.

◆ $pool_schedules

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

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

◆ $raw_data

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

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


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