X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2Fform%2FCalendar.class.php;h=447a45e02f5c6a1659dc6205713473b29ec99a47;hb=8a671525046655e057a15c6de9507834322b466d;hp=f160cfa6cf43de12e3ce6000c0937223a9a5aa35;hpb=9819bb63bec83c13dd40ebb2ffc24df5fcfeda33;p=timetracker.git diff --git a/WEB-INF/lib/form/Calendar.class.php b/WEB-INF/lib/form/Calendar.class.php index f160cfa6..447a45e0 100644 --- a/WEB-INF/lib/form/Calendar.class.php +++ b/WEB-INF/lib/form/Calendar.class.php @@ -63,13 +63,7 @@ class Calendar extends FormElement { $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; } @@ -132,6 +126,8 @@ class Calendar extends FormElement { $str .= ""; + // 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')) { @@ -171,16 +167,9 @@ class Calendar extends FormElement { $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"'; }