/** * Get Calendar Reservation Box by given Subject ID and Datetime Reservation Start. * * @param $subjectId int * @param $from string * MySQL datetime * @return BookingBox or null if no find */ function getCalendarBox($subjectId, $from) { $from =& BookproHelper::dateBeginDay($from); $fromTime = date('H:i', $from->uts); // get calendar for day date $calendar =& BookproHelper::getCalendar($subjectId, $from->dts, $from->dts); if (count($calendar)) { // get first day of calendar $currentDay =& reset($calendar); /* @var $currentDay BookingDay */ // get date boxes $boxes =& $currentDay->boxes; $countBoxes = count($boxes); // search in boxes for ($i = 0; $i < $countBoxes; $i++) { $box =& $boxes[$i]; /* @var $box BookingBox */ if ($box->fromTime == $fromTime) { return $box; } } } return null; }