1 <?php declare(strict_types=1);
23 protected const PROCESS_CLASS = \ilBookingProcessWithScheduleGUI::class;
25 protected \ilCtrlInterface
$ctrl;
44 string $seed_str =
"",
49 $this->
ctrl = $DIC->ctrl();
57 $this->seed = ($this->seed_str !==
"")
61 $this->object_manager = $DIC->bookingManager()->internal()
62 ->domain()->objects($pool_id);
67 $navigation = new \ilCalendarHeaderNavigationGUI(
73 $navigation->getHTML();
96 $this->getWeekGridEntries($this->obj_ids),
103 return $week_widget->render();
106 protected function getWeekGridEntries(
109 $week_grid_entries = [];
111 foreach ($object_ids as $object_id) {
112 $obj = new \ilBookingObject($object_id);
113 $schedule = new \ilBookingSchedule($obj->getScheduleId());
114 $map = array(
'mo',
'tu',
'we',
'th',
'fr',
'sa',
'su');
115 $definition = $schedule->getDefinition();
116 $av_from = ($schedule->getAvailabilityFrom() && !$schedule->getAvailabilityFrom()->isNull())
117 ? $schedule->getAvailabilityFrom()->get(
IL_CAL_DATE)
119 $av_to = ($schedule->getAvailabilityTo() && !$schedule->getAvailabilityTo()->isNull())
123 $has_open_slot =
false;
129 if ($av_from || $av_to) {
132 if ($av_from && $av_from > $today) {
136 if ($av_to && $av_to < $today) {
142 if (isset($definition[$map[$date_info[
'isoday'] - 1]])) {
143 foreach ($definition[$map[$date_info[
'isoday'] - 1]] as $slot) {
144 $slot = explode(
'-', $slot);
145 $slots[] = array(
'from' => str_replace(
':',
'', $slot[0]),
146 'to' => str_replace(
':',
'', $slot[1])
151 foreach ($slots as $slot) {
153 (
int) substr($slot[
'from'], 0, 2),
154 (
int) substr($slot[
'from'], 2, 2),
161 (
int) substr($slot[
'to'], 0, 2),
162 (
int) substr($slot[
'to'], 2, 2),
179 if (!array_sum($nr_available)) {
184 if ($schedule->getDeadline() >= 0) {
186 if ($slot_from < (time() + $schedule->getDeadline() * 60 * 60)) {
189 } elseif ($slot_to < time()) {
194 $from_a = explode(
' ', $from);
195 $from = array_pop($from_a);
197 $to_a = explode(
' ', $to);
198 $to = array_pop($to_a);
200 $this->
ctrl->setParameterByClass(self::PROCESS_CLASS,
"slot", $slot_from .
"_" . $slot_to);
201 $this->
ctrl->setParameterByClass(self::PROCESS_CLASS,
"object_id", $obj->getId());
202 $this->
ctrl->setParameterByClass(self::PROCESS_CLASS,
"seed", $this->seed_str);
203 $link = $this->
ctrl->getLinkTargetByClass(self::PROCESS_CLASS,
"showNumberForm",
"",
true);
204 $this->
ctrl->setParameterByClass(self::PROCESS_CLASS,
"slot", null);
205 $this->
ctrl->setParameterByClass(self::PROCESS_CLASS,
"object_id", null);
213 array_sum($nr_available),
214 $this->object_manager->getColorNrForObject($obj->getId())
224 return $week_grid_entries;
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static _buildWeekDayList(ilDate $a_day, int $a_weekstart)
build week day list public
static getAvailableObject(array $a_ids, int $a_from, int $a_to, bool $a_return_single=true, bool $a_return_counter=false)
Check if any of given objects are bookable.
__construct(object $parent_gui, string $parent_cmd, array $obj_ids, int $pool_id, string $seed_str="", int $week_start=\ilCalendarSettings::WEEK_START_MONDAY)
ILIAS BookingManager Objects ObjectsManager $object_manager