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;
// toMinutes - converts a time string in format 00:00 to a number of minutes.
static function toMinutes($value) {
$signMultiplier = ttStartsWith($value, '-') ? -1 : 1;
- if ($signMultiplier == -1) $duration = ltrim($duration, '-');
+ if ($signMultiplier == -1) $value = ltrim($value, '-');
$time_a = explode(':', $value);
return $signMultiplier * ((int)@$time_a[1] + ((int)@$time_a[0]) * 60);