$stl_cell = ' class="CalendarDay"';
}
- // holidays
- global $user;
- if ($user->isOptionEnabled('show_holidays')) {
- foreach ($this->holidays as $day) {
- if($day == $date) {
- $stl_cell = ' class="CalendarDayHoliday"';
- $stl_link = ' class="CalendarLinkHoliday"';
- }
- }
+ // 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)) {
+ $stl_cell = ' class="CalendarDayHoliday"';
+ $stl_link = ' class="CalendarLinkHoliday"';
}
// selected day
var $custom_logo = 0; // Whether to use a custom logo for group.
var $lock_spec = null; // Cron specification for record locking.
+ var $holidays = null; // Holidays specification.
var $workday_minutes = 480; // Number of work minutes in a regular day.
var $active_users = 0; // Count of active users in group.
$this->currency = $val['currency'];
$this->plugins = $val['plugins'];
$this->lock_spec = $val['lock_spec'];
+ $this->holidays = $val['holidays'];
$this->workday_minutes = $val['workday_minutes'];
/*
$this->custom_logo = $val['custom_logo'];
return false;
}
+ // isHoliday determines if $date falls on a holiday.
+ static function isHoliday2($date) {
+ global $user;
+
+ $holidays = $user->getHolidays();
+ if (!$holidays)
+ return false;
+
+ $holiday_dates = explode(',', $holidays);
+ foreach ($holiday_dates as $holiDateSpec) {
+ if (ttTimeHelper::holidayMatch($date, $holiDateSpec))
+ return true;
+ }
+ return false;
+ }
+
+ // holidayMatch determines if $date matches a single $holiDateSpec.
+ static function holidayMatch($date, $holiDateSpec) {
+
+ $dateArray = explode('-', $date);
+ $holiDateSpecArray = explode('-', $holiDateSpec);
+
+ // Check year.
+ if ($dateArray[0] != $holiDateSpecArray[0] && $holiDateSpecArray[0] != '****') // **** means all years.
+ return false;
+ // Check month.
+ if ($dateArray[1] != $holiDateSpecArray[1])
+ return false;
+ // Check day.
+ if ($dateArray[2] != $holiDateSpecArray[2])
+ return false;
+
+ return true;
+ }
+
// isValidTime validates a value as a time string.
static function isValidTime($value) {
if (strlen($value)==0 || !isset($value)) return false;
var $custom_logo = 0; // Whether to use a custom logo for group.
var $lock_spec = null; // Cron specification for record locking.
+ var $holidays = null; // Holidays specification.
var $workday_minutes = 480; // Number of work minutes in a regular day.
var $rights = array(); // An array of user rights such as 'track_own_time', etc.
var $is_client = false; // Whether user is a client as determined by missing 'track_own_time' right.
$sql = "SELECT u.id, u.login, u.name, u.group_id, u.role_id, r.rank, r.name as role_name, r.rights, u.client_id,".
" u.quota_percent, u.email, g.org_id, g.name as group_name, g.currency, g.lang, g.decimal_mark, g.date_format,".
" g.time_format, g.week_start, g.tracking_mode, g.project_required, g.task_required, g.record_type,".
- " g.bcc_email, g.allow_ip, g.password_complexity, g.plugins, g.config, g.lock_spec, g.workday_minutes, g.custom_logo".
+ " g.bcc_email, g.allow_ip, g.password_complexity, g.plugins, g.config, g.lock_spec, g.holidays, g.workday_minutes, g.custom_logo".
" FROM tt_users u LEFT JOIN tt_groups g ON (u.group_id = g.id) LEFT JOIN tt_roles r on (r.id = u.role_id) WHERE ";
if ($id)
$sql .= "u.id = $id";
$this->currency = $val['currency'];
$this->plugins = $val['plugins'];
$this->lock_spec = $val['lock_spec'];
+ $this->holidays = $val['holidays'];
$this->workday_minutes = $val['workday_minutes'];
$this->custom_logo = $val['custom_logo'];
return ($this->behalfGroup ? $this->behalfGroup->lock_spec : $this->lock_spec);
}
+ // getHolidays returns holidays specification for active group.
+ function getHolidays() {
+ return ($this->behalfGroup ? $this->behalfGroup->holidays : $this->holidays);
+ }
+
// getWorkdayMinutes returns workday_minutes for active group.
function getWorkdayMinutes() {
return ($this->behalfGroup ? $this->behalfGroup->workday_minutes : $this->workday_minutes);
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.19.4.4991 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <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> |
<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>
<td align="right" nowrap>{$i18n.form.group_edit.show_holidays}:</td>
<td>{$forms.groupForm.show_holidays.control} <a href="https://www.anuko.com/lp/tt_14.htm" target="_blank">{$i18n.label.what_is_it}</a></td>
</tr>
-{if isTrue('HOLIDAYS_DEBUG')}
<tr>
<td align="right" nowrap>{$i18n.form.group_edit.holidays}:</td>
<td>{$forms.groupForm.holidays.control} <a href="https://www.anuko.com/lp/tt_14.htm" target="_blank">{$i18n.label.what_is_it}</a></td>
</tr>
-{/if}
<tr>
<td align="right" nowrap>{$i18n.form.group_edit.tracking_mode}:</td>
<td>{$forms.groupForm.tracking_mode.control} {$forms.groupForm.task_required.control} <span id="task_required_label"><label for="task_required">{$i18n.label.required}</label></span></td>