summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsmos <seth.mos@dds.nl>2010-07-23 10:28:02 +0200
committersmos <seth.mos@dds.nl>2010-07-23 10:28:02 +0200
commit9dc3798253279a13ddaae6d6a04269f85c27de5b (patch)
tree2a7f9088af7090e894c3ad4dbd3a6ac6623c0ed3
parent002bc4ab3268e6e5cb3a01ce73a4c1624d09050a (diff)
downloadpfsense-9dc3798253279a13ddaae6d6a04269f85c27de5b.zip
pfsense-9dc3798253279a13ddaae6d6a04269f85c27de5b.tar.gz
Further correct week graph, weeks start at monday, not sunday. Make
previous week work too.
-rwxr-xr-xusr/local/www/status_rrd_graph.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/usr/local/www/status_rrd_graph.php b/usr/local/www/status_rrd_graph.php
index 770b61b..a3103f8 100755
--- a/usr/local/www/status_rrd_graph.php
+++ b/usr/local/www/status_rrd_graph.php
@@ -192,7 +192,7 @@ function get_dates($curperiod, $graph) {
$curyear = date('Y', $now);
$curmonth = date('m', $now);
$curweek = date('W', $now);
- $curweekday = date('w', $now);
+ $curweekday = date('N', $now) - 1; // We want to start on monday
$curday = date('d', $now);
switch($curperiod) {
@@ -208,8 +208,16 @@ function get_dates($curperiod, $graph) {
$end = mktime(0, 0, 0, $curmonth, (($curday + $offset) + 1), $curyear);
break;
case "week":
- $start = mktime(0, 0, 0, $curmonth, (($curday - $curweekday) + $offset), $curyear);
- $end = mktime(0, 0, 0, $curmonth, (($curday - $curweekday) + 7), $curyear);
+ switch($offset) {
+ case 0;
+ $weekoffset = 0;
+ break;
+ default:
+ $weekoffset = ($offset * 7) - 7;
+ break;
+ }
+ $start = mktime(0, 0, 0, $curmonth, (($curday - $curweekday) + $weekoffset), $curyear);
+ $end = mktime(0, 0, 0, $curmonth, (($curday - $curweekday) + $weekoffset + 7), $curyear);
break;
case "month":
$start = mktime(0, 0, 0, ($curmonth + $offset), 0, $curyear);
OpenPOWER on IntegriCloud