Adjusted week start for subgroups.
[timetracker.git] / WEB-INF / lib / form / Calendar.class.php
index 4c835f6..bd777ea 100644 (file)
@@ -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; }
@@ -171,16 +165,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 +249,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';