19 declare(strict_types=1);
28 protected const PROCESS_CLASS = \ilBookingProcessWithScheduleGUI::class;
30 protected \ilCtrlInterface
$ctrl;
49 string $seed_str =
"",
54 $this->
ctrl = $DIC->ctrl();
62 $this->seed = ($this->seed_str !==
"")
66 $this->object_manager = $DIC->bookingManager()->internal()
67 ->domain()->objects($pool_id);
72 $navigation = new \ilCalendarHeaderNavigationGUI(
78 $navigation->getHTML();
101 $this->getWeekGridEntries($this->obj_ids),
108 return $week_widget->render();
111 protected function getWeekGridEntries(
114 $week_grid_entries = [];
116 foreach ($object_ids as $object_id) {
117 $obj = new \ilBookingObject($object_id);
118 $schedule = new \ilBookingSchedule($obj->getScheduleId());
119 $map = array(
'mo',
'tu',
'we',
'th',
'fr',
'sa',
'su');
120 $definition = $schedule->getDefinition();
121 $av_from = ($schedule->getAvailabilityFrom() && !$schedule->getAvailabilityFrom()->isNull())
122 ? $schedule->getAvailabilityFrom()->get(
IL_CAL_DATE)
124 $av_to = ($schedule->getAvailabilityTo() && !$schedule->getAvailabilityTo()->isNull())
128 $has_open_slot =
false;
134 if ($av_from || $av_to) {
137 if ($av_from && $av_from > $today) {
141 if ($av_to && $av_to < $today) {
147 if (isset($definition[$map[$date_info[
'isoday'] - 1]])) {
148 foreach ($definition[$map[$date_info[
'isoday'] - 1]] as $slot) {
149 $slot = explode(
'-', $slot);
150 $slots[] = array(
'from' => str_replace(
':',
'', $slot[0]),
151 'to' => str_replace(
':',
'', $slot[1])
156 foreach ($slots as $slot) {
158 (
int) substr($slot[
'from'], 0, 2),
159 (
int) substr($slot[
'from'], 2, 2),
166 (
int) substr($slot[
'to'], 0, 2),
167 (
int) substr($slot[
'to'], 2, 2),
184 if (!array_sum($nr_available)) {
189 if ($schedule->getDeadline() >= 0) {
191 if ($slot_from < (time() + $schedule->getDeadline() * 60 * 60)) {
194 } elseif ($slot_to < time()) {
199 $from_a = explode(
' ', $from);
200 $from = array_pop($from_a);
202 $to_a = explode(
' ', $to);
203 $to = array_pop($to_a);
205 $this->
ctrl->setParameterByClass(self::PROCESS_CLASS,
"slot", $slot_from .
"_" . $slot_to);
206 $this->
ctrl->setParameterByClass(self::PROCESS_CLASS,
"object_id", $obj->getId());
207 $this->
ctrl->setParameterByClass(self::PROCESS_CLASS,
"seed", $this->seed_str);
208 $link = $this->
ctrl->getLinkTargetByClass(self::PROCESS_CLASS,
"showNumberForm",
"",
true);
209 $this->
ctrl->setParameterByClass(self::PROCESS_CLASS,
"slot",
null);
210 $this->
ctrl->setParameterByClass(self::PROCESS_CLASS,
"object_id",
null);
218 array_sum($nr_available),
219 $this->object_manager->getColorNrForObject($obj->getId())
229 return $week_grid_entries;
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__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
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)