X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/75b65e92b21d45e2b09fb12daef169fb214a7acd..a8967b288d201edff6e4f87e7b0bccb1bf55c483:/WEB-INF/lib/form/Calendar.class.php
diff --git a/WEB-INF/lib/form/Calendar.class.php b/WEB-INF/lib/form/Calendar.class.php
index 4c835f62..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,11 @@ class Calendar extends FormElement {
$stl_cell = ' class="CalendarDay"';
}
- // holidays
- //if ($this->showHolidays) {
- global $user;
- if ($user->show_holidays) {
- foreach ($this->holidays as $day) {
- if($day == $date) {
- $stl_cell = ' class="CalendarDayHoliday"';
- $stl_link = ' class="CalendarLinkHoliday"';
- }
- }
+ // 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"';
}
// selected day
@@ -260,7 +251,7 @@ class Calendar extends FormElement {
function _getActiveDates($start, $end) {
global $user;
- $user_id = $user->getActiveUser();
+ $user_id = $user->getUser();
$table = ($this->highlight == 'expenses') ? 'tt_expense_items' : 'tt_log';