summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics_reporting/page.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/statistics_reporting/page.inc.php')
-rw-r--r--modules-available/statistics_reporting/page.inc.php23
1 files changed, 19 insertions, 4 deletions
diff --git a/modules-available/statistics_reporting/page.inc.php b/modules-available/statistics_reporting/page.inc.php
index cc03e4d8..45f93144 100644
--- a/modules-available/statistics_reporting/page.inc.php
+++ b/modules-available/statistics_reporting/page.inc.php
@@ -11,7 +11,11 @@ class Page_Statistics_Reporting extends Page
/**
* @var int
*/
- private $days;
+ private $from;
+ /**
+ * @var int
+ */
+ private $to;
/**
* @var int
*/
@@ -46,7 +50,11 @@ class Page_Statistics_Reporting extends Page
$this->action = Request::any('action', 'show', 'string');
$this->type = Request::get('type', 'total', 'string');
- $this->days = Request::get('cutoff', 7, 'int');
+
+ // Format: yyyy-mm-dd
+ $fromString = Request::get('from', '-6 days', 'string');
+ $toString = Request::get('to', 'today', 'string');
+
$this->lower = Request::get('lower', 8, 'int');
$this->upper = Request::get('upper', 20, 'int');
@@ -55,9 +63,13 @@ class Page_Statistics_Reporting extends Page
$this->type = 'total';
}
+ // convert from/to dates to unixtime
+ $this->from = min(strtotime($fromString.' 00:00:00'), time());
+ $this->to = min(strtotime($toString.' 23:59:59'), time());
+
// timespan you want to see. default = last 7 days
- GetData::$from = strtotime("-" . ($this->days - 1) . " days 00:00:00");
- GetData::$to = time();
+ GetData::$from = $this->from;
+ GetData::$to = $this->to;
GetData::$lowerTimeBound = $this->lower;
GetData::$upperTimeBound = $this->upper;
/*
@@ -134,6 +146,9 @@ class Page_Statistics_Reporting extends Page
);
}
+ $data['from'] = date_format(date_timestamp_set(new DateTime(), $this->from), 'Y-m-d');
+ $data['to'] = date_format(date_timestamp_set(new DateTime(), $this->to), 'Y-m-d');
+
$data['lower'] = $this->lower;
$data['upper'] = $this->upper;