$this->mMonthNames = $i18n->monthNames;
$this->mWeekDayShortNames = $i18n->weekdayShortNames;
- if (is_array($i18n->holidays)) {
- foreach ($i18n->holidays as $fday) {
- $date_a = explode("/",$fday); // format mm/dd
- $this->holidays[] = mktime(0,0,0, $date_a[0], $date_a[1], date("Y"));// + 7200;
- }
- }
- $this->weekStartDay = $user->week_start;
+ $this->weekStartDay = $user->getWeekStart();
}
function setStyle($style) { $this->style = $style; }
$str .= "<tr>";
+ // TODO: refactor this entire class, as $weekend_start and $weekend_end
+ // are not what their names suggest (debug with non zero week start to see it).
$weekend_start = 6 - $this->weekStartDay; // Saturday by default.
$weekend_end = (7 - $this->weekStartDay) % 7; // Sunday by default.
if (defined('WEEKEND_START_DAY')) {
$stl_cell = ' class="CalendarDay"';
}
- // Handle holidays.
- // Prepare a date to check in DB_DATEFORMAT.
- $date_to_check = "$thisyear-";
- if (strlen($thismonth) == 1) $date_to_check .= '0';
- $date_to_check .= "$thismonth-";
- if (strlen($start_date+$j) == 1) $date_to_check .= '0';
- $date_to_check .= $start_date+$j;
-
- // Check if it falls on a holiday.
- if (ttTimeHelper::isHoliday2($date_to_check)) {
+ // holidays
+ $date_to_check = ttTimeHelper::dateInDatabaseFormat($thisyear, $thismonth, $start_date+$j);
+ if (ttTimeHelper::isHoliday($date_to_check)) {
$stl_cell = ' class="CalendarDayHoliday"';
$stl_link = ' class="CalendarLinkHoliday"';
}