/** * Returns all reservations for the period starting at the current day ($d) and ending at that day next month * A reservation is considered to take place in the period if it has an overlap * (the union of the reservation and the month is not empty) * * @param $d The current day number * @param $m The number of the month * @param $y The year * @pre $m and $y are integers * @return array An associated array ('begin', 'end', 'isSV') with the reservations for this month */ function getReservationsNextDays($d, $m, $y) { //if the month is 12, we know that the next month is 01 and in the next year $y2 = $m == 12 ? $y + 1 : $y; //month 13 does not exist so count modulo $m2 = $m == 12 ? 1 : $m + 1; return getReservations(DateTime::createFromFormat(DATE_TIME_FORMAT, "" . $y . "-" . $m . "-" . $d . " 00:00:00"), DateTime::createFromFormat(DATE_TIME_FORMAT, "" . $y2 . "-" . $m2 . "-" . $d . " 00:00:00")); }
/** * Checks whether there is already a reservation durign the specified time frame * * @param $startSTR The start time of the specified time frame * @param $endSTR The end time fo the specified time frame * @return True if there is a reservation in that time frame and false otherwise */ function alreadyReserved(DateTime $start, DateTime $end) { $reservations = getReservations($start, $end); if (count($reservations) != 0) { return true; } else { return false; } }