private function getAppointmentCalendar(\DateTime $period, \Application\RoomItem $room, \Core\Database $db, \DBMappers\AppointmentItem $appMapper) { $result = array(); $last_day = \Utility\DateHelper::GetLastDayInMonth($period); for ($i = 1; $i <= $last_day; $i++) { $query_date = \Utility\DateHelper::DateOfDay($period, $i); $result[$i] = $appMapper->getDayAppointments($room->getId(), $query_date, $db); } return $result; }
public function getCrossingAppointments(\Application\AppointmentChain $chain, \DBMappers\AppointmentItem $mapper, \Core\Database $db) { $result = array(); foreach ($chain as $appointment) { $day_apps = $mapper->getDayAppointments($appointment->getRoomId(), $appointment->getTimeStart(), $db); foreach ($day_apps as $match) { if (!is_null($appointment->getChain()) && $appointment->getChain() == $match->getChain()) { continue; // пропускаем, если из той же цепочки } if ($appointment->isCrossing($match->getTimeStart(), $match->getTimeEnd())) { $result[] = $match; } } } return $result; }