X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2FttTimeHelper.class.php;h=6fd816e0cd010f5c37dd90ff731bba375a789d8a;hb=19f479eb795f39d331fbfe33ab20534112555630;hp=2b5b39bcaf7b13dae36e4a98cec4628874948e1c;hpb=9819bb63bec83c13dd40ebb2ffc24df5fcfeda33;p=timetracker.git diff --git a/WEB-INF/lib/ttTimeHelper.class.php b/WEB-INF/lib/ttTimeHelper.class.php index 2b5b39bc..6fd816e0 100644 --- a/WEB-INF/lib/ttTimeHelper.class.php +++ b/WEB-INF/lib/ttTimeHelper.class.php @@ -40,22 +40,6 @@ class ttTimeHelper { // 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) @@ -88,6 +72,16 @@ class ttTimeHelper { 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;