diff --git a/calendar/inc/class.calendar_ui.inc.php b/calendar/inc/class.calendar_ui.inc.php index a3745408e7..db09f3a71f 100644 --- a/calendar/inc/class.calendar_ui.inc.php +++ b/calendar/inc/class.calendar_ui.inc.php @@ -43,7 +43,7 @@ class calendar_ui /** * Reference to global datetime class * - * @var datetime + * @var egw_datetime */ var $datetime; /** diff --git a/calendar/inc/class.calendar_uiviews.inc.php b/calendar/inc/class.calendar_uiviews.inc.php index 8230c48229..2bb676d398 100644 --- a/calendar/inc/class.calendar_uiviews.inc.php +++ b/calendar/inc/class.calendar_uiviews.inc.php @@ -188,6 +188,27 @@ class calendar_uiviews extends calendar_ui } } + /** + * Calculate iso8601 week-number, which is defined for Monday as first day of week only + * + * @param int|string|DateTime $weekstart + * @return string + */ + public function week_number($weekstart) + { + $time = new egw_time($weekstart); + switch($this->cal_prefs['weekdaystarts']) + { + case 'Sunday': + $time->modify('+1day'); + break; + case 'Saturday': + $time->modify('+2days'); + break; + } + return $time->format('W'); + } + /** * Show the last view or the default one, if no last */ @@ -299,7 +320,7 @@ class calendar_uiviews extends calendar_ui $this->last['hour'] = 23; $this->last['minute'] = $this->last['sec'] = 59; unset($this->last['raw']); $this->last = $this->bo->date2ts($this->last); - $GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang('Week').' '.adodb_date('W',$this->first).': '.$this->bo->long_date($this->first,$this->last); + $GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang('Week').' '.$this->week_number($this->first).': '.$this->bo->long_date($this->first,$this->last); } else // dayview { @@ -454,12 +475,12 @@ class calendar_uiviews extends calendar_ui $content .= "\t\t\t\t".'