From 1932a912f85ea66364029066f5c2162299f46ed7 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Fri, 12 Sep 2014 11:50:51 +0200 Subject: [PATCH] Fix month-naming for different week arrangements fixes #7179 --- library/Icinga/Web/Widget/Chart/HistoryColorGrid.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/library/Icinga/Web/Widget/Chart/HistoryColorGrid.php b/library/Icinga/Web/Widget/Chart/HistoryColorGrid.php index 6f12ba832..974e02060 100644 --- a/library/Icinga/Web/Widget/Chart/HistoryColorGrid.php +++ b/library/Icinga/Web/Widget/Chart/HistoryColorGrid.php @@ -239,8 +239,11 @@ class HistoryColorGrid extends AbstractWidget { if ($weekday > 6) { $weekday = 0; $weeks[] = array(); + // PRESENT => The last day of week determines the month + if ($this->weekFlow === self::CAL_GROW_INTO_PRESENT) { + $months[$week] = $month; + } $week++; - $months[$week] = $month; } if ($day > cal_days_in_month(CAL_GREGORIAN, $month, $year)) { $month++; @@ -250,6 +253,12 @@ class HistoryColorGrid extends AbstractWidget { } $day = 1; } + if ($weekday === 0) { + // PAST => The first day of each week determines the month + if ($this->weekFlow === self::CAL_GROW_INTO_PAST) { + $months[$week] = $month; + } + } $date = $this->toDateStr($day, $month, $year); $weeks[$week][$weekday] = $date; };