$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"';
}
// isHoliday determines if $date falls on a holiday.
static function isHoliday($date) {
global $user;
- global $i18n;
-
- if (!$user->show_holidays) return false;
-
- // $date is expected as string in DB_DATEFORMAT.
- $month = date('m', strtotime($date));
- $day = date('d', strtotime($date));
- if (in_array($month.'/'.$day, $i18n->holidays))
- return true;
-
- return false;
- }
-
- // isHoliday determines if $date falls on a holiday.
- static function isHoliday2($date) {
- global $user;
$holidays = $user->getHolidays();
if (!$holidays)
return true;
}
+ // dateInDatabaseFormat prepares a date string in DB_DATEFORMAT out of year, month, and day.
+ static function dateInDatabaseFormat($year, $month, $day) {
+ $date = "$year-";
+ if (strlen($month) == 1) $date .= '0';
+ $date .= "$month-";
+ if (strlen($day) == 1) $date .= '0';
+ $date .= $day;
+ return $date;
+ }
+
// isValidTime validates a value as a time string.
static function isValidTime($value) {
if (strlen($value)==0 || !isset($value)) return false;
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.19.4.4992 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.19.4.4993 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
<a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
<a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
<a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
// Iterate from 1st up to selected date.
$workdaysFrom1st = 0;
for ($i = 1; $i <= $selected_date->mDate; $i++) {
- $date = "$selected_date->mYear-$selected_date->mMonth-$i";
+ $date = ttTimeHelper::dateInDatabaseFormat($selected_date->mYear, $selected_date->mMonth, $i);
if (!ttTimeHelper::isWeekend($date) && !ttTimeHelper::isHoliday($date)) {
$workdaysFrom1st++;
}
// Iterate through the entire month.
for ($i = 1; $i <= $daysInMonth; $i++) {
$date = "$year-$month-$i";
+ $date = ttTimeHelper::dateInDatabaseFormat($year, $month, $i);
if (!ttTimeHelper::isWeekend($date) && !ttTimeHelper::isHoliday($date)) {
$workdaysInMonth++;
}