/** * Render month availability calendar */ static function month($month, $rooms, $ari, $filter_room = false) { $first_day_week = $month->dates[0]->day_week; $locale_weekstart = (int) ($format = trim(str_replace('*', '', JText::_('CH_WEEKSTART')))); $start_empty_days = $first_day_week - $locale_weekstart; if ($first_day_week == 0 && $locale_weekstart == 1) { $start_empty_days = 6; } $end_empty_days = 7 - CHLibDate::dateWeekDay($month->end) - (1 - $locale_weekstart); if ($end_empty_days == 7) { $end_empty_days = 0; } $first_week_days = 7 - $start_empty_days; $weeks = 5; if ($start_empty_days + $month->days > 35) { $weeks = 6; } if ($start_empty_days + $month->days == 28) { $weeks = 4; } // row class $row_class = $filter_room ? 'ch-month-room-row' : 'ch-month-row'; // first week $html[] = '<div class="uk-clearfix ' . $row_class . '">'; $html[] = self::monthHead(1, $first_week_days, $month, $filter_room, $start_empty_days); $html[] = self::monthRow(1, $first_week_days, $month, $rooms, $ari, $filter_room, $start_empty_days); $html[] = '</div>'; // middle weeks $first = $first_week_days + 1; $last = $first_week_days + 7; $middle_weeks = $weeks - 2; for ($i = 0; $i < $middle_weeks; $i++) { $html[] = '<div class="uk-clearfix ' . $row_class . '">'; $html[] = self::monthHead($first, $last, $month, $filter_room); $html[] = self::monthRow($first, $last, $month, $rooms, $ari, $filter_room); $html[] = '</div>'; $first = $first + 7; $last = $last + 7; } // end week $html[] = '<div class="uk-clearfix ' . $row_class . '">'; $html[] = self::monthHead($first, $last, $month, $filter_room, 0, $end_empty_days); $html[] = self::monthRow($first, $last, $month, $rooms, $ari, $filter_room, 0, $end_empty_days); $html[] = '</div>'; return implode("\n", $html); }